[llvm-branch-commits] [llvm-branch] r80441 - in /llvm/branches/Apple/Leela: lib/Target/ARM/ARMInstrThumb.td test/CodeGen/ARM/ldr_ext.ll test/CodeGen/Thumb/ldr_ext.ll

Bill Wendling isanbard at gmail.com
Sat Aug 29 14:26:53 PDT 2009


Author: void
Date: Sat Aug 29 16:26:53 2009
New Revision: 80441

URL: http://llvm.org/viewvc/llvm-project?rev=80441&view=rev
Log:
$ svn merge -c 80322 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r80322 into '.':
U    test/CodeGen/Thumb/ldr_ext.ll
U    test/CodeGen/ARM/ldr_ext.ll
U    lib/Target/ARM/ARMInstrThumb.td


Modified:
    llvm/branches/Apple/Leela/lib/Target/ARM/ARMInstrThumb.td
    llvm/branches/Apple/Leela/test/CodeGen/ARM/ldr_ext.ll
    llvm/branches/Apple/Leela/test/CodeGen/Thumb/ldr_ext.ll

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/ARMInstrThumb.td?rev=80441&r1=80440&r2=80441&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/ARMInstrThumb.td Sat Aug 29 16:26:53 2009
@@ -701,13 +701,19 @@
 def : T1Pat<(extloadi8  t_addrmode_s1:$addr),  (tLDRB t_addrmode_s1:$addr)>;
 def : T1Pat<(extloadi16 t_addrmode_s2:$addr),  (tLDRH t_addrmode_s2:$addr)>;
 
-// If it's possible to use [r,r] address mode for sextload, select to
+// If it's impossible to use [r,r] address mode for sextload, select to
 // ldr{b|h} + sxt{b|h} instead.
 def : T1Pat<(sextloadi8 t_addrmode_s1:$addr),
-            (tSXTB (tLDRB t_addrmode_s1:$addr))>;
+            (tSXTB (tLDRB t_addrmode_s1:$addr))>,
+      Requires<[IsThumb1Only, HasV6]>;
 def : T1Pat<(sextloadi16 t_addrmode_s2:$addr),
-            (tSXTH (tLDRH t_addrmode_s2:$addr))>;
+            (tSXTH (tLDRH t_addrmode_s2:$addr))>,
+      Requires<[IsThumb1Only, HasV6]>;
 
+def : T1Pat<(sextloadi8 t_addrmode_s1:$addr),
+            (tASRri (tLSLri (tLDRB t_addrmode_s1:$addr), 24), 24)>;
+def : T1Pat<(sextloadi16 t_addrmode_s1:$addr),
+            (tASRri (tLSLri (tLDRH t_addrmode_s1:$addr), 16), 16)>;
 
 // Large immediate handling.
 

Modified: llvm/branches/Apple/Leela/test/CodeGen/ARM/ldr_ext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/CodeGen/ARM/ldr_ext.ll?rev=80441&r1=80440&r2=80441&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/test/CodeGen/ARM/ldr_ext.ll (original)
+++ llvm/branches/Apple/Leela/test/CodeGen/ARM/ldr_ext.ll Sat Aug 29 16:26:53 2009
@@ -1,27 +1,36 @@
-; RUN: llvm-as < %s | llc -march=arm | grep ldrb | count 1
-; RUN: llvm-as < %s | llc -march=arm | grep ldrh | count 1
-; RUN: llvm-as < %s | llc -march=arm | grep ldrsb | count 1
-; RUN: llvm-as < %s | llc -march=arm | grep ldrsh | count 1
+; RUN: llvm-as < %s | llc -march=arm | FileCheck %s
 
