aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2024-04-05 02:50:16 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2024-04-05 03:55:46 +0200
commit4c8b3600c4856f7915281ae3ff4d97271c83a540 (patch)
tree4d3798a3d49083eed985826ca30df3edbb0f48da
parent3b36e86d6af3b305207c1aa6d56c2b350fefba65 (diff)
downloadgcc-4c8b3600c4856f7915281ae3ff4d97271c83a540.zip
gcc-4c8b3600c4856f7915281ae3ff4d97271c83a540.tar.gz
gcc-4c8b3600c4856f7915281ae3ff4d97271c83a540.tar.bz2
testsuite/gcc.target/cris/pr93372-2.c: Handle xpass from combine improvement
After r14-9692-g839bc42772ba7a, a sequence that actually looks optimal is now emitted, observed at r14-9788-gb7bd2ec73d66f7. This caused an XPASS for this test. While adjusting the test, better also guard it against regressions by checking that there are no redundant move insns. That's the only test that's improved to the point of affecting test-patterns. E.g. pr93372-5.c (which references pr93372-2.c) is also improved, though it retains a redundant compare insn. (PR 93372 was about regressions from the cc0 representation; not further improvement like here, thus it's not tagged. Though, I did not double-check whether this actually *was* a regression from cc0.) * gcc.target/cris/pr93372-2.c: Tweak scan-assembler checks to cover recent combine improvement.
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-2.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-2.c b/gcc/testsuite/gcc.target/cris/pr93372-2.c
index 912069c..2ef6471 100644
--- a/gcc/testsuite/gcc.target/cris/pr93372-2.c
+++ b/gcc/testsuite/gcc.target/cris/pr93372-2.c
@@ -1,19 +1,20 @@
/* Check that eliminable compare-instructions are eliminated. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
-/* { dg-final { scan-assembler-not "\tcmp|\ttest" { xfail *-*-* } } } */
-/* { dg-final { scan-assembler-not "\tnot" { xfail cc0 } } } */
-/* { dg-final { scan-assembler-not "\tlsr" { xfail cc0 } } } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* { dg-final { scan-assembler-not "\tnot" } } */
+/* { dg-final { scan-assembler-not "\tlsr" } } */
+/* We should get just one move, storing the result into *d. */
+/* { dg-final { scan-assembler-times "\tmove" 1 } } */
int f(int a, int b, int *d)
{
int c = a - b;
- /* Whoops! We get a cmp.d with the original operands here. */
+ /* We used to get a cmp.d with the original operands here. */
*d = (c == 0);
- /* Whoops! While we don't get a test.d for the result here for cc0,
- we get a sequence of insns: a move, a "not" and a shift of the
- subtraction-result, where a simple "spl" would have done. */
+ /* We used to get a suboptimal sequence, but now we get the optimal "sge"
+ (a.k.a "spl") re-using flags from the subtraction. */
return c >= 0;
}