2 * Copyright(c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 * Test instructions that might set bits in user status register (USR)
30 * Some of the instructions tested are only available on certain versions
33 #define CORE_HAS_AUDIO (__HEXAGON_ARCH__ >= 67 && defined(__HEXAGON_AUDIO__))
34 #define CORE_IS_V67 (__HEXAGON_ARCH__ >= 67)
37 * Templates for functions to execute an instruction
39 * The templates vary by the number of arguments and the types of the args
40 * and result. We use one letter in the macro name for the result and each
42 * x unknown (specified in a subsequent template) or don't care
43 * R register (32 bits)
50 /* Template for instructions with one register operand */
51 #define FUNC_x_OP_x(RESTYPE, SRCTYPE, NAME, INSN) \
52 static RESTYPE NAME(SRCTYPE src, uint32_t *usr_result) \
59 : "=r"(result), "=r"(usr) \
62 *usr_result = usr & 0x3f; \
66 #define FUNC_R_OP_R(NAME, INSN) \
67 FUNC_x_OP_x(uint32_t, uint32_t, NAME, INSN)
69 #define FUNC_R_OP_P(NAME, INSN) \
70 FUNC_x_OP_x(uint32_t, uint64_t, NAME, INSN)
72 #define FUNC_P_OP_P(NAME, INSN) \
73 FUNC_x_OP_x(uint64_t, uint64_t, NAME, INSN)
75 #define FUNC_P_OP_R(NAME, INSN) \
76 FUNC_x_OP_x(uint64_t, uint32_t, NAME, INSN)
79 * Template for instructions with a register and predicate result
80 * and one register operand
82 #define FUNC_xp_OP_x(RESTYPE, SRCTYPE, NAME, INSN) \
83 static RESTYPE NAME(SRCTYPE src, uint8_t *pred_result, uint32_t *usr_result) \
92 : "=r"(result), "=r"(pred), "=r"(usr) \
94 : "r2", "p2", "usr"); \
95 *pred_result = pred; \
96 *usr_result = usr & 0x3f; \
100 #define FUNC_Rp_OP_R(NAME, INSN) \
101 FUNC_xp_OP_x(uint32_t, uint32_t, NAME, INSN)
103 /* Template for instructions with two register operands */
104 #define FUNC_x_OP_xx(RESTYPE, SRC1TYPE, SRC2TYPE, NAME, INSN) \
105 static RESTYPE NAME(SRC1TYPE src1, SRC2TYPE src2, uint32_t *usr_result) \
112 : "=r"(result), "=r"(usr) \
113 : "r"(src1), "r"(src2) \
115 *usr_result = usr & 0x3f; \
119 #define FUNC_P_OP_PP(NAME, INSN) \
120 FUNC_x_OP_xx(uint64_t, uint64_t, uint64_t, NAME, INSN)
122 #define FUNC_R_OP_PP(NAME, INSN) \
123 FUNC_x_OP_xx(uint32_t, uint64_t, uint64_t, NAME, INSN)
125 #define FUNC_P_OP_RR(NAME, INSN) \
126 FUNC_x_OP_xx(uint64_t, uint32_t, uint32_t, NAME, INSN)
128 #define FUNC_R_OP_RR(NAME, INSN) \
129 FUNC_x_OP_xx(uint32_t, uint32_t, uint32_t, NAME, INSN)
131 #define FUNC_R_OP_PR(NAME, INSN) \
132 FUNC_x_OP_xx(uint32_t, uint64_t, uint32_t, NAME, INSN)
134 #define FUNC_P_OP_PR(NAME, INSN) \
135 FUNC_x_OP_xx(uint64_t, uint64_t, uint32_t, NAME, INSN)
138 * Template for instructions with a register and predicate result
139 * and two register operands
141 #define FUNC_xp_OP_xx(RESTYPE, SRC1TYPE, SRC2TYPE, NAME, INSN) \
142 static RESTYPE NAME(SRC1TYPE src1, SRC2TYPE src2, \
143 uint8_t *pred_result, uint32_t *usr_result) \
152 : "=r"(result), "=r"(pred), "=r"(usr) \
153 : "r"(src1), "r"(src2) \
154 : "r2", "p2", "usr"); \
155 *pred_result = pred; \
156 *usr_result = usr & 0x3f; \
160 #define FUNC_Rp_OP_RR(NAME, INSN) \
161 FUNC_xp_OP_xx(uint32_t, uint32_t, uint32_t, NAME, INSN)
163 /* Template for instructions with one register and one immediate */
164 #define FUNC_x_OP_xI(RESTYPE, SRC1TYPE, NAME, INSN) \
165 static RESTYPE NAME(SRC1TYPE src1, int32_t src2, uint32_t *usr_result) \
172 : "=r"(result), "=r"(usr) \
173 : "r"(src1), "i"(src2) \
175 *usr_result = usr & 0x3f; \
179 #define FUNC_R_OP_RI(NAME, INSN) \
180 FUNC_x_OP_xI(uint32_t, uint32_t, NAME, INSN)
182 #define FUNC_R_OP_PI(NAME, INSN) \
183 FUNC_x_OP_xI(uint32_t, uint64_t, NAME, INSN)
186 * Template for instructions with a read/write result
187 * and two register operands
189 #define FUNC_Xx_OP_xx(RESTYPE, SRC1TYPE, SRC2TYPE, NAME, INSN) \
190 static RESTYPE NAME(RESTYPE result, SRC1TYPE src1, SRC2TYPE src2, \
191 uint32_t *usr_result) \
197 : "+r"(result), "=r"(usr) \
198 : "r"(src1), "r"(src2) \
200 *usr_result = usr & 0x3f; \
204 #define FUNC_XR_OP_RR(NAME, INSN) \
205 FUNC_Xx_OP_xx(uint32_t, uint32_t, uint32_t, NAME, INSN)
207 #define FUNC_XP_OP_PP(NAME, INSN) \
208 FUNC_Xx_OP_xx(uint64_t, uint64_t, uint64_t, NAME, INSN)
210 #define FUNC_XP_OP_RR(NAME, INSN) \
211 FUNC_Xx_OP_xx(uint64_t, uint32_t, uint32_t, NAME, INSN)
214 * Template for instructions with a read/write result
215 * and two register operands
217 #define FUNC_Xxp_OP_xx(RESTYPE, SRC1TYPE, SRC2TYPE, NAME, INSN) \
218 static RESTYPE NAME(RESTYPE result, SRC1TYPE src1, SRC2TYPE src2, \
219 uint8_t *pred_result, uint32_t *usr_result) \
227 : "+r"(result), "=r"(pred), "=r"(usr) \
228 : "r"(src1), "r"(src2) \
230 *pred_result = pred; \
231 *usr_result = usr & 0x3f; \
235 #define FUNC_XPp_OP_PP(NAME, INSN) \
236 FUNC_Xxp_OP_xx(uint64_t, uint64_t, uint64_t, NAME, INSN)
239 * Template for instructions with a read/write result and
240 * two register and one predicate operands
242 #define FUNC_Xx_OP_xxp(RESTYPE, SRC1TYPE, SRC2TYPE, NAME, INSN) \
243 static RESTYPE NAME(RESTYPE result, SRC1TYPE src1, SRC2TYPE src2, uint8_t pred,\
244 uint32_t *usr_result) \
251 : "+r"(result), "=r"(usr) \
252 : "r"(src1), "r"(src2), "r"(pred) \
253 : "r2", "p2", "usr"); \
254 *usr_result = usr & 0x3f; \
258 #define FUNC_XR_OP_RRp(NAME, INSN) \
259 FUNC_Xx_OP_xxp(uint32_t, uint32_t, uint32_t, NAME, INSN)
261 /* Template for compare instructions with two register operands */
262 #define FUNC_CMP_xx(SRC1TYPE, SRC2TYPE, NAME, INSN) \
263 static uint32_t NAME(SRC1TYPE src1, SRC2TYPE src2, uint32_t *usr_result) \
271 : "=r"(result), "=r"(usr) \
272 : "r"(src1), "r"(src2) \
273 : "p1", "r2", "usr"); \
274 *usr_result = usr & 0x3f; \
278 #define FUNC_CMP_RR(NAME, INSN) \
279 FUNC_CMP_xx(uint32_t, uint32_t, NAME, INSN)
281 #define FUNC_CMP_PP(NAME, INSN) \
282 FUNC_CMP_xx(uint64_t, uint64_t, NAME, INSN)
285 * Function declarations using the templates
287 FUNC_R_OP_R(satub
, "%0 = satub(%2)")
288 FUNC_P_OP_PP(vaddubs
, "%0 = vaddub(%2, %3):sat")
289 FUNC_P_OP_PP(vadduhs
, "%0 = vadduh(%2, %3):sat")
290 FUNC_P_OP_PP(vsububs
, "%0 = vsubub(%2, %3):sat")
291 FUNC_P_OP_PP(vsubuhs
, "%0 = vsubuh(%2, %3):sat")
293 /* Add vector of half integers with saturation and pack to unsigned bytes */
294 FUNC_R_OP_PP(vaddhubs
, "%0 = vaddhub(%2, %3):sat")
296 /* Vector saturate half to unsigned byte */
297 FUNC_R_OP_P(vsathub
, "%0 = vsathub(%2)")
299 /* Similar to above but takes a 32-bit argument */
300 FUNC_R_OP_R(svsathub
, "%0 = vsathub(%2)")
302 /* Vector saturate word to unsigned half */
303 FUNC_P_OP_P(vsatwuh_nopack
, "%0 = vsatwuh(%2)")
305 /* Similar to above but returns a 32-bit result */
306 FUNC_R_OP_P(vsatwuh
, "%0 = vsatwuh(%2)")
308 /* Vector arithmetic shift halfwords with saturate and pack */
309 FUNC_R_OP_PI(asrhub_sat
, "%0 = vasrhub(%2, #%3):sat")
311 /* Vector arithmetic shift halfwords with round, saturate and pack */
312 FUNC_R_OP_PI(asrhub_rnd_sat
, "%0 = vasrhub(%2, #%3):raw")
314 FUNC_R_OP_RR(addsat
, "%0 = add(%2, %3):sat")
315 /* Similar to above but with register pairs */
316 FUNC_P_OP_PP(addpsat
, "%0 = add(%2, %3):sat")
318 FUNC_XR_OP_RR(mpy_acc_sat_hh_s0
, "%0 += mpy(%2.H, %3.H):sat")
319 FUNC_R_OP_RR(mpy_sat_hh_s1
, "%0 = mpy(%2.H, %3.H):<<1:sat")
320 FUNC_R_OP_RR(mpy_sat_rnd_hh_s1
, "%0 = mpy(%2.H, %3.H):<<1:rnd:sat")
321 FUNC_R_OP_RR(mpy_up_s1_sat
, "%0 = mpy(%2, %3):<<1:sat")
322 FUNC_P_OP_RR(vmpy2s_s1
, "%0 = vmpyh(%2, %3):<<1:sat")
323 FUNC_P_OP_RR(vmpy2su_s1
, "%0 = vmpyhsu(%2, %3):<<1:sat")
324 FUNC_R_OP_RR(vmpy2s_s1pack
, "%0 = vmpyh(%2, %3):<<1:rnd:sat")
325 FUNC_P_OP_PP(vmpy2es_s1
, "%0 = vmpyeh(%2, %3):<<1:sat")
326 FUNC_R_OP_PP(vdmpyrs_s1
, "%0 = vdmpy(%2, %3):<<1:rnd:sat")
327 FUNC_XP_OP_PP(vdmacs_s0
, "%0 += vdmpy(%2, %3):sat")
328 FUNC_R_OP_RR(cmpyrs_s0
, "%0 = cmpy(%2, %3):rnd:sat")
329 FUNC_XP_OP_RR(cmacs_s0
, "%0 += cmpy(%2, %3):sat")
330 FUNC_XP_OP_RR(cnacs_s0
, "%0 -= cmpy(%2, %3):sat")
331 FUNC_P_OP_PP(vrcmpys_s1_h
, "%0 = vrcmpys(%2, %3):<<1:sat:raw:hi")
332 FUNC_XP_OP_PP(mmacls_s0
, "%0 += vmpyweh(%2, %3):sat")
333 FUNC_R_OP_RR(hmmpyl_rs1
, "%0 = mpy(%2, %3.L):<<1:rnd:sat")
334 FUNC_XP_OP_PP(mmaculs_s0
, "%0 += vmpyweuh(%2, %3):sat")
335 FUNC_R_OP_PR(cmpyi_wh
, "%0 = cmpyiwh(%2, %3):<<1:rnd:sat")
336 FUNC_P_OP_PP(vcmpy_s0_sat_i
, "%0 = vcmpyi(%2, %3):sat")
337 FUNC_P_OP_PR(vcrotate
, "%0 = vcrotate(%2, %3)")
338 FUNC_P_OP_PR(vcnegh
, "%0 = vcnegh(%2, %3)")
341 FUNC_R_OP_PP(wcmpyrw
, "%0 = cmpyrw(%2, %3):<<1:sat")
344 FUNC_R_OP_RR(addh_l16_sat_ll
, "%0 = add(%2.L, %3.L):sat")
345 FUNC_P_OP_P(vconj
, "%0 = vconj(%2):sat")
346 FUNC_P_OP_PP(vxaddsubw
, "%0 = vxaddsubw(%2, %3):sat")
347 FUNC_P_OP_P(vabshsat
, "%0 = vabsh(%2):sat")
348 FUNC_P_OP_PP(vnavgwr
, "%0 = vnavgw(%2, %3):rnd:sat")
349 FUNC_R_OP_RI(round_ri_sat
, "%0 = round(%2, #%3):sat")
350 FUNC_R_OP_RR(asr_r_r_sat
, "%0 = asr(%2, %3):sat")
351 FUNC_R_OP_RR(asl_r_r_sat
, "%0 = asl(%2, %3):sat")
353 FUNC_XPp_OP_PP(ACS
, "%0, p2 = vacsh(%3, %4)")
356 FUNC_R_OP_RR(sfmin
, "%0 = sfmin(%2, %3)")
357 FUNC_R_OP_RR(sfmax
, "%0 = sfmax(%2, %3)")
358 FUNC_R_OP_RR(sfadd
, "%0 = sfadd(%2, %3)")
359 FUNC_R_OP_RR(sfsub
, "%0 = sfsub(%2, %3)")
360 FUNC_R_OP_RR(sfmpy
, "%0 = sfmpy(%2, %3)")
361 FUNC_XR_OP_RR(sffma
, "%0 += sfmpy(%2, %3)")
362 FUNC_XR_OP_RR(sffms
, "%0 -= sfmpy(%2, %3)")
363 FUNC_CMP_RR(sfcmpuo
, "p1 = sfcmp.uo(%2, %3)")
364 FUNC_CMP_RR(sfcmpeq
, "p1 = sfcmp.eq(%2, %3)")
365 FUNC_CMP_RR(sfcmpgt
, "p1 = sfcmp.gt(%2, %3)")
366 FUNC_CMP_RR(sfcmpge
, "p1 = sfcmp.ge(%2, %3)")
368 FUNC_P_OP_PP(dfadd
, "%0 = dfadd(%2, %3)")
369 FUNC_P_OP_PP(dfsub
, "%0 = dfsub(%2, %3)")
372 FUNC_P_OP_PP(dfmin
, "%0 = dfmin(%2, %3)")
373 FUNC_P_OP_PP(dfmax
, "%0 = dfmax(%2, %3)")
374 FUNC_XP_OP_PP(dfmpyhh
, "%0 += dfmpyhh(%2, %3)")
377 FUNC_CMP_PP(dfcmpuo
, "p1 = dfcmp.uo(%2, %3)")
378 FUNC_CMP_PP(dfcmpeq
, "p1 = dfcmp.eq(%2, %3)")
379 FUNC_CMP_PP(dfcmpgt
, "p1 = dfcmp.gt(%2, %3)")
380 FUNC_CMP_PP(dfcmpge
, "p1 = dfcmp.ge(%2, %3)")
382 /* Conversions from sf */
383 FUNC_P_OP_R(conv_sf2df
, "%0 = convert_sf2df(%2)")
384 FUNC_R_OP_R(conv_sf2uw
, "%0 = convert_sf2uw(%2)")
385 FUNC_R_OP_R(conv_sf2w
, "%0 = convert_sf2w(%2)")
386 FUNC_P_OP_R(conv_sf2ud
, "%0 = convert_sf2ud(%2)")
387 FUNC_P_OP_R(conv_sf2d
, "%0 = convert_sf2d(%2)")
388 FUNC_R_OP_R(conv_sf2uw_chop
, "%0 = convert_sf2uw(%2):chop")
389 FUNC_R_OP_R(conv_sf2w_chop
, "%0 = convert_sf2w(%2):chop")
390 FUNC_P_OP_R(conv_sf2ud_chop
, "%0 = convert_sf2ud(%2):chop")
391 FUNC_P_OP_R(conv_sf2d_chop
, "%0 = convert_sf2d(%2):chop")
393 /* Conversions from df */
394 FUNC_R_OP_P(conv_df2sf
, "%0 = convert_df2sf(%2)")
395 FUNC_R_OP_P(conv_df2uw
, "%0 = convert_df2uw(%2)")
396 FUNC_R_OP_P(conv_df2w
, "%0 = convert_df2w(%2)")
397 FUNC_P_OP_P(conv_df2ud
, "%0 = convert_df2ud(%2)")
398 FUNC_P_OP_P(conv_df2d
, "%0 = convert_df2d(%2)")
399 FUNC_R_OP_P(conv_df2uw_chop
, "%0 = convert_df2uw(%2):chop")
400 FUNC_R_OP_P(conv_df2w_chop
, "%0 = convert_df2w(%2):chop")
401 FUNC_P_OP_P(conv_df2ud_chop
, "%0 = convert_df2ud(%2):chop")
402 FUNC_P_OP_P(conv_df2d_chop
, "%0 = convert_df2d(%2):chop")
404 /* Integer to float conversions */
405 FUNC_R_OP_R(conv_uw2sf
, "%0 = convert_uw2sf(%2)")
406 FUNC_R_OP_R(conv_w2sf
, "%0 = convert_w2sf(%2)")
407 FUNC_R_OP_P(conv_ud2sf
, "%0 = convert_ud2sf(%2)")
408 FUNC_R_OP_P(conv_d2sf
, "%0 = convert_d2sf(%2)")
410 /* Special purpose floating point instructions */
411 FUNC_XR_OP_RRp(sffma_sc
, "%0 += sfmpy(%2, %3, p2):scale")
412 FUNC_Rp_OP_RR(sfrecipa
, "%0, p2 = sfrecipa(%3, %4)")
413 FUNC_R_OP_RR(sffixupn
, "%0 = sffixupn(%2, %3)")
414 FUNC_R_OP_RR(sffixupd
, "%0 = sffixupd(%2, %3)")
415 FUNC_R_OP_R(sffixupr
, "%0 = sffixupr(%2)")
416 FUNC_Rp_OP_R(sfinvsqrta
, "%0, p2 = sfinvsqrta(%3)")
419 * Templates for test cases
421 * Same naming convention as the function templates
423 #define TEST_x_OP_x(RESTYPE, CHECKFN, SRCTYPE, FUNC, SRC, RES, USR_RES) \
427 uint32_t usr_result; \
428 result = FUNC(src, &usr_result); \
429 CHECKFN(result, RES); \
430 check32(usr_result, USR_RES); \
433 #define TEST_R_OP_R(FUNC, SRC, RES, USR_RES) \
434 TEST_x_OP_x(uint32_t, check32, uint32_t, FUNC, SRC, RES, USR_RES)
436 #define TEST_R_OP_P(FUNC, SRC, RES, USR_RES) \
437 TEST_x_OP_x(uint32_t, check32, uint64_t, FUNC, SRC, RES, USR_RES)
439 #define TEST_P_OP_P(FUNC, SRC, RES, USR_RES) \
440 TEST_x_OP_x(uint64_t, check64, uint64_t, FUNC, SRC, RES, USR_RES)
442 #define TEST_P_OP_R(FUNC, SRC, RES, USR_RES) \
443 TEST_x_OP_x(uint64_t, check64, uint32_t, FUNC, SRC, RES, USR_RES)
445 #define TEST_xp_OP_x(RESTYPE, CHECKFN, SRCTYPE, FUNC, SRC, \
446 RES, PRED_RES, USR_RES) \
450 uint8_t pred_result; \
451 uint32_t usr_result; \
452 result = FUNC(src, &pred_result, &usr_result); \
453 CHECKFN(result, RES); \
454 check32(pred_result, PRED_RES); \
455 check32(usr_result, USR_RES); \
458 #define TEST_Rp_OP_R(FUNC, SRC, RES, PRED_RES, USR_RES) \
459 TEST_xp_OP_x(uint32_t, check32, uint32_t, FUNC, SRC, RES, PRED_RES, USR_RES)
461 #define TEST_x_OP_xx(RESTYPE, CHECKFN, SRC1TYPE, SRC2TYPE, \
462 FUNC, SRC1, SRC2, RES, USR_RES) \
465 SRC1TYPE src1 = SRC1; \
466 SRC2TYPE src2 = SRC2; \
467 uint32_t usr_result; \
468 result = FUNC(src1, src2, &usr_result); \
469 CHECKFN(result, RES); \
470 check32(usr_result, USR_RES); \
473 #define TEST_P_OP_PP(FUNC, SRC1, SRC2, RES, USR_RES) \
474 TEST_x_OP_xx(uint64_t, check64, uint64_t, uint64_t, \
475 FUNC, SRC1, SRC2, RES, USR_RES)
477 #define TEST_R_OP_PP(FUNC, SRC1, SRC2, RES, USR_RES) \
478 TEST_x_OP_xx(uint32_t, check32, uint64_t, uint64_t, \
479 FUNC, SRC1, SRC2, RES, USR_RES)
481 #define TEST_P_OP_RR(FUNC, SRC1, SRC2, RES, USR_RES) \
482 TEST_x_OP_xx(uint64_t, check64, uint32_t, uint32_t, \
483 FUNC, SRC1, SRC2, RES, USR_RES)
485 #define TEST_R_OP_RR(FUNC, SRC1, SRC2, RES, USR_RES) \
486 TEST_x_OP_xx(uint32_t, check32, uint32_t, uint32_t, \
487 FUNC, SRC1, SRC2, RES, USR_RES)
489 #define TEST_R_OP_PR(FUNC, SRC1, SRC2, RES, USR_RES) \
490 TEST_x_OP_xx(uint32_t, check32, uint64_t, uint32_t, \
491 FUNC, SRC1, SRC2, RES, USR_RES)
493 #define TEST_P_OP_PR(FUNC, SRC1, SRC2, RES, USR_RES) \
494 TEST_x_OP_xx(uint64_t, check64, uint64_t, uint32_t, \
495 FUNC, SRC1, SRC2, RES, USR_RES)
497 #define TEST_xp_OP_xx(RESTYPE, CHECKFN, SRC1TYPE, SRC2TYPE, FUNC, SRC1, SRC2, \
498 RES, PRED_RES, USR_RES) \
501 SRC1TYPE src1 = SRC1; \
502 SRC2TYPE src2 = SRC2; \
503 uint8_t pred_result; \
504 uint32_t usr_result; \
505 result = FUNC(src1, src2, &pred_result, &usr_result); \
506 CHECKFN(result, RES); \
507 check32(pred_result, PRED_RES); \
508 check32(usr_result, USR_RES); \
511 #define TEST_Rp_OP_RR(FUNC, SRC1, SRC2, RES, PRED_RES, USR_RES) \
512 TEST_xp_OP_xx(uint32_t, check32, uint32_t, uint32_t, FUNC, SRC1, SRC2, \
513 RES, PRED_RES, USR_RES)
515 #define TEST_x_OP_xI(RESTYPE, CHECKFN, SRC1TYPE, \
516 FUNC, SRC1, SRC2, RES, USR_RES) \
519 SRC1TYPE src1 = SRC1; \
520 uint32_t src2 = SRC2; \
521 uint32_t usr_result; \
522 result = FUNC(src1, src2, &usr_result); \
523 CHECKFN(result, RES); \
524 check32(usr_result, USR_RES); \
527 #define TEST_R_OP_RI(FUNC, SRC1, SRC2, RES, USR_RES) \
528 TEST_x_OP_xI(uint32_t, check32, uint32_t, \
529 FUNC, SRC1, SRC2, RES, USR_RES)
531 #define TEST_R_OP_PI(FUNC, SRC1, SRC2, RES, USR_RES) \
532 TEST_x_OP_xI(uint32_t, check64, uint64_t, \
533 FUNC, SRC1, SRC2, RES, USR_RES)
535 #define TEST_Xx_OP_xx(RESTYPE, CHECKFN, SRC1TYPE, SRC2TYPE, \
536 FUNC, RESIN, SRC1, SRC2, RES, USR_RES) \
538 RESTYPE result = RESIN; \
539 SRC1TYPE src1 = SRC1; \
540 SRC2TYPE src2 = SRC2; \
541 uint32_t usr_result; \
542 result = FUNC(result, src1, src2, &usr_result); \
543 CHECKFN(result, RES); \
544 check32(usr_result, USR_RES); \
547 #define TEST_XR_OP_RR(FUNC, RESIN, SRC1, SRC2, RES, USR_RES) \
548 TEST_Xx_OP_xx(uint32_t, check32, uint32_t, uint32_t, \
549 FUNC, RESIN, SRC1, SRC2, RES, USR_RES)
551 #define TEST_XP_OP_PP(FUNC, RESIN, SRC1, SRC2, RES, USR_RES) \
552 TEST_Xx_OP_xx(uint64_t, check64, uint64_t, uint64_t, \
553 FUNC, RESIN, SRC1, SRC2, RES, USR_RES)
555 #define TEST_XP_OP_RR(FUNC, RESIN, SRC1, SRC2, RES, USR_RES) \
556 TEST_Xx_OP_xx(uint64_t, check64, uint32_t, uint32_t, \
557 FUNC, RESIN, SRC1, SRC2, RES, USR_RES)
559 #define TEST_Xxp_OP_xx(RESTYPE, CHECKFN, SRC1TYPE, SRC2TYPE, \
560 FUNC, RESIN, SRC1, SRC2, RES, PRED_RES, USR_RES) \
562 RESTYPE result = RESIN; \
563 SRC1TYPE src1 = SRC1; \
564 SRC2TYPE src2 = SRC2; \
566 uint32_t usr_result; \
567 result = FUNC(result, src1, src2, &pred_res, &usr_result); \
568 CHECKFN(result, RES); \
569 check32(usr_result, USR_RES); \
572 #define TEST_XPp_OP_PP(FUNC, RESIN, SRC1, SRC2, RES, PRED_RES, USR_RES) \
573 TEST_Xxp_OP_xx(uint64_t, check64, uint64_t, uint64_t, FUNC, RESIN, SRC1, SRC2, \
574 RES, PRED_RES, USR_RES)
576 #define TEST_Xx_OP_xxp(RESTYPE, CHECKFN, SRC1TYPE, SRC2TYPE, \
577 FUNC, RESIN, SRC1, SRC2, PRED, RES, USR_RES) \
579 RESTYPE result = RESIN; \
580 SRC1TYPE src1 = SRC1; \
581 SRC2TYPE src2 = SRC2; \
582 uint8_t pred = PRED; \
583 uint32_t usr_result; \
584 result = FUNC(result, src1, src2, pred, &usr_result); \
585 CHECKFN(result, RES); \
586 check32(usr_result, USR_RES); \
589 #define TEST_XR_OP_RRp(FUNC, RESIN, SRC1, SRC2, PRED, RES, USR_RES) \
590 TEST_Xx_OP_xxp(uint32_t, check32, uint32_t, uint32_t, \
591 FUNC, RESIN, SRC1, SRC2, PRED, RES, USR_RES)
593 #define TEST_CMP_xx(SRC1TYPE, SRC2TYPE, \
594 FUNC, SRC1, SRC2, RES, USR_RES) \
597 SRC1TYPE src1 = SRC1; \
598 SRC2TYPE src2 = SRC2; \
599 uint32_t usr_result; \
600 result = FUNC(src1, src2, &usr_result); \
601 check32(result, RES); \
602 check32(usr_result, USR_RES); \
605 #define TEST_CMP_RR(FUNC, SRC1, SRC2, RES, USR_RES) \
606 TEST_CMP_xx(uint32_t, uint32_t, FUNC, SRC1, SRC2, RES, USR_RES)
608 #define TEST_CMP_PP(FUNC, SRC1, SRC2, RES, USR_RES) \
609 TEST_CMP_xx(uint64_t, uint64_t, FUNC, SRC1, SRC2, RES, USR_RES)
613 TEST_R_OP_R(satub
, 0, 0, USR_CLEAR
);
614 TEST_R_OP_R(satub
, 0xff, 0xff, USR_CLEAR
);
615 TEST_R_OP_R(satub
, 0xfff, 0xff, USR_OVF
);
616 TEST_R_OP_R(satub
, -1, 0, USR_OVF
);
618 TEST_P_OP_PP(vaddubs
, 0xfeLL
, 0x01LL
, 0xffLL
, USR_CLEAR
);
619 TEST_P_OP_PP(vaddubs
, 0xffLL
, 0xffLL
, 0xffLL
, USR_OVF
);
621 TEST_P_OP_PP(vadduhs
, 0xfffeLL
, 0x1LL
, 0xffffLL
, USR_CLEAR
);
622 TEST_P_OP_PP(vadduhs
, 0xffffLL
, 0x1LL
, 0xffffLL
, USR_OVF
);
624 TEST_P_OP_PP(vsububs
, 0x0807060504030201LL
, 0x0101010101010101LL
,
625 0x0706050403020100LL
, USR_CLEAR
);
626 TEST_P_OP_PP(vsububs
, 0x0807060504030201LL
, 0x0202020202020202LL
,
627 0x0605040302010000LL
, USR_OVF
);
629 TEST_P_OP_PP(vsubuhs
, 0x0004000300020001LL
, 0x0001000100010001LL
,
630 0x0003000200010000LL
, USR_CLEAR
);
631 TEST_P_OP_PP(vsubuhs
, 0x0004000300020001LL
, 0x0002000200020002LL
,
632 0x0002000100000000LL
, USR_OVF
);
634 TEST_R_OP_PP(vaddhubs
, 0x0004000300020001LL
, 0x0001000100010001LL
,
635 0x05040302, USR_CLEAR
);
636 TEST_R_OP_PP(vaddhubs
, 0x7fff000300020001LL
, 0x0002000200020002LL
,
637 0xff050403, USR_OVF
);
639 TEST_R_OP_P(vsathub
, 0x0001000300020001LL
, 0x01030201, USR_CLEAR
);
640 TEST_R_OP_P(vsathub
, 0x010000700080ffffLL
, 0xff708000, USR_OVF
);
642 TEST_R_OP_P(vsatwuh
, 0x0000ffff00000001LL
, 0xffff0001, USR_CLEAR
);
643 TEST_R_OP_P(vsatwuh
, 0x800000000000ffffLL
, 0x0000ffff, USR_OVF
);
645 TEST_P_OP_P(vsatwuh_nopack
, 0x0000ffff00000001LL
, 0x0000ffff00000001LL
,
647 TEST_P_OP_P(vsatwuh_nopack
, 0x800000000000ffffLL
, 0x000000000000ffffLL
,
650 TEST_R_OP_R(svsathub
, 0x00020001, 0x0201, USR_CLEAR
);
651 TEST_R_OP_R(svsathub
, 0x0080ffff, 0x8000, USR_OVF
);
653 TEST_R_OP_PI(asrhub_sat
, 0x004f003f002f001fLL
, 3, 0x09070503,
655 TEST_R_OP_PI(asrhub_sat
, 0x004fffff8fff001fLL
, 3, 0x09000003,
658 TEST_R_OP_PI(asrhub_rnd_sat
, 0x004f003f002f001fLL
, 2, 0x0a080604,
660 TEST_R_OP_PI(asrhub_rnd_sat
, 0x004fffff8fff001fLL
, 2, 0x0a000004,
663 TEST_R_OP_RR(addsat
, 1, 2, 3,
665 TEST_R_OP_RR(addsat
, 0x7fffffff, 0x00000010, 0x7fffffff,
667 TEST_R_OP_RR(addsat
, 0x80000000, 0x80000006, 0x80000000,
670 TEST_P_OP_PP(addpsat
, 1LL, 2LL, 3LL, USR_CLEAR
);
671 /* overflow to max positive */
672 TEST_P_OP_PP(addpsat
, 0x7ffffffffffffff0LL
, 0x0000000000000010LL
,
673 0x7fffffffffffffffLL
, USR_OVF
);
674 /* overflow to min negative */
675 TEST_P_OP_PP(addpsat
, 0x8000000000000003LL
, 0x8000000000000006LL
,
676 0x8000000000000000LL
, USR_OVF
);
678 TEST_XR_OP_RR(mpy_acc_sat_hh_s0
, 0x7fffffff, 0xffff0000, 0x11110000,
679 0x7fffeeee, USR_CLEAR
);
680 TEST_XR_OP_RR(mpy_acc_sat_hh_s0
, 0x7fffffff, 0x7fff0000, 0x7fff0000,
681 0x7fffffff, USR_OVF
);
683 TEST_R_OP_RR(mpy_sat_hh_s1
, 0xffff0000, 0x11110000, 0xffffddde,
685 TEST_R_OP_RR(mpy_sat_hh_s1
, 0x7fff0000, 0x7fff0000, 0x7ffe0002,
687 TEST_R_OP_RR(mpy_sat_hh_s1
, 0x80000000, 0x80000000, 0x7fffffff,
690 TEST_R_OP_RR(mpy_sat_rnd_hh_s1
, 0xffff0000, 0x11110000, 0x00005dde,
692 TEST_R_OP_RR(mpy_sat_rnd_hh_s1
, 0x7fff0000, 0x7fff0000, 0x7ffe8002,
694 TEST_R_OP_RR(mpy_sat_rnd_hh_s1
, 0x80000000, 0x80000000, 0x7fffffff,
697 TEST_R_OP_RR(mpy_up_s1_sat
, 0xffff0000, 0x11110000, 0xffffddde,
699 TEST_R_OP_RR(mpy_up_s1_sat
, 0x7fff0000, 0x7fff0000, 0x7ffe0002,
701 TEST_R_OP_RR(mpy_up_s1_sat
, 0x80000000, 0x80000000, 0x7fffffff,
704 TEST_P_OP_RR(vmpy2s_s1
, 0x7fff0000, 0x7fff0000, 0x7ffe000200000000LL
,
706 TEST_P_OP_RR(vmpy2s_s1
, 0x80000000, 0x80000000, 0x7fffffff00000000LL
,
709 TEST_P_OP_RR(vmpy2su_s1
, 0x7fff0000, 0x7fff0000, 0x7ffe000200000000LL
,
711 TEST_P_OP_RR(vmpy2su_s1
, 0xffffbd97, 0xffffffff, 0xfffe000280000000LL
,
714 TEST_R_OP_RR(vmpy2s_s1pack
, 0x7fff0000, 0x7fff0000, 0x7ffe0000,
716 TEST_R_OP_RR(vmpy2s_s1pack
, 0x80008000, 0x80008000, 0x7fff7fff,
719 TEST_P_OP_PP(vmpy2es_s1
, 0x7fff7fff7fff7fffLL
, 0x1fff1fff1fff1fffLL
,
720 0x1ffec0021ffec002LL
, USR_CLEAR
);
721 TEST_P_OP_PP(vmpy2es_s1
, 0x8000800080008000LL
, 0x8000800080008000LL
,
722 0x7fffffff7fffffffLL
, USR_OVF
);
724 TEST_R_OP_PP(vdmpyrs_s1
, 0x7fff7fff7fff7fffLL
, 0x1fff1fff1fff1fffLL
,
725 0x3ffe3ffe, USR_CLEAR
);
726 TEST_R_OP_PP(vdmpyrs_s1
, 0x8000800080008000LL
, 0x8000800080008000LL
,
727 0x7fff7fffLL
, USR_OVF
);
729 TEST_XP_OP_PP(vdmacs_s0
, 0x0fffffffULL
, 0x00ff00ff00ff00ffLL
,
730 0x00ff00ff00ff00ffLL
, 0x0001fc021001fc01LL
, USR_CLEAR
);
731 TEST_XP_OP_PP(vdmacs_s0
, 0x01111111ULL
, 0x8000800080001000LL
,
732 0x8000800080008000LL
, 0x7fffffff39111111LL
, USR_OVF
);
734 TEST_R_OP_RR(cmpyrs_s0
, 0x7fff0000, 0x7fff0000, 0x0000c001,
736 TEST_R_OP_RR(cmpyrs_s0
, 0x80008000, 0x80008000, 0x7fff0000,
739 TEST_XP_OP_RR(cmacs_s0
, 0x0fffffff, 0x7fff0000, 0x7fff0000,
740 0x00000000d000fffeLL
, USR_CLEAR
);
741 TEST_XP_OP_RR(cmacs_s0
, 0x0fff1111, 0x80008000, 0x80008000,
742 0x7fffffff0fff1111LL
, USR_OVF
);
744 TEST_XP_OP_RR(cnacs_s0
, 0x000000108fffffffULL
, 0x7fff0000, 0x7fff0000,
745 0x00000010cfff0000ULL
, USR_CLEAR
);
746 TEST_XP_OP_RR(cnacs_s0
, 0x000000108ff1111fULL
, 0x00002001, 0x00007ffd,
747 0x0000001080000000ULL
, USR_OVF
);
749 TEST_P_OP_PP(vrcmpys_s1_h
, 0x00ff00ff00ff00ffLL
, 0x00ff00ff00ff00ffLL
,
750 0x0003f8040003f804LL
, USR_CLEAR
);
751 TEST_P_OP_PP(vrcmpys_s1_h
, 0x8000800080008000LL
, 0x8000800080008000LL
,
752 0x7fffffff7fffffffLL
, USR_OVF
);
754 TEST_XP_OP_PP(mmacls_s0
, 0x6fffffff, 0x00ff00ff00ff00ffLL
,
755 0x00ff00ff00ff00ffLL
, 0x0000fe017000fe00LL
, USR_CLEAR
);
756 TEST_XP_OP_PP(mmacls_s0
, 0x6f1111ff, 0x8000800080008000LL
,
757 0x1000100080008000LL
, 0xf80008007fffffffLL
, USR_OVF
);
759 TEST_R_OP_RR(hmmpyl_rs1
, 0x7fff0000, 0x7fff0001, 0x0000fffe,
761 TEST_R_OP_RR(hmmpyl_rs1
, 0x80000000, 0x80008000, 0x7fffffff,
764 TEST_XP_OP_PP(mmaculs_s0
, 0x000000007fffffffULL
, 0xffff800080008000LL
,
765 0xffff800080008000LL
, 0xffffc00040003fffLL
, USR_CLEAR
);
766 TEST_XP_OP_PP(mmaculs_s0
, 0x000011107fffffffULL
, 0x00ff00ff00ff00ffLL
,
767 0x00ff00ff001100ffLL
, 0x00010f117fffffffLL
, USR_OVF
);
769 TEST_R_OP_PR(cmpyi_wh
, 0x7fff000000000000LL
, 0x7fff0001, 0x0000fffe,
771 TEST_R_OP_PR(cmpyi_wh
, 0x8000000000000000LL
, 0x80008000, 0x7fffffff,
774 TEST_P_OP_PP(vcmpy_s0_sat_i
, 0x00ff00ff00ff00ffLL
, 0x00ff00ff00ff00ffLL
,
775 0x0001fc020001fc02LL
, USR_CLEAR
);
776 TEST_P_OP_PP(vcmpy_s0_sat_i
, 0x8000800080008000LL
, 0x8000800080008000LL
,
777 0x7fffffff7fffffffLL
, USR_OVF
);
779 TEST_P_OP_PR(vcrotate
, 0x8000000000000000LL
, 0x00000002,
780 0x8000000000000000LL
, USR_CLEAR
);
781 TEST_P_OP_PR(vcrotate
, 0x7fff80007fff8000LL
, 0x00000001,
782 0x7fff80007fff7fffLL
, USR_OVF
);
784 TEST_P_OP_PR(vcnegh
, 0x8000000000000000LL
, 0x00000002,
785 0x8000000000000000LL
, USR_CLEAR
);
786 TEST_P_OP_PR(vcnegh
, 0x7fff80007fff8000LL
, 0x00000001,
787 0x7fff80007fff7fffLL
, USR_OVF
);
790 TEST_R_OP_PP(wcmpyrw
, 0x8765432101234567LL
, 0x00000002ffffffffLL
,
791 0x00000001, USR_CLEAR
);
792 TEST_R_OP_PP(wcmpyrw
, 0x800000007fffffffLL
, 0x000000ff7fffffffLL
,
793 0x7fffffff, USR_OVF
);
794 TEST_R_OP_PP(wcmpyrw
, 0x7fffffff80000000LL
, 0x7fffffff000000ffLL
,
795 0x80000000, USR_OVF
);
797 printf("Audio instructions skipped\n");
800 TEST_R_OP_RR(addh_l16_sat_ll
, 0x0000ffff, 0x00000002, 0x00000001,
802 TEST_R_OP_RR(addh_l16_sat_ll
, 0x00007fff, 0x00000005, 0x00007fff,
804 TEST_R_OP_RR(addh_l16_sat_ll
, 0x00008000, 0x00008000, 0xffff8000,
807 TEST_P_OP_P(vconj
, 0x0000ffff00000001LL
, 0x0000ffff00000001LL
, USR_CLEAR
);
808 TEST_P_OP_P(vconj
, 0x800000000000ffffLL
, 0x7fff00000000ffffLL
, USR_OVF
);
810 TEST_P_OP_PP(vxaddsubw
, 0x8765432101234567LL
, 0x00000002ffffffffLL
,
811 0x8765432201234569LL
, USR_CLEAR
);
812 TEST_P_OP_PP(vxaddsubw
, 0x7fffffff7fffffffLL
, 0xffffffffffffffffLL
,
813 0x7fffffff7ffffffeLL
, USR_OVF
);
814 TEST_P_OP_PP(vxaddsubw
, 0x800000000fffffffLL
, 0x0000000a00000008LL
,
815 0x8000000010000009LL
, USR_OVF
);
817 TEST_P_OP_P(vabshsat
, 0x0001000afffff800LL
, 0x0001000a00010800LL
,
819 TEST_P_OP_P(vabshsat
, 0x8000000b000c000aLL
, 0x7fff000b000c000aLL
,
822 TEST_P_OP_PP(vnavgwr
, 0x8765432101234567LL
, 0x00000002ffffffffLL
,
823 0xc3b2a1900091a2b4LL
, USR_CLEAR
);
824 TEST_P_OP_PP(vnavgwr
, 0x7fffffff8000000aLL
, 0x80000000ffffffffLL
,
825 0x7fffffffc0000006LL
, USR_OVF
);
827 TEST_R_OP_RI(round_ri_sat
, 0x0000ffff, 2, 0x00004000, USR_CLEAR
);
828 TEST_R_OP_RI(round_ri_sat
, 0x7fffffff, 2, 0x1fffffff, USR_OVF
);
830 TEST_R_OP_RR(asr_r_r_sat
, 0x0000ffff, 0x02, 0x00003fff, USR_CLEAR
);
831 TEST_R_OP_RR(asr_r_r_sat
, 0x80000000, 0x01, 0xc0000000, USR_CLEAR
);
832 TEST_R_OP_RR(asr_r_r_sat
, 0xffffffff, 0x01, 0xffffffff, USR_CLEAR
);
833 TEST_R_OP_RR(asr_r_r_sat
, 0x00ffffff, 0xf5, 0x7fffffff, USR_OVF
);
834 TEST_R_OP_RR(asr_r_r_sat
, 0x80000000, 0xf5, 0x80000000, USR_OVF
);
835 TEST_R_OP_RR(asr_r_r_sat
, 0x7fff0000, 0x42, 0x7fffffff, USR_OVF
);
836 TEST_R_OP_RR(asr_r_r_sat
, 0xff000000, 0x42, 0x80000000, USR_OVF
);
837 TEST_R_OP_RR(asr_r_r_sat
, 4096, 32, 0x00000000, USR_CLEAR
);
838 TEST_R_OP_RR(asr_r_r_sat
, 4096, -32, 0x7fffffff, USR_OVF
);
839 TEST_R_OP_RR(asr_r_r_sat
, -4096, 32, 0xffffffff, USR_CLEAR
);
840 TEST_R_OP_RR(asr_r_r_sat
, -4096, -32, 0x80000000, USR_OVF
);
841 TEST_R_OP_RR(asr_r_r_sat
, 0, -32, 0x00000000, USR_CLEAR
);
842 TEST_R_OP_RR(asr_r_r_sat
, 1, -32, 0x7fffffff, USR_OVF
);
844 TEST_R_OP_RR(asl_r_r_sat
, 0x00000000, 0x40, 0x00000000, USR_CLEAR
);
845 TEST_R_OP_RR(asl_r_r_sat
, 0x80000000, 0xff, 0xc0000000, USR_CLEAR
);
846 TEST_R_OP_RR(asl_r_r_sat
, 0xffffffff, 0xff, 0xffffffff, USR_CLEAR
);
847 TEST_R_OP_RR(asl_r_r_sat
, 0x00ffffff, 0x0b, 0x7fffffff, USR_OVF
);
848 TEST_R_OP_RR(asl_r_r_sat
, 0x80000000, 0x0b, 0x80000000, USR_OVF
);
849 TEST_R_OP_RR(asl_r_r_sat
, 0x7fff0000, 0xbe, 0x7fffffff, USR_OVF
);
850 TEST_R_OP_RR(asl_r_r_sat
, 0xff000000, 0xbe, 0x80000000, USR_OVF
);
851 TEST_R_OP_RR(asl_r_r_sat
, 4096, 32, 0x7fffffff, USR_OVF
);
852 TEST_R_OP_RR(asl_r_r_sat
, 4096, -32, 0x00000000, USR_CLEAR
);
853 TEST_R_OP_RR(asl_r_r_sat
, -4096, 32, 0x80000000, USR_OVF
);
854 TEST_R_OP_RR(asl_r_r_sat
, -4096, -32, 0xffffffff, USR_CLEAR
);
855 TEST_R_OP_RR(asl_r_r_sat
, 0, 32, 0x00000000, USR_CLEAR
);
856 TEST_R_OP_RR(asl_r_r_sat
, 1, 32, 0x7fffffff, USR_OVF
);
858 TEST_XPp_OP_PP(ACS
, 0x0004000300020001ULL
, 0x0001000200030004ULL
,
859 0x0000000000000000ULL
, 0x0004000300030004ULL
, 0xf0,
861 TEST_XPp_OP_PP(ACS
, 0x0004000300020001ULL
, 0x0001000200030004ULL
,
862 0x000affff000d0000ULL
, 0x000e0003000f0004ULL
, 0xcc,
864 TEST_XPp_OP_PP(ACS
, 0x00047fff00020001ULL
, 0x00017fff00030004ULL
,
865 0x000a0fff000d0000ULL
, 0x000e7fff000f0004ULL
, 0xfc,
867 TEST_XPp_OP_PP(ACS
, 0x00047fff00020001ULL
, 0x00017fff00030004ULL
,
868 0x000a0fff000d0000ULL
, 0x000e7fff000f0004ULL
, 0xf0,
872 TEST_R_OP_RR(sfmin
, SF_one
, SF_small_neg
, SF_small_neg
, USR_CLEAR
);
873 TEST_R_OP_RR(sfmin
, SF_one
, SF_SNaN
, SF_one
, USR_FPINVF
);
874 TEST_R_OP_RR(sfmin
, SF_SNaN
, SF_one
, SF_one
, USR_FPINVF
);
875 TEST_R_OP_RR(sfmin
, SF_one
, SF_QNaN
, SF_one
, USR_CLEAR
);
876 TEST_R_OP_RR(sfmin
, SF_QNaN
, SF_one
, SF_one
, USR_CLEAR
);
877 TEST_R_OP_RR(sfmin
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
878 TEST_R_OP_RR(sfmin
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
879 TEST_R_OP_RR(sfmin
, SF_zero
, SF_zero_neg
, SF_zero_neg
, USR_CLEAR
);
880 TEST_R_OP_RR(sfmin
, SF_zero_neg
, SF_zero
, SF_zero_neg
, USR_CLEAR
);
882 TEST_R_OP_RR(sfmax
, SF_one
, SF_small_neg
, SF_one
, USR_CLEAR
);
883 TEST_R_OP_RR(sfmax
, SF_one
, SF_SNaN
, SF_one
, USR_FPINVF
);
884 TEST_R_OP_RR(sfmax
, SF_SNaN
, SF_one
, SF_one
, USR_FPINVF
);
885 TEST_R_OP_RR(sfmax
, SF_one
, SF_QNaN
, SF_one
, USR_CLEAR
);
886 TEST_R_OP_RR(sfmax
, SF_QNaN
, SF_one
, SF_one
, USR_CLEAR
);
887 TEST_R_OP_RR(sfmax
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
888 TEST_R_OP_RR(sfmax
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
889 TEST_R_OP_RR(sfmax
, SF_zero
, SF_zero_neg
, SF_zero
, USR_CLEAR
);
890 TEST_R_OP_RR(sfmax
, SF_zero_neg
, SF_zero
, SF_zero
, USR_CLEAR
);
892 TEST_R_OP_RR(sfadd
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
893 TEST_R_OP_RR(sfadd
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
894 TEST_R_OP_RR(sfadd
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
895 TEST_R_OP_RR(sfadd
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
897 TEST_R_OP_RR(sfsub
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
898 TEST_R_OP_RR(sfsub
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
899 TEST_R_OP_RR(sfsub
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
900 TEST_R_OP_RR(sfsub
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
902 TEST_R_OP_RR(sfmpy
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
903 TEST_R_OP_RR(sfmpy
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
904 TEST_R_OP_RR(sfmpy
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
905 TEST_R_OP_RR(sfmpy
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
907 TEST_XR_OP_RR(sffma
, SF_one
, SF_one
, SF_one
, SF_two
, USR_CLEAR
);
908 TEST_XR_OP_RR(sffma
, SF_zero
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
909 TEST_XR_OP_RR(sffma
, SF_zero
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
910 TEST_XR_OP_RR(sffma
, SF_zero
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
911 TEST_XR_OP_RR(sffma
, SF_zero
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
913 TEST_XR_OP_RR(sffms
, SF_one
, SF_one
, SF_one
, SF_zero
, USR_CLEAR
);
914 TEST_XR_OP_RR(sffms
, SF_zero
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
915 TEST_XR_OP_RR(sffms
, SF_zero
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
916 TEST_XR_OP_RR(sffms
, SF_zero
, SF_QNaN
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
917 TEST_XR_OP_RR(sffms
, SF_zero
, SF_SNaN
, SF_QNaN
, SF_HEX_NaN
, USR_FPINVF
);
919 TEST_CMP_RR(sfcmpuo
, SF_one
, SF_large_pos
, 0x00, USR_CLEAR
);
920 TEST_CMP_RR(sfcmpuo
, SF_INF
, SF_large_pos
, 0x00, USR_CLEAR
);
921 TEST_CMP_RR(sfcmpuo
, SF_QNaN
, SF_large_pos
, 0xff, USR_CLEAR
);
922 TEST_CMP_RR(sfcmpuo
, SF_QNaN_neg
, SF_large_pos
, 0xff, USR_CLEAR
);
923 TEST_CMP_RR(sfcmpuo
, SF_SNaN
, SF_large_pos
, 0xff, USR_FPINVF
);
924 TEST_CMP_RR(sfcmpuo
, SF_SNaN_neg
, SF_large_pos
, 0xff, USR_FPINVF
);
925 TEST_CMP_RR(sfcmpuo
, SF_QNaN
, SF_QNaN
, 0xff, USR_CLEAR
);
926 TEST_CMP_RR(sfcmpuo
, SF_QNaN
, SF_SNaN
, 0xff, USR_FPINVF
);
928 TEST_CMP_RR(sfcmpeq
, SF_one
, SF_QNaN
, 0x00, USR_CLEAR
);
929 TEST_CMP_RR(sfcmpeq
, SF_one
, SF_SNaN
, 0x00, USR_FPINVF
);
930 TEST_CMP_RR(sfcmpgt
, SF_one
, SF_QNaN
, 0x00, USR_CLEAR
);
931 TEST_CMP_RR(sfcmpgt
, SF_one
, SF_SNaN
, 0x00, USR_FPINVF
);
932 TEST_CMP_RR(sfcmpge
, SF_one
, SF_QNaN
, 0x00, USR_CLEAR
);
933 TEST_CMP_RR(sfcmpge
, SF_one
, SF_SNaN
, 0x00, USR_FPINVF
);
935 TEST_P_OP_PP(dfadd
, DF_any
, DF_QNaN
, DF_HEX_NaN
, USR_CLEAR
);
936 TEST_P_OP_PP(dfadd
, DF_any
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
937 TEST_P_OP_PP(dfadd
, DF_QNaN
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
938 TEST_P_OP_PP(dfadd
, DF_SNaN
, DF_QNaN
, DF_HEX_NaN
, USR_FPINVF
);
940 TEST_P_OP_PP(dfsub
, DF_any
, DF_QNaN
, DF_HEX_NaN
, USR_CLEAR
);
941 TEST_P_OP_PP(dfsub
, DF_any
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
942 TEST_P_OP_PP(dfsub
, DF_QNaN
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
943 TEST_P_OP_PP(dfsub
, DF_SNaN
, DF_QNaN
, DF_HEX_NaN
, USR_FPINVF
);
946 TEST_P_OP_PP(dfmin
, DF_any
, DF_small_neg
, DF_small_neg
, USR_CLEAR
);
947 TEST_P_OP_PP(dfmin
, DF_any
, DF_SNaN
, DF_any
, USR_FPINVF
);
948 TEST_P_OP_PP(dfmin
, DF_SNaN
, DF_any
, DF_any
, USR_FPINVF
);
949 TEST_P_OP_PP(dfmin
, DF_any
, DF_QNaN
, DF_any
, USR_CLEAR
);
950 TEST_P_OP_PP(dfmin
, DF_QNaN
, DF_any
, DF_any
, USR_CLEAR
);
951 TEST_P_OP_PP(dfmin
, DF_SNaN
, DF_QNaN
, DF_HEX_NaN
, USR_FPINVF
);
952 TEST_P_OP_PP(dfmin
, DF_QNaN
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
953 TEST_P_OP_PP(dfmin
, DF_zero
, DF_zero_neg
, DF_zero_neg
, USR_CLEAR
);
954 TEST_P_OP_PP(dfmin
, DF_zero_neg
, DF_zero
, DF_zero_neg
, USR_CLEAR
);
956 TEST_P_OP_PP(dfmax
, DF_any
, DF_small_neg
, DF_any
, USR_CLEAR
);
957 TEST_P_OP_PP(dfmax
, DF_any
, DF_SNaN
, DF_any
, USR_FPINVF
);
958 TEST_P_OP_PP(dfmax
, DF_SNaN
, DF_any
, DF_any
, USR_FPINVF
);
959 TEST_P_OP_PP(dfmax
, DF_any
, DF_QNaN
, DF_any
, USR_CLEAR
);
960 TEST_P_OP_PP(dfmax
, DF_QNaN
, DF_any
, DF_any
, USR_CLEAR
);
961 TEST_P_OP_PP(dfmax
, DF_SNaN
, DF_QNaN
, DF_HEX_NaN
, USR_FPINVF
);
962 TEST_P_OP_PP(dfmax
, DF_QNaN
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
963 TEST_P_OP_PP(dfmax
, DF_zero
, DF_zero_neg
, DF_zero
, USR_CLEAR
);
964 TEST_P_OP_PP(dfmax
, DF_zero_neg
, DF_zero
, DF_zero
, USR_CLEAR
);
966 TEST_XP_OP_PP(dfmpyhh
, DF_one
, DF_one
, DF_one
, DF_one_hh
, USR_CLEAR
);
967 TEST_XP_OP_PP(dfmpyhh
, DF_zero
, DF_any
, DF_QNaN
, DF_HEX_NaN
, USR_CLEAR
);
968 TEST_XP_OP_PP(dfmpyhh
, DF_zero
, DF_any
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
969 TEST_XP_OP_PP(dfmpyhh
, DF_zero
, DF_QNaN
, DF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
970 TEST_XP_OP_PP(dfmpyhh
, DF_zero
, DF_SNaN
, DF_QNaN
, DF_HEX_NaN
, USR_FPINVF
);
972 printf("v67 instructions skipped\n");
975 TEST_CMP_PP(dfcmpuo
, DF_small_neg
, DF_any
, 0x00, USR_CLEAR
);
976 TEST_CMP_PP(dfcmpuo
, DF_large_pos
, DF_any
, 0x00, USR_CLEAR
);
977 TEST_CMP_PP(dfcmpuo
, DF_QNaN
, DF_any
, 0xff, USR_CLEAR
);
978 TEST_CMP_PP(dfcmpuo
, DF_QNaN_neg
, DF_any
, 0xff, USR_CLEAR
);
979 TEST_CMP_PP(dfcmpuo
, DF_SNaN
, DF_any
, 0xff, USR_FPINVF
);
980 TEST_CMP_PP(dfcmpuo
, DF_SNaN_neg
, DF_any
, 0xff, USR_FPINVF
);
981 TEST_CMP_PP(dfcmpuo
, DF_QNaN
, DF_QNaN
, 0xff, USR_CLEAR
);
982 TEST_CMP_PP(dfcmpuo
, DF_QNaN
, DF_SNaN
, 0xff, USR_FPINVF
);
984 TEST_CMP_PP(dfcmpeq
, DF_any
, DF_QNaN
, 0x00, USR_CLEAR
);
985 TEST_CMP_PP(dfcmpeq
, DF_any
, DF_SNaN
, 0x00, USR_FPINVF
);
986 TEST_CMP_PP(dfcmpgt
, DF_any
, DF_QNaN
, 0x00, USR_CLEAR
);
987 TEST_CMP_PP(dfcmpgt
, DF_any
, DF_SNaN
, 0x00, USR_FPINVF
);
988 TEST_CMP_PP(dfcmpge
, DF_any
, DF_QNaN
, 0x00, USR_CLEAR
);
989 TEST_CMP_PP(dfcmpge
, DF_any
, DF_SNaN
, 0x00, USR_FPINVF
);
991 TEST_P_OP_R(conv_sf2df
, SF_QNaN
, DF_HEX_NaN
, USR_CLEAR
);
992 TEST_P_OP_R(conv_sf2df
, SF_SNaN
, DF_HEX_NaN
, USR_FPINVF
);
993 TEST_R_OP_R(conv_sf2uw
, SF_QNaN
, 0xffffffff, USR_FPINVF
);
994 TEST_R_OP_R(conv_sf2uw
, SF_SNaN
, 0xffffffff, USR_FPINVF
);
995 TEST_R_OP_R(conv_sf2w
, SF_QNaN
, 0xffffffff, USR_FPINVF
);
996 TEST_R_OP_R(conv_sf2w
, SF_SNaN
, 0xffffffff, USR_FPINVF
);
997 TEST_P_OP_R(conv_sf2ud
, SF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
998 TEST_P_OP_R(conv_sf2ud
, SF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
999 TEST_P_OP_R(conv_sf2d
, SF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1000 TEST_P_OP_R(conv_sf2d
, SF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1001 TEST_R_OP_R(conv_sf2uw_chop
, SF_QNaN
, 0xffffffff, USR_FPINVF
);
1002 TEST_R_OP_R(conv_sf2uw_chop
, SF_SNaN
, 0xffffffff, USR_FPINVF
);
1003 TEST_R_OP_R(conv_sf2w_chop
, SF_QNaN
, 0xffffffff, USR_FPINVF
);
1004 TEST_R_OP_R(conv_sf2w_chop
, SF_SNaN
, 0xffffffff, USR_FPINVF
);
1005 TEST_P_OP_R(conv_sf2ud_chop
, SF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1006 TEST_P_OP_R(conv_sf2ud_chop
, SF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1007 TEST_P_OP_R(conv_sf2d_chop
, SF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1008 TEST_P_OP_R(conv_sf2d_chop
, SF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1010 TEST_R_OP_P(conv_df2sf
, DF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
1011 TEST_R_OP_P(conv_df2sf
, DF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
1012 TEST_R_OP_P(conv_df2uw
, DF_QNaN
, 0xffffffff, USR_FPINVF
);
1013 TEST_R_OP_P(conv_df2uw
, DF_SNaN
, 0xffffffff, USR_FPINVF
);
1014 TEST_R_OP_P(conv_df2w
, DF_QNaN
, 0xffffffff, USR_FPINVF
);
1015 TEST_R_OP_P(conv_df2w
, DF_SNaN
, 0xffffffff, USR_FPINVF
);
1016 TEST_P_OP_P(conv_df2ud
, DF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1017 TEST_P_OP_P(conv_df2ud
, DF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1018 TEST_P_OP_P(conv_df2d
, DF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1019 TEST_P_OP_P(conv_df2d
, DF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1020 TEST_R_OP_P(conv_df2uw_chop
, DF_QNaN
, 0xffffffff, USR_FPINVF
);
1021 TEST_R_OP_P(conv_df2uw_chop
, DF_SNaN
, 0xffffffff, USR_FPINVF
);
1023 /* Test for typo in HELPER(conv_df2uw_chop) */
1024 TEST_R_OP_P(conv_df2uw_chop
, 0xffffff7f00000001ULL
, 0xffffffff, USR_FPINVF
);
1026 TEST_R_OP_P(conv_df2w_chop
, DF_QNaN
, 0xffffffff, USR_FPINVF
);
1027 TEST_R_OP_P(conv_df2w_chop
, DF_SNaN
, 0xffffffff, USR_FPINVF
);
1028 TEST_P_OP_P(conv_df2ud_chop
, DF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1029 TEST_P_OP_P(conv_df2ud_chop
, DF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1030 TEST_P_OP_P(conv_df2d_chop
, DF_QNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1031 TEST_P_OP_P(conv_df2d_chop
, DF_SNaN
, 0xffffffffffffffffULL
, USR_FPINVF
);
1033 TEST_R_OP_R(conv_uw2sf
, 0x00000001, SF_one
, USR_CLEAR
);
1034 TEST_R_OP_R(conv_uw2sf
, 0x010020a5, 0x4b801052, USR_FPINPF
);
1035 TEST_R_OP_R(conv_w2sf
, 0x00000001, SF_one
, USR_CLEAR
);
1036 TEST_R_OP_R(conv_w2sf
, 0x010020a5, 0x4b801052, USR_FPINPF
);
1037 TEST_R_OP_P(conv_ud2sf
, 0x0000000000000001ULL
, SF_one
, USR_CLEAR
);
1038 TEST_R_OP_P(conv_ud2sf
, 0x00000000010020a5ULL
, 0x4b801052, USR_FPINPF
);
1039 TEST_R_OP_P(conv_d2sf
, 0x0000000000000001ULL
, SF_one
, USR_CLEAR
);
1040 TEST_R_OP_P(conv_d2sf
, 0x00000000010020a5ULL
, 0x4b801052, USR_FPINPF
);
1042 TEST_XR_OP_RRp(sffma_sc
, SF_one
, SF_one
, SF_one
, 1, SF_four
,
1044 TEST_XR_OP_RRp(sffma_sc
, SF_QNaN
, SF_one
, SF_one
, 1, SF_HEX_NaN
,
1046 TEST_XR_OP_RRp(sffma_sc
, SF_one
, SF_QNaN
, SF_one
, 1, SF_HEX_NaN
,
1048 TEST_XR_OP_RRp(sffma_sc
, SF_one
, SF_one
, SF_QNaN
, 1, SF_HEX_NaN
,
1050 TEST_XR_OP_RRp(sffma_sc
, SF_SNaN
, SF_one
, SF_one
, 1, SF_HEX_NaN
,
1052 TEST_XR_OP_RRp(sffma_sc
, SF_one
, SF_SNaN
, SF_one
, 1, SF_HEX_NaN
,
1054 TEST_XR_OP_RRp(sffma_sc
, SF_one
, SF_one
, SF_SNaN
, 1, SF_HEX_NaN
,
1057 TEST_Rp_OP_RR(sfrecipa
, SF_one
, SF_one
, SF_one_recip
, 0x00,
1059 TEST_Rp_OP_RR(sfrecipa
, SF_QNaN
, SF_one
, SF_HEX_NaN
, 0x00,
1061 TEST_Rp_OP_RR(sfrecipa
, SF_one
, SF_QNaN
, SF_HEX_NaN
, 0x00,
1063 TEST_Rp_OP_RR(sfrecipa
, SF_one
, SF_SNaN
, SF_HEX_NaN
, 0x00,
1065 TEST_Rp_OP_RR(sfrecipa
, SF_SNaN
, SF_one
, SF_HEX_NaN
, 0x00,
1068 TEST_R_OP_RR(sffixupn
, SF_one
, SF_one
, SF_one
, USR_CLEAR
);
1069 TEST_R_OP_RR(sffixupn
, SF_QNaN
, SF_one
, SF_HEX_NaN
, USR_CLEAR
);
1070 TEST_R_OP_RR(sffixupn
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
1071 TEST_R_OP_RR(sffixupn
, SF_SNaN
, SF_one
, SF_HEX_NaN
, USR_FPINVF
);
1072 TEST_R_OP_RR(sffixupn
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
1074 TEST_R_OP_RR(sffixupd
, SF_one
, SF_one
, SF_one
, USR_CLEAR
);
1075 TEST_R_OP_RR(sffixupd
, SF_QNaN
, SF_one
, SF_HEX_NaN
, USR_CLEAR
);
1076 TEST_R_OP_RR(sffixupd
, SF_one
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
1077 TEST_R_OP_RR(sffixupd
, SF_SNaN
, SF_one
, SF_HEX_NaN
, USR_FPINVF
);
1078 TEST_R_OP_RR(sffixupd
, SF_one
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
1080 TEST_R_OP_R(sffixupr
, SF_one
, SF_one
, USR_CLEAR
);
1081 TEST_R_OP_R(sffixupr
, SF_QNaN
, SF_HEX_NaN
, USR_CLEAR
);
1082 TEST_R_OP_R(sffixupr
, SF_SNaN
, SF_HEX_NaN
, USR_FPINVF
);
1084 TEST_Rp_OP_R(sfinvsqrta
, SF_one
, SF_one_invsqrta
, 0x00, USR_CLEAR
);
1085 TEST_Rp_OP_R(sfinvsqrta
, SF_zero
, SF_one
, 0x00, USR_CLEAR
);
1086 TEST_Rp_OP_R(sfinvsqrta
, SF_QNaN
, SF_HEX_NaN
, 0x00, USR_CLEAR
);
1087 TEST_Rp_OP_R(sfinvsqrta
, SF_small_neg
, SF_HEX_NaN
, 0x00, USR_FPINVF
);
1088 TEST_Rp_OP_R(sfinvsqrta
, SF_SNaN
, SF_HEX_NaN
, 0x00, USR_FPINVF
);
1090 puts(err
? "FAIL" : "PASS");