summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-15 00:14:11 +0000
committerDan Gohman <gohman@apple.com>2009-09-15 00:14:11 +0000
commit907355caf89549138ab3ea0e4ab13a5df0ee014a (patch)
treeb56c5968a255a1e06ade7332652715c2fcbee3f6 /test
parente6798372ea38e5ea24c26282a0d69aa6e3829854 (diff)
downloadllvm-907355caf89549138ab3ea0e4ab13a5df0ee014a.tar.gz
llvm-907355caf89549138ab3ea0e4ab13a5df0ee014a.tar.bz2
llvm-907355caf89549138ab3ea0e4ab13a5df0ee014a.tar.xz
On x86-64, the 32-bit cmov doesn't actually clear the high 32-bit of
its result if the condition is false. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/cmov-zext.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/X86/cmov-zext.ll b/test/CodeGen/X86/cmov-zext.ll
new file mode 100644
index 0000000000..8df228a00a
--- /dev/null
+++ b/test/CodeGen/X86/cmov-zext.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+
+; x86's 32-bit cmov doesn't clobber the high 32 bits of the destination
+; if the condition is false. An explicit zero-extend (movl) is needed
+; after the cmov.
+
+; CHECK: cmovne %edi, %esi
+; CHECK-NEXT: movl %esi, %edi
+
+declare void @bar(i64) nounwind
+
+define void @foo(i64 %a, i64 %b, i1 %p) nounwind {
+ %c = trunc i64 %a to i32
+ %d = trunc i64 %b to i32
+ %e = select i1 %p, i32 %c, i32 %d
+ %f = zext i32 %e to i64
+ call void @bar(i64 %f)
+ ret void
+}