Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-cmpsd-1.c
blob331923c53d335c430acd8aa17d68d53d2f250b68
1 /* { dg-do run } */
2 /* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */
3 /* { dg-require-effective-target lp64 } */
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_sd_1
14 #endif
16 #include <emmintrin.h>
17 #include <math.h>
19 double s1[] = {2134.3343, 6678.346};
20 double s2[] = {41124.234, 6678.346};
21 long long dd[] = {1, 2}, d[2];
22 union{long long l[2]; double d[2];} e;
24 void check(char *id, __m128d dst)
26 __v2di dest = (__v2di)dst;
28 if(checkVl(d, e.l, 2))
30 printf("mm_cmp%s_sd FAILED\n", id);
31 printf("dst [%lld, %lld], e.l[%lld]\n",
32 dest[0], dest[1], e.l[0]);
36 #define CMP(cmp, rel) \
37 e.l[0] = rel ? -1 : 0; \
38 dest = _mm_loadu_pd((double*)dd); \
39 source1 = _mm_loadu_pd(s1); \
40 source2 = _mm_loadu_pd(s2); \
41 dest = _mm_cmp##cmp##_sd(source1, source2); \
42 _mm_storeu_pd((double*) d, dest); \
43 check("" #cmp "", dest);
45 static void
46 TEST ()
48 __m128d source1, source2, dest;
50 e.d[1] = s1[1];
52 CMP(eq, !isunordered(s1[0], s2[0]) && s1[0] == s2[0]);
53 CMP(lt, !isunordered(s1[0], s2[0]) && s1[0] < s2[0]);
54 CMP(le, !isunordered(s1[0], s2[0]) && s1[0] <= s2[0]);
55 CMP(unord, isunordered(s1[0], s2[0]));
56 CMP(neq, isunordered(s1[0], s2[0]) || s1[0] != s2[0]);
57 CMP(nlt, isunordered(s1[0], s2[0]) || s1[0] >= s2[0]);
58 CMP(nle, isunordered(s1[0], s2[0]) || s1[0] > s2[0]);
59 CMP(ord, !isunordered(s1[0], s2[0]));
61 CMP(ge, isunordered(s1[0], s2[0]) || s1[0] >= s2[0]);
62 CMP(gt, isunordered(s1[0], s2[0]) || s1[0] > s2[0]);
63 CMP(nge, !isunordered(s1[0], s2[0]) && s1[0] < s2[0]);
64 CMP(ngt, !isunordered(s1[0], s2[0]) && s1[0] <= s2[0]);