mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-10 14:10:58 +00:00
SelectionDAG: Aggressively fold shuffles of constant splats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207352 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f090afddb4
commit
55e03c1992
@ -1441,6 +1441,11 @@ SDValue SelectionDAG::getVectorShuffle(EVT VT, SDLoc dl, SDValue N1,
|
||||
if (Identity && NElts)
|
||||
return N1;
|
||||
|
||||
// Shuffling a constant splat doesn't change the result.
|
||||
if (N2Undef && N1.getOpcode() == ISD::BUILD_VECTOR)
|
||||
if (cast<BuildVectorSDNode>(N1)->getConstantSplatValue())
|
||||
return N1;
|
||||
|
||||
FoldingSetNodeID ID;
|
||||
SDValue Ops[2] = { N1, N2 };
|
||||
AddNodeIDNode(ID, ISD::VECTOR_SHUFFLE, getVTList(VT), Ops, 2);
|
||||
|
@ -115,6 +115,7 @@ define <4 x i32> @test8(<4 x i32> %a) {
|
||||
; SSE-LABEL: test8:
|
||||
; SSE: pmuldq
|
||||
; SSE: pshufd $57
|
||||
; SSE-NOT: pshufd $57
|
||||
; SSE: pmuldq
|
||||
; SSE: shufps $-35
|
||||
; SSE: pshufd $-40
|
||||
@ -126,6 +127,7 @@ define <4 x i32> @test8(<4 x i32> %a) {
|
||||
; AVX-LABEL: test8:
|
||||
; AVX: vpmuldq
|
||||
; AVX: vpshufd $57
|
||||
; AVX-NOT: vpshufd $57
|
||||
; AVX: vpmuldq
|
||||
; AVX: vshufps $-35
|
||||
; AVX: vpshufd $-40
|
||||
@ -140,7 +142,7 @@ define <8 x i32> @test9(<8 x i32> %a) {
|
||||
ret <8 x i32> %div
|
||||
|
||||
; AVX-LABEL: test9:
|
||||
; AVX: vpermd
|
||||
; AVX: vpbroadcastd
|
||||
; AVX: vpmuldq
|
||||
; AVX: vshufps $-35
|
||||
; AVX: vpmuldq
|
||||
@ -157,7 +159,7 @@ define <8 x i32> @test10(<8 x i32> %a) {
|
||||
ret <8 x i32> %rem
|
||||
|
||||
; AVX-LABEL: test10:
|
||||
; AVX: vpermd
|
||||
; AVX: vpbroadcastd
|
||||
; AVX: vpmuludq
|
||||
; AVX: vshufps $-35
|
||||
; AVX: vpmuludq
|
||||
@ -174,7 +176,7 @@ define <8 x i32> @test11(<8 x i32> %a) {
|
||||
ret <8 x i32> %rem
|
||||
|
||||
; AVX-LABEL: test11:
|
||||
; AVX: vpermd
|
||||
; AVX: vpbroadcastd
|
||||
; AVX: vpmuldq
|
||||
; AVX: vshufps $-35
|
||||
; AVX: vpmuldq
|
||||
|
Loading…
Reference in New Issue
Block a user