From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 567DC3858428; Mon, 6 Sep 2021 05:24:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 567DC3858428 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/88473] AVX512: constant folding on mask does not remove unnecessary instructions Date: Mon, 06 Sep 2021 05:24:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 8.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 05:24:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88473 --- Comment #9 from Hongtao.liu --- (In reply to Hongtao.liu from comment #8) > (In reply to Andrew Pinski from comment #7) > > The UNSPEC_MASKOP ones are still there. > >=20 > > PR 93885 is the same issue. >=20 > void test(void* data, void* data2) > { > __m128i v =3D _mm_load_si128((__m128i const*)data); > __mmask8 m =3D _mm_testn_epi16_mask(v, v); > m =3D m | 0x0f; > m =3D m | 0xf0; > v =3D _mm_maskz_add_epi16(m, v, v); > _mm_store_si128((__m128i*)data2, v); > } >=20 > Should be ok. >=20 > 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=