]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
when building in debug mode, vgetq_lane_*() and vextq_*() need immediate operands...
authorKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Tue, 24 Nov 2020 15:56:40 +0000 (17:56 +0200)
committerKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Tue, 24 Nov 2020 15:56:40 +0000 (17:56 +0200)
src/util/arch/arm/simd_utils.h

index 7c5d11d520c5b2a372b60f761e37a99112c118a3..232ca76f40f1d5a03f6749fab468e95a4e1556b4 100644 (file)
@@ -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) {