summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-10-10 18:34:56 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-10-10 18:34:56 +0000
commita86a58695dfbfa1b0e660f09297e6608e3a48bbc (patch)
tree53aeaf2bbfa6fd1ea40a05ed48400f6efd5e9fb9 /test/CodeGen
parenta0ed0c0fcdd8b94f741f296a67669da3180fb42c (diff)
downloadllvm-a86a58695dfbfa1b0e660f09297e6608e3a48bbc.tar.gz
llvm-a86a58695dfbfa1b0e660f09297e6608e3a48bbc.tar.bz2
llvm-a86a58695dfbfa1b0e660f09297e6608e3a48bbc.tar.xz
X86: Add patterns for the movbe instruction (mov + bswap, only available on atom)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141563 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/X86/movbe.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/CodeGen/X86/movbe.ll b/test/CodeGen/X86/movbe.ll
new file mode 100644
index 0000000000..0ed84693d5
--- /dev/null
+++ b/test/CodeGen/X86/movbe.ll
@@ -0,0 +1,36 @@
+; RUN: llc -march=x86-64 -mcpu=atom < %s | FileCheck %s
+
+declare i32 @llvm.bswap.i32(i32) nounwind readnone
+declare i64 @llvm.bswap.i64(i64) nounwind readnone
+
+define void @test1(i32* nocapture %x, i32 %y) nounwind {
+ %bswap = call i32 @llvm.bswap.i32(i32 %y)
+ store i32 %bswap, i32* %x, align 4
+ ret void
+; CHECK: test1:
+; CHECK: movbel %esi, (%rdi)
+}
+
+define i32 @test2(i32* %x) nounwind {
+ %load = load i32* %x, align 4
+ %bswap = call i32 @llvm.bswap.i32(i32 %load)
+ ret i32 %bswap
+; CHECK: test2:
+; CHECK: movbel (%rdi), %eax
+}
+
+define void @test3(i64* %x, i64 %y) nounwind {
+ %bswap = call i64 @llvm.bswap.i64(i64 %y)
+ store i64 %bswap, i64* %x, align 8
+ ret void
+; CHECK: test3:
+; CHECK: movbeq %rsi, (%rdi)
+}
+
+define i64 @test4(i64* %x) nounwind {
+ %load = load i64* %x, align 8
+ %bswap = call i64 @llvm.bswap.i64(i64 %load)
+ ret i64 %bswap
+; CHECK: test4:
+; CHECK: movbeq (%rdi), %rax
+}