mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Fix a bug in the scalarization of BUILD_VECTOR. BUILD_VECTOR elements may be wider than the output element type. Make sure to trunc them if needed.
Together with Michael Kuperstein <michael.m.kuperstein@intel.com> llvm-svn: 160235
This commit is contained in:
parent
a09775b875
commit
338506d265
@ -516,6 +516,7 @@ private:
|
||||
SDValue ScalarizeVecRes_InregOp(SDNode *N);
|
||||
|
||||
SDValue ScalarizeVecRes_BITCAST(SDNode *N);
|
||||
SDValue ScalarizeVecRes_BUILD_VECTOR(SDNode *N);
|
||||
SDValue ScalarizeVecRes_CONVERT_RNDSAT(SDNode *N);
|
||||
SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N);
|
||||
SDValue ScalarizeVecRes_FP_ROUND(SDNode *N);
|
||||
|
@ -48,7 +48,7 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
|
||||
|
||||
case ISD::MERGE_VALUES: R = ScalarizeVecRes_MERGE_VALUES(N, ResNo);break;
|
||||
case ISD::BITCAST: R = ScalarizeVecRes_BITCAST(N); break;
|
||||
case ISD::BUILD_VECTOR: R = N->getOperand(0); break;
|
||||
case ISD::BUILD_VECTOR: R = ScalarizeVecRes_BUILD_VECTOR(N); break;
|
||||
case ISD::CONVERT_RNDSAT: R = ScalarizeVecRes_CONVERT_RNDSAT(N); break;
|
||||
case ISD::EXTRACT_SUBVECTOR: R = ScalarizeVecRes_EXTRACT_SUBVECTOR(N); break;
|
||||
case ISD::FP_ROUND: R = ScalarizeVecRes_FP_ROUND(N); break;
|
||||
@ -152,6 +152,14 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_BITCAST(SDNode *N) {
|
||||
NewVT, N->getOperand(0));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ScalarizeVecRes_BUILD_VECTOR(SDNode *N) {
|
||||
EVT EltVT = N->getValueType(0).getVectorElementType();
|
||||
SDValue InOp = N->getOperand(0);
|
||||
if (InOp.getValueType() != EltVT)
|
||||
return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), EltVT, InOp);
|
||||
return InOp;
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ScalarizeVecRes_CONVERT_RNDSAT(SDNode *N) {
|
||||
EVT NewVT = N->getValueType(0).getVectorElementType();
|
||||
SDValue Op0 = GetScalarizedVector(N->getOperand(0));
|
||||
|
8
test/CodeGen/Generic/2012-07-15-BuildVectorPromote.ll
Normal file
8
test/CodeGen/Generic/2012-07-15-BuildVectorPromote.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: llc -mcpu=corei7 < %s
|
||||
; We don't care about the output, just that it doesn't crash
|
||||
|
||||
define <1 x i1> @buildvec_promote() {
|
||||
%cmp = icmp ule <1 x i32> undef, undef
|
||||
%sel = select i1 undef, <1 x i1> undef, <1 x i1> %cmp
|
||||
ret <1 x i1> %sel
|
||||
}
|
Loading…
Reference in New Issue
Block a user