Debian Codegraph @

gcc/testsuite/gcc.target/cris/pr93372-2.c

raw
1 /* Check that eliminable compare-instructions are eliminated. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4 /* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
5 /* { dg-final { scan-assembler-not "\tnot" } } */
6 /* { dg-final { scan-assembler-not "\tlsr" } } */
7 /* We should get just one move, storing the result into *d. */
8 /* { dg-final { scan-assembler-times "\tmove" 1 } } */
9
10 int f(int a, int b, int *d)
11 {
12 int c = a - b;
13
14 /* We used to get a cmp.d with the original operands here. */
15 *d = (c == 0);
16
17 /* We used to get a suboptimal sequence, but now we get the optimal "sge"
18 (a.k.a "spl") re-using flags from the subtraction. */
19 return c >= 0;
20 }