2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr61839_2.c
blob638189e66e569c6d2786ed8b3e1c859d9b185c72
1 /* PR tree-optimization/61839. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-evrp" } */
4 /* { dg-require-effective-target int32plus } */
6 __attribute__ ((noinline))
7 int foo ()
9 int a = -1;
10 volatile unsigned b = 1U;
11 int c = 1;
12 c = (a + 972195718) / (b ? 2 : 0);
13 if (c == 486097858)
15 else
16 __builtin_abort ();
17 return 0;
20 __attribute__ ((noinline))
21 int bar ()
23 int a = -1;
24 volatile unsigned b = 1U;
25 int c = 1;
26 c = (a + 972195718) % (b ? 2 : 0);
27 if (c == 1)
29 else
30 __builtin_abort ();
31 return 0;
34 __attribute__ ((noinline))
35 int bar2 ()
37 int a = -1;
38 volatile unsigned b = 1U;
39 int c = 1;
40 c = (a + 972195716) % (b ? 1 : 2);
41 if (c == 0)
43 else
44 __builtin_abort ();
45 return 0;
49 /* Dont optimize 972195717 / 0 in function foo. */
50 /* { dg-final { scan-tree-dump-times "972195717 / " 1 "evrp" } } */
51 /* Dont optimize 972195717 % 0 in function bar. */
52 /* { dg-final { scan-tree-dump-times "972195717 % " 1 "evrp" } } */
53 /* May optimize in function bar2, but EVRP doesn't perform this yet. */
54 /* { dg-final { scan-tree-dump-times "972195715 % " 0 "evrp" { xfail *-*-* } } } */