Fix part 1 of pr4682. PICADD is a 16-bit instruction even in thumb2 mode.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 4 Aug 2009 23:47:55 +0000 (23:47 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 4 Aug 2009 23:47:55 +0000 (23:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78126 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrFormats.td
lib/Target/ARM/ARMInstrThumb.td
lib/Target/ARM/ARMInstrThumb2.td
test/CodeGen/Thumb2/load-global.ll
test/CodeGen/Thumb2/pic-load.ll

index ce39a3f737676af471de3a2191c9b99c8edb975f..2d76a3615f6b68769beca77c2c114640a3bbbffa 100644 (file)
@@ -808,6 +808,10 @@ class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
 class TI<dag oops, dag iops, string asm, list<dag> pattern>
   : ThumbI<oops, iops, AddrModeNone, Size2Bytes, asm, "", pattern>;
 
+// Two-address instructions
+class TIt<dag oops, dag iops, string asm, list<dag> pattern>
+  : ThumbI<oops, iops, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
+
 // tBL, tBX instructions
 class TIx2<dag oops, dag iops, string asm, list<dag> pattern>
   : ThumbI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
index 9917e016dd0a82633a13a70f48c0e7726ca702a7..cc4f20c682c0df3f33218314d45df9b388a8c6e9 100644 (file)
@@ -127,10 +127,11 @@ PseudoInst<(outs), (ins i32imm:$amt),
            [(ARMcallseq_start imm:$amt)]>, Requires<[IsThumb1Only]>;
 }
 
+// For both thumb1 and thumb2.
 let isNotDuplicable = 1 in
-def tPICADD : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, pclabel:$cp),
-                  "$cp:\n\tadd $dst, pc",
-                  [(set tGPR:$dst, (ARMpic_add tGPR:$lhs, imm:$cp))]>;
+def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp),
+                 "$cp:\n\tadd $dst, pc",
+                 [(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>;
 
 // PC relative add.
 def tADDrPCi : T1I<(outs tGPR:$dst), (ins i32imm:$rhs),
index faa7dd5475d8cababaec3978e3bdaeed9519379e..1b6b575a9ac64b3fb81bdab83a3daf55058c32d4 100644 (file)
@@ -422,12 +422,6 @@ multiclass T2I_bin_rrot<string opc, PatFrag opnode> {
 //  Miscellaneous Instructions.
 //
 
-let isNotDuplicable = 1 in
-def t2PICADD : T2XI<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp),
-                    "$cp:\n\tadd.w $dst, $lhs, pc",
-                    [(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>;
-
-
 // LEApcrel - Load a pc-relative address into a register without offending the
 // assembler.
 def t2LEApcrel : T2XI<(outs GPR:$dst), (ins i32imm:$label, pred:$p),
index 24aaf21f4986a521cb6da2520dab6fe96c12b018..4aad567fa8f129eaf4651fb9c53ba1e3c0c6edb4 100644 (file)
@@ -17,7 +17,7 @@ define i32 @test1() {
 ; DYNAMIC: .long L_G$non_lazy_ptr
 
 ; PIC: _test1
-; PIC: add.w r0, r0, pc
+; PIC: add r0, pc
 ; PIC: .long L_G$non_lazy_ptr-(LPC0+4)
 
 ; LINUX: test1
index 553377b48bcde2e9d70b0069c885af5ee95c572b..92862c87e7aebfb99dab0fbf2e3a77a98d3e6671 100644 (file)
@@ -8,7 +8,7 @@
 define hidden arm_apcscc i32 @atexit(void ()* %func) nounwind {
 entry:
 ; CHECK: atexit:
-; CHECK: add.w r0, r0, pc
+; CHECK: add r0, pc
        %r = alloca %struct.one_atexit_routine, align 4         ; <%struct.one_atexit_routine*> [#uses=3]
        %0 = getelementptr %struct.one_atexit_routine* %r, i32 0, i32 0, i32 0          ; <void ()**> [#uses=1]
        store void ()* %func, void ()** %0, align 4