[llvm] r178448 - X86: Promote sitofp <8 x i16> to <8 x i32> when AVX is available.

Benjamin Kramer benny.kra at googlemail.com
Sun Mar 31 05:49:15 PDT 2013


Author: d0k
Date: Sun Mar 31 07:49:15 2013
New Revision: 178448

URL: http://llvm.org/viewvc/llvm-project?rev=178448&view=rev
Log:
X86: Promote sitofp <8 x i16> to <8 x i32> when AVX is available.

A vector sext + sitofp is a lot cheaper than 8 scalar conversions.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/test/CodeGen/X86/avx-cvt.ll

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=178448&r1=178447&r2=178448&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Mar 31 07:49:15 2013
@@ -1111,6 +1111,7 @@ X86TargetLowering::X86TargetLowering(X86
     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);
 

Modified: llvm/trunk/test/CodeGen/X86/avx-cvt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-cvt.ll?rev=178448&r1=178447&r2=178448&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-cvt.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-cvt.ll Sun Mar 31 07:49:15 2013
@@ -18,6 +18,12 @@ define <4 x double> @sitofp01(<4 x i32>
   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>





More information about the llvm-commits mailing list