2015-03-06 20:34:20 +00:00
|
|
|
; RUN: llc < %s -march=x86-64 -mattr=+sse4.1 | FileCheck %s
|
2011-09-18 10:39:32 +00:00
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: load_2_i8:
|
2011-09-18 10:39:32 +00:00
|
|
|
; A single 16-bit load
|
2012-10-23 17:34:00 +00:00
|
|
|
;CHECK: pmovzxbq
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: paddq
|
|
|
|
;CHECK: pshufb
|
|
|
|
; A single 16-bit store
|
|
|
|
;CHECK: movw
|
|
|
|
;CHECK: ret
|
|
|
|
|
|
|
|
define void @load_2_i8(<2 x i8>* %A) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%T = load <2 x i8>, <2 x i8>* %A
|
2011-09-18 10:39:32 +00:00
|
|
|
%G = add <2 x i8> %T, <i8 9, i8 7>
|
|
|
|
store <2 x i8> %G, <2 x i8>* %A
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: load_2_i16:
|
2011-09-18 10:39:32 +00:00
|
|
|
; Read 32-bits
|
2012-10-23 17:34:00 +00:00
|
|
|
;CHECK: pmovzxwq
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: paddq
|
[x86] Enable the new vector shuffle lowering by default.
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
2014-10-04 03:52:55 +00:00
|
|
|
;CHECK: pshufd
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: movd
|
|
|
|
;CHECK: ret
|
|
|
|
define void @load_2_i16(<2 x i16>* %A) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%T = load <2 x i16>, <2 x i16>* %A
|
2011-09-18 10:39:32 +00:00
|
|
|
%G = add <2 x i16> %T, <i16 9, i16 7>
|
|
|
|
store <2 x i16> %G, <2 x i16>* %A
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: load_2_i32:
|
2012-10-23 17:34:00 +00:00
|
|
|
;CHECK: pmovzxdq
|
2014-07-24 22:15:28 +00:00
|
|
|
;CHECK: paddd
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: pshufd
|
|
|
|
;CHECK: ret
|
|
|
|
define void @load_2_i32(<2 x i32>* %A) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%T = load <2 x i32>, <2 x i32>* %A
|
2011-09-18 10:39:32 +00:00
|
|
|
%G = add <2 x i32> %T, <i32 9, i32 7>
|
|
|
|
store <2 x i32> %G, <2 x i32>* %A
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: load_4_i8:
|
2012-10-23 17:34:00 +00:00
|
|
|
;CHECK: pmovzxbd
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: paddd
|
|
|
|
;CHECK: pshufb
|
|
|
|
;CHECK: ret
|
|
|
|
define void @load_4_i8(<4 x i8>* %A) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%T = load <4 x i8>, <4 x i8>* %A
|
2011-09-18 10:39:32 +00:00
|
|
|
%G = add <4 x i8> %T, <i8 1, i8 4, i8 9, i8 7>
|
|
|
|
store <4 x i8> %G, <4 x i8>* %A
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: load_4_i16:
|
2012-10-23 17:34:00 +00:00
|
|
|
;CHECK: pmovzxwd
|
2014-07-24 22:15:28 +00:00
|
|
|
;CHECK: paddw
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: pshufb
|
|
|
|
;CHECK: ret
|
|
|
|
define void @load_4_i16(<4 x i16>* %A) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%T = load <4 x i16>, <4 x i16>* %A
|
2011-09-18 10:39:32 +00:00
|
|
|
%G = add <4 x i16> %T, <i16 1, i16 4, i16 9, i16 7>
|
|
|
|
store <4 x i16> %G, <4 x i16>* %A
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: load_8_i8:
|
2012-10-23 17:34:00 +00:00
|
|
|
;CHECK: pmovzxbw
|
2014-07-24 22:15:28 +00:00
|
|
|
;CHECK: paddb
|
2011-09-18 10:39:32 +00:00
|
|
|
;CHECK: pshufb
|
|
|
|
;CHECK: ret
|
|
|
|
define void @load_8_i8(<8 x i8>* %A) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%T = load <8 x i8>, <8 x i8>* %A
|
2011-09-18 10:39:32 +00:00
|
|
|
%G = add <8 x i8> %T, %T
|
|
|
|
store <8 x i8> %G, <8 x i8>* %A
|
|
|
|
ret void
|
|
|
|
}
|