Lines Matching refs:shuffle
5 #include "src/wasm/simd-shuffle.h"
15 void SimdShuffle::CanonicalizeShuffle(bool inputs_equal, uint8_t* shuffle,
26 if (shuffle[i] < kSimd128Size) {
40 // encountered first. This makes architectural shuffle pattern matching
42 if (shuffle[0] >= kSimd128Size) {
43 // The second operand is used first. Swap inputs and adjust the shuffle.
46 shuffle[i] ^= kSimd128Size;
52 for (int i = 0; i < kSimd128Size; ++i) shuffle[i] &= kSimd128Size - 1;
56 bool SimdShuffle::TryMatchIdentity(const uint8_t* shuffle) {
58 if (shuffle[i] != i) return false;
63 bool SimdShuffle::TryMatch32x4Rotate(const uint8_t* shuffle,
66 bool is_concat = TryMatchConcat(shuffle, &offset);
68 // Since we already have a concat shuffle, we know that the indices goes from:
82 bool SimdShuffle::TryMatch32x4Shuffle(const uint8_t* shuffle,
85 if (shuffle[i * 4] % 4 != 0) return false;
87 if (shuffle[i * 4 + j] - shuffle[i * 4 + j - 1] != 1) return false;
89 shuffle32x4[i] = shuffle[i * 4] / 4;
94 bool SimdShuffle::TryMatch16x8Shuffle(const uint8_t* shuffle,
97 if (shuffle[i * 2] % 2 != 0) return false;
99 if (shuffle[i * 2 + j] - shuffle[i * 2 + j - 1] != 1) return false;
101 shuffle16x8[i] = shuffle[i * 2] / 2;
106 bool SimdShuffle::TryMatchConcat(const uint8_t* shuffle, uint8_t* offset) {
107 // Don't match the identity shuffle (e.g. [0 1 2 ... 15]).
108 uint8_t start = shuffle[0];
110 DCHECK_GT(kSimd128Size, start); // The shuffle should be canonicalized.
114 if ((shuffle[i]) != ((shuffle[i - 1] + 1))) {
115 if (shuffle[i - 1] != 15) return false;
116 if (shuffle[i] % kSimd128Size != 0) return false;
123 bool SimdShuffle::TryMatchBlend(const uint8_t* shuffle) {
125 if ((shuffle[i] & 0xF) != i) return false;
130 uint8_t SimdShuffle::PackShuffle4(uint8_t* shuffle) {
131 return (shuffle[0] & 3) | ((shuffle[1] & 3) << 2) | ((shuffle[2] & 3) << 4) |
132 ((shuffle[3] & 3) << 6);
151 int32_t SimdShuffle::Pack4Lanes(const uint8_t* shuffle) {
155 result |= shuffle[i];
160 void SimdShuffle::Pack16Lanes(uint32_t* dst, const uint8_t* shuffle) {
162 dst[i] = wasm::SimdShuffle::Pack4Lanes(shuffle + (i * 4));
167 std::array<uint8_t, kSimd128Size> shuffle) {
168 return std::all_of(shuffle.begin(), shuffle.end(),