X86: Promote sitofp <8 x i16> to <8 x i32> when AVX is available.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 31 Mar 2013 12:49:15 +0000 (12:49 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 31 Mar 2013 12:49:15 +0000 (12:49 +0000)
A vector sext + sitofp is a lot cheaper than 8 scalar conversions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178448 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx-cvt.ll

index 80c392ae1ce6137b68c72f5653fc5a8d03af8eee..69341869aa3ee34ccad14346278ce67521cfa7f1 100644 (file)
@@ -1111,6 +1111,7 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
     setOperationAction(ISD::FP_TO_SINT,         MVT::v8i16, Custom);
 
     setOperationAction(ISD::FP_TO_SINT,         MVT::v8i32, Legal);
+    setOperationAction(ISD::SINT_TO_FP,         MVT::v8i16, Promote);
     setOperationAction(ISD::SINT_TO_FP,         MVT::v8i32, Legal);
     setOperationAction(ISD::FP_ROUND,           MVT::v4f32, Legal);
 
index 62bdea2b4957fbd3b59457162f4a48dad795763c..22fad7ce4b7d98a6a8f2315ab3c000ca7ff26acc 100644 (file)
@@ -18,6 +18,12 @@ define <4 x double> @sitofp01(<4 x i32> %a) {
   ret <4 x double> %b
 }
 
+; CHECK: vcvtdq2ps %ymm
+define <8 x float> @sitofp02(<8 x i16> %a) {
+  %b = sitofp <8 x i16> %a to <8 x float>
+  ret <8 x float> %b
+}
+
 ; CHECK: vcvttpd2dqy %ymm
 define <4 x i32> @fptosi01(<4 x double> %a) {
   %b = fptosi <4 x double> %a to <4 x i32>