[llvm-commits] [llvm] r138076 - in /llvm/trunk: lib/Target/ARM/ARMInstrFormats.td lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/AsmParser/ARMAsmParser.cpp test/MC/ARM/basic-thumb-instructions.s test/MC/ARM/thumb-diagnostics.s
Jim Grosbach
grosbach at apple.com
Fri Aug 19 13:46:54 PDT 2011
Author: grosbach
Date: Fri Aug 19 15:46:54 2011
New Revision: 138076
URL: http://llvm.org/viewvc/llvm-project?rev=138076&view=rev
Log:
Thumb assembly parsing and encoding for MOV.
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/test/MC/ARM/basic-thumb-instructions.s
llvm/trunk/test/MC/ARM/thumb-diagnostics.s
Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=138076&r1=138075&r2=138076&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Fri Aug 19 15:46:54 2011
@@ -148,7 +148,7 @@
// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
// register whose default is 0 (no register).
def CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }
-def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
+def pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),
(ops (i32 14), (i32 zero_reg))> {
let PrintMethod = "printPredicateOperand";
let ParserMatchClass = CondCodeOperand;
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=138076&r1=138075&r2=138076&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Fri Aug 19 15:46:54 2011
@@ -1014,6 +1014,11 @@
let Inst{10-8} = Rd;
let Inst{7-0} = imm8;
}
+// Because we have an explicit tMOVSr below, we need an alias to handle
+// the immediate "movs" form here. Blech.
+def : InstAlias <"movs $Rdn, $imm",
+ (tMOVi8 tGPR:$Rdn, CPSR, imm0_255:$imm, 14, 0)>,
+ Requires<[IsThumb]>;
// A7-73: MOV(2) - mov setting flag.
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=138076&r1=138075&r2=138076&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Aug 19 15:46:54 2011
@@ -3173,7 +3173,7 @@
isARMLowRegister(Inst.getOperand(2).getReg()))
return Match_RequiresThumb2;
// Others only require ARMv6 or later.
- else if (Opc == ARM::tMOVr && isThumbOne() &&
+ else if (Opc == ARM::tMOVr && isThumbOne() && !hasV6Ops() &&
isARMLowRegister(Inst.getOperand(0).getReg()) &&
isARMLowRegister(Inst.getOperand(1).getReg()))
return Match_RequiresV6;
Modified: llvm/trunk/test/MC/ARM/basic-thumb-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-thumb-instructions.s?rev=138076&r1=138075&r2=138076&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-thumb-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-thumb-instructions.s Fri Aug 19 15:46:54 2011
@@ -296,3 +296,25 @@
lsrs r2, r6
@ CHECK: lsrs r2, r6 @ encoding: [0xf2,0x40]
+
+
+ at ------------------------------------------------------------------------------
+@ MOV (immediate)
+ at ------------------------------------------------------------------------------
+ movs r2, #0
+ movs r2, #255
+ movs r2, #23
+
+@ CHECK: movs r2, #0 @ encoding: [0x00,0x22]
+@ CHECK: movs r2, #255 @ encoding: [0xff,0x22]
+@ CHECK: movs r2, #23 @ encoding: [0x17,0x22]
+
+
+ at ------------------------------------------------------------------------------
+@ MOV (register)
+ at ------------------------------------------------------------------------------
+ mov r3, r4
+ movs r1, r3
+
+@ CHECK: mov r3, r4 @ encoding: [0x23,0x46]
+@ CHECK: movs r1, r3 @ encoding: [0x19,0x00]
Modified: llvm/trunk/test/MC/ARM/thumb-diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb-diagnostics.s?rev=138076&r1=138075&r2=138076&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb-diagnostics.s (original)
+++ llvm/trunk/test/MC/ARM/thumb-diagnostics.s Fri Aug 19 15:46:54 2011
@@ -1,5 +1,7 @@
@ RUN: not llvm-mc -triple=thumbv6-apple-darwin < %s 2> %t
@ RUN: FileCheck --check-prefix=CHECK-ERRORS < %t %s
+@ RUN: not llvm-mc -triple=thumbv5-apple-darwin < %s 2> %t
+@ RUN: FileCheck --check-prefix=CHECK-ERRORS-V5 < %t %s
@ Check for various assembly diagnostic messages on invalid input.
@@ -15,9 +17,9 @@
@ CHECK-ERRORS: error: instruction variant requires Thumb2
@ CHECK-ERRORS: add r2, r3
@ CHECK-ERRORS: ^
-@ CHECK-ERRORS: error: instruction variant requires ARMv6 or later
-@ CHECK-ERRORS: mov r2, r3
-@ CHECK-ERRORS: ^
+@ CHECK-ERRORS-V5: error: instruction variant requires ARMv6 or later
+@ CHECK-ERRORS-V5: mov r2, r3
+@ CHECK-ERRORS-V5: ^
@ Out of range immediates for ASR instruction.
More information about the llvm-commits
mailing list