From: Nadav Rotem Date: Sun, 15 Apr 2012 15:08:09 +0000 (+0000) Subject: When emulating vselect using OR/AND/XOR make sure to bitcast the result back to the... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3ab32ea49ec13182f1397dc89c37551692f67140;p=oota-llvm.git When emulating vselect using OR/AND/XOR make sure to bitcast the result back to the original type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154764 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp index 3ae8345bd19..9fe4480d113 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp @@ -417,7 +417,8 @@ SDValue VectorLegalizer::ExpandVSELECT(SDValue Op) { Op1 = DAG.getNode(ISD::AND, DL, VT, Op1, Mask); Op2 = DAG.getNode(ISD::AND, DL, VT, Op2, NotMask); - return DAG.getNode(ISD::OR, DL, VT, Op1, Op2); + SDValue Val = DAG.getNode(ISD::OR, DL, VT, Op1, Op2); + return DAG.getNode(ISD::BITCAST, DL, Op.getValueType(), Val); } SDValue VectorLegalizer::ExpandUINT_TO_FLOAT(SDValue Op) { diff --git a/test/CodeGen/X86/sse41-blend.ll b/test/CodeGen/X86/sse41-blend.ll index 78604a0e963..1a1017d2c17 100644 --- a/test/CodeGen/X86/sse41-blend.ll +++ b/test/CodeGen/X86/sse41-blend.ll @@ -80,3 +80,11 @@ define <2 x double> @B(<2 x double> %x, <2 x double> %y) { ret <2 x double> %min } +; CHECK: float_crash +define void @float_crash() nounwind { +entry: + %merge205vector_func.i = select <4 x i1> undef, <4 x double> undef, <4 x double> undef + %extract214vector_func.i = extractelement <4 x double> %merge205vector_func.i, i32 0 + store double %extract214vector_func.i, double addrspace(1)* undef, align 8 + ret void +}