summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Liao <michael.liao@intel.com>2012-10-16 19:38:35 +0000
committerMichael Liao <michael.liao@intel.com>2012-10-16 19:38:35 +0000
commit272ea0323999890d8bcf75b873a1c8ab2cdcba0d (patch)
tree9c360ccd3e6ec121f64e3be30ed53b9128f96e95 /test
parent6f7cccd2e28bf544609ee8fdbfac4a24e9f37ff6 (diff)
downloadllvm-272ea0323999890d8bcf75b873a1c8ab2cdcba0d.tar.gz
llvm-272ea0323999890d8bcf75b873a1c8ab2cdcba0d.tar.bz2
llvm-272ea0323999890d8bcf75b873a1c8ab2cdcba0d.tar.xz
Teach DAG combine to fold (trunc (fptoXi x)) to (fptoXi x)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/trunc-fp2int.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGen/X86/trunc-fp2int.ll b/test/CodeGen/X86/trunc-fp2int.ll
new file mode 100644
index 0000000000..792af16c95
--- /dev/null
+++ b/test/CodeGen/X86/trunc-fp2int.ll
@@ -0,0 +1,18 @@
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7 | FileCheck %s
+
+define <4 x i8> @bar(<4 x float> %in) nounwind readnone alwaysinline {
+ %1 = fptoui <4 x float> %in to <4 x i8>
+ ret <4 x i8> %1
+; CHECK: bar
+; CHECK: cvttps2dq
+}
+define <4 x i8> @foo(<4 x float> %in) nounwind readnone alwaysinline {
+ %1 = fptoui <4 x float> %in to <4 x i32>
+ %2 = trunc <4 x i32> %1 to <4 x i16>
+ %3 = shufflevector <4 x i16> %2, <4 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %4 = trunc <8 x i16> %3 to <8 x i8>
+ %5 = shufflevector <8 x i8> %4, <8 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ ret <4 x i8> %5
+; CHECK: foo
+; CHECK: cvttps2dq
+}