Fix broken MinGW build of gcc.c
[official-gcc.git] / gcc / testsuite / gcc.dg / pr31096-1.c
blob3866c7578b7a0da7e5e165ae798113226324c1f5
1 /* PR middle-end/31096 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
5 #if __SIZEOF_INT__ < 4
6 __extension__ typedef __INT32_TYPE__ int32_t;
7 __extension__ typedef __UINT32_TYPE__ uint32_t;
8 #else
9 typedef int int32_t;
10 typedef unsigned uint32_t;
11 #endif
13 #define zero(name, op) \
14 int32_t name (int32_t a, int32_t b) \
15 { return a * 0 op b * 0; }
17 zero(zeq, ==) zero(zne, !=) zero(zlt, <)
18 zero(zgt, >) zero(zge, >=) zero(zle, <=)
20 #define unsign_pos(name, op) \
21 int32_t name (uint32_t a, uint32_t b) \
22 { return a * 4 op b * 4; }
24 unsign_pos(upeq, ==) unsign_pos(upne, !=) unsign_pos(uplt, <)
25 unsign_pos(upgt, >) unsign_pos(upge, >=) unsign_pos(uple, <=)
27 #define unsign_neg(name, op) \
28 int32_t name (uint32_t a, uint32_t b) \
29 { return a * -2 op b * -2; }
31 unsign_neg(uneq, ==) unsign_neg(unne, !=) unsign_neg(unlt, <)
32 unsign_neg(ungt, >) unsign_neg(unge, >=) unsign_neg(unle, <=)
34 #define float(name, op) \
35 int32_t name (float a, float b) \
36 { return a * 5 op b * 5; }
38 float(feq, ==) float(fne, !=) float(flt, <)
39 float(fgt, >) float(fge, >=) float(fle, <=)
41 #define float_val(name, op) \
42 int32_t name (int32_t a, int32_t b) \
43 { return a * 54.0 op b * 54.0; }
45 float_val(fveq, ==) float_val(fvne, !=) float_val(fvlt, <)
46 float_val(fvgt, >) float_val(fvge, >=) float_val(fvle, <=)
48 #define vec(name, op) \
49 int32_t name (int32_t a, int32_t b) \
50 { int32_t c[10]; return a * c[1] op b * c[1]; }
52 vec(veq, ==) vec(vne, !=) vec(vlt, <)
53 vec(vgt, >) vec(vge, >=) vec(vle, <=)
55 /* { dg-final { scan-tree-dump-times "\\(D\\) \\* 4" 24 "optimized" } } */
56 /* { dg-final { scan-tree-dump-times "\\(D\\) \\* 4294967294" 12 "optimized" } } */
57 /* { dg-final { scan-tree-dump-times "\\(D\\) \\* 5\\.0e\\+0" 12 "optimized" } } */
58 /* { dg-final { scan-tree-dump-times "\\* 5\\.4e\\+1" 12 "optimized" } } */
59 /* { dg-final { scan-tree-dump-times "\\(D\\) \\* c\\\$1_8\\(D\\)" 12 "optimized" } } */