CostModel: add another known vector trunc optimization.
authorNadav Rotem <nrotem@apple.com>
Tue, 6 Nov 2012 21:17:17 +0000 (21:17 +0000)
committerNadav Rotem <nrotem@apple.com>
Tue, 6 Nov 2012 21:17:17 +0000 (21:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167488 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/Analysis/CostModel/X86/cast.ll

index 5853b5109c45f1b2d0aafc443ac756de1bf8aea3..bdbc9bb0ace86b5230c12902cebf98a8aee5186c 100644 (file)
@@ -17692,6 +17692,7 @@ unsigned X86VectorTargetTransformInfo::getCastInstrCost(unsigned Opcode,
     { ISD::FP_TO_SINT,  MVT::v4i8, MVT::v4f32,  1 },
     { ISD::ZERO_EXTEND, MVT::v8i32, MVT::v8i1,  6 },
     { ISD::SIGN_EXTEND, MVT::v8i32, MVT::v8i1,  9 },
+    { ISD::TRUNCATE,    MVT::v8i32, MVT::v8i64, 3 },
   };
 
   if (ST.hasAVX()) {
index 298d5c66ad7ff85bfab7b1711870f1bddbceac4a..75c97a781e7fad9766e0cc2c93f298259d06d6d3 100644 (file)
@@ -53,6 +53,9 @@ define i32 @zext_sext(<8 x i1> %in) {
   ;CHECK: cost of 1 {{.*}} trunc
   %F = trunc <8 x i32> undef to <8 x i16>
 
+  ;CHECK: cost of 3 {{.*}} trunc
+  %G = trunc <8 x i64> undef to <8 x i32>
+
   ret i32 undef
 }