AGENTS.md
This commit is contained in:
parent
087c8b32c3
commit
b701059c8c
7 changed files with 331 additions and 62 deletions
|
|
@ -186,10 +186,17 @@ namespace Crafter {
|
|||
template <std::array<std::uint8_t, Len> ShuffleValues>
|
||||
static consteval bool CheckEpi32Shuffle() {
|
||||
if constexpr (PerLane == 8) {
|
||||
for(std::uint8_t i = 1; i < Len; i+=2) {
|
||||
if(ShuffleValues[i-1] != ShuffleValues[i] - 1) {
|
||||
return false;
|
||||
}
|
||||
// 16-bit lanes move as 32-bit words: every output word has to
|
||||
// take both halves of one source word, in order. The check
|
||||
// used to accept any two consecutive sources, (1, 2) included,
|
||||
// so Shuffle<{{1,2,0}}> on a VectorF16 took the epi32 path and
|
||||
// came out wrong. An odd Len puts the second slot half a word
|
||||
// off, so only Packing 1 can qualify then, and its last lane
|
||||
// has to be a word's low half.
|
||||
if (Len % 2 != 0 && Packing > 1) return false;
|
||||
for (std::uint8_t i = 0; i < Len; i += 2) {
|
||||
if (ShuffleValues[i] % 2 != 0) return false;
|
||||
if (i + 1 < Len && ShuffleValues[i + 1] != ShuffleValues[i] + 1) return false;
|
||||
}
|
||||
}
|
||||
for(std::uint8_t i = 0; i < Len; i++) {
|
||||
|
|
@ -300,9 +307,13 @@ namespace Crafter {
|
|||
|
||||
template <std::array<std::uint8_t, Len> ShuffleValues>
|
||||
static consteval std::uint8_t GetShuffleMaskEpi32() {
|
||||
// One 2-bit field per 32-bit word, four words to the immediate; a
|
||||
// word holds perWord elements, so a 16-bit lane index is halved
|
||||
// (the old shift of 4 * i for halves ran off the 8-bit immediate).
|
||||
constexpr std::uint8_t perWord = 4 / sizeof(T);
|
||||
std::uint8_t mask = 0;
|
||||
for(std::uint8_t i = 0; i < std::min(Len, std::uint8_t(8)); i+=4/sizeof(T)) {
|
||||
mask = mask | (ShuffleValues[i] & 0b11) << (8 / sizeof(T) * i);
|
||||
for (std::uint8_t i = 0; i < std::min<std::uint8_t>(Len, 4 * perWord); i += perWord) {
|
||||
mask = mask | (((ShuffleValues[i] / perWord) & 0b11) << (2 * (i / perWord)));
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue