]>
Commit | Line | Data |
---|---|---|
f0b7d4cc AM |
1 | /* PR tree-optimization/102738 */ |
2 | /* { dg-options "-O2 -fdump-tree-evrp" } */ | |
5bb1e518 | 3 | /* { dg-do compile { target int128 } } */ |
f0b7d4cc AM |
4 | |
5 | /* Remove arithmetic shift right when the LHS is known to be 0 or -1. */ | |
6 | ||
7 | int a1(__int128 f, int g) | |
8 | { | |
9 | /* Leaves f >> 127. */ | |
10 | return (f >> 127) >> g; | |
11 | } | |
12 | ||
13 | int a2(int f, int g) | |
14 | { | |
15 | /* Leaves f >> 31. */ | |
16 | return (f >> 31) >> g; | |
17 | } | |
18 | ||
19 | int a3(int f, int g) | |
20 | { | |
21 | if (f == 0 || f == -1) | |
22 | return f >> g; | |
23 | __builtin_unreachable(); | |
24 | } | |
25 | ||
26 | int a4(int f, int g) | |
27 | { | |
28 | if (f == 0 || f == 1) | |
29 | return (-f) >> g; | |
30 | __builtin_unreachable(); | |
31 | } | |
32 | ||
33 | int a5(int f, int g) | |
34 | { | |
35 | if (f == 0 || f == 1) | |
36 | return (f-1) >> g; | |
37 | return 0; | |
38 | } | |
39 | ||
40 | int a6(int f, int g) | |
41 | { | |
42 | if (f == 6 || f == 7) | |
43 | return (f-7) >> g; | |
44 | __builtin_unreachable(); | |
45 | } | |
46 | ||
47 | /* { dg-final { scan-tree-dump-times " >> 127" 1 "evrp" } } */ | |
48 | /* { dg-final { scan-tree-dump-times " >> 31" 1 "evrp" } } */ | |
49 | /* { dg-final { scan-tree-dump-times " >> " 2 "evrp" } } */ |