Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / vararg-5.c
blob03ff60cd748affa1e597e1c4133618a9becc6d3a
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-mavx" } */
5 #include <stdarg.h>
6 #include <assert.h>
8 #include "avx-check.h"
10 __m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
11 __m256d n2 = { -93.83, 893.318, 3994.3, -39484.0 };
12 __m128i n3 = { 893, -3180 } ;
13 int n4 = 324;
14 double n5 = 103.3;
15 __m128i n6 = { -123, 2 };
16 __m128d n7 = { -91.387, -8193.518 };
17 __m256d n8 = { -123.3, 2.3, 3.4, -10.03 };
18 __m128 n9 = { -123.3, 2.3, 3.4, -10.03 };
19 __m128i n10 = { 1233, -100 };
20 int n11 = 407;
21 double n12 = 304.9;
22 __m128i n13 = { 233, -110 };
23 __m256i n14 = { -1233, 23, 34, -1003 };
24 __m128i n15 = { -393, -180 };
25 __m128d n16 = { 73.0, 63.18 };
26 __m256 n17 = { -183.3, -22.3, 13.9, -119.3, 483.1, 122.3, -33.4, -9.37 };
27 __m128 n18 = { -183.3, 22.3, 13.4, -19.03 };
29 __m128 e1;
30 __m256d e2;
31 __m128i e3;
32 int e4;
33 double e5;
34 __m128i e6;
35 __m128d e7;
36 __m256d e8;
37 __m128 e9;
38 __m128i e10;
39 int e11;
40 double e12;
41 __m128i e13;
42 __m256i e14;
43 __m128i e15;
44 __m128d e16;
45 __m256 e17;
46 __m128 e18;
48 static void
49 __attribute__((noinline))
50 test (__m128 a1, __m256d a2, __m128i a3, ...)
52 va_list va_arglist;
54 e1 = a1;
55 e2 = a2;
56 e3 = a3;
57 va_start (va_arglist, a3);
58 e4 = va_arg (va_arglist, int);
59 e5 = va_arg (va_arglist, double);
60 e6 = va_arg (va_arglist, __m128i);
61 e7 = va_arg (va_arglist, __m128d);
62 e8 = va_arg (va_arglist, __m256d);
63 e9 = va_arg (va_arglist, __m128);
64 e10 = va_arg (va_arglist, __m128i);
65 e11 = va_arg (va_arglist, int);
66 e12 = va_arg (va_arglist, double);
67 e13 = va_arg (va_arglist, __m128i);
68 e14 = va_arg (va_arglist, __m256i);
69 e15 = va_arg (va_arglist, __m128i);
70 e16 = va_arg (va_arglist, __m128d);
71 e17 = va_arg (va_arglist, __m256);
72 e18 = va_arg (va_arglist, __m128);
73 va_end (va_arglist);
76 static void
77 avx_test (void)
79 test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12,
80 n13, n14, n15, n16, n17, n18);
81 assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
82 assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
83 assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
84 assert (n4 == e4);
85 assert (n5 == e5);
86 assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
87 assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
88 assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
89 assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
90 assert (__builtin_memcmp (&e10, &n10, sizeof (e10)) == 0);
91 assert (n11 == e11);
92 assert (n12 == e12);
93 assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
94 assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
95 assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
96 assert (__builtin_memcmp (&e16, &n16, sizeof (e16)) == 0);
97 assert (__builtin_memcmp (&e17, &n17, sizeof (e17)) == 0);
98 assert (__builtin_memcmp (&e18, &n18, sizeof (e18)) == 0);