[AArch64/arm] PR testsuite/85326 Avoid C++ tests when C++ compiler not present
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / m512-check.h
blob1a1065d205350579bbd67043cedfa1e9dd592fcb
1 #include <immintrin.h>
2 #include "m256-check.h"
4 typedef union
6 __m512i x;
7 char a[64];
8 } union512i_b;
10 typedef union
12 __m512i x;
13 short a[32];
14 } union512i_w;
16 typedef union
18 __m512i x;
19 int a[16];
20 } union512i_d;
22 typedef union
24 __m512i x;
25 long long a[8];
26 } union512i_q;
28 typedef union
30 __m512 x;
31 float a[16];
32 } union512;
34 typedef union
36 __m512d x;
37 double a[8];
38 } union512d;
40 typedef union
42 __m512i x;
43 unsigned char a[64];
44 } union512i_ub;
46 typedef union
48 __m512i x;
49 unsigned short a[32];
50 } union512i_uw;
52 typedef union
54 __m512i x;
55 unsigned int a[16];
56 } union512i_ud;
58 typedef union
60 __m512i x;
61 unsigned long long a[8];
62 } union512i_uq;
65 CHECK_EXP (union512i_b, char, "%d")
66 CHECK_EXP (union512i_w, short, "%d")
67 CHECK_EXP (union512i_d, int, "0x%x")
68 CHECK_EXP (union512i_q, long long, "0x%llx")
69 CHECK_EXP (union512, float, "%f")
70 CHECK_EXP (union512d, double, "%f")
71 CHECK_EXP (union512i_ub, unsigned char, "%d")
72 CHECK_EXP (union512i_uw, unsigned short, "%d")
73 CHECK_EXP (union512i_ud, unsigned int, "0x%x")
74 CHECK_EXP (union512i_uq, unsigned long long, "0x%llx")
77 CHECK_FP_EXP (union512, float, ESP_FLOAT, "%f")
78 CHECK_FP_EXP (union512d, double, ESP_DOUBLE, "%f")
80 #define CHECK_ROUGH_EXP(UINON_TYPE, VALUE_TYPE, FMT) \
81 static int \
82 __attribute__((noinline, unused)) \
83 check_rough_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v, \
84 VALUE_TYPE eps) \
85 { \
86 int i; \
87 int err = 0; \
89 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
90 { \
91 /* We can have have v[i] == 0 == u.a[i] for some i, \
92 when we test zero-masking. */ \
93 if (v[i] == 0.0 && u.a[i] == 0.0) \
94 continue; \
95 if (v[i] == 0.0 && u.a[i] != 0.0) \
96 { \
97 err++; \
98 PRINTF ("%i: " FMT " != " FMT "\n", \
99 i, v[i], u.a[i]); \
101 VALUE_TYPE rel_err = (u.a[i] - v[i]) / v[i]; \
102 if (((rel_err < 0) ? -rel_err : rel_err) > eps) \
104 err++; \
105 PRINTF ("%i: " FMT " != " FMT "\n", \
106 i, v[i], u.a[i]); \
109 return err; \
112 CHECK_ROUGH_EXP (union512, float, "%f")
113 CHECK_ROUGH_EXP (union512d, double, "%f")
114 CHECK_ROUGH_EXP (union256, float, "%f")
115 CHECK_ROUGH_EXP (union256d, double, "%f")
116 CHECK_ROUGH_EXP (union128, float, "%f")
117 CHECK_ROUGH_EXP (union128d, double, "%f")