From: Quentin Colombet Date: Fri, 21 Nov 2014 00:47:19 +0000 (+0000) Subject: [X86] Do not custom lower UINT_TO_FP when the target type does not X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7439d448393c27c49713428fc989ca0f14205c1;p=platform%2Fupstream%2Fllvm.git [X86] Do not custom lower UINT_TO_FP when the target type does not match the custom lowering. llvm-svn: 222489 --- diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9355187..f05b6c6 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -13610,6 +13610,11 @@ static SDValue lowerUINT_TO_FP_vXi32(SDValue Op, SelectionDAG &DAG, 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"); diff --git a/llvm/test/CodeGen/X86/vec_uint_to_fp.ll b/llvm/test/CodeGen/X86/vec_uint_to_fp.ll index 607be9a8..46cfcd9 100644 --- a/llvm/test/CodeGen/X86/vec_uint_to_fp.ll +++ b/llvm/test/CodeGen/X86/vec_uint_to_fp.ll @@ -154,3 +154,14 @@ define <8 x float> @test2(<8 x i32> %A) nounwind { %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 +}