Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / sse2-pinsrw.c
blob2fd5b0bd6252b1517b26956c87c829fc32f0c923
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_pinsrw_1
14 #endif
16 #include <emmintrin.h>
17 #include <string.h>
19 #define msk0 0x00
20 #define msk1 0x01
21 #define msk2 0x02
22 #define msk3 0x03
23 #define msk4 0x04
24 #define msk5 0x05
25 #define msk6 0x06
26 #define msk7 0x07
28 static void
29 TEST (void)
31 union
33 __m128i x;
34 unsigned int i[4];
35 unsigned short s[8];
36 } res [8], val, tmp;
37 int masks[8];
38 unsigned short ins[4] = { 3, 4, 5, 6 };
39 int i;
41 val.i[0] = 0x35251505;
42 val.i[1] = 0x75655545;
43 val.i[2] = 0xB5A59585;
44 val.i[3] = 0xF5E5D5C5;
46 /* Check pinsrw imm8, r32, xmm. */
47 res[0].x = _mm_insert_epi16 (val.x, ins[0], msk0);
48 res[1].x = _mm_insert_epi16 (val.x, ins[0], msk1);
49 res[2].x = _mm_insert_epi16 (val.x, ins[0], msk2);
50 res[3].x = _mm_insert_epi16 (val.x, ins[0], msk3);
51 res[4].x = _mm_insert_epi16 (val.x, ins[0], msk4);
52 res[5].x = _mm_insert_epi16 (val.x, ins[0], msk5);
53 res[6].x = _mm_insert_epi16 (val.x, ins[0], msk6);
54 res[7].x = _mm_insert_epi16 (val.x, ins[0], msk7);
56 masks[0] = msk0;
57 masks[1] = msk1;
58 masks[2] = msk2;
59 masks[3] = msk3;
60 masks[4] = msk4;
61 masks[5] = msk5;
62 masks[6] = msk6;
63 masks[7] = msk7;
65 for (i = 0; i < 8; i++)
67 tmp.x = val.x;
68 tmp.s[masks[i]] = ins[0];
69 if (memcmp (&tmp, &res[i], sizeof (tmp)))
70 abort ();
73 /* Check pinsrw imm8, m16, xmm. */
74 for (i = 0; i < 8; i++)
76 res[i].x = _mm_insert_epi16 (val.x, ins[i % 2], msk0);
77 masks[i] = msk0;
80 for (i = 0; i < 8; i++)
82 tmp.x = val.x;
83 tmp.s[masks[i]] = ins[i % 2];
84 if (memcmp (&tmp, &res[i], sizeof (tmp)))
85 abort ();