1 /* PR rtl-optimization/95862 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4
5 int
f1(int a,int b)6 f1 (int a, int b)
7 {
8 unsigned long long c;
9 return __builtin_mul_overflow (a, b, &c);
10 }
11
12 int
f2(int a,unsigned b)13 f2 (int a, unsigned b)
14 {
15 unsigned long long c;
16 return __builtin_mul_overflow (a, b, &c);
17 }
18
19 int
f3(unsigned a,unsigned b)20 f3 (unsigned a, unsigned b)
21 {
22 long long c;
23 return __builtin_mul_overflow (a, b, &c);
24 }
25
26 int
f4(int a,unsigned b)27 f4 (int a, unsigned b)
28 {
29 long long c;
30 return __builtin_mul_overflow (a, b, &c);
31 }
32
33 short
f5(short a,short b)34 f5 (short a, short b)
35 {
36 unsigned c;
37 return __builtin_mul_overflow (a, b, &c);
38 }
39
40 short
f6(short a,unsigned short b)41 f6 (short a, unsigned short b)
42 {
43 unsigned c;
44 return __builtin_mul_overflow (a, b, &c);
45 }
46
47 short
f7(unsigned short a,unsigned short b)48 f7 (unsigned short a, unsigned short b)
49 {
50 int c;
51 return __builtin_mul_overflow (a, b, &c);
52 }
53
54 short
f8(short a,unsigned short b)55 f8 (short a, unsigned short b)
56 {
57 int c;
58 return __builtin_mul_overflow (a, b, &c);
59 }
60
61 signed char
f9(signed char a,signed char b)62 f9 (signed char a, signed char b)
63 {
64 unsigned short c;
65 return __builtin_mul_overflow (a, b, &c);
66 }
67
68 signed char
f10(signed char a,unsigned char b)69 f10 (signed char a, unsigned char b)
70 {
71 unsigned short c;
72 return __builtin_mul_overflow (a, b, &c);
73 }
74
75 signed char
f11(unsigned char a,unsigned char b)76 f11 (unsigned char a, unsigned char b)
77 {
78 short c;
79 return __builtin_mul_overflow (a, b, &c);
80 }
81
82 signed char
f12(signed char a,unsigned char b)83 f12 (signed char a, unsigned char b)
84 {
85 short c;
86 return __builtin_mul_overflow (a, b, &c);
87 }
88