2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
14 CALC (float *s
, float *r
, int imm
)
19 for (i
= 0; i
< SIZE
; i
++)
22 case _MM_FROUND_FLOOR
:
23 r
[i
] = floor (s
[i
] * pow (2, m
)) / pow (2, m
);
26 r
[i
] = ceil (s
[i
] * pow (2, m
)) / pow (2, m
);
38 UNION_TYPE (AVX512F_LEN
,) res1
, res2
, res3
, s
;
41 MASK_TYPE mask
= 6 ^ (0xffff >> SIZE
);
43 imm
= _MM_FROUND_FLOOR
| (7 << 4);
45 for (i
= 0; i
< 3; i
++)
48 for (j
= 0; j
< SIZE
; j
++)
50 s
.a
[j
] = j
* (j
+ 12.0231);
51 res1
.a
[j
] = DEFAULT_VALUE
;
52 res2
.a
[j
] = DEFAULT_VALUE
;
53 res3
.a
[j
] = DEFAULT_VALUE
;
59 imm
= _MM_FROUND_FLOOR
| (7 << 4);
60 res1
.x
= INTRINSIC (_roundscale_ps
) (s
.x
, imm
);
61 res2
.x
= INTRINSIC (_mask_roundscale_ps
) (res2
.x
, mask
, s
.x
, imm
);
62 res3
.x
= INTRINSIC (_maskz_roundscale_ps
) (mask
, s
.x
, imm
);
65 imm
= _MM_FROUND_FLOOR
;
66 res1
.x
= INTRINSIC (_floor_ps
) (s
.x
);
67 res2
.x
= INTRINSIC (_mask_floor_ps
) (res2
.x
, mask
, s
.x
);
68 res3
.x
= INTRINSIC (_maskz_floor_ps
) (mask
, s
.x
);
71 imm
= _MM_FROUND_CEIL
;
72 res1
.x
= INTRINSIC (_ceil_ps
) (s
.x
);
73 res2
.x
= INTRINSIC (_mask_ceil_ps
) (res2
.x
, mask
, s
.x
);
74 res3
.x
= INTRINSIC (_maskz_ceil_ps
) (mask
, s
.x
);
78 CALC (s
.a
, res_ref
, imm
);
80 if (UNION_CHECK (AVX512F_LEN
,) (res1
, res_ref
))
83 MASK_MERGE ()(res_ref
, mask
, SIZE
);
85 if (UNION_CHECK (AVX512F_LEN
,) (res2
, res_ref
))
88 MASK_ZERO ()(res_ref
, mask
, SIZE
);
90 if (UNION_CHECK (AVX512F_LEN
,) (res3
, res_ref
))