Skip to content

Commit

Permalink
Merge pull request #2383 from Mousius:revert-gatherindexn
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 699943134
  • Loading branch information
copybara-github committed Nov 25, 2024
2 parents 7e01a07 + 3da3328 commit 2b565e8
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions hwy/ops/generic_ops-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2760,15 +2760,7 @@ template <class D, typename T = TFromD<D>>
HWY_API VFromD<D> GatherIndexN(D d, const T* HWY_RESTRICT base,
VFromD<RebindToSigned<D>> index,
const size_t max_lanes_to_load) {
const RebindToSigned<D> di;
using TI = TFromD<decltype(di)>;
static_assert(sizeof(T) == sizeof(TI), "Index/lane size must match");

VFromD<D> v = Zero(d);
for (size_t i = 0; i < HWY_MIN(MaxLanes(d), max_lanes_to_load); ++i) {
v = InsertLane(v, i, base[ExtractLane(index, i)]);
}
return v;
return GatherIndexNOr(Zero(d), d, base, index, max_lanes_to_load);
}

template <class D, typename T = TFromD<D>>
Expand All @@ -2780,8 +2772,9 @@ HWY_API VFromD<D> GatherIndexNOr(VFromD<D> no, D d, const T* HWY_RESTRICT base,
static_assert(sizeof(T) == sizeof(TI), "Index/lane size must match");

VFromD<D> v = no;
for (size_t i = 0; i < HWY_MIN(MaxLanes(d), max_lanes_to_load); ++i) {
v = InsertLane(v, i, base[ExtractLane(index, i)]);
for (size_t i = 0; i < MaxLanes(d); ++i) {
if (i < max_lanes_to_load)
v = InsertLane(v, i, base[ExtractLane(index, i)]);
}
return v;
}
Expand Down

0 comments on commit 2b565e8

Please sign in to comment.