[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-cvtsd2si-1.c
blob4aead4afbdd4b10c23b72ac7101a0a758d90ae7b
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_cvtsd2si_1
14 #endif
16 #include <emmintrin.h>
19 static int
20 __attribute__((noinline, unused))
21 test (__m128d p)
23 return _mm_cvtsd_si32 (p);
26 static void
27 TEST (void)
29 union128d s;
30 int e;
31 int d;
33 s.x = _mm_set_pd (123.321, 456.987);
35 d = test (s.x);
37 e = (int)(s.a[0] + 0.5);
39 if (d != e)
41 #if DEBUG
42 printf ("sse2_test_cvtsd2si_1; failed\n");
43 printf ("\t [%f,%f] -> [%d]\n", s.a[0], s.a[1], d);
44 printf ("\t expect [%d]\n", e);
45 #endif
46 abort ();