2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / m256-check.h
blob6dbc3a0d9d76fbd9acd326efa3c5b73c8956fff6
1 #include <immintrin.h>
2 #include "m128-check.h"
4 #ifndef max
5 #define max(a, b) (((a) > (b)) ? (a):(b))
6 #endif
7 #ifndef min
8 #define min(a, b) (((a) < (b)) ? (a):(b))
9 #endif
11 typedef union
13 __m256i x;
14 char a[32];
15 } union256i_b;
17 typedef union
19 __m256i x;
20 short a[16];
21 } union256i_w;
23 typedef union
25 __m256i x;
26 int a[8];
27 } union256i_d;
29 typedef union
31 __m256i x;
32 long long a[4];
33 } union256i_q;
35 typedef union
37 __m256 x;
38 float a[8];
39 } union256;
41 typedef union
43 __m256d x;
44 double a[4];
45 } union256d;
47 typedef union
49 __m256i x;
50 unsigned char a[32];
51 } union256i_ub;
53 typedef union
55 __m256i x;
56 unsigned short a[16];
57 } union256i_uw;
59 typedef union
61 __m256i x;
62 unsigned int a[8];
63 } union256i_ud;
65 typedef union
67 __m256i x;
68 unsigned long long a[4];
69 } union256i_uq;
71 CHECK_EXP (union256i_b, char, "%d")
72 CHECK_EXP (union256i_w, short, "%d")
73 CHECK_EXP (union256i_d, int, "0x%x")
74 CHECK_EXP (union256i_q, long long, "0x%llx")
75 CHECK_EXP (union256, float, "%f")
76 CHECK_EXP (union256d, double, "%f")
77 CHECK_EXP (union256i_ub, unsigned char, "%d")
78 CHECK_EXP (union256i_uw, unsigned short, "%d")
79 CHECK_EXP (union256i_ud, unsigned int, "0x%x")
80 CHECK_EXP (union256i_uq, unsigned long long, "0x%llx")
82 #define CHECK_FP_EXP(UINON_TYPE, VALUE_TYPE, ESP, FMT) \
83 static int \
84 __attribute__((noinline, unused)) \
85 check_fp_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
86 { \
87 int i; \
88 int err = 0; \
90 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
91 if (u.a[i] > (v[i] + (ESP)) || u.a[i] < (v[i] - (ESP))) \
92 { \
93 err++; \
94 PRINTF ("%i: " FMT " != " FMT "\n", \
95 i, v[i], u.a[i]); \
96 } \
97 return err; \
100 CHECK_FP_EXP (union256, float, ESP_FLOAT, "%f")
101 CHECK_FP_EXP (union256d, double, ESP_DOUBLE, "%f")