1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

R600: Consider bitcast when folding const_address node.

Patch by: Vincent Lejeune

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 174098
This commit is contained in:
Tom Stellard 2013-01-31 22:11:53 +00:00
parent 585a9178bf
commit fe5c14ff9a
2 changed files with 11 additions and 0 deletions

View File

@ -318,6 +318,9 @@ bool AMDGPUDAGToDAGISel::FoldOperands(unsigned Opcode,
}
}
break;
case ISD::BITCAST:
Ops[OperandIdx[i] - 1] = Operand.getOperand(0);
return true;
default:
break;
}

View File

@ -991,6 +991,14 @@ SDValue R600TargetLowering::PerformDAGCombine(SDNode *N,
return Arg->getOperand(Element);
}
}
if (Arg.getOpcode() == ISD::BITCAST &&
Arg.getOperand(0).getOpcode() == ISD::BUILD_VECTOR) {
if (ConstantSDNode *Const = dyn_cast<ConstantSDNode>(N->getOperand(1))) {
unsigned Element = Const->getZExtValue();
return DAG.getNode(ISD::BITCAST, N->getDebugLoc(), N->getVTList(),
Arg->getOperand(0).getOperand(Element));
}
}
}
}
return SDValue();