| 1 |
#include "avx512fp16-ymm-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 |
struct m256h_struct |
| 19 |
{ |
| 20 |
__m256h x; |
| 21 |
}; |
| 22 |
|
| 23 |
struct m256h_2_struct |
| 24 |
{ |
| 25 |
__m256h x1, x2; |
| 26 |
}; |
| 27 |
|
| 28 |
/* Check that the struct is passed as the individual members in fregs. */ |
| 29 |
void |
| 30 |
check_struct_passing1 (struct m256_struct ms1 ATTRIBUTE_UNUSED, |
| 31 |
struct m256_struct ms2 ATTRIBUTE_UNUSED, |
| 32 |
struct m256_struct ms3 ATTRIBUTE_UNUSED, |
| 33 |
struct m256_struct ms4 ATTRIBUTE_UNUSED, |
| 34 |
struct m256_struct ms5 ATTRIBUTE_UNUSED, |
| 35 |
struct m256_struct ms6 ATTRIBUTE_UNUSED, |
| 36 |
struct m256_struct ms7 ATTRIBUTE_UNUSED, |
| 37 |
struct m256_struct ms8 ATTRIBUTE_UNUSED) |
| 38 |
{ |
| 39 |
check_m256_arguments; |
| 40 |
} |
| 41 |
|
| 42 |
void |
| 43 |
check_struct_passing2 (struct m256_2_struct ms ATTRIBUTE_UNUSED) |
| 44 |
{ |
| 45 |
/* Check the passing on the stack by comparing the address of the |
| 46 |
stack elements to the expected place on the stack. */ |
| 47 |
assert ((unsigned long)&ms.x1 == rsp+8); |
| 48 |
assert ((unsigned long)&ms.x2 == rsp+40); |
| 49 |
} |
| 50 |
|
| 51 |
void |
| 52 |
check_struct_passing1h (struct m256h_struct ms1 ATTRIBUTE_UNUSED, |
| 53 |
struct m256h_struct ms2 ATTRIBUTE_UNUSED, |
| 54 |
struct m256h_struct ms3 ATTRIBUTE_UNUSED, |
| 55 |
struct m256h_struct ms4 ATTRIBUTE_UNUSED, |
| 56 |
struct m256h_struct ms5 ATTRIBUTE_UNUSED, |
| 57 |
struct m256h_struct ms6 ATTRIBUTE_UNUSED, |
| 58 |
struct m256h_struct ms7 ATTRIBUTE_UNUSED, |
| 59 |
struct m256h_struct ms8 ATTRIBUTE_UNUSED) |
| 60 |
{ |
| 61 |
check_m256_arguments; |
| 62 |
} |
| 63 |
|
| 64 |
void |
| 65 |
check_struct_passing2h (struct m256h_2_struct ms ATTRIBUTE_UNUSED) |
| 66 |
{ |
| 67 |
/* Check the passing on the stack by comparing the address of the |
| 68 |
stack elements to the expected place on the stack. */ |
| 69 |
assert ((unsigned long)&ms.x1 == rsp+8); |
| 70 |
assert ((unsigned long)&ms.x2 == rsp+40); |
| 71 |
} |
| 72 |
|
| 73 |
static void |
| 74 |
do_test (void) |
| 75 |
{ |
| 76 |
struct m256_struct m256s [8]; |
| 77 |
struct m256h_struct m256hs [8]; |
| 78 |
struct m256_2_struct m256_2s = { |
| 79 |
{ 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94 }, |
| 80 |
{ -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3 } |
| 81 |
}; |
| 82 |
struct m256h_2_struct m256h_2s = { |
| 83 |
{ 47.364f16, 36.3f16, -367.6f16, 3474.6f16, -7.364f16, -63.3f16, 7.6f16, 74.64f16, |
| 84 |
57.865f16, 86.8f16, -867.6f16, 8575.6f16, -7.865f16, -68.8f16, 7.6f16, 75.65f16 }, |
| 85 |
{ -7.364f16, -3.3f16, -36.6f16, 34.6f16, 7.6f16, 74.64f16, -47.364f16, 36.3f16, |
| 86 |
-8.364f16, -3.3f16, -36.6f16, 34.6f16, 8.6f16, 84.64f16, -48.364f16, 36.3f16 } |
| 87 |
}; |
| 88 |
int i; |
| 89 |
|
| 90 |
for (i = 0; i < 8; i++) |
| 91 |
{ |
| 92 |
m256s[i].x = (__m256){32+i, 0, i, 0, -i, 0, i - 12, i + 8}; |
| 93 |
|
| 94 |
m256hs[i].x = (__m256h){33+i, 0, i, 0, -i, 0, i - 11, i + 9, |
| 95 |
31+i, 2, i, 3, -i, 4, i - 10, i + 7}; |
| 96 |
} |
| 97 |
|
| 98 |
clear_struct_registers; |
| 99 |
for (i = 0; i < 8; i++) |
| 100 |
(&fregs.ymm0)[i]._m256[0] = m256s[i].x; |
| 101 |
num_fregs = 8; |
| 102 |
WRAP_CALL (check_struct_passing1)(m256s[0], m256s[1], m256s[2], m256s[3], |
| 103 |
m256s[4], m256s[5], m256s[6], m256s[7]); |
| 104 |
WRAP_CALL (check_struct_passing2)(m256_2s); |
| 105 |
|
| 106 |
clear_struct_registers; |
| 107 |
for (i = 0; i < 8; i++) |
| 108 |
(&fregs.ymm0)[i]._m256h[0] = m256hs[i].x; |
| 109 |
num_fregs = 8; |
| 110 |
WRAP_CALL (check_struct_passing1h)(m256hs[0], m256hs[1], m256hs[2], m256hs[3], |
| 111 |
m256hs[4], m256hs[5], m256hs[6], m256hs[7]); |
| 112 |
WRAP_CALL (check_struct_passing2h)(m256h_2s); |
| 113 |
} |