| 1 |
#include "avx512f-check.h" |
| 2 |
#include "args.h" |
| 3 |
|
| 4 |
struct IntegerRegisters iregs; |
| 5 |
struct FloatRegisters fregs; |
| 6 |
unsigned int num_iregs, num_fregs; |
| 7 |
|
| 8 |
struct m512_struct |
| 9 |
{ |
| 10 |
__m512 x; |
| 11 |
}; |
| 12 |
|
| 13 |
struct m512_2_struct |
| 14 |
{ |
| 15 |
__m512 x1, x2; |
| 16 |
}; |
| 17 |
|
| 18 |
/* Check that the struct is passed as the individual members in fregs. */ |
| 19 |
void |
| 20 |
check_struct_passing1 (struct m512_struct ms1 ATTRIBUTE_UNUSED, |
| 21 |
struct m512_struct ms2 ATTRIBUTE_UNUSED, |
| 22 |
struct m512_struct ms3 ATTRIBUTE_UNUSED, |
| 23 |
struct m512_struct ms4 ATTRIBUTE_UNUSED, |
| 24 |
struct m512_struct ms5 ATTRIBUTE_UNUSED, |
| 25 |
struct m512_struct ms6 ATTRIBUTE_UNUSED, |
| 26 |
struct m512_struct ms7 ATTRIBUTE_UNUSED, |
| 27 |
struct m512_struct ms8 ATTRIBUTE_UNUSED) |
| 28 |
{ |
| 29 |
/* Check register contents. */ |
| 30 |
check_m512_arguments; |
| 31 |
} |
| 32 |
|
| 33 |
void |
| 34 |
check_struct_passing2 (struct m512_2_struct ms ATTRIBUTE_UNUSED) |
| 35 |
{ |
| 36 |
/* Check the passing on the stack by comparing the address of the |
| 37 |
stack elements to the expected place on the stack. */ |
| 38 |
assert ((unsigned long)&ms.x1 == rsp+8); |
| 39 |
assert ((unsigned long)&ms.x2 == rsp+72); |
| 40 |
} |
| 41 |
|
| 42 |
static void |
| 43 |
avx512f_test (void) |
| 44 |
{ |
| 45 |
struct m512_struct m512s [8]; |
| 46 |
struct m512_2_struct m512_2s = { |
| 47 |
{ 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94, |
| 48 |
48.3941, 39.31, -397.91, 3484.91, -8.3941, -93.31, 7.91, 84.941 }, |
| 49 |
{ -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3, |
| 50 |
-8.3942, -3.32, -39.92, 34.92, 7.92, 84.942, -48.3942, 39.32 } |
| 51 |
}; |
| 52 |
int i; |
| 53 |
|
| 54 |
for (i = 0; i < 8; i++) |
| 55 |
m512s[i].x = (__m512){32+i, 0, i, 0, -i, 0, i - 12, i + 8, |
| 56 |
32+i, 0, i, 0, -i, 0, i - 12, i + 8}; |
| 57 |
|
| 58 |
clear_struct_registers; |
| 59 |
for (i = 0; i < 8; i++) |
| 60 |
(&fregs.zmm0)[i]._m512[0] = m512s[i].x; |
| 61 |
num_fregs = 8; |
| 62 |
WRAP_CALL (check_struct_passing1)(m512s[0], m512s[1], m512s[2], m512s[3], |
| 63 |
m512s[4], m512s[5], m512s[6], m512s[7]); |
| 64 |
WRAP_CALL (check_struct_passing2)(m512_2s); |
| 65 |
} |