Thumb2 parsing and encoding for BXJ.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139053 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td
index a12be96..c6a3e50 100644
--- a/lib/Target/ARM/ARMInstrThumb2.td
+++ b/lib/Target/ARM/ARMInstrThumb2.td
@@ -3068,16 +3068,13 @@
 
 // Branch and Exchange Jazelle -- for disassembly only
 // Rm = Inst{19-16}
-def t2BXJ : T2I<(outs), (ins rGPR:$func), NoItinerary, "bxj", "\t$func",
-              [/* For disassembly only; pattern left blank */]> {
+def t2BXJ : T2I<(outs), (ins rGPR:$func), NoItinerary, "bxj", "\t$func", []> {
+  bits<4> func;
   let Inst{31-27} = 0b11110;
   let Inst{26} = 0;
   let Inst{25-20} = 0b111100;
-  let Inst{15-14} = 0b10;
-  let Inst{12} = 0;
-
-  bits<4> func;
   let Inst{19-16} = func;
+  let Inst{15-0} = 0b1000111100000000;
 }
 
 // Compare and branch on zero / non-zero
diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s
index b68d117..3c3247f 100644
--- a/test/MC/ARM/basic-thumb2-instructions.s
+++ b/test/MC/ARM/basic-thumb2-instructions.s
@@ -255,6 +255,18 @@
 
 
 @------------------------------------------------------------------------------
+@ BXJ
+@------------------------------------------------------------------------------
+        bxj r5
+        it ne
+        bxjne r7
+
+@ CHECK: bxj	r5                      @ encoding: [0xc5,0xf3,0x00,0x8f]
+@ CHECK: it	ne                      @ encoding: [0x18,0xbf]
+@ CHECK: bxjne	r7                      @ encoding: [0xc7,0xf3,0x00,0x8f]
+
+
+@------------------------------------------------------------------------------
 @ CBZ/CBNZ
 @------------------------------------------------------------------------------
         cbnz    r7, #6
@@ -263,6 +275,7 @@
 @ CHECK: cbnz    r7, #6                  @ encoding: [0x1f,0xb9]
 @ CHECK: cbnz    r7, #12                 @ encoding: [0x37,0xb9]
 
+
 @------------------------------------------------------------------------------
 @ IT
 @------------------------------------------------------------------------------