Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp @@ -23315,7 +23315,7 @@ SDValue OldExtract = St->getOperand(1); SDValue ExtOp0 = OldExtract.getOperand(0); unsigned VecSize = ExtOp0.getValueSizeInBits(); - MVT VecVT = MVT::getVectorVT(MVT::f64, VecSize / 64); + EVT VecVT = EVT::getVectorVT(*DAG.getContext(), MVT::f64, VecSize / 64); SDValue BitCast = DAG.getNode(ISD::BITCAST, dl, VecVT, ExtOp0); SDValue NewExtract = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::f64, BitCast, OldExtract.getOperand(1)); Index: llvm/trunk/test/CodeGen/X86/i64-mem-copy.ll =================================================================== --- llvm/trunk/test/CodeGen/X86/i64-mem-copy.ll +++ llvm/trunk/test/CodeGen/X86/i64-mem-copy.ll @@ -63,3 +63,14 @@ ret void } +; PR23476 +; Handle extraction from a non-simple / pre-legalization type. + +define void @PR23476(<5 x i64> %in, i64* %out, i32 %index) { +; X32-LABEL: PR23476: +; X32: movsd {{.*#+}} xmm0 = mem[0],zero +; X32-NEXT: movsd %xmm0, (%eax) + %ext = extractelement <5 x i64> %in, i32 %index + store i64 %ext, i64* %out, align 8 + ret void +}