From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 90264385E01A; Thu, 26 Mar 2020 15:24:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90264385E01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585236275; bh=f5tuR/HWZ7IguoAqZAWtgVZ6UIWnu/pTFPSmBKpgtFw=; h=From:To:Subject:Date:From; b=tkCzzof6OPjJhs6WsFVY/sv8qj12dt9hRxRjLVhOLniCBdOiPWbPPPZbj7H4az4DI nrF9NfQrdSVVx93S8x5GGsiBWF9TPE8EmqHRInTtSzL4W1mLv1EwBTa2MQY0zVThmV /qdB3v2ajh7DALOlmvwgWno8Ynu2HsnhQlgx1TPI= From: "kretz at kde dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/94343] New: [10 Regression] invalid AVX512VL vpternlogd instruction emitted for -march=knl Date: Thu, 26 Mar 2020 15:24:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kretz at kde dot org 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone cf_gcctarget Message-ID: 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: Thu, 26 Mar 2020 15:24:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94343 Bug ID: 94343 Summary: [10 Regression] invalid AVX512VL vpternlogd instruction emitted for -march=3Dknl Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: missed-optimization, wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kretz at kde dot org Target Milestone: --- Target: i386,x86-64 Test case (`-O1 -march=3Dknl`, cf. https://godbolt.org/z/qQc3Sf): using W [[gnu::vector_size(16)]] =3D long long; using V [[gnu::vector_size(16)]] =3D int; auto f(V a) { return __builtin_ia32_pandn128(reinterpret_cast(~V() ^ a), ~W()); } This emits a XMM variant of `vpternlogd` which requires AVX512VL. But it was supposed to compile for KNL. Besides the bug, there's also a missed optimization here: `~V() ^ a` flips = all bits and pandn flips all bits again. Thus it should compile to a single `re= t` instruction. Note that the variation: auto f(V a) { return ~reinterpret_cast(~V() ^ a) & ~W(); } compiles to vpternlogd xmm0, xmm0, xmm0, 0x55 vpternlogq xmm0, xmm0, xmm0, 0x55 for KNL.=