2012-10-10 18:04:52 +00:00
|
|
|
; RUN: llc < %s -march=x86 -mcpu=corei7 | FileCheck %s
|
|
|
|
; RUN: llc < %s -march=x86 -mcpu=core-avx-i | FileCheck %s --check-prefix=AVX
|
2012-10-10 16:53:28 +00:00
|
|
|
|
|
|
|
define <1 x float> @test1(<1 x double>* %p) nounwind {
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-LABEL: test1:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: pushl %eax
|
|
|
|
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; CHECK-NEXT: movsd (%eax), %xmm0
|
|
|
|
; CHECK-NEXT: cvtsd2ss %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: movss %xmm0, (%esp)
|
|
|
|
; CHECK-NEXT: flds (%esp)
|
|
|
|
; CHECK-NEXT: popl %eax
|
|
|
|
; CHECK-NEXT: retl
|
|
|
|
;
|
|
|
|
; AVX-LABEL: test1:
|
|
|
|
; AVX: # BB#0:
|
|
|
|
; AVX-NEXT: pushl %eax
|
|
|
|
; AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; AVX-NEXT: vmovsd (%eax), %xmm0
|
|
|
|
; AVX-NEXT: vcvtsd2ss %xmm0, %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: vmovss %xmm0, (%esp)
|
|
|
|
; AVX-NEXT: flds (%esp)
|
|
|
|
; AVX-NEXT: popl %eax
|
|
|
|
; AVX-NEXT: retl
|
2015-02-27 21:17:42 +00:00
|
|
|
%x = load <1 x double>, <1 x double>* %p
|
2012-10-10 16:53:28 +00:00
|
|
|
%y = fptrunc <1 x double> %x to <1 x float>
|
|
|
|
ret <1 x float> %y
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x float> @test2(<2 x double>* %p) nounwind {
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-LABEL: test2:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; CHECK-NEXT: cvtpd2ps (%eax), %xmm0
|
|
|
|
; CHECK-NEXT: retl
|
|
|
|
;
|
|
|
|
; AVX-LABEL: test2:
|
|
|
|
; AVX: # BB#0:
|
|
|
|
; AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; AVX-NEXT: vcvtpd2psx (%eax), %xmm0
|
|
|
|
; AVX-NEXT: retl
|
2015-02-27 21:17:42 +00:00
|
|
|
%x = load <2 x double>, <2 x double>* %p
|
2012-10-10 16:53:28 +00:00
|
|
|
%y = fptrunc <2 x double> %x to <2 x float>
|
|
|
|
ret <2 x float> %y
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @test3(<4 x double>* %p) nounwind {
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-LABEL: test3:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; CHECK-NEXT: cvtpd2ps 16(%eax), %xmm1
|
|
|
|
; CHECK-NEXT: cvtpd2ps (%eax), %xmm0
|
[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-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-NEXT: retl
|
|
|
|
;
|
|
|
|
; AVX-LABEL: test3:
|
|
|
|
; AVX: # BB#0:
|
|
|
|
; AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; AVX-NEXT: vcvtpd2psy (%eax), %xmm0
|
|
|
|
; AVX-NEXT: retl
|
2015-02-27 21:17:42 +00:00
|
|
|
%x = load <4 x double>, <4 x double>* %p
|
2012-10-10 16:53:28 +00:00
|
|
|
%y = fptrunc <4 x double> %x to <4 x float>
|
|
|
|
ret <4 x float> %y
|
|
|
|
}
|
|
|
|
|
|
|
|
define <8 x float> @test4(<8 x double>* %p) nounwind {
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-LABEL: test4:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; CHECK-NEXT: cvtpd2ps 16(%eax), %xmm1
|
|
|
|
; CHECK-NEXT: cvtpd2ps (%eax), %xmm0
|
[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-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-NEXT: cvtpd2ps 48(%eax), %xmm2
|
|
|
|
; CHECK-NEXT: cvtpd2ps 32(%eax), %xmm1
|
[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-NEXT: unpcklpd {{.*#+}} xmm1 = xmm1[0],xmm2[0]
|
2014-10-03 01:06:32 +00:00
|
|
|
; CHECK-NEXT: retl
|
|
|
|
;
|
|
|
|
; AVX-LABEL: test4:
|
|
|
|
; AVX: # BB#0:
|
|
|
|
; AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; AVX-NEXT: vcvtpd2psy (%eax), %xmm0
|
|
|
|
; AVX-NEXT: vcvtpd2psy 32(%eax), %xmm1
|
|
|
|
; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
|
|
|
|
; AVX-NEXT: retl
|
2015-02-27 21:17:42 +00:00
|
|
|
%x = load <8 x double>, <8 x double>* %p
|
2012-10-10 16:53:28 +00:00
|
|
|
%y = fptrunc <8 x double> %x to <8 x float>
|
|
|
|
ret <8 x float> %y
|
|
|
|
}
|
|
|
|
|
|
|
|
|