1 /* PR tree-optimization/61839.  */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fdump-tree-vrp1 -fdisable-tree-evrp -fdump-tree-optimized" } */
4 /* { dg-require-effective-target int32plus } */
5 
6 __attribute__ ((noinline))
foo()7 int foo ()
8 {
9   int a = -1;
10   volatile unsigned b = 1U;
11   int c = 1;
12   c = (a + 972195718) >> (1LU <= b);
13   if (c == 486097858)
14     ;
15   else
16     __builtin_abort ();
17   return 0;
18 }
19 
20 __attribute__ ((noinline))
bar()21 int bar ()
22 {
23   int a = -1;
24   volatile unsigned b = 1U;
25   int c = 1;
26   c = (a + 972195718) >> (b ? 2 : 3);
27   if (c == 243048929)
28     ;
29   else
30     __builtin_abort ();
31   return 0;
32 }
33 
main()34 int main ()
35 {
36   foo ();
37   bar ();
38 }
39 
40 /* Scan for c = 972195717) >> [0, 1] in function foo.  */
41 /* { dg-final { scan-tree-dump-times "486097858 : 972195717" 1  "vrp1" } } */
42 /* Scan for c = 972195717) >> [2, 3] in function bar.  */
43 /* { dg-final { scan-tree-dump-times "243048929 : 121524464" 2  "vrp1" } } */
44 /* { dg-final { scan-tree-dump-times "486097858" 0  "optimized" } } */
45