aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/cmpelim_mult_uses_1.c
blob: 953c388037f4cc4d6daa446ab40b3f8546736034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-options "-O2" } */

/* X is both compared against zero and used.  Make sure we can still
   generate an ADDS and avoid an explicit comparison against zero.  */

int
foo (int x, int y)
{
  x += y;
  if (x != 0)
    x = x + 2;
  return x;
}

/* { dg-final { scan-assembler-times "adds\\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 1 } } */
/* { dg-final { scan-assembler-not "cmp\\tw\[0-9\]+, 0" } } */