| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -march=x86-64-v3 -mavx10.2" } */ |
| 3 |
/* { dg-require-effective-target avx10_2 } */ |
| 4 |
|
| 5 |
#define AVX10_2 |
| 6 |
#define AVX10_SCALAR |
| 7 |
#include "avx10-helper.h" |
| 8 |
#define SIZE_RES (128 / 16) |
| 9 |
|
| 10 |
#define CMP(PRED, IMM) \ |
| 11 |
exp = _mm_comi_round_ss (__A, __B, IMM, _MM_FROUND_NO_EXC); \ |
| 12 |
res1 = _mm_comi##PRED##_sbh (src1.x, src2.x); \ |
| 13 |
if (exp != res1) \ |
| 14 |
abort (); |
| 15 |
|
| 16 |
void |
| 17 |
TEST (void) |
| 18 |
{ |
| 19 |
int i; |
| 20 |
int res1, exp; |
| 21 |
UNION_TYPE (128, bf16_uw) src1, src2; |
| 22 |
|
| 23 |
struct |
| 24 |
{ |
| 25 |
float x1; |
| 26 |
float x2; |
| 27 |
} |
| 28 |
inputs[] = |
| 29 |
{ |
| 30 |
{ 4.3, 2.18 }, |
| 31 |
{ -4.3, 3.18 }, |
| 32 |
{ __builtin_nanf (""), -5.8 }, |
| 33 |
{ -4.8, __builtin_nansf ("") }, |
| 34 |
{ 3.8, __builtin_nansf ("") }, |
| 35 |
{ 4.2, 4.2 }, |
| 36 |
{ __builtin_nanf (""), __builtin_nansf ("") }, |
| 37 |
}; |
| 38 |
|
| 39 |
for (i = 0; i < sizeof (inputs) / sizeof (inputs[0]); i++) |
| 40 |
{ |
| 41 |
float x = inputs[i].x1; |
| 42 |
float y = inputs[i].x2; |
| 43 |
|
| 44 |
__m128 __A = _mm_load_ss (&x); |
| 45 |
__m128 __B = _mm_load_ss (&y); |
| 46 |
for (int n = 0; n < SIZE_RES; n++) |
| 47 |
{ |
| 48 |
src2.a[n] = convert_fp32_to_bf16(y); |
| 49 |
src1.a[n] = convert_fp32_to_bf16(x); |
| 50 |
} |
| 51 |
CMP (eq, _CMP_EQ_OQ); |
| 52 |
CMP (ge, _CMP_GE_OS); |
| 53 |
CMP (gt, _CMP_GT_OS); |
| 54 |
CMP (lt, _CMP_LT_OS); |
| 55 |
CMP (le, _CMP_LE_OS); |
| 56 |
CMP (neq, _CMP_NEQ_UQ); |
| 57 |
} |
| 58 |
} |