From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D7C73858C83; Mon, 7 Feb 2022 05:41:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D7C73858C83 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104371] [x86] Failure to use optimize pxor+pcmpeqb+pmovmskb+cmp 0xFFFF pattern to ptest Date: Mon, 07 Feb 2022 05:41:22 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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, 07 Feb 2022 05:41:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104371 --- Comment #5 from Hongtao.liu --- (In reply to Richard Biener from comment #1) > [local count: 1073741824]: > _2 =3D VIEW_CONVERT_EXPR<__v16qi>(x_3(D)); > _6 =3D _2 =3D=3D { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; > _7 =3D VIEW_CONVERT_EXPR(_6); > _4 =3D __builtin_ia32_pmovmskb128 (_7); > _5 =3D _4 =3D=3D 65535; > return _5; >=20 > so likely one reason is the builtin and later UNSPEC for the movemask > operation. >=20 Under AVX512BW & AVX512VL we can fold __builtin_ia32_pmovmskb128 to=20 vector(16) temp_1 =3D _7 < { 0, 0, 0, 0, 0, 0, 0, 0, 0, = 0, 0, 0, 0, 0, 0, 0 } temp_2 =3D VIEW_CONVERT_EXPR temp_1; ----- ???? _4 =3D zero_extend temp_2; but I'm not sure if VIEW_CONVERT_EXPR can be used between vector and integer type.=