diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/avx10_2-vcvttph2iubs-2.h')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/avx10_2-vcvttph2iubs-2.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-vcvttph2iubs-2.h b/gcc/testsuite/gcc.target/i386/avx10_2-vcvttph2iubs-2.h new file mode 100644 index 0000000..f77a8a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx10_2-vcvttph2iubs-2.h @@ -0,0 +1,81 @@ +#include "avx10-helper.h" +#include <limits.h> +#include <string.h> + +#define SIZE (AVX512F_LEN / 16) +#include "avx512f-mask-type.h" + +static void +CALC (_Float16 *s, short *r) +{ + int i; + unsigned char tmp; + + for (i = 0; i < SIZE; i++) + { + if (s[i] > UCHAR_MAX) + tmp = UCHAR_MAX; + else if (s[i] < 0) + tmp = 0; + else + tmp = s[i]; + r[i] = (unsigned short) tmp; + } +} + +void +TEST (void) +{ + UNION_TYPE (AVX512F_LEN, h) s; + UNION_TYPE (AVX512F_LEN, i_w) res1, res2, res3; + MASK_TYPE mask = MASK_VALUE; + short res_ref[SIZE] = { 0 }, res_ref2[SIZE] = { 0 }; + int i, sign = 1; + + for (i = 0; i < SIZE; i++) + { + s.a[i] = 1.23 * (i + 2) * sign; + sign = -sign; + } + + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + + res1.x = INTRINSIC (_ipcvtts_ph_epu8) (s.x); + res2.x = INTRINSIC (_mask_ipcvtts_ph_epu8) (res2.x, mask, s.x); + res3.x = INTRINSIC (_maskz_ipcvtts_ph_epu8) (mask, s.x); + + CALC (s.a, res_ref); + memcpy(res_ref2, res_ref, sizeof(res_ref)); + + if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref)) + abort (); + + MASK_MERGE (i_w) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref)) + abort (); + + MASK_ZERO (i_w) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref)) + abort (); + +#if AVX512F_LEN == 512 + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + + res1.x = INTRINSIC (_ipcvtts_roundph_epu8) (s.x, 8); + res2.x = INTRINSIC (_mask_ipcvtts_roundph_epu8) (res2.x, mask, s.x, 8); + res3.x = INTRINSIC (_maskz_ipcvtts_roundph_epu8) (mask, s.x, 8); + + if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref2)) + abort (); + + MASK_MERGE (i_w) (res_ref2, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref2)) + abort (); + + MASK_ZERO (i_w) (res_ref2, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref2)) + abort (); +#endif +} |