| 1 |
#include "avx-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 m256_struct |
| 9 |
{ |
| 10 |
__m256 x; |
| 11 |
}; |
| 12 |
|
| 13 |
struct m256_2_struct |
| 14 |
{ |
| 15 |
__m256 x1, x2; |
| 16 |
}; |
| 17 |
|
| 18 |
/* Check that the struct is passed as the individual members in fregs. */ |
| 19 |
void |
| 20 |
check_struct_passing1 (struct m256_struct ms1 ATTRIBUTE_UNUSED, |
| 21 |
struct m256_struct ms2 ATTRIBUTE_UNUSED, |
| 22 |
struct m256_struct ms3 ATTRIBUTE_UNUSED, |
| 23 |
struct m256_struct ms4 ATTRIBUTE_UNUSED, |
| 24 |
struct m256_struct ms5 ATTRIBUTE_UNUSED, |
| 25 |
struct m256_struct ms6 ATTRIBUTE_UNUSED, |
| 26 |
struct m256_struct ms7 ATTRIBUTE_UNUSED, |
| 27 |
struct m256_struct ms8 ATTRIBUTE_UNUSED) |
| 28 |
{ |
| 29 |
check_m256_arguments; |
| 30 |
} |
| 31 |
|
| 32 |
void |
| 33 |
check_struct_passing2 (struct m256_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 |
static void |
| 42 |
avx_test (void) |
| 43 |
{ |
| 44 |
struct m256_struct m256s [8]; |
| 45 |
struct m256_2_struct m256_2s = { |
| 46 |
{ 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94 }, |
| 47 |
{ -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3 } |
| 48 |
}; |
| 49 |
int i; |
| 50 |
|
| 51 |
for (i = 0; i < 8; i++) |
| 52 |
m256s[i].x = (__m256){32+i, 0, i, 0, -i, 0, i - 12, i + 8}; |
| 53 |
|
| 54 |
clear_struct_registers; |
| 55 |
for (i = 0; i < 8; i++) |
| 56 |
(&fregs.ymm0)[i]._m256[0] = m256s[i].x; |
| 57 |
num_fregs = 8; |
| 58 |
WRAP_CALL (check_struct_passing1)(m256s[0], m256s[1], m256s[2], m256s[3], |
| 59 |
m256s[4], m256s[5], m256s[6], m256s[7]); |
| 60 |
WRAP_CALL (check_struct_passing2)(m256_2s); |
| 61 |
} |