| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -march=x86-64-v3 -mavx10.2" } */ |
| 3 |
/* { dg-require-effective-target avx10_2 } */ |
| 4 |
|
| 5 |
#ifndef AVX10_2 |
| 6 |
#define AVX10_2 |
| 7 |
#define AVX10_2_512 |
| 8 |
#define AVX10_512BIT |
| 9 |
#endif |
| 10 |
#include "avx10-helper.h" |
| 11 |
#include <limits.h> |
| 12 |
#include <string.h> |
| 13 |
|
| 14 |
#define SRC_SIZE (AVX512F_LEN_HALF / 32) |
| 15 |
#define SIZE (AVX512F_LEN / 64) |
| 16 |
#include "avx512f-mask-type.h" |
| 17 |
|
| 18 |
static void |
| 19 |
CALC (float *s, long long *r) |
| 20 |
{ |
| 21 |
int i; |
| 22 |
|
| 23 |
for (i = 0; i < SIZE; i++) |
| 24 |
{ |
| 25 |
if (s[i] > LLONG_MAX) |
| 26 |
r[i] = LLONG_MAX; |
| 27 |
else if (s[i] < LLONG_MIN) |
| 28 |
r[i] = LLONG_MIN; |
| 29 |
else |
| 30 |
r[i] = s[i]; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
void |
| 35 |
TEST (void) |
| 36 |
{ |
| 37 |
UNION_TYPE (AVX512F_LEN_HALF, ) s; |
| 38 |
UNION_TYPE (AVX512F_LEN, i_q) res1, res2, res3; |
| 39 |
MASK_TYPE mask = MASK_VALUE; |
| 40 |
long long res_ref[SIZE] = { 0 }, res_ref2[SIZE] = { 0 }; |
| 41 |
int i, sign = 1; |
| 42 |
|
| 43 |
for (i = 0; i < SRC_SIZE; i++) |
| 44 |
{ |
| 45 |
s.a[i] = 1.23 * (i + 2) * sign; |
| 46 |
sign = -sign; |
| 47 |
} |
| 48 |
|
| 49 |
for (i = 0; i < SIZE; i++) |
| 50 |
res2.a[i] = DEFAULT_VALUE; |
| 51 |
|
| 52 |
res1.x = INTRINSIC (_cvtts_ps_epi64) (s.x); |
| 53 |
res2.x = INTRINSIC (_mask_cvtts_ps_epi64) (res2.x, mask, s.x); |
| 54 |
res3.x = INTRINSIC (_maskz_cvtts_ps_epi64) (mask, s.x); |
| 55 |
|
| 56 |
CALC (s.a, res_ref); |
| 57 |
memcpy(res_ref2, res_ref, sizeof(res_ref)); |
| 58 |
|
| 59 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref)) |
| 60 |
abort (); |
| 61 |
|
| 62 |
MASK_MERGE (i_q) (res_ref, mask, SIZE); |
| 63 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref)) |
| 64 |
abort (); |
| 65 |
|
| 66 |
MASK_ZERO (i_q) (res_ref, mask, SIZE); |
| 67 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref)) |
| 68 |
abort (); |
| 69 |
|
| 70 |
#if AVX512F_LEN == 512 |
| 71 |
for (i = 0; i < SIZE; i++) |
| 72 |
res2.a[i] = DEFAULT_VALUE; |
| 73 |
|
| 74 |
res1.x = INTRINSIC (_cvtts_roundps_epi64) (s.x, 8); |
| 75 |
res2.x = INTRINSIC (_mask_cvtts_roundps_epi64) (res2.x, mask, s.x, 8); |
| 76 |
res3.x = INTRINSIC (_maskz_cvtts_roundps_epi64) (mask, s.x, 8); |
| 77 |
|
| 78 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref2)) |
| 79 |
abort (); |
| 80 |
|
| 81 |
MASK_MERGE (i_q) (res_ref2, mask, SIZE); |
| 82 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref2)) |
| 83 |
abort (); |
| 84 |
|
| 85 |
MASK_ZERO (i_q) (res_ref2, mask, SIZE); |
| 86 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref2)) |
| 87 |
abort (); |
| 88 |
#endif |
| 89 |
} |