aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr96272.c
blob: 4c9fa6360d314c56ad8b5ef17e4290673266922f (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
37
/* PR tree-optimization/96272 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-widening_mul" } */

unsigned
foo (unsigned a, unsigned b)
{
  if (a > ~0U - b)
    return ~0U;
  return a + b;
}

unsigned
bar (unsigned a, unsigned b)
{
  if (a <= ~0U - b)
    return ~0U;
  return a + b;
}

unsigned
baz (unsigned a, unsigned b)
{
  if (~0U - b < a)
    return ~0U;
  return a + b;
}

unsigned
qux (unsigned a, unsigned b)
{
  if (~0U - b >= a)
    return ~0U;
  return a + b;
}

/* { dg-final { scan-tree-dump-times "ADD_OVERFLOW" 4 "widening_mul" { target { i?86-*-* x86_64-*-* } } } } */