[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-cmppd-1.c
blob458e0d428328a1e0409a4cfb93e0ab2381bc3f27
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_cmp_pd_1
14 #endif
16 #include <emmintrin.h>
17 #include <math.h>
19 double ps1[] = {2134.3343, 6678.346};
20 double ps2[] = {41124.234, 6678.346};
21 long long pdd[] = {1, 2}, pd[2];
22 union{long long l[2]; double d[2];} pe;
24 void pd_check(char *id, __m128d dst)
26 __v2di dest = (__v2di)dst;
28 if(checkVl(pd, pe.l, 2))
30 printf("mm_cmp%s_pd FAILED\n", id);
31 printf("dst [%lld, %lld], e.l[%lld, %lld]\n",
32 dest[0], dest[1], pe.l[0], pe.l[1]);
36 #define CMP(cmp, rel0, rel1) \
37 pe.l[0] = rel0 ? -1 : 0; \
38 pe.l[1] = rel1 ? -1 : 0; \
39 dest = _mm_loadu_pd((double*)pdd); \
40 source1 = _mm_loadu_pd(ps1); \
41 source2 = _mm_loadu_pd(ps2); \
42 dest = _mm_cmp##cmp##_pd(source1, source2); \
43 _mm_storeu_pd((double*) pd, dest); \
44 pd_check("" #cmp "", dest);
46 static void
47 TEST ()
49 __m128d source1, source2, dest;
51 CMP(eq, !isunordered(ps1[0], ps2[0]) && ps1[0] == ps2[0],
52 !isunordered(ps1[1], ps2[1]) && ps1[1] == ps2[1]);
53 CMP(lt, !isunordered(ps1[0], ps2[0]) && ps1[0] < ps2[0],
54 !isunordered(ps1[1], ps2[1]) && ps1[1] < ps2[1]);
55 CMP(le, !isunordered(ps1[0], ps2[0]) && ps1[0] <= ps2[0],
56 !isunordered(ps1[1], ps2[1]) && ps1[1] <= ps2[1]);
57 CMP(unord, isunordered(ps1[0], ps2[0]),
58 isunordered(ps1[1], ps2[1]));
59 CMP(neq, isunordered(ps1[0], ps2[0]) || ps1[0] != ps2[0],
60 isunordered(ps1[1], ps2[1]) || ps1[1] != ps2[01]);
61 CMP(nlt, isunordered(ps1[0], ps2[0]) || ps1[0] >= ps2[0],
62 isunordered(ps1[1], ps2[1]) || ps1[1] >= ps2[1]);
63 CMP(nle, isunordered(ps1[0], ps2[0]) || ps1[0] > ps2[0],
64 isunordered(ps1[1], ps2[1]) || ps1[1] > ps2[1]);
65 CMP(ord, !isunordered(ps1[0], ps2[0]),
66 !isunordered(ps1[1], ps2[1]));
68 CMP(ge, isunordered(ps1[0], ps2[0]) || ps1[0] >= ps2[0],
69 isunordered(ps1[1], ps2[1]) || ps1[1] >= ps2[1]);
70 CMP(gt, isunordered(ps1[0], ps2[0]) || ps1[0] > ps2[0],
71 isunordered(ps1[1], ps2[1]) || ps1[1] > ps2[1]);
72 CMP(nge, !isunordered(ps1[0], ps2[0]) && ps1[0] < ps2[0],
73 !isunordered(ps1[1], ps2[1]) && ps1[1] < ps2[1]);
74 CMP(ngt, !isunordered(ps1[0], ps2[0]) && ps1[0] <= ps2[0],
75 !isunordered(ps1[1], ps2[1]) && ps1[1] <= ps2[1]);