On 20/05/2025 05:28, Alexandre Oliva wrote:
(The backport I've only just posted is not enough for the tests to pass;
there's another problem)
r14-10824 is a backport of r15-4549, that rewrote and extended into
check-function-bodies the save/restore expectations introduced in
r15-2160. Alas, r15-2160 mentions an insn_propagation patch that
enables those specific save/restore insns to be generated, presumably
r15-1945, and this change is not present in gcc-14, so we get
different save/restore insns, and the test fails, even after
backporting r15-1035, that allows for single-character function names
in check-function-bodies.
Drop the save/restore checks that don't belong in gcc-14.
Tested with gcc-14 on arm-vxworks7r2. Ok to install in gcc-14?
for gcc/testsuite/ChangeLog
* gcc.target/arm/fp16-aapcs-1.c: Drop save/restore checks.
* gcc.target/arm/fp16-aapcs-2.c: Likewise.
* gcc.target/arm/fp16-aapcs-3.c: Likewise.
* gcc.target/arm/fp16-aapcs-4.c: Likewise.
The more I look at these tests, the more I wonder whether the value they
add is worth the maintenance cost.
We already have several tests in gcc.target/arm/aapcs/vfp*.c that check
parameter passing of __fp16 types, so it should be safe to assume that
argument passing is correct. Hence we only really need to validate
return values. That can be done with a simple test that just checks
that the result returned from one function is passed as the parameter to
a subsequent one without being moved to a different value. A test
something like
__fp16 f();
void g(__fp16);
void h();
int test()
{
g(f());
h();
}
should assemble to
bl f
bl g
with nothing between the two calls. The call to h() is simply to ensure
that g() isn't tail-called.
It should then be easy to write a scan assembler test that checks that
neither s0 nor r0 are mentioned in the assembler output (and that should
cover both hard and soft abi variants). I'm not even sure that a
function body test is needed, but if you really want one checking that
we get back-to-back BL instructions would be enough.
R.
---
gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c | 7 ++-----
gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c | 8 --------
gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c | 7 ++-----
gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c | 8 --------
4 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c
b/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c
index b18d7cda65c8d..450c52fcd5c6c 100644
--- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c
+++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c
@@ -29,10 +29,8 @@ Below block is for non-armv8.1
** ...
** vmov\.f32 s0, \2
** )
-** vstr\.32 s2, \[sp, #4\] @ int
+** ...
** bl swap
-** vldr\.32 s2, \[sp, #4\] @ int
-** vmov\.f32 s0, s2
** |
@@ -50,9 +48,8 @@ Below block is for armv8.1
** ...
** vmov s0, \4 @ __fp16
** )
-** vstr\.32 s2, \[sp, #4\] @ int
+** ...
** bl swap
-** vldr\.16 s0, \[sp, #4\]
** )
** ...
diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c
b/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c
index 48510e895368d..c15f29dd3e44b 100644
--- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c
+++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c
@@ -28,14 +28,6 @@ swap (__fp16, __fp16);
** )
** ...
*/
-/*
-** F: { target arm_little_endian }
-** ...
-** str r2, \[sp, #4\]
-** bl swap
-** ldrh r0, \[sp, #4\] @ __fp16
-** ...
-*/
__fp16
F (__fp16 a, __fp16 b, __fp16 c)
{
diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c
b/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c
index 7238ef3a02e03..1102dc7344919 100644
--- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c
+++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c
@@ -29,10 +29,8 @@ Below block is for non-armv8.1
** ...
** vmov\.f32 s0, \2
** )
-** vstr\.32 s2, \[sp, #4\] @ int
+** ...
** bl swap
-** vldr\.32 s2, \[sp, #4\] @ int
-** vmov\.f32 s0, s2
** |
@@ -50,9 +48,8 @@ Below block is for armv8.1
** ...
** vmov s0, \4
** )
-** vstr\.32 s2, \[sp, #4\] @ int
+** ...
** bl swap
-** vldr\.16 s0, \[sp, #4\]
** )
** ...
diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c
b/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c
index 13f08d8afa32d..00a44d15129a8 100644
--- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c
+++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c
@@ -28,14 +28,6 @@ swap (__fp16, __fp16);
** )
** ...
*/
-/*
-** F: { target arm_little_endian }
-** ...
-** str r2, \[sp, #4\]
-** bl swap
-** ldrh r0, \[sp, #4\] @ __fp16
-** ...
-*/
__fp16
F (__fp16 a, __fp16 b, __fp16 c)
{