    let Inst{7-4}   = 0b0001;
    let Inst{19-8}  = 0b111111111111;
    let Inst{27-20} = 0b00010010;
-@@ -654,7 +668,11 @@
+@@ -654,7 +674,11 @@
  
  // Indirect branches
  let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {

                 [(ARMcall GPR:$func)]>,
             Requires<[IsARM, HasV5T, IsNotDarwin]> {
     let Inst{7-4}   = 0b0011;
@@ -701,7 +728,11 @@
 
   // ARMv4T
   def BX : ABXIx2<(outs), (ins GPR:$func, variable_ops),

+      "\n\n";
+
+    O <<
+      "\t.macro sfi_data_tst reg\n"
+      "\ttst \\reg, #0xc0000000\n"
+      "\t.endm\n"
+      "\n\n";
+
+    O <<
+      "\t.macro sfi_code_mask reg cond=\n"
+      "\tbic\\cond \\reg, \\reg, #0xc000000f\n"
+      "\t.endm\n"
