[pushed] testsuite: Add -fno-tree-sink to sve/pr96357.c

Message ID mptfrjh6p2e.fsf@arm.com
State Committed
Commit 11c6d8cc9e5924c3a70e9289d1be2c2885b1dc6d
Headers
Series [pushed] testsuite: Add -fno-tree-sink to sve/pr96357.c |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap fail Patch failed to apply
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Richard Sandiford March 13, 2025, 1:24 p.m. UTC
  gcc.target/aarch64/sve/pr96357.c started failing after
r15-518-g99b1daae18c095d6, which tweaked the heuristics
about when to sink code.  The testcase has:

  double i = d, j = 1.0 - f, k = j ? d : j;
  if (k == 1.0)
    i = 0.0;
  *l = *n = *g = *h = i * 0.5;

where k == 1.0 is false if j is zero (since k is then also 0).
So we end up with a diamond whose condition is j != 0 && d == 1.
The else branch of the diamond is the only one that uses the result
of i = d, so after the patch, we sink the conversion to there.
And that seems like a reasonable thing to do.

However, aarch64 doesn't yet allow int->double conversions to be
predicated, so ifcvt cannot handle the sunk form, meaning that we
can no longer vectorise.

The testcase is highly artificial and so shouldn't IMO be used
to tune the sinking heuristics.  Instead I think we should just
disable sinking for the test.  An alternative would be to add
-ffast-math, but I think that would interfere more with the
original intent.

Tested on aarch64-linux-gnu & pushed, but I'm happy to revisit
if others would prefer a different fix.

Richard


gcc/testsuite/
	* gcc.target/aarch64/sve/pr96357.c: Add -fno-tree-sink.
---
 gcc/testsuite/gcc.target/aarch64/sve/pr96357.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr96357.c b/gcc/testsuite/gcc.target/aarch64/sve/pr96357.c
index 5d8fd8b53c3..9a7f912e529 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/pr96357.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr96357.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fpermissive -O3 -march=armv8.2-a+sve" } */
+/* { dg-options "-fpermissive -O3 -march=armv8.2-a+sve -fno-tree-sink" } */
 
 int d;