Handle T_HRESULT types in CodeView records
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse4_1-blendpd.c
blobb98d42dc051405d49243494b4e37b19225aa8fe5
1 /* { dg-do run } */
2 /* { dg-require-effective-target p8vector_hw } */
3 /* { dg-options "-O2 -mvsx -Wno-psabi" } */
4 /* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */
6 #ifndef CHECK_H
7 #define CHECK_H "sse4_1-check.h"
8 #endif
10 #ifndef TEST
11 #define TEST sse4_1_test
12 #endif
14 #include CHECK_H
16 #include <smmintrin.h>
17 #include <string.h>
19 #define NUM 20
21 #ifndef MASK
22 #define MASK 0x03
23 #endif
25 static void
26 init_blendpd (double *src1, double *src2)
28 int i, sign = 1;
30 for (i = 0; i < NUM * 2; i++)
32 src1[i] = i * i * sign;
33 src2[i] = (i + 20) * sign;
34 sign = -sign;
38 static int
39 check_blendpd (__m128d *dst, double *src1, double *src2)
41 double tmp[2];
42 int j;
44 memcpy (&tmp[0], src1, sizeof (tmp));
46 for(j = 0; j < 2; j++)
47 if ((MASK & (1 << j)))
48 tmp[j] = src2[j];
50 return memcmp (dst, &tmp[0], sizeof (tmp));
53 static void
54 TEST (void)
56 __m128d x, y;
57 union
59 __m128d x[NUM];
60 double d[NUM * 2];
61 } dst, src1, src2;
62 union
64 __m128d x;
65 double d[2];
66 } src3;
67 int i;
69 init_blendpd (src1.d, src2.d);
71 /* Check blendpd imm8, m128, xmm */
72 for (i = 0; i < NUM; i++)
74 dst.x[i] = _mm_blend_pd (src1.x[i], src2.x[i], MASK);
75 if (check_blendpd (&dst.x[i], &src1.d[i * 2], &src2.d[i * 2]))
76 abort ();
79 /* Check blendpd imm8, xmm, xmm */
80 src3.x = _mm_setzero_pd ();
82 x = _mm_blend_pd (dst.x[2], src3.x, MASK);
83 y = _mm_blend_pd (src3.x, dst.x[2], MASK);
85 if (check_blendpd (&x, &dst.d[4], &src3.d[0]))
86 abort ();
88 if (check_blendpd (&y, &src3.d[0], &dst.d[4]))
89 abort ();