mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Handle v2i64 BUILD_VECTOR custom lowering correctly. v2i64 is a legal type,
but i64 is not. If possible, change a i64 op to a f64 (e.g. load, constant) and then cast it back. llvm-svn: 27849
This commit is contained in:
parent
1c46fc49e1
commit
9dcd046bbd
@ -2980,7 +2980,22 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
if (Elt0IsZero) return Op;
|
||||
|
||||
// Zero extend a scalar to a vector.
|
||||
return DAG.getNode(X86ISD::ZEXT_S2VEC, Op.getValueType(), Elt0);
|
||||
if (Elt0.getValueType() != MVT::i64)
|
||||
return DAG.getNode(X86ISD::ZEXT_S2VEC, Op.getValueType(), Elt0);
|
||||
|
||||
// See if we can turn it into a f64 op.
|
||||
bool IsLegal = false;
|
||||
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Elt0)) {
|
||||
Elt0 = DAG.getConstantFP(BitsToDouble(C->getValue()), MVT::f64);
|
||||
IsLegal = true;
|
||||
} else if (Elt0.getOpcode() == ISD::LOAD) {
|
||||
Elt0 = DAG.getLoad(MVT::f64, Elt0.getOperand(0), Elt0.getOperand(1),
|
||||
Elt0.getOperand(2));
|
||||
IsLegal = true;
|
||||
}
|
||||
if (IsLegal)
|
||||
return DAG.getNode(ISD::BIT_CONVERT, MVT::v2i64,
|
||||
DAG.getNode(X86ISD::ZEXT_S2VEC, MVT::v2f64, Elt0));
|
||||
}
|
||||
|
||||
if (Values.size() > 2) {
|
||||
|
Loading…
Reference in New Issue
Block a user