aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr98334.c
blob: 283abc5ba0a05245f07fd6774278b6f83f9010d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* PR rtl-optimization/98334 */
/* { dg-do compile } */
/* { dg-options "-O2 -fomit-frame-pointer -fno-stack-protector" } */
/* { dg-final { scan-assembler-not "\taddl\t" } } */
/* { dg-final { scan-assembler-not "\tsubl\t" } } */
/* { dg-final { scan-assembler-not "\tleal\t" } } */

int
foo (int i, unsigned int n)
{
  int result = 0;
  while (n > 0)
    {
      result += i;
      n -= 1;
    }
  return result;
}

int
bar (int x, int y)
{
  return (int) (y - 1U) * x + x;
}

int
baz (int x, int y)
{
  return (y - 1) * x + x;
}

int
qux (int x, int y)
{
  return x * (int) (y + 1U) - x;
}