comparison gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
comparison
equal deleted inserted replaced
18:1830386684a0 19:2b5abeee2509
1 /* { dg-do run } */
2 /* { dg-options "-mdejagnu-cpu=future -O2" } */
3 /* { dg-require-effective-target powerpc_future_hw } */
4
5 #include <altivec.h>
6
7 #ifdef DEBUG
8 #include <stdio.h>
9 #endif
10
11 #define IMM0 0
12 #define IMM1 1
13 #define IMM2 2
14 #define IMM3 3
15
16 void abort (void);
17
18 int main ()
19 {
20 int i;
21 vector unsigned char vec_byte_arg;
22 vector unsigned char vec_byte_result, vec_byte_expected0, vec_byte_expected1;
23 vector unsigned char vec_byte_expected2, vec_byte_expected3;
24
25 vector unsigned short vec_hword_arg;
26 vector unsigned short vec_hword_result, vec_hword_expected0;
27 vector unsigned short vec_hword_expected1, vec_hword_expected2;
28 vector unsigned short vec_hword_expected3;
29
30 vector unsigned int vec_word_arg;
31 vector unsigned int vec_word_result, vec_word_expected0, vec_word_expected1;
32 vector unsigned int vec_word_expected2, vec_word_expected3;
33
34 vec_byte_arg = (vector unsigned char ){ 0xFF, 0xF0, 0x7F, 0xFF,
35 0xFF, 0xFF, 0xFF, 0xFF,
36 0x00, 0x00, 0x01, 0x23,
37 0x45, 0x67, 0x00, 0x00 };
38
39 vec_byte_result = (vector unsigned char ){ 0xFF, 0xFF, 0xFF, 0xFF,
40 0xFF, 0xFF, 0xFF, 0xFF,
41 0xFF, 0xFF, 0xFF, 0xFF,
42 0xFF, 0xFF, 0xFF, 0xFF };
43
44 vec_byte_expected0 = (vector unsigned char){ 0x1F, 0x1E, 0x1D, 0x1C,
45 0x1B, 0x1A, 0x19, 0x18,
46 0x06, 0x05, 0x15, 0x04,
47 0x03, 0x02, 0x01, 0x00 };
48
49 vec_byte_expected1 = (vector unsigned char){ 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x07, 0x06, 0x04,
52 0x03, 0x02, 0x01, 0x00 };
53
54 vec_byte_expected2 = (vector unsigned char){ 0x10, 0x11, 0x12, 0x13,
55 0x14, 0x15, 0x16, 0x17,
56 0x00, 0x01, 0x1a, 0x02,
57 0x03, 0x04, 0x05, 0x06 };
58
59 vec_byte_expected3 = (vector unsigned char){ 0x08, 0x09, 0x0B, 0x0C,
60 0x0D, 0x0E, 0x0F, 0x00,
61 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00 };
63
64 vec_hword_arg = (vector unsigned short) { 0x0004, 0xF003, 0x0002, 0x0001,
65 0xF004, 0x1003, 0xF002, 0x0001 };
66 vec_hword_expected0 = (vector unsigned short int){ 0x405, 0x1c1d, 0x203,
67 0x1819, 0x1617, 0x1,
68 0x1213, 0x1011 };
69 vec_hword_expected1 = (vector unsigned short int){ 0x0, 0x0, 0x0, 0x0,
70 0x0, 0xe0f, 0xa0b, 0x405 };
71 vec_hword_expected2 = (vector unsigned short int){ 0x100, 0x1312, 0x302,
72 0x1716, 0x1918, 0x504,
73 0x1d1c, 0x1f1e };
74 vec_hword_expected3 = (vector unsigned short int){ 0x100, 0x504, 0xb0a, 0x0,
75 0x0, 0x0, 0x0, 0x0 };
76
77 vec_word_arg = (vector unsigned int){ 0xFEDCBA90, 0xF101, 0xF0000202, 0xF303 };
78 vec_word_expected0 = (vector unsigned int){ 0x4050607, 0x18191a1b,
79 0x10203, 0x10111213 };
80 vec_word_expected1 = (vector unsigned int){ 0x0, 0x0, 0xc0d0e0f, 0x4050607 };
81 vec_word_expected2 = (vector unsigned int){ 0x3020100, 0x17161514,
82 0x7060504, 0x1f1e1d1c };
83 vec_word_expected3 = (vector unsigned int){ 0x3020100, 0xb0a0908, 0x0, 0x0 };
84
85 vec_byte_result = vec_genpcvm (vec_byte_arg, IMM0);
86
87 for (i = 0; i < 16; i++) {
88 if (vec_byte_expected0[i] != vec_byte_result[i])
89 #if DEBUG
90 printf("ERROR: vec_genpcvm(IMM = 0), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
91 i, vec_byte_expected0[i], i, vec_byte_result[i]);
92 #else
93 abort();
94 #endif
95 }
96
97 vec_byte_result = vec_genpcvm (vec_byte_arg, IMM1);
98
99 for (i = 0; i < 16; i++) {
100 if (vec_byte_expected1[i] != vec_byte_result[i])
101 #if DEBUG
102 printf("ERROR: vec_genpcvm(IMM = 1), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
103 i, vec_byte_expected1[i], i, vec_byte_result[i]);
104 #else
105 abort();
106 #endif
107 }
108
109 vec_byte_result = vec_genpcvm (vec_byte_arg, IMM2);
110
111 for (i = 0; i < 16; i++) {
112 if (vec_byte_expected2[i] != vec_byte_result[i])
113 #if DEBUG
114 printf("ERROR: vec_genpcvmbm(IMM = 2), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
115 i, vec_byte_expected2[i], i, vec_byte_result[i]);
116 #else
117 abort();
118 #endif
119 }
120
121 vec_byte_result = vec_genpcvm (vec_byte_arg, IMM3);
122
123 for (i = 0; i < 16; i++) {
124 if (vec_byte_expected3[i] != vec_byte_result[i])
125 #if DEBUG
126 printf("ERROR: vec_genpcvm(IMM = 3), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
127 i, vec_byte_expected3[i], i, vec_byte_result[i]);
128 #else
129 abort();
130 #endif
131 }
132
133 vec_hword_result = vec_genpcvm (vec_hword_arg, IMM0);
134
135 for (i = 0; i < 8; i++) {
136 if (vec_hword_expected0[i] != vec_hword_result[i])
137 #if DEBUG
138 printf("ERROR: vec_genpcvmhm(IMM = 0), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
139 i, vec_hword_expected0[i], i, vec_hword_result[i]);
140 #else
141 abort();
142 #endif
143 }
144
145 vec_hword_result = vec_genpcvm (vec_hword_arg, IMM1);
146
147 for (i = 0; i < 8; i++) {
148 if (vec_hword_expected1[i] != vec_hword_result[i])
149 #if DEBUG
150 printf("ERROR: vec_genpcvm(IMM = 1), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
151 i, vec_hword_expected1[i], i, vec_hword_result[i]);
152 #else
153 abort();
154 #endif
155 }
156
157 vec_hword_result = vec_genpcvm (vec_hword_arg, IMM2);
158
159 for (i = 0; i < 8; i++) {
160 if (vec_hword_expected2[i] != vec_hword_result[i])
161 #if DEBUG
162 printf("ERROR: vec_genpcvm(IMM = 2), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
163 i, vec_hword_expected2[i], i, vec_hword_result[i]);
164 #else
165 abort();
166 #endif
167 }
168
169 vec_hword_result = vec_genpcvm (vec_hword_arg, IMM3);
170
171 for (i = 0; i < 8; i++) {
172 if (vec_hword_expected3[i] != vec_hword_result[i])
173 #if DEBUG
174 printf("ERROR: vec_genpcvm(IMM = 3), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
175 i, vec_hword_expected3[i], i, vec_hword_result[i]);
176 #else
177 abort();
178 #endif
179 }
180
181
182 vec_word_result = vec_genpcvm (vec_word_arg, IMM0);
183
184 for (i = 0; i < 4; i++) {
185 if (vec_word_expected0[i] != vec_word_result[i])
186 #if DEBUG
187 printf("ERROR: vec_genpcvm(IMM = 0), vec_word_expected[%d] = 0x%x does not match vec_word_result[%d] = 0x%x\n",
188 i, vec_word_expected0[i], i, vec_word_result[i]);
189 #else
190 abort();
191 #endif
192 }
193
194 vec_word_result = vec_genpcvm (vec_word_arg, IMM1);
195
196 for (i = 0; i < 4; i++) {
197 if (vec_word_expected1[i] != vec_word_result[i])
198 #if DEBUG
199 printf("ERROR: vec_genpcvm(IMM = 1), vec_word_expected[%d] = 0%x does not match vec_word_result[%d] = 0x%x\n",
200 i, vec_word_expected1[i], i, vec_word_result[i]);
201 #else
202 abort();
203 #endif
204 }
205
206 vec_word_result = vec_genpcvm (vec_word_arg, IMM2);
207
208 for (i = 0; i < 4; i++) {
209 if (vec_word_expected2[i] != vec_word_result[i])
210 #if DEBUG
211 printf("ERROR: vec_genpcvm(IMM = 2), vec_word_expected[%d] = 0x%x does not match vec_word_result[%d] = 0x%x\n",
212 i, vec_word_expected2[i], i, vec_word_result[i]);
213 #else
214 abort();
215 #endif
216 }
217
218 vec_word_result = vec_genpcvm (vec_word_arg, IMM3);
219
220 for (i = 0; i < 4; i++) {
221 if (vec_word_expected3[i] != vec_word_result[i])
222 #if DEBUG
223 printf("ERROR: vec_genpcvm(IMM = 3), vec_word_expected[%d] = 0x%x does not match vec_word_result[%d] = 0x%x\n",
224 i, vec_word_expected3[i], i, vec_word_result[i]);
225 #else
226 abort();
227 #endif
228 }
229
230 return 0;
231 }