| 1 |
/* PR tree-optimization/95853 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-widening_mul" } */ |
| 4 |
|
| 5 |
#if __SIZEOF_INT128__ |
| 6 |
typedef __uint128_t W; |
| 7 |
typedef unsigned long long T; |
| 8 |
#else |
| 9 |
typedef unsigned long long W; |
| 10 |
typedef unsigned int T; |
| 11 |
#endif |
| 12 |
|
| 13 |
struct S { int p; T r; }; |
| 14 |
|
| 15 |
struct S |
| 16 |
foo (T x, T y) |
| 17 |
{ |
| 18 |
W z = (W) x + y; |
| 19 |
return (struct S) { z > ~(T) 0, (T) z }; |
| 20 |
} |
| 21 |
|
| 22 |
struct S |
| 23 |
bar (T x) |
| 24 |
{ |
| 25 |
W z = (W) x + 132; |
| 26 |
return (struct S) { z > ~(T) 0, (T) z }; |
| 27 |
} |
| 28 |
|
| 29 |
struct S |
| 30 |
baz (T x, unsigned short y) |
| 31 |
{ |
| 32 |
W z = (W) x + y; |
| 33 |
return (struct S) { z > ~(T) 0, (T) z }; |
| 34 |
} |
| 35 |
|
| 36 |
struct S |
| 37 |
qux (unsigned short x, T y) |
| 38 |
{ |
| 39 |
W z = (W) x + y; |
| 40 |
return (struct S) { z > ~(T) 0, (T) z }; |
| 41 |
} |
| 42 |
|
| 43 |
struct S |
| 44 |
corge (T x, T y) |
| 45 |
{ |
| 46 |
T w = x + y; |
| 47 |
W z = (W) x + y; |
| 48 |
return (struct S) { z > ~(T) 0, w }; |
| 49 |
} |
| 50 |
|
| 51 |
struct S |
| 52 |
garple (T x, T y) |
| 53 |
{ |
| 54 |
W z = (W) x + y; |
| 55 |
T w = x + y; |
| 56 |
return (struct S) { z > ~(T) 0, w }; |
| 57 |
} |
| 58 |
|
| 59 |
/* { dg-final { scan-tree-dump-times "ADD_OVERFLOW" 6 "widening_mul" { target { i?86-*-* x86_64-*-* } } } } */ |