| 1 |
#include "bf16-ymm-check.h" |
| 2 |
#include "args.h" |
| 3 |
|
| 4 |
struct FloatRegisters fregs; |
| 5 |
struct IntegerRegisters iregs; |
| 6 |
unsigned int num_fregs, num_iregs; |
| 7 |
|
| 8 |
struct m256bf16_struct |
| 9 |
{ |
| 10 |
__m256bf16 x; |
| 11 |
}; |
| 12 |
|
| 13 |
struct m256bf16_2_struct |
| 14 |
{ |
| 15 |
__m256bf16 x1, x2; |
| 16 |
}; |
| 17 |
|
| 18 |
/* Check that the struct is passed as the individual members in fregs. */ |
| 19 |
void |
| 20 |
check_struct_passing1bf16 (struct m256bf16_struct ms1 ATTRIBUTE_UNUSED, |
| 21 |
struct m256bf16_struct ms2 ATTRIBUTE_UNUSED, |
| 22 |
struct m256bf16_struct ms3 ATTRIBUTE_UNUSED, |
| 23 |
struct m256bf16_struct ms4 ATTRIBUTE_UNUSED, |
| 24 |
struct m256bf16_struct ms5 ATTRIBUTE_UNUSED, |
| 25 |
struct m256bf16_struct ms6 ATTRIBUTE_UNUSED, |
| 26 |
struct m256bf16_struct ms7 ATTRIBUTE_UNUSED, |
| 27 |
struct m256bf16_struct ms8 ATTRIBUTE_UNUSED) |
| 28 |
{ |
| 29 |
check_m256_arguments; |
| 30 |
} |
| 31 |
|
| 32 |
void |
| 33 |
check_struct_passing2bf16 (struct m256bf16_2_struct ms ATTRIBUTE_UNUSED) |
| 34 |
{ |
| 35 |
/* Check the passing on the stack by comparing the address of the |
| 36 |
stack elements to the expected place on the stack. */ |
| 37 |
assert ((unsigned long)&ms.x1 == rsp+8); |
| 38 |
assert ((unsigned long)&ms.x2 == rsp+40); |
| 39 |
} |
| 40 |
|
| 41 |
volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, |
| 42 |
bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16; |
| 43 |
|
| 44 |
static void |
| 45 |
do_test (void) |
| 46 |
{ |
| 47 |
struct m256bf16_struct m256bf16s [8]; |
| 48 |
struct m256bf16_2_struct m256bf16_2s = { |
| 49 |
{ bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, |
| 50 |
bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16}, |
| 51 |
{ bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, |
| 52 |
bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16}, |
| 53 |
}; |
| 54 |
int i; |
| 55 |
|
| 56 |
for (i = 0; i < 8; i++) |
| 57 |
{ |
| 58 |
m256bf16s[i].x = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, |
| 59 |
bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16}; |
| 60 |
} |
| 61 |
|
| 62 |
clear_struct_registers; |
| 63 |
for (i = 0; i < 8; i++) |
| 64 |
(&fregs.ymm0)[i]._m256bf16[0] = m256bf16s[i].x; |
| 65 |
num_fregs = 8; |
| 66 |
WRAP_CALL (check_struct_passing1bf16) (m256bf16s[0], m256bf16s[1], m256bf16s[2], m256bf16s[3], |
| 67 |
m256bf16s[4], m256bf16s[5], m256bf16s[6], m256bf16s[7]); |
| 68 |
WRAP_CALL (check_struct_passing2bf16) (m256bf16_2s); |
| 69 |
} |