2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / vararg-10.c
blob053649877ede9f8901a5eb100ae7a728791b4d33
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 struct m256d
12 __m256d v;
15 __m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
16 struct m256d n2 = { { -93.83, 893.318, 3994.3, -39484.0 } };
17 __m128i n3 = { 893, -3180 } ;
18 int n4 = 324;
19 double n5 = 103.3;
20 __m128i n6 = { -123, 2 };
21 __m128d n7 = { -91.387, -8193.518 };
22 struct m256d n8 = { { -123.3, 2.3, 3.4, -10.03 } };
23 __m128 n9 = { -123.3, 2.3, 3.4, -10.03 };
24 __m128i n10 = { 1233, -100 };
25 int n11 = 407;
26 double n12 = 304.9;
27 __m128i n13 = { 233, -110 };
28 __m256i n14 = { -1233, 23, 34, -1003 };
29 __m128i n15 = { -393, -180 };
30 __m128d n16 = { 73.0, 63.18 };
31 __m256 n17 = { -183.3, -22.3, 13.9, -119.3, 483.1, 122.3, -33.4, -9.37 };
32 __m128 n18 = { -183.3, 22.3, 13.4, -19.03 };
34 __m128 e1;
35 struct m256d e2;
36 __m128i e3;
37 int e4;
38 double e5;
39 __m128i e6;
40 __m128d e7;
41 struct m256d e8;
42 __m128 e9;
43 __m128i e10;
44 int e11;
45 double e12;
46 __m128i e13;
47 __m256i e14;
48 __m128i e15;
49 __m128d e16;
50 __m256 e17;
51 __m128 e18;
53 static void
54 __attribute__((noinline))
55 foo (va_list va_arglist)
57 e4 = va_arg (va_arglist, int);
58 e5 = va_arg (va_arglist, double);
59 e6 = va_arg (va_arglist, __m128i);
60 e7 = va_arg (va_arglist, __m128d);
61 e8 = va_arg (va_arglist, struct m256d);
62 e9 = va_arg (va_arglist, __m128);
63 e10 = va_arg (va_arglist, __m128i);
64 e11 = va_arg (va_arglist, int);
65 e12 = va_arg (va_arglist, double);
66 e13 = va_arg (va_arglist, __m128i);
67 e14 = va_arg (va_arglist, __m256i);
68 e15 = va_arg (va_arglist, __m128i);
69 e16 = va_arg (va_arglist, __m128d);
70 e17 = va_arg (va_arglist, __m256);
71 e18 = va_arg (va_arglist, __m128);
72 va_end (va_arglist);
75 static void
76 __attribute__((noinline))
77 test (__m128 a1, struct m256d a2, __m128i a3, ...)
79 va_list va_arglist;
81 e1 = a1;
82 e2 = a2;
83 e3 = a3;
84 va_start (va_arglist, a3);
85 foo (va_arglist);
86 va_end (va_arglist);
89 static void
90 avx_test (void)
92 test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12,
93 n13, n14, n15, n16, n17, n18);
94 assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
95 assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
96 assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
97 assert (n4 == e4);
98 assert (n5 == e5);
99 assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
100 assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
101 assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
102 assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
103 assert (__builtin_memcmp (&e10, &n10, sizeof (e10)) == 0);
104 assert (n11 == e11);
105 assert (n12 == e12);
106 assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
107 assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
108 assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
109 assert (__builtin_memcmp (&e16, &n16, sizeof (e16)) == 0);
110 assert (__builtin_memcmp (&e17, &n17, sizeof (e17)) == 0);
111 assert (__builtin_memcmp (&e18, &n18, sizeof (e18)) == 0);