comparison gcc/testsuite/gcc.dg/pr80131-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* { dg-do compile } */
2 /* { dg-require-effective-target int32plus } */
3 /* { dg-options "-fdump-tree-gimple" } */
4
5 /* Checks the simplification of:
6 1 << (C - x) to (1 << C) >> x, where C = precision (type) - 1
7 f1 is not simplified but f2, f3 and f4 are. */
8
9 __INT64_TYPE__ f1 (__INT64_TYPE__ i)
10 {
11 return (__INT64_TYPE__)1 << (31 - i);
12 }
13
14 __INT64_TYPE__ f2 (__INT64_TYPE__ i)
15 {
16 return (__INT64_TYPE__)1 << (63 - i);
17 }
18
19 __UINT64_TYPE__ f3 (__INT64_TYPE__ i)
20 {
21 return (__UINT64_TYPE__)1 << (63 - i);
22 }
23
24 __INT32_TYPE__ f4 (__INT32_TYPE__ i)
25 {
26 return (__INT32_TYPE__)1 << (31 - i);
27 }
28
29 /* { dg-final { scan-tree-dump-times "= 31 -" 1 "gimple" } } */
30 /* { dg-final { scan-tree-dump-times "9223372036854775808 >>" 2 "gimple" } } */
31 /* { dg-final { scan-tree-dump "2147483648 >>" "gimple" } } */