* g++.dg/other/i386-2.C (dg-options): Add -mavx512pf.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / vararg-7.c
blob0f10d6784db8dea1ea41d01a729875f5ca790903
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse2" } */
3 /* { dg-require-effective-target sse2 } */
5 #include <stdarg.h>
6 #include <assert.h>
8 #include "sse2-check.h"
10 struct m128
12 __m128 v;
15 struct m128 n1 = { { -283.3, -23.3, 213.4, 1119.03 } };
16 __m128d n2 = { -93.83, 893.318 };
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 m128 n8 = { { -123.3, 2.3, 3.4, -10.03 } };
23 __m128i n9 = { 1233, -100 };
24 int n10 = 407;
25 double n11 = 304.9;
26 __m128i n12 = { 233, -110 };
27 __m128i n13 = { -393, -180 };
28 __m128d n14 = { 73.0, 63.18 };
29 struct m128 n15 = { { -183.3, 22.3, 13.4, -19.03 } };
31 struct m128 e1;
32 __m128d e2;
33 __m128i e3;
34 int e4;
35 double e5;
36 __m128i e6;
37 __m128d e7;
38 struct m128 e8;
39 __m128i e9;
40 int e10;
41 double e11;
42 __m128i e12;
43 __m128i e13;
44 __m128d e14;
45 struct m128 e15;
47 static void
48 __attribute__((noinline))
49 test (struct m128 a1, __m128d a2, __m128i a3, ...)
51 va_list va_arglist;
53 e1 = a1;
54 e2 = a2;
55 e3 = a3;
56 va_start (va_arglist, a3);
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 m128);
62 e9 = va_arg (va_arglist, __m128i);
63 e10 = va_arg (va_arglist, int);
64 e11 = va_arg (va_arglist, double);
65 e12 = va_arg (va_arglist, __m128i);
66 e13 = va_arg (va_arglist, __m128i);
67 e14 = va_arg (va_arglist, __m128d);
68 e15 = va_arg (va_arglist, struct m128);
69 va_end (va_arglist);
72 static void
73 sse2_test (void)
75 test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15);
76 assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
77 assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
78 assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
79 assert (n4 == e4);
80 assert (n5 == e5);
81 assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
82 assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
83 assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
84 assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
85 assert (n10 == e10);
86 assert (n11 == e11);
87 assert (__builtin_memcmp (&e12, &n12, sizeof (e12)) == 0);
88 assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
89 assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
90 assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);