Skip to content

Commit dfd1bf1

Browse files
committed
added comments on VSX code path
which is still disabled for now.
1 parent eccd082 commit dfd1bf1

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

xxh3.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,9 @@ XXH3_accumulate_512( void* XXH_RESTRICT acc,
558558
}
559559
}
560560

561-
#elif (XXH_VECTOR == XXH_VSX) && 0 /* <=========================== MUST BE UPDATED */
562-
/* note : vsx code path currently not tested in CI (limitation of cross-compiler and/or emulator) */
561+
#elif (XXH_VECTOR == XXH_VSX) && 0 /* <=========================== DISABLED : MUST BE VALIDATED */
562+
/* note : vsx code path currently not tested in CI (limitation of cross-compiler and/or emulator)
563+
* for vsx code path to be shipped and supported, it is critical to create a CI test for it */
563564
U64x2* const xacc = (U64x2*) acc; /* presumed aligned */
564565
U64x2 const* const xdata = (U64x2 const*) data; /* no alignment restriction */
565566
U64x2 const* const xkey = (U64x2 const*) key; /* no alignment restriction */
@@ -571,20 +572,26 @@ XXH3_accumulate_512( void* XXH_RESTRICT acc,
571572
/* key_vec = xkey[i]; */
572573
#ifdef __BIG_ENDIAN__
573574
/* byteswap */
574-
U64x2 const data_vec = vec_revb(vec_vsx_ld(0, xdata + i));
575-
U64x2 const key_vec = vec_revb(vec_vsx_ld(0, xkey + i));
575+
U64x2 const data_vec = vec_revb(vec_vsx_ld(0, xdata + i)); /* note : vec_revb is power9+ */
576+
U64x2 const key_vec = vec_revb(vec_vsx_ld(0, xkey + i)); /* note : vec_revb is power9+ */
576577
#else
577578
U64x2 const data_vec = vec_vsx_ld(0, xdata + i);
578579
U64x2 const key_vec = vec_vsx_ld(0, xkey + i);
579580
#endif
580-
U64x2 data_key = data_vec ^ key_vec;
581+
U64x2 const data_key = data_vec ^ key_vec;
581582
/* shuffled = (data_key << 32) | (data_key >> 32); */
582-
U32x4 shuffled = (U32x4)vec_rl(data_key, v32);
583+
U32x4 const shuffled = (U32x4)vec_rl(data_key, v32);
583584
/* product = ((U64x2)data_key & 0xFFFFFFFF) * ((U64x2)shuffled & 0xFFFFFFFF); */
584-
U64x2 product = XXH_vsxMultOdd((U32x4)data_key, shuffled);
585+
U64x2 const product = XXH_vsxMultOdd((U32x4)data_key, shuffled);
585586

586587
xacc[i] += product;
587-
xacc[i] += data_vec; /* <======================= Incorrect for 128-bit variant (must swap) */
588+
589+
if (accWidth == XXH3_acc_64bits) {
590+
xacc[i] += data_vec;
591+
} else { /* XXH3_acc_128bits */
592+
U64x2 const data_swapped = vec_permi(data_vec, data_vec, 2); /* <===== untested !!! */
593+
xacc[i] += data_swapped;
594+
}
588595
}
589596

590597
#else /* scalar variant of Accumulator - universal */

0 commit comments

Comments
 (0)