[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-sqrtpd-1.c
blob7a2de5e42e861ea6f060545ea1377fceca49ea79
1 /* { dg-do run } */
2 /* { dg-options "-O3 -mvsx -Wno-psabi" } */
3 /* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */
4 /* { dg-require-effective-target p8vector_hw } */
6 #ifndef CHECK_H
7 #define CHECK_H "sse2-check.h"
8 #endif
10 #include CHECK_H
12 #ifndef TEST
13 #define TEST sse2_test_sqrt_pd_1
14 #endif
16 #include <emmintrin.h>
17 #include <math.h>
19 static __m128d
20 __attribute__((noinline, unused))
21 test (__m128d s1)
23 return _mm_sqrt_pd (s1);
26 static void
27 TEST (void)
29 union128d u, s1;
30 __m128d bogus = { 123.0, 456.0 };
31 double e[2];
32 int i;
34 s1.x = _mm_set_pd (2134.3343,1234.635654);
35 u.x = test (s1.x);
37 for (i = 0; i < 2; i++)
39 __m128d tmp = _mm_load_sd (&s1.a[i]);
40 tmp = _mm_sqrt_sd (bogus, tmp);
41 _mm_store_sd (&e[i], tmp);
44 if (check_union128d (u, e))
46 #if DEBUG
47 printf ("sse2_test_sqrt_pd_1; check_union128d failed\n");
48 printf ("\t [%f,%f] -> [%f,%f]\n", s1.a[0], s1.a[1], u.a[0], u.a[1]);
49 printf ("\t expect [%f,%f]\n", e[0], e[1]);
50 #endif
51 abort ();