]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add -fno-tree-sink to sve/pr96357.c
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 13 Mar 2025 13:23:28 +0000 (13:23 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 13 Mar 2025 13:23:28 +0000 (13:23 +0000)
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.

gcc/testsuite/
* gcc.target/aarch64/sve/pr96357.c: Add -fno-tree-sink.

gcc/testsuite/gcc.target/aarch64/sve/pr96357.c

index 5d8fd8b53c3de7e52bc325410b40e86fbf359b0f..9a7f912e529f634dd167d95aabed2738a7c87ac0 100644 (file)
@@ -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;