summaryrefslogtreecommitdiff
path: root/test/CodeGen/Thumb2/thumb2-sxt_rot.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-07-03 01:43:10 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-07-03 01:43:10 +0000
commitd27c9fc403ae906c60ca3dfee72001f7e1930492 (patch)
treeebc165bd75b92cdf0a02e4cbc4a1b3fbe39adce0 /test/CodeGen/Thumb2/thumb2-sxt_rot.ll
parent292aef33e1ed71e720f4e8d0b7332a1013398836 (diff)
downloadllvm-d27c9fc403ae906c60ca3dfee72001f7e1930492.tar.gz
llvm-d27c9fc403ae906c60ca3dfee72001f7e1930492.tar.bz2
llvm-d27c9fc403ae906c60ca3dfee72001f7e1930492.tar.xz
Add thumb2 sign / zero extend with rotate instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Thumb2/thumb2-sxt_rot.ll')
-rw-r--r--test/CodeGen/Thumb2/thumb2-sxt_rot.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGen/Thumb2/thumb2-sxt_rot.ll b/test/CodeGen/Thumb2/thumb2-sxt_rot.ll
new file mode 100644
index 0000000000..4afe354028
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-sxt_rot.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \
+; RUN: grep sxtb | count 2
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \
+; RUN: grep sxtb | grep ror | count 1
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \
+; RUN: grep sxtab | count 1
+
+define i32 @test0(i8 %A) {
+ %B = sext i8 %A to i32
+ ret i32 %B
+}
+
+define i8 @test1(i32 %A) signext {
+ %B = lshr i32 %A, 8
+ %C = shl i32 %A, 24
+ %D = or i32 %B, %C
+ %E = trunc i32 %D to i8
+ ret i8 %E
+}
+
+define i32 @test2(i32 %A, i32 %X) signext {
+ %B = lshr i32 %A, 8
+ %C = shl i32 %A, 24
+ %D = or i32 %B, %C
+ %E = trunc i32 %D to i8
+ %F = sext i8 %E to i32
+ %G = add i32 %F, %X
+ ret i32 %G
+}