-define i32 @test1(i8* %v.pntr.s0.u1) {
-    %tmp.u = load i8* %v.pntr.s0.u1
+define i32 @test1(i8* %t1) nounwind {
+; CHECK: ldrb
+    %tmp.u = load i8* %t1
     %tmp1.s = zext i8 %tmp.u to i32
     ret i32 %tmp1.s
 }
 
-define i32 @test2(i16* %v.pntr.s0.u1) {
-    %tmp.u = load i16* %v.pntr.s0.u1
+define i32 @test2(i16* %t1) nounwind {
+; CHECK: ldrh
+    %tmp.u = load i16* %t1
     %tmp1.s = zext i16 %tmp.u to i32
     ret i32 %tmp1.s
 }
 
-define i32 @test3(i8* %v.pntr.s1.u0) {
-    %tmp.s = load i8* %v.pntr.s1.u0
+define i32 @test3(i8* %t0) nounwind {
+; CHECK: ldrsb
+    %tmp.s = load i8* %t0
     %tmp1.s = sext i8 %tmp.s to i32
     ret i32 %tmp1.s
 }
 
-define i32 @test4() {
+define i32 @test4(i16* %t0) nounwind {
+; CHECK: ldrsh
+    %tmp.s = load i16* %t0
+    %tmp1.s = sext i16 %tmp.s to i32
+    ret i32 %tmp1.s
+}
+
+define i32 @test5() nounwind {
+; CHECK: mov r0, #0
+; CHECK: ldrsh
     %tmp.s = load i16* null
     %tmp1.s = sext i16 %tmp.s to i32
     ret i32 %tmp1.s

Modified: llvm/branches/Apple/Leela/test/CodeGen/Thumb/ldr_ext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/CodeGen/Thumb/ldr_ext.ll?rev=80441&r1=80440&r2=80441&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/test/CodeGen/Thumb/ldr_ext.ll (original)
+++ llvm/branches/Apple/Leela/test/CodeGen/Thumb/ldr_ext.ll Sat Aug 29 16:26:53 2009
@@ -1,34 +1,56 @@
-; RUN: llvm-as < %s | llc -march=thumb | FileCheck %s
+; RUN: llvm-as < %s | llc -march=thumb | FileCheck %s -check-prefix=V5
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+v6 | FileCheck %s -check-prefix=V6
 
-define i32 @test1(i8* %v.pntr.s0.u1) {
-; CHECK: test1:
-; CHECK: ldrb
-    %tmp.u = load i8* %v.pntr.s0.u1
+; rdar://7176514
+
+define i32 @test1(i8* %t1) nounwind {
+; V5: ldrb
+
+; V6: ldrb
+    %tmp.u = load i8* %t1
     %tmp1.s = zext i8 %tmp.u to i32
     ret i32 %tmp1.s
 }
 
-define i32 @test2(i16* %v.pntr.s0.u1) {
-; CHECK: test2:
-; CHECK: ldrh
-    %tmp.u = load i16* %v.pntr.s0.u1
+define i32 @test2(i16* %t1) nounwind {
+; V5: ldrh
+
+; V6: ldrh
+    %tmp.u = load i16* %t1
     %tmp1.s = zext i16 %tmp.u to i32
     ret i32 %tmp1.s
 }
 
-define i32 @test3(i8* %v.pntr.s1.u0) {
-; CHECK: test3:
-; CHECK: ldrb 
-; CHECK: sxtb
-   %tmp.s = load i8* %v.pntr.s1.u0
+define i32 @test3(i8* %t0) nounwind {
+; V5: ldrb
+; V5: lsls
+; V5: asrs
+
+; V6: ldrb
+; V6: sxtb
+    %tmp.s = load i8* %t0
     %tmp1.s = sext i8 %tmp.s to i32
     ret i32 %tmp1.s
 }
 
-define i32 @test4() {
-; CHECK: test4:
-; CHECK: movs
-; CHECK: ldrsh 
+define i32 @test4(i16* %t0) nounwind {
+; V5: ldrh
+; V5: lsls
+; V5: asrs
+
+; V6: ldrh
+; V6: sxth
+    %tmp.s = load i16* %t0
+    %tmp1.s = sext i16 %tmp.s to i32
+    ret i32 %tmp1.s
+}
+
+define i32 @test5() nounwind {
+; V5: movs r0, #0
+; V5: ldrsh
+
+; V6: movs r0, #0
+; V6: ldrsh
     %tmp.s = load i16* null
     %tmp1.s = sext i16 %tmp.s to i32
     ret i32 %tmp1.s





More information about the llvm-branch-commits mailing list