1 /* { dg-do run } */
2 /* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */
3 /* { dg-require-effective-target p8vector_hw } */
4
5 #ifndef CHECK_H
6 #define CHECK_H "sse2-check.h"
7 #endif
8
9 #include CHECK_H
10
11 #ifndef TEST
12 #define TEST sse2_test_cvtsd2ss_1
13 #endif
14
15 #include <emmintrin.h>
16
17 static __m128
18 __attribute__((noinline, unused))
test(__m128 p1,__m128d p2)19 test (__m128 p1, __m128d p2)
20 {
21 return _mm_cvtsd_ss (p1, p2);
22 }
23
24 static void
TEST(void)25 TEST (void)
26 {
27 union128d s1;
28 union128 u, s2;
29 double source1[2] = {123.345, 67.3321};
30 float e[4] = {5633.098, 93.21, 3.34, 4555.2};
31
32 s1.x = _mm_loadu_pd (source1);
33 s2.x = _mm_loadu_ps (e);
34
35 __asm("" : "+v"(s1.x), "+v"(s2.x));
36 u.x = test(s2.x, s1.x);
37
38 e[0] = (float)source1[0];
39
40 if (check_union128(u, e))
41 {
42 #if DEBUG
43 printf ("sse2_test_cvtsd2ss_1; check_union128 failed\n");
44 printf ("\t [%f,%f,%f,%f],[%f,%f]\n", s2.a[0], s2.a[1], s2.a[2], s2.a[3],
45 s1.a[0], s1.a[1]);
46 printf ("\t -> \t[%f,%f,%f,%f]\n", u.a[0], u.a[1], u.a[2], u.a[3]);
47 printf ("\texpect\t[%f,%f,%f,%f]\n", e[0], e[1], e[2], e[3]);
48 #endif
49 abort ();
50 }
51 }
52