mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Allow SelectionDAG::FoldConstantArithmetic to work when it's called with a vector VT but scalar values.
llvm-svn: 207835
This commit is contained in:
parent
fbcd004fb7
commit
96dab04f0f
@ -2924,11 +2924,17 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, EVT VT,
|
||||
}
|
||||
}
|
||||
|
||||
assert((Scalar1 && Scalar2) ||
|
||||
VT.getVectorNumElements() == Outputs.size() && "No scalar or vector!");
|
||||
|
||||
// Handle the scalar case first.
|
||||
if (Scalar1 && Scalar2)
|
||||
if (!VT.isVector())
|
||||
return Outputs.back();
|
||||
|
||||
// Otherwise build a big vector out of the scalar elements we generated.
|
||||
// We may have a vector type but a scalar result. Create a splat.
|
||||
Outputs.resize(VT.getVectorNumElements(), Outputs.back());
|
||||
|
||||
// Build a big vector out of the scalar elements we generated.
|
||||
return getNode(ISD::BUILD_VECTOR, SDLoc(), VT, Outputs);
|
||||
}
|
||||
|
||||
|
@ -205,3 +205,13 @@ define <8 x i32> @test11(<8 x i32> %a) {
|
||||
; AVX: vpadd
|
||||
; AVX: vpmulld
|
||||
}
|
||||
|
||||
define <2 x i16> @test12() {
|
||||
%I8 = insertelement <2 x i16> zeroinitializer, i16 -1, i32 0
|
||||
%I9 = insertelement <2 x i16> %I8, i16 -1, i32 1
|
||||
%B9 = urem <2 x i16> %I9, %I9
|
||||
ret <2 x i16> %B9
|
||||
|
||||
; AVX-LABEL: test12:
|
||||
; AVX: xorps
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user