[llvm-commits] [llvm] r146937 - in /llvm/trunk: lib/Target/ARM/AsmParser/ARMAsmParser.cpp test/MC/ARM/basic-arm-instructions.s
Jim Grosbach
grosbach at apple.com
Mon Dec 19 16:59:38 PST 2011
Author: grosbach
Date: Mon Dec 19 18:59:38 2011
New Revision: 146937
URL: http://llvm.org/viewvc/llvm-project?rev=146937&view=rev
Log:
ARM assembly shifts by zero should be plain 'mov' instructions.
"mov r1, r2, lsl #0" should assemble as "mov r1, r2" even though it's
not strictly legal UAL syntax. It's a common extension and the friendly
thing to do.
rdar://10604663
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/test/MC/ARM/basic-arm-instructions.s
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=146937&r1=146936&r2=146937&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Dec 19 18:59:38 2011
@@ -5945,6 +5945,23 @@
}
break;
}
+ case ARM::MOVsi: {
+ ARM_AM::ShiftOpc SOpc = ARM_AM::getSORegShOp(Inst.getOperand(2).getImm());
+ if (SOpc == ARM_AM::rrx) return false;
+ if (ARM_AM::getSORegOffset(Inst.getOperand(2).getImm()) == 0) {
+ // Shifting by zero is accepted as a vanilla 'MOVr'
+ MCInst TmpInst;
+ TmpInst.setOpcode(ARM::MOVr);
+ TmpInst.addOperand(Inst.getOperand(0));
+ TmpInst.addOperand(Inst.getOperand(1));
+ TmpInst.addOperand(Inst.getOperand(3));
+ TmpInst.addOperand(Inst.getOperand(4));
+ TmpInst.addOperand(Inst.getOperand(5));
+ Inst = TmpInst;
+ return true;
+ }
+ return false;
+ }
case ARM::t2IT: {
// The mask bits for all but the first condition are represented as
// the low bit of the condition code value implies 't'. We currently
Modified: llvm/trunk/test/MC/ARM/basic-arm-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-arm-instructions.s?rev=146937&r1=146936&r2=146937&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-arm-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-arm-instructions.s Mon Dec 19 18:59:38 2011
@@ -904,11 +904,28 @@
movs r2, r3
moveq r2, r3
movseq r2, r3
+ mov r12, r8, lsl #(2 - 2)
+ lsl r2, r3, #(2 - 2)
+ mov r12, r8, lsr #(2 - 2)
+ lsr r2, r3, #(2 - 2)
+ mov r12, r8, asr #(2 - 2)
+ asr r2, r3, #(2 - 2)
+ mov r12, r8, ror #(2 - 2)
+ ror r2, r3, #(2 - 2)
@ CHECK: mov r2, r3 @ encoding: [0x03,0x20,0xa0,0xe1]
@ CHECK: movs r2, r3 @ encoding: [0x03,0x20,0xb0,0xe1]
@ CHECK: moveq r2, r3 @ encoding: [0x03,0x20,0xa0,0x01]
@ CHECK: movseq r2, r3 @ encoding: [0x03,0x20,0xb0,0x01]
+@ CHECK: mov r12, r8 @ encoding: [0x08,0xc0,0xa0,0xe1]
+@ CHECK: mov r2, r3 @ encoding: [0x03,0x20,0xa0,0xe1]
+@ CHECK: mov r12, r8 @ encoding: [0x08,0xc0,0xa0,0xe1]
+@ CHECK: mov r2, r3 @ encoding: [0x03,0x20,0xa0,0xe1]
+@ CHECK: mov r12, r8 @ encoding: [0x08,0xc0,0xa0,0xe1]
+@ CHECK: mov r2, r3 @ encoding: [0x03,0x20,0xa0,0xe1]
+@ CHECK: mov r12, r8 @ encoding: [0x08,0xc0,0xa0,0xe1]
+@ CHECK: mov r2, r3 @ encoding: [0x03,0x20,0xa0,0xe1]
+
@------------------------------------------------------------------------------
@ MOVT
More information about the llvm-commits
mailing list