pr9367: Add missing predicated BLX instructions.
authorBob Wilson <bob.wilson@apple.com>
Thu, 3 Mar 2011 01:41:01 +0000 (01:41 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 3 Mar 2011 01:41:01 +0000 (01:41 +0000)
Patch by Jyun-Yan You, with some minor adjustments and a testcase from me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126915 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrInfo.td
lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
test/MC/Disassembler/ARM/arm-tests.txt
utils/TableGen/ARMDecoderEmitter.cpp

index 173275b084d5054df2c69786c470cd079d1c7257..c9b7541a4d443540275505679dcf7f93d342acb9 100644 (file)
@@ -1340,7 +1340,16 @@ let isCall = 1,
             Requires<[IsARM, HasV5T, IsNotDarwin]> {
     bits<4> func;
     let Inst{31-4} = 0b1110000100101111111111110011;
-    let Inst{3-0}   = func;
+    let Inst{3-0}  = func;
+  }
+
+  def BLX_pred : AI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
+                    IIC_Br, "blx", "\t$func",
+                    [(ARMcall_pred GPR:$func)]>,
+                 Requires<[IsARM, HasV5T, IsNotDarwin]> {
+    bits<4> func;
+    let Inst{27-4} = 0b000100101111111111110011;
+    let Inst{3-0}  = func;
   }
 
   // ARMv4T
@@ -1389,6 +1398,15 @@ let isCall = 1,
     let Inst{3-0}   = func;
   }
 
+  def BLXr9_pred : AI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
+                      IIC_Br, "blx", "\t$func",
+                      [(ARMcall_pred GPR:$func)]>,
+                   Requires<[IsARM, HasV5T, IsDarwin]> {
+    bits<4> func;
+    let Inst{27-4} = 0b000100101111111111110011;
+    let Inst{3-0}   = func;
+  }
+
   // ARMv4T
   // Note: Restrict $func to the tGPR regclass to prevent it being in LR.
   def BXr9_CALL : ARMPseudoInst<(outs), (ins tGPR:$func, variable_ops),
index bac68dd9ead072ae3010d4703744f4b36c0cddf0..32c41fc479d24a29db9a93a46c1dbbe6fc60853f 100644 (file)
@@ -809,8 +809,10 @@ static bool DisassembleBrMiscFrm(MCInst &MI, unsigned Opcode, uint32_t insn,
   if (Opcode == ARM::BX_RET || Opcode == ARM::MOVPCLR)
     return true;
 
-  // BLXr9 and BX take one GPR reg.
-  if (Opcode == ARM::BLXr9 || Opcode == ARM::BX) {
+  // BLX and BX take one GPR reg.
+  if (Opcode == ARM::BLXr9 || Opcode == ARM::BLXr9_pred ||
+      Opcode == ARM::BLX || Opcode == ARM::BLX_pred ||
+      Opcode == ARM::BX) {
     assert(NumOps >= 1 && OpInfo[OpIdx].RegClass == ARM::GPRRegClassID &&
            "Reg operand expected");
     MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, ARM::GPRRegClassID,
index 0ff1e56fa4e5056a2f33049b9c36d8b3a2b49a20..197b9b04a3cf9c7035d6d83d5c350946e9ed255b 100644 (file)
 
 # CHECK: rsbs r6, r7, r8
 0x08 0x60 0x77 0xe0
+
+# CHECK: blxeq r5
+0x35 0xff 0x2f 0x01
index a8de7452ea0650529c246e4a64fdb568a37c4e9f..cec6b9abd06b80161c33741a55cea2cd2219af9e 100644 (file)
@@ -1632,7 +1632,7 @@ ARMDEBackend::populateInstruction(const CodeGenInstruction &CGI,
 
     // Ignore the non-Darwin BL instructions and the TPsoft (TLS) instruction.
     if (Name == "BL" || Name == "BL_pred" || Name == "BLX" || Name == "BX" ||
-        Name == "TPsoft")
+        Name == "BLX_pred" || Name == "TPsoft")
       return false;
 
     // Ignore VDUPf[d|q] instructions known to conflict with VDUP32[d-q] for