diff options
author | Spencer Abson <spencer.abson@arm.com> | 2025-01-23 19:48:49 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@arm.com> | 2025-04-22 17:07:39 +0200 |
commit | fabbf99fc8ae26f0d87ff0c8619b4fc3bb4a5da2 (patch) | |
tree | 1d561a9ea2d030dbb40f6909a132e25b96a7c430 /gcc/fortran | |
parent | 5d5e8e87a42af8c0d962fa16dc9835fb71778250 (diff) | |
download | gcc-fabbf99fc8ae26f0d87ff0c8619b4fc3bb4a5da2.zip gcc-fabbf99fc8ae26f0d87ff0c8619b4fc3bb4a5da2.tar.gz gcc-fabbf99fc8ae26f0d87ff0c8619b4fc3bb4a5da2.tar.bz2 |
AArch64: Define the spaceship optab [PR117013]
This expansion ensures that exactly one comparison is emitted for
spacesip-like sequences on floating-point operands, including when
the result of such sequences are compared against members of
std::<some_ordering>::<some_value>.
For both integer and floating-point types, we optimize for the case
in which the result of a spaceship-like operation is written to a GPR.
The PR highlights this issue for floating-point operands, but we also
make an improvement for integers, preferring:
cmp w0, w1
cset w1, gt
csinv w0, w1, wzr, ge
over:
cmp w0, w1
mov w0, 1
csinv w0, w0, wzr, ge
csel w0, w0, wzr, ne
to compute:
auto test(int a, int b) { return a <=> b;}
gcc/ChangeLog:
PR target/117013
* config/aarch64/aarch64-protos.h (aarch64_expand_fp_spaceship):
Declare optab expander function for floating-point types.
* config/aarch64/aarch64.cc (aarch64_expand_fp_spaceship):
Define optab expansion for floating-point types (new function).
* config/aarch64/aarch64.md (spaceship<mode>4):
Add define_expands for spaceship<mode>4 on integer and
floating-point types.
gcc/testsuite/ChangeLog:
PR target/117013
* g++.target/aarch64/spaceship_1.C: New test.
* g++.target/aarch64/spaceship_2.C: New test.
* g++.target/aarch64/spaceship_3.C: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions