Mercurial > vec
comparison utils/genaltivec.c @ 44:b0a3f0248ecc default tip
altivec: vec_splat_* is actually not at all what I thought it was
lol
author | Paper <paper@tflc.us> |
---|---|
date | Tue, 29 Apr 2025 16:54:13 -0400 |
parents | ca0f0223a62d |
children |
comparison
equal
deleted
inserted
replaced
43:d96806b543ac | 44:b0a3f0248ecc |
---|---|
215 puts(")\n{"); | 215 puts(")\n{"); |
216 | 216 |
217 switch (op) { | 217 switch (op) { |
218 case OP_SPLAT: | 218 case OP_SPLAT: |
219 printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); | 219 printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); |
220 puts("#ifdef vec_splats"); | |
221 puts("\tvec.altivec = vec_splats(x);"); | 220 puts("\tvec.altivec = vec_splats(x);"); |
222 printf("#elif defined(vec_splat_%s%d)\n", LOAVSIGN(is_signed), bits); | 221 puts("\treturn vec;"); |
223 printf("\tvec.altivec = vec_splat_%s%d(x);\n", LOAVSIGN(is_signed), bits); | |
224 puts("#else"); | |
225 puts("# error logic error"); | |
226 puts("#endif"); | |
227 printf("\treturn vec;\n"); | |
228 break; | 222 break; |
229 case OP_LOAD_ALIGNED: | 223 case OP_LOAD_ALIGNED: |
230 printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); | 224 printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); |
231 puts("\tvec.altivec = vec_ld(0, x);"); | 225 puts("\tvec.altivec = vec_ld(0, x);"); |
232 printf("\treturn vec;\n"); | 226 puts("\treturn vec;"); |
233 break; | 227 break; |
234 case OP_LOAD: | 228 case OP_LOAD: |
235 printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); | 229 printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); |
236 puts("\tvec.altivec = vec_perm(vec_ld(0, x), vec_ld(16, x), vec_lvsl(0, x));"); | 230 puts("\tvec.altivec = vec_perm(vec_ld(0, x), vec_ld(16, x), vec_lvsl(0, x));"); |
237 printf("\treturn vec;\n"); | 231 puts("\treturn vec;"); |
238 break; | 232 break; |
239 case OP_STORE_ALIGNED: | 233 case OP_STORE_ALIGNED: |
240 puts("\tvec_st(vec.altivec, 0, arr);"); | 234 puts("\tvec_st(vec.altivec, 0, arr);"); |
241 break; | 235 break; |
242 case OP_STORE: | 236 case OP_STORE: |
274 if (op == OP_RSHIFT) { | 268 if (op == OP_RSHIFT) { |
275 printf("\tvec.altivec = vec_sr%s(vec1.altivec, vec2.altivec);\n", (is_signed) ? "a" : ""); | 269 printf("\tvec.altivec = vec_sr%s(vec1.altivec, vec2.altivec);\n", (is_signed) ? "a" : ""); |
276 } else { | 270 } else { |
277 printf("\tvec.altivec = (vector %s %s)vec_%s(vec1.altivec, vec2.altivec);\n", (is_signed) ? "signed" : "unsigned", types[(bits / 8) - 1], op_altivec[op - OP_ADD]); | 271 printf("\tvec.altivec = (vector %s %s)vec_%s(vec1.altivec, vec2.altivec);\n", (is_signed) ? "signed" : "unsigned", types[(bits / 8) - 1], op_altivec[op - OP_ADD]); |
278 } | 272 } |
279 printf("\treturn vec;\n"); | 273 puts("\treturn vec;"); |
280 break; | 274 break; |
281 } | 275 } |
282 default: | 276 default: |
283 printf("#error implement this operation"); | 277 printf("#error implement this operation"); |
284 break; | 278 break; |