mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
03a77831cc
Update the entire regression test suite for the new shuffles. Remove most of the old testing which was devoted to the old shuffle lowering path and is no longer relevant really. Also remove a few other random tests that only really exercised shuffles and only incidently or without any interesting aspects to them. Benchmarking that I have done shows a few small regressions with this on LNT, zero measurable regressions on real, large applications, and for several benchmarks where the loop vectorizer fires in the hot path it shows 5% to 40% improvements for SSE2 and SSE3 code running on Sandy Bridge machines. Running on AMD machines shows even more dramatic improvements. When using newer ISA vector extensions the gains are much more modest, but the code is still better on the whole. There are a few regressions being tracked (PR21137, PR21138, PR21139) but by and large this is expected to be a win for x86 generated code performance. It is also more correct than the code it replaces. I have fuzz tested this extensively with ISA extensions up through AVX2 and found no crashes or miscompiles (yet...). The old lowering had a few miscompiles and crashers after a somewhat smaller amount of fuzz testing. There is one significant area where the new code path lags behind and that is in AVX-512 support. However, there was *extremely little* support for that already and so this isn't a significant step backwards and the new framework will probably make it easier to implement lowering that uses the full power of AVX-512's table-based shuffle+blend (IMO). Many thanks to Quentin, Andrea, Robert, and others for benchmarking assistance. Thanks to Adam and others for help with AVX-512. Thanks to Hal, Eric, and *many* others for answering my incessant questions about how the backend actually works. =] I will leave the old code path in the tree until the 3 PRs above are at least resolved to folks' satisfaction. Then I will rip it (and 1000s of lines of code) out. =] I don't expect this flag to stay around for very long. It may not survive next week. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219046 91177308-0d34-0410-b5e6-96231b3b80d8
97 lines
2.7 KiB
LLVM
97 lines
2.7 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=ALL --check-prefix=SSE2
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse4.1 | FileCheck %s --check-prefix=ALL --check-prefix=SSE41
|
|
|
|
define <4 x i32> @a(<4 x i32> %i) nounwind {
|
|
; SSE2-LABEL: a:
|
|
; SSE2: movdqa {{.*}}, %[[X1:xmm[0-9]+]]
|
|
; SSE2-NEXT: pshufd {{.*}} # [[X2:xmm[0-9]+]] = xmm0[1,1,3,3]
|
|
; SSE2-NEXT: pmuludq %[[X1]], %xmm0
|
|
; SSE2-NEXT: pmuludq %[[X1]], %[[X2]]
|
|
; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],[[X2]][0,2]
|
|
; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,1,3]
|
|
; SSE2-NEXT: retq
|
|
;
|
|
; SSE41-LABEL: a:
|
|
; SSE41: pmulld
|
|
; SSE41-NEXT: retq
|
|
entry:
|
|
%A = mul <4 x i32> %i, < i32 117, i32 117, i32 117, i32 117 >
|
|
ret <4 x i32> %A
|
|
}
|
|
|
|
define <2 x i64> @b(<2 x i64> %i) nounwind {
|
|
; ALL-LABEL: b:
|
|
; ALL: pmuludq
|
|
; ALL: pmuludq
|
|
; ALL: pmuludq
|
|
entry:
|
|
%A = mul <2 x i64> %i, < i64 117, i64 117 >
|
|
ret <2 x i64> %A
|
|
}
|
|
|
|
define <4 x i32> @c(<4 x i32> %i, <4 x i32> %j) nounwind {
|
|
; SSE2-LABEL: c:
|
|
; SSE2: pshufd {{.*}} # [[X2:xmm[0-9]+]] = xmm0[1,1,3,3]
|
|
; SSE2-NEXT: pmuludq %xmm1, %xmm0
|
|
; SSE2-NEXT: pshufd {{.*}} # xmm1 = xmm1[1,1,3,3]
|
|
; SSE2-NEXT: pmuludq %[[X2]], %xmm1
|
|
; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[0,2]
|
|
; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,1,3]
|
|
; SSE2-NEXT: retq
|
|
;
|
|
; SSE41-LABEL: c:
|
|
; SSE41: pmulld
|
|
; SSE41-NEXT: retq
|
|
entry:
|
|
%A = mul <4 x i32> %i, %j
|
|
ret <4 x i32> %A
|
|
}
|
|
|
|
define <2 x i64> @d(<2 x i64> %i, <2 x i64> %j) nounwind {
|
|
; ALL-LABEL: d:
|
|
; ALL: pmuludq
|
|
; ALL: pmuludq
|
|
; ALL: pmuludq
|
|
entry:
|
|
%A = mul <2 x i64> %i, %j
|
|
ret <2 x i64> %A
|
|
}
|
|
|
|
declare void @foo()
|
|
|
|
define <4 x i32> @e(<4 x i32> %i, <4 x i32> %j) nounwind {
|
|
; SSE2-LABEL: e:
|
|
; SSE2: movdqa {{[0-9]*}}(%rsp), %xmm0
|
|
; SSE2-NEXT: pshufd {{.*}} # [[X1:xmm[0-9]+]] = xmm0[1,1,3,3]
|
|
; SSE2-NEXT: movdqa {{[0-9]*}}(%rsp), %[[X2:xmm[0-9]+]]
|
|
; SSE2-NEXT: pmuludq %[[X2]], %xmm0
|
|
; SSE2-NEXT: pshufd {{.*}} # [[X2]] = [[X2]][1,1,3,3]
|
|
; SSE2-NEXT: pmuludq %[[X1]], %[[X2]]
|
|
; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],[[X2]][0,2]
|
|
; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,1,3]
|
|
; SSE2-NEXT: addq ${{[0-9]+}}, %rsp
|
|
; SSE2-NEXT: retq
|
|
;
|
|
; SSE41-LABEL: e:
|
|
; SSE41: pmulld {{[0-9]+}}(%rsp), %xmm
|
|
; SSE41-NEXT: addq ${{[0-9]+}}, %rsp
|
|
; SSE41-NEXT: retq
|
|
entry:
|
|
; Use a call to force spills.
|
|
call void @foo()
|
|
%A = mul <4 x i32> %i, %j
|
|
ret <4 x i32> %A
|
|
}
|
|
|
|
define <2 x i64> @f(<2 x i64> %i, <2 x i64> %j) nounwind {
|
|
; ALL-LABEL: f:
|
|
; ALL: pmuludq
|
|
; ALL: pmuludq
|
|
; ALL: pmuludq
|
|
entry:
|
|
; Use a call to force spills.
|
|
call void @foo()
|
|
%A = mul <2 x i64> %i, %j
|
|
ret <2 x i64> %A
|
|
}
|