Handle T_HRESULT types in CodeView records
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-builtin-10c.c
blob5ed6424d64f3a0ef722a2d13d759bc8698688a68
1 /* { dg-do run } */
2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-maltivec" } */
5 /* This test should run the same on any target that supports altivec/vmx
6 instructions. Intentionally not specifying cpu in order to test
7 all code generation paths. */
9 #include <altivec.h>
11 extern void abort (void);
13 #define CONST0 (0)
14 #define CONST1 (1)
15 #define CONST2 (2)
16 #define CONST3 (3)
17 #define CONST4 (4)
18 #define CONST5 (5)
19 #define CONST6 (6)
20 #define CONST7 (7)
23 /* Test that indices > length of vector are applied modulo the vector
24 length. */
26 /* Test for vector residing in register. */
27 vector short s3 (vector short v, short x)
29 return vec_insert (x, v, 3);
32 vector short s7 (vector short v, short x)
34 return vec_insert (x, v, 7);
37 vector short s21 (vector short v, short x)
39 return vec_insert (x, v, 21);
42 vector short s30 (vector short v, short x)
44 return vec_insert (x, v, 30);
47 /* Test for vector residing in memory. */
48 vector short ms3 (vector short *vp, short x)
50 return vec_insert (x, *vp, 3);
53 vector short ms7 (vector short *vp, short x)
55 return vec_insert (x, *vp, 7);
58 vector short ms21 (vector short *vp, short x)
60 return vec_insert (x, *vp, 21);
63 vector short ms30 (vector short *vp, short x)
65 return vec_insert (x, *vp, 30);
68 /* Test the same with variable indices. */
70 /* Test for variable selector and vector residing in register. */
71 __attribute__((noinline))
72 vector short ci (vector short v, int i, short x)
74 return vec_insert (x, v, i);
77 /* Test for variable selector and vector residing in memory. */
78 __attribute__((noinline))
79 vector short mci (vector short *vp, int i, short x)
81 return vec_insert (x, *vp, i);
85 int main (int argc, short *argv[]) {
86 vector short sv = {
87 CONST0, CONST1, CONST2, CONST3, CONST4, CONST5, CONST6, CONST7 };
88 short s;
90 sv = s3 (sv, CONST6);
91 if (sv [3] != CONST6)
92 abort ();
94 sv = s7 (sv, CONST4);
95 if (sv [7] != CONST4)
96 abort ();
98 sv = s21 (sv, CONST3);
99 if (sv [5] != CONST3)
100 abort ();
102 sv = s30 (sv, CONST2);
103 if (sv [6] != CONST2)
104 abort ();
106 sv = ms3 (&sv, CONST5);
107 if (sv [3] != CONST5)
108 abort ();
110 sv = ms7 (&sv, CONST1);
111 if (sv [7] != CONST1)
112 abort ();
114 sv = ms21 (&sv, CONST2);
115 if (sv [5] != CONST2)
116 abort ();
118 sv = ms30 (&sv, CONST0);
119 if (sv [6] != CONST0)
120 abort ();
122 sv = ci (sv, 5, CONST6);
123 if (sv [5] != CONST6)
124 abort ();
126 sv = ci (sv, 2, CONST4);
127 if (sv [2] != CONST4)
128 abort ();
130 sv = ci (sv, 15, CONST3);
131 if (sv [7] != CONST3)
132 abort ();
134 sv = ci (sv, 28, CONST3);
135 if (sv [4] != CONST3)
136 abort ();
138 sv = mci (&sv, 5, CONST3);
139 if (sv [5] != CONST3)
140 abort ();
142 sv = mci (&sv, 12, CONST7);
143 if (sv [4] != CONST7)
144 abort ();
146 sv = mci (&sv, 25, CONST6);
147 if (sv [1] != CONST6)
148 abort ();
150 sv = mci (&sv, 16, CONST5);
151 if (sv [0] != CONST5)
152 abort ();
154 return 0;