We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a3a6b2 commit 8a883adCopy full SHA for 8a883ad
1 file changed
crates/core_arch/src/x86/avx2.rs
@@ -4669,6 +4669,16 @@ mod tests {
4669
assert_eq_m256i(r, e);
4670
}
4671
4672
+ #[target_feature(enable = "avx2")]
4673
+ #[cfg_attr(test, assert_instr(vpmaddwd))]
4674
+ unsafe fn test_mm256_madd_epi16_mul_one(mad: __m256i) -> __m256i {
4675
+ // This is a trick used in the adler32 algorithm to get a widening addition. The
4676
+ // multiplication by 1 is trivial, but must not be optimized out because then the vpmaddwd
4677
+ // instruction is no longer selected. The assert_instr verifies that this is the case.
4678
+ let one_v = _mm256_set1_epi16(1);
4679
+ _mm256_madd_epi16(mad, one_v)
4680
+ }
4681
+
4682
#[simd_test(enable = "avx2")]
4683
const fn test_mm256_inserti128_si256() {
4684
let a = _mm256_setr_epi64x(1, 2, 3, 4);
0 commit comments