diff options
author | Kenneth Heafield <github@kheafield.com> | 2020-04-24 02:39:10 +0300 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2020-04-24 02:39:10 +0300 |
commit | cceddf2df1a366e14aa49cb3c46c3294c9c57489 (patch) | |
tree | 8a6da88b6d9e31bd1a9fc5ec929e4b20f9d00943 | |
parent | d73a47adc6e0ac88b10e127df7e083bf3bb6c46b (diff) |
Silence compiler warnings on 1<< overflow
-rw-r--r-- | tile/access.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tile/access.h b/tile/access.h index 535a873..e8e09e5 100644 --- a/tile/access.h +++ b/tile/access.h @@ -65,7 +65,9 @@ template <class T> class RowMajorAccess { __m512i offsets = Offsets<B_cols, B_cols - ColRemain>(); // We might be at the end of the data, in which case a mask is needed. constexpr Index remaining = (A_rows - 1) * B_cols + ColRemain; - _mm512_mask_i32scatter_epi32(data_ - (B_cols - ColRemain), static_cast<__mmask16>(1 << remaining) - 1, offsets, *from, sizeof(int32_t)); + // Compilers seem to complain a lot about shifting past the end :-( + constexpr __mmask16 mask = (remaining >= 16) ? 0xffff : (static_cast<__mmask16>(1 << remaining) - 1); + _mm512_mask_i32scatter_epi32(data_ - (B_cols - ColRemain), mask, offsets, *from, sizeof(int32_t)); // We just wrote 16 values: ColRemain, the next row (all or partial), possibly the next etc. // 16 - ColRemain of the next row and whatever followed. constexpr Index Wrote = ((remaining < 16) ? remaining : 16); |