2 /* { dg-require-effective-target sse4 } */
3 /* { dg-options "-O2 -msse4.1" } */
6 #define CHECK_H "sse4_1-check.h"
10 #define TEST sse4_1_test
15 #include <smmintrin.h>
19 /* mingw runtime don't provide random(). */
31 init_blendps (float *src1
, float *src2
)
35 for (i
= 0; i
< NUM
* 4; i
++)
37 src1
[i
] = i
* i
* sign
;
38 src2
[i
] = (i
+ 20) * sign
;
44 check_blendps (__m128
*dst
, float *src1
, float *src2
)
49 memcpy (&tmp
[0], src1
, sizeof (tmp
));
50 for (j
= 0; j
< 4; j
++)
51 if ((MASK
& (1 << j
)))
54 return memcmp (dst
, &tmp
[0], sizeof (tmp
));
73 init_blendps (src1
.f
, src2
.f
);
75 for (i
= 0; i
< 4; i
++)
76 src3
.f
[i
] = (int) random ();
78 /* Check blendps imm8, m128, xmm */
79 for (i
= 0; i
< NUM
; i
++)
81 dst
.x
[i
] = _mm_blend_ps (src1
.x
[i
], src2
.x
[i
], MASK
);
82 if (check_blendps (&dst
.x
[i
], &src1
.f
[i
* 4], &src2
.f
[i
* 4]))
86 /* Check blendps imm8, xmm, xmm */
87 x
= _mm_blend_ps (dst
.x
[2], src3
.x
, MASK
);
88 y
= _mm_blend_ps (src3
.x
, dst
.x
[2], MASK
);
90 if (check_blendps (&x
, &dst
.f
[8], &src3
.f
[0]))
93 if (check_blendps (&y
, &src3
.f
[0], &dst
.f
[8]))