[llvm] r222489 - [X86] Do not custom lower UINT_TO_FP when the target type does not
Quentin Colombet
qcolombet at apple.com
Thu Nov 20 16:47:19 PST 2014
Author: qcolombet
Date: Thu Nov 20 18:47:19 2014
New Revision: 222489
URL: http://llvm.org/viewvc/llvm-project?rev=222489&view=rev
Log:
[X86] Do not custom lower UINT_TO_FP when the target type does not
match the custom lowering.
<rdar://problem/19026326>
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/vec_uint_to_fp.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=222489&r1=222488&r2=222489&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Nov 20 18:47:19 2014
@@ -13610,6 +13610,11 @@ static SDValue lowerUINT_TO_FP_vXi32(SDV
EVT VecIntVT = V.getValueType();
bool Is128 = VecIntVT == MVT::v4i32;
EVT VecFloatVT = Is128 ? MVT::v4f32 : MVT::v8f32;
+ // If we convert to something else than the supported type, e.g., to v4f64,
+ // abort early.
+ if (VecFloatVT != Op->getValueType(0))
+ return SDValue();
+
unsigned NumElts = VecIntVT.getVectorNumElements();
assert((VecIntVT == MVT::v4i32 || VecIntVT == MVT::v8i32) &&
"Unsupported custom type");
Modified: llvm/trunk/test/CodeGen/X86/vec_uint_to_fp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_uint_to_fp.ll?rev=222489&r1=222488&r2=222489&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vec_uint_to_fp.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vec_uint_to_fp.ll Thu Nov 20 18:47:19 2014
@@ -154,3 +154,14 @@ define <8 x float> @test2(<8 x i32> %A)
%C = uitofp <8 x i32> %A to <8 x float>
ret <8 x float> %C
}
+
+define <4 x double> @test3(<4 x i32> %arg) {
+; CHECK-LABEL: test3:
+; This test used to crash because we were custom lowering it as if it was
+; a conversion between <4 x i32> and <4 x float>.
+; AVX: vcvtdq2pd
+; AVX2: vcvtdq2pd
+; CHECK: retq
+ %tmp = uitofp <4 x i32> %arg to <4 x double>
+ ret <4 x double> %tmp
+}
More information about the llvm-commits
mailing list