diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2011-10-07 16:15:08 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2011-10-07 16:15:08 +0000 |
commit | 244455e6d6bb95c5e556ace66adb148dbcd16a27 (patch) | |
tree | 4f53569ab317f3e7df55bf6e4eab1757229856ae /test/CodeGen/Thumb | |
parent | 3f329cb781492e19a72af267cd3b7c2d8307a818 (diff) | |
download | external_llvm-244455e6d6bb95c5e556ace66adb148dbcd16a27.zip external_llvm-244455e6d6bb95c5e556ace66adb148dbcd16a27.tar.gz external_llvm-244455e6d6bb95c5e556ace66adb148dbcd16a27.tar.bz2 |
Peephole optimization for ABS on ARM.
Patch by Ana Pazos!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Thumb')
-rw-r--r-- | test/CodeGen/Thumb/iabs.ll | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/CodeGen/Thumb/iabs.ll b/test/CodeGen/Thumb/iabs.ll index d7cdcd8..d03b5b2 100644 --- a/test/CodeGen/Thumb/iabs.ll +++ b/test/CodeGen/Thumb/iabs.ll @@ -3,9 +3,9 @@ ;; Integer absolute value, should produce something as good as: ;; Thumb: -;; asr r2, r0, #31 -;; add r0, r0, r2 -;; eor r0, r2 +;; movs r0, r0 +;; bpl +;; rsb r0, r0, #0 (with opitmization, bpl + rsb is if-converted into rsbmi) ;; bx lr define i32 @test(i32 %a) { @@ -13,5 +13,10 @@ define i32 @test(i32 %a) { %b = icmp sgt i32 %a, -1 %abs = select i1 %b, i32 %a, i32 %tmp1neg ret i32 %abs +; CHECK: movs r0, r0 +; CHECK: bpl +; CHECK: rsb r0, r0, #0 +; CHECK: bx lr } + |