* gcc.target/i386/pr70021.c: Add -mtune=skylake.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / vect-fmax-fmin.c
blob33a94441613f87cb8c1bd111407bb5d8333129d2
1 /* { dg-do run } */
2 /* { dg-options "-O3 -ffast-math" } */
4 extern void abort (void);
6 #include "vect-fmax-fmin.x"
8 #include "vect-fmaxv-fminv.x"
10 #define DEFN_SETV(type) \
11 void set_vector_##type (pR##type a, type n) \
12 { \
13 int i; \
14 for (i=0; i<16; i++) \
15 a[i] = n; \
18 #define DEFN_CHECKV(type) \
19 void check_vector_##type (pR##type a, pR##type vec) \
20 { \
21 int i; \
22 for (i=0; i<16; i++) \
23 if (a[i] != vec[i]) \
24 abort (); \
27 #define TEST2(fname, type) \
28 set_vector_##type (c##type, 0.0); \
29 fname##_##type (a##type, b##type); \
30 check_vector_##type (c##type, fname##_##type##_vector);
32 #define TEST3(fname, type) \
33 set_vector_##type (c##type, 0.0); \
34 fname##_##type (a##type, b##type, c##type); \
35 check_vector_##type (c##type, fname##_##type##_vector);
37 #define TEST(fname, N) \
38 TEST##N (fname, F32); \
39 TEST##N (fname, F64);
41 typedef float F32;
42 typedef double F64;
44 DEFN_SETV (F32)
45 DEFN_SETV (F64)
47 DEFN_CHECKV (F32)
48 DEFN_CHECKV (F64)
50 int main (void)
53 F32 aF32[16];
54 F32 bF32[16];
55 F32 cF32[16];
57 F64 aF64[16];
58 F64 bF64[16];
59 F64 cF64[16];
60 int i;
62 /* Golden vectors. */
63 F32 max_F32_vector[] = { 15.0, 14.0, 13.0, 12.0, 11.0, 10.0, 9.0, 8.0,
64 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0 };
66 F64 max_F64_vector[] = { 15.0, 14.0, 13.0, 12.0, 11.0, 10.0, 9.0, 8.0,
67 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0 };
69 F32 min_F32_vector[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,
70 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0 };
72 F64 min_F64_vector[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,
73 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0 };
75 F32 minv_F32_value = 0.0f;
76 F32 maxv_F32_value = 15.0f;
78 F64 minv_F64_value = 0.0;
79 F64 maxv_F64_value = 15.0;
81 /* Setup input vectors. */
82 for (i=0; i<16; i++)
84 aF32[i] = (float)(15-i);
85 bF32[i] = (float)i;
86 aF64[i] = (double)(15-i);
87 bF64[i] = (double)i;
90 TEST (max, 3);
91 TEST (min, 3);
93 /* Test across lanes ops. */
94 if (maxv_f32 (max_F32_vector) != maxv_F32_value)
95 abort ();
96 if (minv_f32 (min_F32_vector) != minv_F32_value)
97 abort ();
99 if (maxv_f64 (max_F64_vector) != maxv_F64_value)
100 abort ();
101 if (minv_f64 (min_F64_vector) != minv_F64_value)
102 abort ();
104 return 0;