diff --git a/src/util/arch/arm/simd_utils.h b/src/util/arch/arm/simd_utils.h index 7c5d11d5..232ca76f 100644 --- a/src/util/arch/arm/simd_utils.h +++ b/src/util/arch/arm/simd_utils.h @@ -161,11 +161,45 @@ m128 load_m128_from_u64a(const u64a *p) { } static really_inline u32 extract32from128(const m128 in, unsigned imm) { +#if !defined(DEBUG) return vgetq_lane_u32((uint32x4_t) in, imm); +#else + switch (imm) { + case 0: + return vgetq_lane_u32((uint32x4_t) in, 0); + break; + case 1: + return vgetq_lane_u32((uint32x4_t) in, 1); + break; + case 2: + return vgetq_lane_u32((uint32x4_t) in, 2); + break; + case 3: + return vgetq_lane_u32((uint32x4_t) in, 3); + break; + default: + return 0; + break; + } +#endif } -static really_inline u32 extract64from128(const m128 in, unsigned imm) { +static really_inline u64a extract64from128(const m128 in, unsigned imm) { +#if !defined(DEBUG) return vgetq_lane_u64((uint64x2_t) in, imm); +#else + switch (imm) { + case 0: + return vgetq_lane_u64((uint32x4_t) in, 0); + break; + case 1: + return vgetq_lane_u64((uint32x4_t) in, 1); + break; + default: + return 0; + break; + } +#endif } static really_inline m128 and128(m128 a, m128 b) { @@ -278,10 +312,37 @@ char testbit128(m128 val, unsigned int n) { return isnonzero128(and128(mask, val)); } +#define CASE_ALIGN_VECTORS(a, b, offset) case offset: return (m128)vextq_s8((int8x16_t)(a), (int8x16_t)(b), (offset)); break; + static really_inline m128 palignr(m128 r, m128 l, int offset) { +#if !defined(DEBUG) return (m128)vextq_s8((int8x16_t)l, (int8x16_t)r, offset); +#else + switch (offset) { + CASE_ALIGN_VECTORS(l, r, 0); + CASE_ALIGN_VECTORS(l, r, 1); + CASE_ALIGN_VECTORS(l, r, 2); + CASE_ALIGN_VECTORS(l, r, 3); + CASE_ALIGN_VECTORS(l, r, 4); + CASE_ALIGN_VECTORS(l, r, 5); + CASE_ALIGN_VECTORS(l, r, 6); + CASE_ALIGN_VECTORS(l, r, 7); + CASE_ALIGN_VECTORS(l, r, 8); + CASE_ALIGN_VECTORS(l, r, 9); + CASE_ALIGN_VECTORS(l, r, 10); + CASE_ALIGN_VECTORS(l, r, 11); + CASE_ALIGN_VECTORS(l, r, 12); + CASE_ALIGN_VECTORS(l, r, 13); + CASE_ALIGN_VECTORS(l, r, 14); + CASE_ALIGN_VECTORS(l, r, 15); + default: + return zeroes128(); + break; + } +#endif } +#undef CASE_ALIGN_VECTORS static really_inline m128 pshufb_m128(m128 a, m128 b) {