Mercurial > vec
changeset 44:b0a3f0248ecc
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 | d96806b543ac |
children | 7955bed1d169 |
files | include/vec/impl/ppc/altivec.h utils/genaltivec.c |
diffstat | 2 files changed, 4 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/include/vec/impl/ppc/altivec.h Tue Apr 29 16:48:58 2025 -0400 +++ b/include/vec/impl/ppc/altivec.h Tue Apr 29 16:54:13 2025 -0400 @@ -38,13 +38,7 @@ VEC_FUNC_IMPL vint8x16 vint8x16_splat(vec_int8 x) { vint8x16 vec; -#ifdef vec_splats vec.altivec = vec_splats(x); -#elif defined(vec_splat_s8) - vec.altivec = vec_splat_s8(x); -#else -# error logic error -#endif return vec; } # define VINT8x16_SPLAT_DEFINED @@ -228,13 +222,7 @@ VEC_FUNC_IMPL vuint8x16 vuint8x16_splat(vec_uint8 x) { vuint8x16 vec; -#ifdef vec_splats vec.altivec = vec_splats(x); -#elif defined(vec_splat_u8) - vec.altivec = vec_splat_u8(x); -#else -# error logic error -#endif return vec; } # define VUINT8x16_SPLAT_DEFINED @@ -418,13 +406,7 @@ VEC_FUNC_IMPL vint16x8 vint16x8_splat(vec_int16 x) { vint16x8 vec; -#ifdef vec_splats vec.altivec = vec_splats(x); -#elif defined(vec_splat_s16) - vec.altivec = vec_splat_s16(x); -#else -# error logic error -#endif return vec; } # define VINT16x8_SPLAT_DEFINED @@ -608,13 +590,7 @@ VEC_FUNC_IMPL vuint16x8 vuint16x8_splat(vec_uint16 x) { vuint16x8 vec; -#ifdef vec_splats vec.altivec = vec_splats(x); -#elif defined(vec_splat_u16) - vec.altivec = vec_splat_u16(x); -#else -# error logic error -#endif return vec; } # define VUINT16x8_SPLAT_DEFINED @@ -798,13 +774,7 @@ VEC_FUNC_IMPL vint32x4 vint32x4_splat(vec_int32 x) { vint32x4 vec; -#ifdef vec_splats vec.altivec = vec_splats(x); -#elif defined(vec_splat_s32) - vec.altivec = vec_splat_s32(x); -#else -# error logic error -#endif return vec; } # define VINT32x4_SPLAT_DEFINED @@ -988,13 +958,7 @@ VEC_FUNC_IMPL vuint32x4 vuint32x4_splat(vec_uint32 x) { vuint32x4 vec; -#ifdef vec_splats vec.altivec = vec_splats(x); -#elif defined(vec_splat_u32) - vec.altivec = vec_splat_u32(x); -#else -# error logic error -#endif return vec; } # define VUINT32x4_SPLAT_DEFINED
--- a/utils/genaltivec.c Tue Apr 29 16:48:58 2025 -0400 +++ b/utils/genaltivec.c Tue Apr 29 16:54:13 2025 -0400 @@ -217,24 +217,18 @@ switch (op) { case OP_SPLAT: printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); - puts("#ifdef vec_splats"); puts("\tvec.altivec = vec_splats(x);"); - printf("#elif defined(vec_splat_%s%d)\n", LOAVSIGN(is_signed), bits); - printf("\tvec.altivec = vec_splat_%s%d(x);\n", LOAVSIGN(is_signed), bits); - puts("#else"); - puts("# error logic error"); - puts("#endif"); - printf("\treturn vec;\n"); + puts("\treturn vec;"); break; case OP_LOAD_ALIGNED: printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); puts("\tvec.altivec = vec_ld(0, x);"); - printf("\treturn vec;\n"); + puts("\treturn vec;"); break; case OP_LOAD: printf("\tv%sint%dx%d vec;\n", LOSIGN(is_signed), bits, size); puts("\tvec.altivec = vec_perm(vec_ld(0, x), vec_ld(16, x), vec_lvsl(0, x));"); - printf("\treturn vec;\n"); + puts("\treturn vec;"); break; case OP_STORE_ALIGNED: puts("\tvec_st(vec.altivec, 0, arr);"); @@ -276,7 +270,7 @@ } else { 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]); } - printf("\treturn vec;\n"); + puts("\treturn vec;"); break; } default: