1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse2" } */
3 /* { dg-require-effective-target sse2 } */
4
5 #include <stdarg.h>
6 #include <assert.h>
7
8 #include "sse2-check.h"
9
10 __m128 n1 = { -283.3, -23.3, 213.4, 1119.03 };
11 __m128d n2 = { -93.83, 893.318 };
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 __m128 n8 = { -123.3, 2.3, 3.4, -10.03 };
18 __m128i n9 = { 1233, -100 };
19 int n10 = 407;
20 double n11 = 304.9;
21 __m128i n12 = { 233, -110 };
22 __m128i n13 = { -393, -180 };
23 __m128d n14 = { 73.0, 63.18 };
24 __m128 n15 = { -183.3, 22.3, 13.4, -19.03 };
25
26 __m128 e1;
27 __m128d e2;
28 __m128i e3;
29 int e4;
30 double e5;
31 __m128i e6;
32 __m128d e7;
33 __m128 e8;
34 __m128i e9;
35 int e10;
36 double e11;
37 __m128i e12;
38 __m128i e13;
39 __m128d e14;
40 __m128 e15;
41
42 static void
43 __attribute__((noinline))
foo(va_list va_arglist)44 foo (va_list va_arglist)
45 {
46 e4 = va_arg (va_arglist, int);
47 e5 = va_arg (va_arglist, double);
48 e6 = va_arg (va_arglist, __m128i);
49 e7 = va_arg (va_arglist, __m128d);
50 e8 = va_arg (va_arglist, __m128);
51 e9 = va_arg (va_arglist, __m128i);
52 e10 = va_arg (va_arglist, int);
53 e11 = va_arg (va_arglist, double);
54 e12 = va_arg (va_arglist, __m128i);
55 e13 = va_arg (va_arglist, __m128i);
56 e14 = va_arg (va_arglist, __m128d);
57 e15 = va_arg (va_arglist, __m128);
58 }
59
60 static void
61 __attribute__((noinline))
test(__m128 a1,__m128d a2,__m128i a3,...)62 test (__m128 a1, __m128d a2, __m128i a3, ...)
63 {
64 va_list va_arglist;
65
66 e1 = a1;
67 e2 = a2;
68 e3 = a3;
69 va_start (va_arglist, a3);
70 foo (va_arglist);
71 va_end (va_arglist);
72 }
73
74 static void
sse2_test(void)75 sse2_test (void)
76 {
77 test (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15);
78 assert (__builtin_memcmp (&e1, &n1, sizeof (e1)) == 0);
79 assert (__builtin_memcmp (&e2, &n2, sizeof (e2)) == 0);
80 assert (__builtin_memcmp (&e3, &n3, sizeof (e3)) == 0);
81 assert (n4 == e4);
82 assert (n5 == e5);
83 assert (__builtin_memcmp (&e6, &n6, sizeof (e6)) == 0);
84 assert (__builtin_memcmp (&e7, &n7, sizeof (e7)) == 0);
85 assert (__builtin_memcmp (&e8, &n8, sizeof (e8)) == 0);
86 assert (__builtin_memcmp (&e9, &n9, sizeof (e9)) == 0);
87 assert (n10 == e10);
88 assert (n11 == e11);
89 assert (__builtin_memcmp (&e12, &n12, sizeof (e12)) == 0);
90 assert (__builtin_memcmp (&e13, &n13, sizeof (e13)) == 0);
91 assert (__builtin_memcmp (&e14, &n14, sizeof (e14)) == 0);
92 assert (__builtin_memcmp (&e15, &n15, sizeof (e15)) == 0);
93 }
94