| 1 |
/* { dg-do run { target avx512fp16 } } */ |
| 2 |
/* { dg-options "-O2 -mavx512fp16 -mavx512vl" } */ |
| 3 |
|
| 4 |
#include<stdio.h> |
| 5 |
#include <math.h> |
| 6 |
#include <complex.h> |
| 7 |
|
| 8 |
static void do_test (void); |
| 9 |
|
| 10 |
#define DO_TEST do_test |
| 11 |
#define AVX512FP16 |
| 12 |
|
| 13 |
#include <immintrin.h> |
| 14 |
#include "avx512-check.h" |
| 15 |
|
| 16 |
static void |
| 17 |
do_test (void) |
| 18 |
{ |
| 19 |
_Float16 _Complex fc = 1.0 + 1.0*I; |
| 20 |
union |
| 21 |
{ |
| 22 |
_Float16 _Complex a; |
| 23 |
float b; |
| 24 |
} u = { .a = fc }; |
| 25 |
float ff= u.b; |
| 26 |
|
| 27 |
typedef union |
| 28 |
{ |
| 29 |
float fp[8]; |
| 30 |
__m256h m256h; |
| 31 |
} u1; |
| 32 |
|
| 33 |
__m256h test256 = _mm256_set1_pch(fc); |
| 34 |
|
| 35 |
u1 test1; |
| 36 |
test1.m256h = test256; |
| 37 |
for (int i = 0; i<8; i++) |
| 38 |
{ |
| 39 |
if (test1.fp[i] != ff) abort(); |
| 40 |
} |
| 41 |
|
| 42 |
typedef union |
| 43 |
{ |
| 44 |
float fp[4]; |
| 45 |
__m128h m128h; |
| 46 |
} u2; |
| 47 |
|
| 48 |
__m128h test128 = _mm_set1_pch(fc); |
| 49 |
|
| 50 |
u2 test2; |
| 51 |
test2.m128h = test128; |
| 52 |
for (int i = 0; i<4; i++) |
| 53 |
{ |
| 54 |
if (test2.fp[i] != ff) abort(); |
| 55 |
} |
| 56 |
|
| 57 |
} |