mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Allow SelectionDAG::FoldConstantArithmetic to work when it's called with a vector VT but scalar values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
74e9519ef9
commit
bcf1501839
@ -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