2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-vround-2.c
blob46b5f06f30837d152fc99d29f912d66c92af184b
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-Ofast -mavx -mno-avx2" } */
5 #ifndef CHECK_H
6 #define CHECK_H "avx-check.h"
7 #define TEST avx_test
8 #define SRC "avx-vround-1.c"
9 #endif
11 #include CHECK_H
12 #include SRC
14 static void
15 TEST (void)
17 union128d a, ae;
18 union128 b, be;
19 union256d c, ce;
20 union256 d, de;
21 if (f1 (0.5) != 1.0 || f1 (1.5) != 2.0 || f1 (-0.5) != -1.0 || f1 (-1.5) != -2.0)
22 abort ();
23 if (f2 (0.5f) != 1.0f || f2 (1.5f) != 2.0f || f2 (-0.5f) != -1.0f || f2 (-1.5f) != -2.0f)
24 abort ();
25 a.x = f3 (_mm_set1_pd (7.0), _mm_set1_pd (0.5));
26 ae.x = _mm_set_pd (7.0, 0.0);
27 if (check_union128d (a, ae.a))
28 abort ();
29 a.x = f3 (_mm_set1_pd (7.0), _mm_set1_pd (1.5));
30 ae.x = _mm_set_pd (7.0, 2.0);
31 if (check_union128d (a, ae.a))
32 abort ();
33 a.x = f3 (_mm_set1_pd (7.0), _mm_set1_pd (-0.5));
34 ae.x = _mm_set_pd (7.0, 0.0);
35 if (check_union128d (a, ae.a))
36 abort ();
37 a.x = f3 (_mm_set1_pd (7.0), _mm_set1_pd (-1.5));
38 ae.x = _mm_set_pd (7.0, -2.0);
39 if (check_union128d (a, ae.a))
40 abort ();
41 b.x = f4 (_mm_set1_ps (7.0f), _mm_set1_ps (0.5f));
42 be.x = _mm_set_ps (7.0f, 7.0f, 7.0f, 0.0f);
43 if (check_union128 (b, be.a))
44 abort ();
45 b.x = f4 (_mm_set1_ps (7.0f), _mm_set1_ps (1.5f));
46 be.x = _mm_set_ps (7.0f, 7.0f, 7.0f, 2.0f);
47 if (check_union128 (b, be.a))
48 abort ();
49 b.x = f4 (_mm_set1_ps (7.0f), _mm_set1_ps (-0.5f));
50 be.x = _mm_set_ps (7.0f, 7.0f, 7.0f, 0.0f);
51 if (check_union128 (b, be.a))
52 abort ();
53 b.x = f4 (_mm_set1_ps (7.0f), _mm_set1_ps (-1.5f));
54 be.x = _mm_set_ps (7.0f, 7.0f, 7.0f, -2.0f);
55 if (check_union128 (b, be.a))
56 abort ();
57 a.x = f5 (_mm_set_pd (0.5, 1.5));
58 ae.x = _mm_set_pd (0.0, 2.0);
59 if (check_union128d (a, ae.a))
60 abort ();
61 a.x = f5 (_mm_set_pd (-0.5, -1.5));
62 ae.x = _mm_set_pd (0.0, -2.0);
63 if (check_union128d (a, ae.a))
64 abort ();
65 b.x = f6 (_mm_set_ps (0.5f, 1.5f, -0.5f, -1.5f));
66 be.x = _mm_set_ps (0.0f, 2.0f, 0.0f, -2.0f);
67 if (check_union128 (b, be.a))
68 abort ();
69 c.x = f7 (_mm256_set_pd (0.5, 1.5, -0.5, -1.5));
70 ce.x = _mm256_set_pd (0.0, 2.0, 0.0, -2.0);
71 if (check_union256d (c, ce.a))
72 abort ();
73 d.x = f8 (_mm256_set_ps (0.5f, 1.5f, -0.5f, -1.5f, 0.25f, 1.0f, -16.5f, 0.75f));
74 de.x = _mm256_set_ps (0.0f, 2.0f, 0.0f, -2.0f, 0.0f, 1.0f, -16.0f, 1.0f);
75 if (check_union256 (d, de.a))
76 abort ();