libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / pr113982.c
blob4c5be6cc832e9e6cd8be7c27d59d986cfe4ef28a
1 /* PR middle-end/113982 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-widening_mul" } */
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 #define B __CHAR_BIT__ * sizeof (T)
14 struct S { int p; T r; };
16 struct S
17 foo (T x, T y)
19 W z = (W) x + y;
20 return (struct S) { z >> B, (T) z };
23 struct S
24 bar (T x)
26 W z = (W) x + 132;
27 return (struct S) { z >> B, (T) z };
30 struct S
31 baz (T x, unsigned short y)
33 W z = (W) x + y;
34 return (struct S) { z >> B, (T) z };
37 struct S
38 qux (unsigned short x, T y)
40 W z = (W) x + y;
41 return (struct S) { z >> B, (T) z };
44 struct S
45 corge (T x, T y)
47 T w = x + y;
48 W z = (W) x + y;
49 return (struct S) { z >> B, w };
52 struct S
53 garple (T x, T y)
55 W z = (W) x + y;
56 T w = x + y;
57 return (struct S) { z >> B, w };
60 /* { dg-final { scan-tree-dump-times "ADD_OVERFLOW" 6 "widening_mul" { target { i?86-*-* x86_64-*-* } } } } */