agora inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 9/9] reuse existing variable by overwriting it
73+ messages / 4 participants
[nested] [flat]

* [PATCH 9/9] reuse existing variable by overwriting it
@ 2026-03-12 15:14  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:14 UTC (permalink / raw)

---
 src/backend/replication/pgoutput_repack/pgoutput_repack.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/backend/replication/pgoutput_repack/pgoutput_repack.c b/src/backend/replication/pgoutput_repack/pgoutput_repack.c
index c77564c4024..67442d07ab1 100644
--- a/src/backend/replication/pgoutput_repack/pgoutput_repack.c
+++ b/src/backend/replication/pgoutput_repack/pgoutput_repack.c
@@ -250,12 +250,8 @@ store_change(LogicalDecodingContext *ctx, Relation relation,
 	/* ... and the attributes themselves, if any */
 	foreach_ptr(varlena, attr_val, attrs_ext)
 	{
-		varlena    *ext_val;
-		Size		ext_val_size;
-
-		ext_val = detoast_external_attr(attr_val);
-		ext_val_size = VARSIZE_ANY(ext_val);
-		BufFileWrite(file, ext_val, ext_val_size);
+		attr_val = detoast_external_attr(attr_val);
+		BufFileWrite(file, attr_val, VARSIZE_ANY(attr_val));
 	}
 
 	/* Finally write the tuple size ... */
-- 
2.47.3


--pnppmxqkefjd4hu2--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:30  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:30 UTC (permalink / raw)

---
 src/include/port/simd.h | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/include/port/simd.h b/src/include/port/simd.h
index 50615aec7f4..25a26c81cce 100644
--- a/src/include/port/simd.h
+++ b/src/include/port/simd.h
@@ -548,10 +548,6 @@ vector8_pack_16(const Vector8 v1, const Vector8 v2)
 
 /*
  * Unsigned shift left of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -560,24 +556,13 @@ vector8_shift_left(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_slli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshlq_n_u32((Vector32) v1, 4);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
 
 /*
  * Unsigned shift right of each 32-bit element in the vector by "i" bits.
- *
- * XXX AArch64 requires an integer literal, so we have to list all expected
- * values of "i" from all callers in a switch statement.  If you add a new
- * caller, be sure your expected values of "i" are handled.
  */
 #ifndef USE_NO_SIMD
 static inline Vector8
@@ -586,16 +571,8 @@ vector8_shift_right(const Vector8 v1, int i)
 #ifdef USE_SSE2
 	return _mm_srli_epi32(v1, i);
 #elif defined(USE_NEON)
-	switch (i)
-	{
-		case 4:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 4);
-		case 8:
-			return (Vector8) vshrq_n_u32((Vector32) v1, 8);
-		default:
-			Assert(false);
-			return vector8_broadcast(0);
-	}
+	/* negative shift count means right shift */
+	return (Vector8) vshlq_u32((Vector32) v1, vdupq_n_s32(-i));
 #endif
 }
 #endif							/* ! USE_NO_SIMD */
-- 
2.50.1 (Apple Git-155)


--9YipY07vKHAnXga/--





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:32  Nathan Bossart <[email protected]>
  0 siblings, 1 reply; 73+ messages in thread

From: Nathan Bossart @ 2026-07-02 00:32 UTC (permalink / raw)
  To: pgsql-hackers; +Cc: [email protected]

In commit ec8719ccbf, I added a switch statement with all expected shift
counts for vector8_shift_{left,right} because AArch64's vshlq_n_u32 and
vshrq_n_u32 require an integer literal.  I discovered that we can use
vshlq_u32 instead for both cases, which avoids the need for the switch
statement and compiles to the same machine code on recent gcc/clang.

-- 
nathan


^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* Re: remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 05:28  John Naylor <[email protected]>
  parent: Nathan Bossart <[email protected]>
  0 siblings, 1 reply; 73+ messages in thread

From: John Naylor @ 2026-07-02 05:28 UTC (permalink / raw)
  To: Nathan Bossart <[email protected]>; +Cc: pgsql-hackers

On Thu, Jul 2, 2026 at 7:32 AM Nathan Bossart <[email protected]> wrote:
> In commit ec8719ccbf, I added a switch statement with all expected shift
> counts for vector8_shift_{left,right} because AArch64's vshlq_n_u32 and
> vshrq_n_u32 require an integer literal.  I discovered that we can use
> vshlq_u32 instead for both cases, which avoids the need for the switch
> statement and compiles to the same machine code on recent gcc/clang.

Hmm! +1

--
John Naylor
Amazon Web Services





^ permalink  raw  reply  [nested|flat] 73+ messages in thread

* Re: remove switch statement in vector8_shift_{left,right}
@ 2026-07-06 16:40  Nathan Bossart <[email protected]>
  parent: John Naylor <[email protected]>
  0 siblings, 0 replies; 73+ messages in thread

From: Nathan Bossart @ 2026-07-06 16:40 UTC (permalink / raw)
  To: John Naylor <[email protected]>; +Cc: pgsql-hackers

Committed.

-- 
nathan






^ permalink  raw  reply  [nested|flat] 73+ messages in thread


end of thread, other threads:[~2026-07-06 16:40 UTC | newest]

Thread overview: 73+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 15:14 [PATCH 9/9] reuse existing variable by overwriting it Álvaro Herrera <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:30 [PATCH v1 1/1] remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 00:32 remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>
2026-07-02 05:28 ` Re: remove switch statement in vector8_shift_{left,right} John Naylor <[email protected]>
2026-07-06 16:40   ` Re: remove switch statement in vector8_shift_{left,right} Nathan Bossart <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox