agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH v31 03/11] Allow to prolong life span of transition tables until transaction end
192+ messages / 4 participants
[nested] [flat]
* [PATCH v31 03/11] Allow to prolong life span of transition tables until transaction end
@ 2019-12-20 01:09 Yugo Nagata <[email protected]>
0 siblings, 0 replies; 192+ messages in thread
From: Yugo Nagata @ 2019-12-20 01:09 UTC (permalink / raw)
Originally, tuplestores of AFTER trigger's transition tables were
freed for each query depth. For our IVM implementation, we would like
to prolong life of the tuplestores because we have to preserve them
for a whole query assuming that some base tables might be changed
in some trigger functions.
---
src/backend/commands/trigger.c | 83 ++++++++++++++++++++++++++++++++--
src/include/commands/trigger.h | 2 +
2 files changed, 81 insertions(+), 4 deletions(-)
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 84494c4b81..0424ab9a29 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -3729,6 +3729,10 @@ typedef struct AfterTriggerEventList
* end of the list, so it is relatively easy to discard them. The event
* list chunks themselves are stored in event_cxt.
*
+ * prolonged_tuplestored is a list of transition table tuplestores whose
+ * life are prolonged to the end of the outmost query instead of each nested
+ * query.
+ *
* query_depth is the current depth of nested AfterTriggerBeginQuery calls
* (-1 when the stack is empty).
*
@@ -3794,6 +3798,7 @@ typedef struct AfterTriggersData
SetConstraintState state; /* the active S C state */
AfterTriggerEventList events; /* deferred-event list */
MemoryContext event_cxt; /* memory context for events, if any */
+ List *prolonged_tuplestores; /* list of prolonged tuplestores */
/* per-query-level data: */
AfterTriggersQueryData *query_stack; /* array of structs shown below */
@@ -3829,6 +3834,7 @@ struct AfterTriggersTableData
bool closed; /* true when no longer OK to add tuples */
bool before_trig_done; /* did we already queue BS triggers? */
bool after_trig_done; /* did we already queue AS triggers? */
+ bool prolonged; /* are transition tables prolonged? */
AfterTriggerEventList after_trig_events; /* if so, saved list pointer */
/*
@@ -3878,6 +3884,7 @@ static void TransitionTableAddTuple(EState *estate,
TupleTableSlot *original_insert_tuple,
Tuplestorestate *tuplestore);
static void AfterTriggerFreeQuery(AfterTriggersQueryData *qs);
+static void release_or_prolong_tuplestore(Tuplestorestate *ts, bool prolonged);
static SetConstraintState SetConstraintStateCreate(int numalloc);
static SetConstraintState SetConstraintStateCopy(SetConstraintState origstate);
static SetConstraintState SetConstraintStateAddItem(SetConstraintState state,
@@ -4755,6 +4762,45 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events,
}
+/*
+ * SetTransitionTablePreserved
+ *
+ * Prolong lifespan of transition tables corresponding specified relid and
+ * command type to the end of the outmost query instead of each nested query.
+ * This enables to use nested AFTER trigger's transition tables from outer
+ * query's triggers. Currently, only immediate incremental view maintenance
+ * uses this.
+ */
+void
+SetTransitionTablePreserved(Oid relid, CmdType cmdType)
+{
+ AfterTriggersTableData *table;
+ AfterTriggersQueryData *qs;
+ bool found = false;
+ ListCell *lc;
+
+ /* Check state, like AfterTriggerSaveEvent. */
+ if (afterTriggers.query_depth < 0)
+ elog(ERROR, "SetTransitionTablePreserved() called outside of query");
+
+ qs = &afterTriggers.query_stack[afterTriggers.query_depth];
+
+ foreach(lc, qs->tables)
+ {
+ table = (AfterTriggersTableData *) lfirst(lc);
+ if (table->relid == relid && table->cmdType == cmdType &&
+ table->closed)
+ {
+ table->prolonged = true;
+ found = true;
+ }
+ }
+
+ if (!found)
+ elog(ERROR,"could not find table with OID %d and command type %d", relid, cmdType);
+}
+
+
/*
* GetAfterTriggersTableData
*
@@ -4965,6 +5011,7 @@ AfterTriggerBeginXact(void)
*/
afterTriggers.firing_counter = (CommandId) 1; /* mustn't be 0 */
afterTriggers.query_depth = -1;
+ afterTriggers.prolonged_tuplestores = NIL;
/*
* Verify that there is no leftover state remaining. If these assertions
@@ -5125,19 +5172,19 @@ AfterTriggerFreeQuery(AfterTriggersQueryData *qs)
ts = table->old_upd_tuplestore;
table->old_upd_tuplestore = NULL;
if (ts)
- tuplestore_end(ts);
+ release_or_prolong_tuplestore(ts, table->prolonged);
ts = table->new_upd_tuplestore;
table->new_upd_tuplestore = NULL;
if (ts)
- tuplestore_end(ts);
+ release_or_prolong_tuplestore(ts, table->prolonged);
ts = table->old_del_tuplestore;
table->old_del_tuplestore = NULL;
if (ts)
- tuplestore_end(ts);
+ release_or_prolong_tuplestore(ts, table->prolonged);
ts = table->new_ins_tuplestore;
table->new_ins_tuplestore = NULL;
if (ts)
- tuplestore_end(ts);
+ release_or_prolong_tuplestore(ts, table->prolonged);
if (table->storeslot)
{
TupleTableSlot *slot = table->storeslot;
@@ -5154,6 +5201,34 @@ AfterTriggerFreeQuery(AfterTriggersQueryData *qs)
*/
qs->tables = NIL;
list_free_deep(tables);
+
+ /* Release prolonged tuplestores at the end of the outmost query */
+ if (afterTriggers.query_depth == 0)
+ {
+ foreach(lc, afterTriggers.prolonged_tuplestores)
+ {
+ ts = (Tuplestorestate *) lfirst(lc);
+ if (ts)
+ tuplestore_end(ts);
+ }
+ afterTriggers.prolonged_tuplestores = NIL;
+ }
+}
+
+/*
+ * Release the tuplestore, or append it to the prolonged tuplestores list.
+ */
+static void
+release_or_prolong_tuplestore(Tuplestorestate *ts, bool prolonged)
+{
+ if (prolonged && afterTriggers.query_depth > 0)
+ {
+ MemoryContext oldcxt = MemoryContextSwitchTo(CurTransactionContext);
+ afterTriggers.prolonged_tuplestores = lappend(afterTriggers.prolonged_tuplestores, ts);
+ MemoryContextSwitchTo(oldcxt);
+ }
+ else
+ tuplestore_end(ts);
}
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index cb968d03ec..768d6e1c0b 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -265,6 +265,8 @@ extern void AfterTriggerEndSubXact(bool isCommit);
extern void AfterTriggerSetState(ConstraintsSetStmt *stmt);
extern bool AfterTriggerPendingOnRel(Oid relid);
+extern void SetTransitionTablePreserved(Oid relid, CmdType cmdType);
+
/*
* in utils/adt/ri_triggers.c
--
2.25.1
--Multipart=_Fri__29_Mar_2024_23_47_00_+0900_KGpmmDOIs1266Ib1
Content-Type: text/x-diff;
name="v31-0004-Add-Incremental-View-Maintenance-support-to-pg_d.patch"
Content-Disposition: attachment;
filename="v31-0004-Add-Incremental-View-Maintenance-support-to-pg_d.patch"
Content-Transfer-Encoding: 7bit
^ permalink raw reply [nested|flat] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ messages in thread
* remove switch statement in vector8_shift_{left,right}
@ 2026-07-02 00:32 Nathan Bossart <[email protected]>
0 siblings, 1 reply; 192+ 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] 192+ 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; 192+ 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] 192+ 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; 192+ 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] 192+ messages in thread
end of thread, other threads:[~2026-07-06 16:40 UTC | newest]
Thread overview: 192+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 01:09 [PATCH v31 03/11] Allow to prolong life span of transition tables until transaction end Yugo Nagata <[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: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: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