| 1 |
/* { dg-do run { target avx512fp16 } } */ |
| 2 |
/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */ |
| 3 |
|
| 4 |
|
| 5 |
#define AVX512FP16 |
| 6 |
#include "avx512fp16-helper.h" |
| 7 |
|
| 8 |
#define N_ELEMS (AVX512F_LEN / 16) |
| 9 |
|
| 10 |
void NOINLINE |
| 11 |
EMULATE(cvtph2_pd) (V512 * dest, V512 op1, |
| 12 |
__mmask32 k, int zero_mask) |
| 13 |
{ |
| 14 |
V512 v1, v2, v3, v4, v5, v6, v7, v8; |
| 15 |
int i; |
| 16 |
__mmask16 m1, m2; |
| 17 |
|
| 18 |
m1 = k & 0xffff; |
| 19 |
unpack_ph_2twops(op1, &v1, &v2); |
| 20 |
|
| 21 |
for (i = 0; i < 8; i++) { |
| 22 |
if (((1 << i) & m1) == 0) { |
| 23 |
if (zero_mask) { |
| 24 |
v5.u64[i] = 0; |
| 25 |
} |
| 26 |
else { |
| 27 |
v5.u64[i] = dest->u64[i]; |
| 28 |
} |
| 29 |
} |
| 30 |
else { |
| 31 |
v5.f64[i] = v1.f32[i]; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
*dest = v5; |
| 36 |
} |
| 37 |
|
| 38 |
void |
| 39 |
TEST (void) |
| 40 |
{ |
| 41 |
V512 res; |
| 42 |
V512 exp; |
| 43 |
|
| 44 |
init_src(); |
| 45 |
|
| 46 |
EMULATE(cvtph2_pd)(&exp, src1, NET_MASK, 0); |
| 47 |
DF(res) = INTRINSIC (_cvtph_pd) (src1.xmmh[0]); |
| 48 |
CHECK_RESULT (&res, &exp, N_ELEMS, _cvtph_pd); |
| 49 |
|
| 50 |
init_dest(&res, &exp); |
| 51 |
EMULATE(cvtph2_pd)(&exp, src1, 0xcc, 0); |
| 52 |
DF(res) = INTRINSIC (_mask_cvtph_pd) (DF(res), 0xcc, src1.xmmh[0]); |
| 53 |
CHECK_RESULT (&res, &exp, N_ELEMS, _mask_cvtph_pd); |
| 54 |
|
| 55 |
EMULATE(cvtph2_pd)(&exp, src1, 0xc1, 1); |
| 56 |
DF(res) = INTRINSIC (_maskz_cvtph_pd) (0xc1, src1.xmmh[0]); |
| 57 |
CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_cvtph_pd); |
| 58 |
|
| 59 |
#if AVX512F_LEN == 512 |
| 60 |
EMULATE(cvtph2_pd)(&exp, src1, NET_MASK, 0); |
| 61 |
DF(res) = INTRINSIC (_cvt_roundph_pd) (src1.xmmh[0], _ROUND_CUR); |
| 62 |
CHECK_RESULT (&res, &exp, N_ELEMS, _cvt_roundph_pd); |
| 63 |
|
| 64 |
init_dest(&res, &exp); |
| 65 |
EMULATE(cvtph2_pd)(&exp, src1, 0xcc, 0); |
| 66 |
DF(res) = INTRINSIC (_mask_cvt_roundph_pd) (DF(res), 0xcc, src1.xmmh[0], _ROUND_CUR); |
| 67 |
CHECK_RESULT (&res, &exp, N_ELEMS, _mask_cvt_roundph_pd); |
| 68 |
|
| 69 |
EMULATE(cvtph2_pd)(&exp, src1, 0xc1, 1); |
| 70 |
DF(res) = INTRINSIC (_maskz_cvt_roundph_pd) (0xc1, src1.xmmh[0], _ROUND_CUR); |
| 71 |
CHECK_RESULT (&res, &exp, N_ELEMS, _maskz_cvt_roundph_pd); |
| 72 |
#endif |
| 73 |
|
| 74 |
if (n_errs != 0) { |
| 75 |
abort (); |
| 76 |
} |
| 77 |
} |
| 78 |
|