1 /* { dg-options "--std=gnu99" } */
3 /* Check that optimizations like (x * 1) to x, or (x * -1) to -x,
4 do not apply to decimal float computations where trailing zeroes
7 extern void abort (void);
11 extern int printf (const char *, ...);
12 #define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
14 #define FAILURE abort ();
17 #define COMPARE32(A,B) \
20 #define COMPARE64(A,B) \
21 A.i[0] == B.i[0] && A.i[1] == B.i[1]
23 #define COMPARE128(A,B) \
24 A.i[0] == B.i[0] && A.i[1] == B.i[1] && A.i[2] == B.i[2] && A.i[3] == B.i[3]
58 volatile u128 p128_1_0
;
59 volatile u128 p128_2_0
;
61 volatile u128 m128_1_0
;
62 volatile u128 m128_2_0
;
101 /* Multiplying by a value with no trailing zero should not change the
104 a32
.d
= p32_2_0
.d
* p32_1
.d
;
105 if (! (COMPARE32 (a32
, p32_2_0
)))
108 a32
.d
= p32_2_0
.d
* 1.DF
;
109 if (! (COMPARE32 (a32
, p32_2_0
)))
112 a32
.d
= p32_2_0
.d
* m32_1
.d
;
113 if (! (COMPARE32 (a32
, m32_2_0
)))
116 a32
.d
= p32_2_0
.d
* -1.DF
;
117 if (! (COMPARE32 (a32
, m32_2_0
)))
120 /* Multiplying by a value with a trailing zero should change the
123 a32
.d
= p32_2_0
.d
* p32_1_0
.d
;
124 if (COMPARE32 (a32
, p32_2_0
))
127 a32
.d
= p32_2_0
.d
* 1.0DF
;
128 if (COMPARE32 (a32
, p32_2_0
))
131 a32
.d
= p32_2_0
.d
* m32_1_0
.d
;
132 if (COMPARE32 (a32
, m32_2_0
))
135 a32
.d
= p32_2_0
.d
* -1.0DF
;
136 if (COMPARE32 (a32
, m32_2_0
))
143 /* Multiplying by a value with no trailing zero should not change the
146 a64
.d
= p64_2_0
.d
* p64_1
.d
;
147 if (! (COMPARE64 (a64
, p64_2_0
)))
150 a64
.d
= p64_2_0
.d
* 1.DD
;
151 if (! (COMPARE64 (a64
, p64_2_0
)))
154 a64
.d
= p64_2_0
.d
* m64_1
.d
;
155 if (! (COMPARE64 (a64
, m64_2_0
)))
158 a64
.d
= p64_2_0
.d
* -1.DD
;
159 if (! (COMPARE64 (a64
, m64_2_0
)))
162 /* Multiplying by a value with a trailing zero should change the
165 a64
.d
= p64_2_0
.d
* p64_1_0
.d
;
166 if (COMPARE64 (a64
, p64_2_0
))
169 a64
.d
= p64_2_0
.d
* 1.0DD
;
170 if (COMPARE64 (a64
, p64_2_0
))
173 a64
.d
= p64_2_0
.d
* m64_1_0
.d
;
174 if (COMPARE64 (a64
, m64_2_0
))
177 a64
.d
= p64_2_0
.d
* -1.0DD
;
178 if (COMPARE64 (a64
, m64_2_0
))
185 /* Multiplying by a value with no trailing zero should not change the
188 a128
.d
= p128_2_0
.d
* p128_1_0
.d
;
189 if (COMPARE128 (a128
, p128_2_0
))
192 a128
.d
= p128_2_0
.d
* 1.0DL
;
193 if (COMPARE128 (a128
, p128_2_0
))
196 a128
.d
= p128_2_0
.d
* m128_1_0
.d
;
197 if (COMPARE128 (a128
, m128_2_0
))
200 a128
.d
= p128_2_0
.d
* -1.0DL
;
201 if (COMPARE128 (a128
, m128_2_0
))
204 /* Multiplying by a value with a trailing zero should change the
207 a128
.d
= p128_2_0
.d
* p128_1
.d
;
208 if (! (COMPARE128 (a128
, p128_2_0
)))
211 a128
.d
= p128_2_0
.d
* 1.DL
;
212 if (! (COMPARE128 (a128
, p128_2_0
)))
215 a128
.d
= p128_2_0
.d
* m128_1
.d
;
216 if (! (COMPARE128 (a128
, m128_2_0
)))
219 a128
.d
= p128_2_0
.d
* -1.DL
;
220 if (! (COMPARE128 (a128
, m128_2_0
)))