diff options
author | Spencer Abson <spencer.abson@arm.com> | 2025-07-15 10:12:08 +0000 |
---|---|---|
committer | Spencer Abson <spencer.abson@arm.com> | 2025-07-16 10:35:57 +0000 |
commit | abf865732a7313cf79ffa325faed3467ed28d8b8 (patch) | |
tree | 46069e4920a1b4632f4b58ddc5fd36f67175860b /gcc/tree-ssa-loop-prefetch.cc | |
parent | 13604c5bdca81e1f3e4baa3a348eaec986a8f447 (diff) | |
download | gcc-abf865732a7313cf79ffa325faed3467ed28d8b8.zip gcc-abf865732a7313cf79ffa325faed3467ed28d8b8.tar.gz gcc-abf865732a7313cf79ffa325faed3467ed28d8b8.tar.bz2 |
aarch64: Fold builtins with highpart args to highpart equivalent [PR117850]
Add a fold at gimple_fold_builtin to prefer the highpart variant of a builtin
if at least one argument is a vector highpart and all others are VECTOR_CSTs
that we can extend to 128-bits.
For example, we prefer to duplicate f0 and use UMULL2 here over DUP+UMULL:
uint16x8_t
foo (const uint8x16_t s)
{
const uint8x8_t f0 = vdup_n_u8 (4);
return vmull_u8 (vget_high_u8 (s), f0);
}
gcc/ChangeLog:
PR target/117850
* config/aarch64/aarch64-builtins.cc (LO_HI_PAIRINGS): New, group the
lo/hi pairs from aarch64-builtin-pairs.def.
(aarch64_get_highpart_builtin): New function.
(aarch64_v128_highpart_ref): New function, helper to look for vector
highparts.
(aarch64_build_vector_cst): New function, helper to build duplicated
VECTOR_CSTs.
(aarch64_fold_lo_call_to_hi): New function.
(aarch64_general_gimple_fold_builtin): Add cases for the lo builtins
in aarch64-builtin-pairs.def.
* config/aarch64/aarch64-builtin-pairs.def: New file, declare the
parirs of lowpart-operating and highpart-operating builtins.
gcc/testsuite/ChangeLog:
PR target/117850
* gcc.target/aarch64/simd/vabal_combine.c: Removed. This is
covered by fold_to_highpart_1.c
* gcc.target/aarch64/simd/fold_to_highpart_1.c: New test.
* gcc.target/aarch64/simd/fold_to_highpart_2.c: Likewise.
* gcc.target/aarch64/simd/fold_to_highpart_3.c: Likewise.
* gcc.target/aarch64/simd/fold_to_highpart_4.c: Likewise.
* gcc.target/aarch64/simd/fold_to_highpart_5.c: Likewise.
* gcc.target/aarch64/simd/fold_to_highpart_6.c: Likewise.
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.cc')
0 files changed, 0 insertions, 0 deletions