]> git.ipfire.org Git - thirdparty/gcc.git/commit
AArch64: Use standard names for saturating arithmetic
authorTamar Christina <tamar.christina@arm.com>
Fri, 17 Jan 2025 17:43:49 +0000 (17:43 +0000)
committerTamar Christina <tamar.christina@arm.com>
Fri, 17 Jan 2025 17:43:49 +0000 (17:43 +0000)
commit5f5833a4107ddfbcd87651bf140151de043f4c36
tree43c906b3003f74fb6559509dd3f17b6914be2895
parent7a47e480390f9087ee75adbba8aaff2022244b2b
AArch64: Use standard names for saturating arithmetic

This renames the existing {s,u}q{add,sub} instructions to use the
standard names {s,u}s{add,sub}3 which are used by IFN_SAT_ADD and
IFN_SAT_SUB.

The NEON intrinsics for saturating arithmetic and their corresponding
builtins are changed to use these standard names too.

Using the standard names for the instructions causes 32 and 64-bit
unsigned scalar saturating arithmetic to use the NEON instructions,
resulting in an additional (and inefficient) FMOV to be generated when
the original operands are in GP registers. This patch therefore also
restores the original behaviour of using the adds/subs instructions
in this circumstance.

Additional tests are written for the scalar and Adv. SIMD cases to
ensure that the correct instructions are used. The NEON intrinsics are
already tested elsewhere.

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc: Expand iterators.
* config/aarch64/aarch64-simd-builtins.def: Use standard names
* config/aarch64/aarch64-simd.md: Use standard names, split insn
definitions on signedness of operator and type of operands.
* config/aarch64/arm_neon.h: Use standard builtin names.
* config/aarch64/iterators.md: Add VSDQ_I_QI_HI iterator to
simplify splitting of insn for unsigned scalar arithmetic.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/scalar_intrinsics.c: Update testcases.
* gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect.inc:
Template file for unsigned vector saturating arithmetic tests.
* gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_1.c:
8-bit vector type tests.
* gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_2.c:
16-bit vector type tests.
* gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_3.c:
32-bit vector type tests.
* gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_4.c:
64-bit vector type tests.
* gcc.target/aarch64/saturating_arithmetic.inc: Template file
for scalar saturating arithmetic tests.
* gcc.target/aarch64/saturating_arithmetic_1.c: 8-bit tests.
* gcc.target/aarch64/saturating_arithmetic_2.c: 16-bit tests.
* gcc.target/aarch64/saturating_arithmetic_3.c: 32-bit tests.
* gcc.target/aarch64/saturating_arithmetic_4.c: 64-bit tests.

Co-authored-by: Tamar Christina <tamar.christina@arm.com>
17 files changed:
gcc/config/aarch64/aarch64-builtins.cc
gcc/config/aarch64/aarch64-simd-builtins.def
gcc/config/aarch64/aarch64-simd.md
gcc/config/aarch64/arm_neon.h
gcc/config/aarch64/iterators.md
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect.inc [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/saturating_arithmetic_autovect_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/saturating-arithmetic-signed.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/saturating_arithmetic.inc [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/saturating_arithmetic_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/saturating_arithmetic_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/saturating_arithmetic_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/saturating_arithmetic_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c