[Bug target/88473] AVX512: constant folding on mask does not remove unnecessary instructions

crazylht at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Sep 6 05:24:14 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88473

--- Comment #9 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #8)
> (In reply to Andrew Pinski from comment #7)
> > The UNSPEC_MASKOP ones are still there.
> > 
> > PR 93885 is the same issue.
> 
> void test(void* data, void* data2)
> {
>     __m128i v = _mm_load_si128((__m128i const*)data);
>     __mmask8 m = _mm_testn_epi16_mask(v, v);
>     m = m | 0x0f;
>     m = m | 0xf0;
>     v = _mm_maskz_add_epi16(m, v, v);
>     _mm_store_si128((__m128i*)data2, v);
> }
> 
> Should be ok.
> 
> Currently we rely on RA to choose whether to use mask register or gpr for
> bitwise operation, which means that if we remove UNSPEC_MASKOP, _kor_mask8
> will only generate gpr orb, to ensure the correspondence between intrinsic
> and instruction, UNSPEC_MASKOP is necessary, if the user wants GCC to
> optimize bitwise operation, it is recommended to use bitwise operator
> instead of intrinsic.

Similar for 88476


More information about the Gcc-bugs mailing list