summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/shift-combine.ll
diff options
context:
space:
mode:
authorZijiao Ma <jojo.ma@linaro.org>2016-12-23 02:56:07 +0000
committerZijiao Ma <jojo.ma@linaro.org>2016-12-23 02:56:07 +0000
commitbf6007bd1bbce91c369e187efd26929f9fc74003 (patch)
tree5412e70cbd0c1160fdaf0645401b4a751e2414ef /llvm/test/CodeGen/ARM/shift-combine.ll
parent37c178b6f52d4d01326801915be0592992466dab (diff)
downloadbcm5719-llvm-bf6007bd1bbce91c369e187efd26929f9fc74003.tar.gz
bcm5719-llvm-bf6007bd1bbce91c369e187efd26929f9fc74003.zip
Make the canonicalisation on shifts benifit to more case.
1.Fix pessimized case in FIXME. 2.Add tests for it. 3.The canonicalisation on shifts results in different sequence for tests of machine-licm.Correct some check lines. Differential Revision: https://reviews.llvm.org/D27916 llvm-svn: 290410
Diffstat (limited to 'llvm/test/CodeGen/ARM/shift-combine.ll')
-rw-r--r--llvm/test/CodeGen/ARM/shift-combine.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/shift-combine.ll b/llvm/test/CodeGen/ARM/shift-combine.ll
new file mode 100644
index 00000000000..9da3b31b9a1
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/shift-combine.ll
@@ -0,0 +1,31 @@
+; RUN: llc -mtriple=armv7-linux-gnueabihf %s -o - | FileCheck %s
+
+@array = weak global [4 x i32] zeroinitializer
+
+define i32 @test_lshr_and1(i32 %x) {
+entry:
+;CHECK-LABLE: test_lshr_and1:
+;CHECK: movw r1, :lower16:array
+;CHECK-NEXT: and r0, r0, #12
+;CHECK-NEXT: movt r1, :upper16:array
+;CHECK-NEXT: ldr r0, [r1, r0]
+;CHECK-NEXT: bx lr
+ %tmp2 = lshr i32 %x, 2
+ %tmp3 = and i32 %tmp2, 3
+ %tmp4 = getelementptr [4 x i32], [4 x i32]* @array, i32 0, i32 %tmp3
+ %tmp5 = load i32, i32* %tmp4, align 4
+ ret i32 %tmp5
+}
+define i32 @test_lshr_and2(i32 %x) {
+entry:
+;CHECK-LABLE: test_lshr_and2:
+;CHECK: ubfx r0, r0, #1, #15
+;CHECK-NEXT: add r0, r0, r0
+;CHECK-NEXT: bx lr
+ %a = and i32 %x, 65534
+ %b = lshr i32 %a, 1
+ %c = and i32 %x, 65535
+ %d = lshr i32 %c, 1
+ %e = add i32 %b, %d
+ ret i32 %e
+}
OpenPOWER on IntegriCloud