1 /* { dg-do run { target mipsisa64*-*-* } } */
2 /* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */
4 /* Test v2sf calculations */
8 typedef float v2sf
__attribute__ ((vector_size (8)));
13 v2sf
init (float a
, float b
)
18 /* Move between registers */
24 /* Load from memory */
37 v2sf
add (v2sf a
, v2sf b
)
43 v2sf
sub (v2sf a
, v2sf b
)
55 v2sf
mul (v2sf a
, v2sf b
)
60 /* Multiply and add */
61 v2sf
madd (v2sf a
, v2sf b
, v2sf c
)
66 /* Multiply and subtract */
67 v2sf
msub (v2sf a
, v2sf b
, v2sf c
)
72 /* Negate Multiply and add */
73 v2sf
nmadd (v2sf a
, v2sf b
, v2sf c
)
78 /* Negate Multiply and subtract */
79 v2sf
nmsub (v2sf a
, v2sf b
, v2sf c
)
84 /* Conditional Move */
85 v2sf
cond_move1 (v2sf a
, v2sf b
, long i
)
93 /* Conditional Move */
94 v2sf
cond_move2 (v2sf a
, v2sf b
, int i
)
102 /* Conditional Move */
103 v2sf
cond_move3 (v2sf a
, v2sf b
, float i
)
111 /* Conditional Move */
112 v2sf
cond_move4 (v2sf a
, v2sf b
, double i
)
122 v2sf a
, b
, c
, d
, e
, f
;
128 b
= (v2sf
) {1.2, 3.4};
129 if (!__builtin_mips_upper_c_eq_ps (a
, b
) ||
130 !__builtin_mips_lower_c_eq_ps (a
, b
))
133 a
= (v2sf
) {1.2, 2.3};
134 b
= (v2sf
) {5.3, 6.1};
137 if (!__builtin_mips_upper_c_eq_ps (a
, b
) ||
138 !__builtin_mips_lower_c_eq_ps (a
, b
))
141 a
= (v2sf
) {1.2, 2.3};
142 b
= (v2sf
) {5.3, 6.1};
144 d
= (v2sf
) {6.5, 8.4};
145 if (!__builtin_mips_upper_c_eq_ps (c
, d
) ||
146 !__builtin_mips_lower_c_eq_ps (c
, d
))
153 if (!__builtin_mips_upper_c_eq_ps (c
, d
) ||
154 !__builtin_mips_lower_c_eq_ps (c
, d
))
161 if (!__builtin_mips_upper_c_eq_ps (c
, d
) ||
162 !__builtin_mips_lower_c_eq_ps (c
, d
))
170 if (!__builtin_mips_upper_c_eq_ps (d
, e
) ||
171 !__builtin_mips_lower_c_eq_ps (d
, e
))
179 if (!__builtin_mips_upper_c_eq_ps (d
, e
) ||
180 !__builtin_mips_lower_c_eq_ps (d
, e
))
187 e
= (v2sf
) {-10, -78};
188 if (!__builtin_mips_upper_c_eq_ps (d
, e
) ||
189 !__builtin_mips_lower_c_eq_ps (d
, e
))
197 if (!__builtin_mips_upper_c_eq_ps (d
, e
) ||
198 !__builtin_mips_lower_c_eq_ps (d
, e
))
203 c
= (v2sf
) {-98, -12};
204 if (!__builtin_mips_upper_c_eq_ps (b
, c
) ||
205 !__builtin_mips_lower_c_eq_ps (b
, c
))
210 c
= cond_move1 (a
, b
, 1000);
211 if (!__builtin_mips_upper_c_eq_ps (c
, a
) ||
212 !__builtin_mips_lower_c_eq_ps (c
, a
))
217 c
= cond_move2 (a
, b
, -1000);
218 if (!__builtin_mips_upper_c_eq_ps (c
, b
) ||
219 !__builtin_mips_lower_c_eq_ps (c
, b
))
224 c
= cond_move3 (a
, b
, 9.0);
225 if (!__builtin_mips_upper_c_eq_ps (c
, a
) ||
226 !__builtin_mips_lower_c_eq_ps (c
, a
))
231 c
= cond_move4 (a
, b
, -10.0);
232 if (!__builtin_mips_upper_c_eq_ps (c
, b
) ||
233 !__builtin_mips_lower_c_eq_ps (c
, b
))
238 c
= (v2sf
) {33, 123};
240 e
= __builtin_mips_movt_c_eq_ps (a
, b
, c
, d
);
242 if (!__builtin_mips_upper_c_eq_ps (e
, f
) ||
243 !__builtin_mips_lower_c_eq_ps (e
, f
))
248 c
= (v2sf
) {33, 123};
250 e
= __builtin_mips_movf_c_eq_ps (a
, b
, c
, d
);
252 if (!__builtin_mips_upper_c_eq_ps (e
, f
) ||
253 !__builtin_mips_lower_c_eq_ps (e
, f
))
257 b
= (v2sf
) {100, 200};
258 if (!__builtin_mips_upper_c_eq_ps (a
, b
) ||
259 !__builtin_mips_lower_c_eq_ps (a
, b
))
262 a
= (v2sf
) {123, 321};
265 if (!__builtin_mips_upper_c_eq_ps (a
, b
) ||
266 !__builtin_mips_lower_c_eq_ps (a
, b
))
269 printf ("Test Passes\n");