public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94343] New: [10 Regression] invalid AVX512VL vpternlogd instruction emitted for -march=knl
@ 2020-03-26 15:24 kretz at kde dot org
  2020-03-26 15:39 ` [Bug target/94343] " marxin at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: kretz at kde dot org @ 2020-03-26 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94343
           Summary: [10 Regression] invalid AVX512VL vpternlogd
                    instruction emitted for -march=knl
           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=knl`, cf. https://godbolt.org/z/qQc3Sf):

using W [[gnu::vector_size(16)]] = long long;
using V [[gnu::vector_size(16)]] = int;

auto f(V a) {
    return __builtin_ia32_pandn128(reinterpret_cast<W>(~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 `ret`
instruction. Note that the variation:

auto f(V a) {
    return ~reinterpret_cast<W>(~V() ^ a) & ~W();
}

compiles to

  vpternlogd xmm0, xmm0, xmm0, 0x55
  vpternlogq xmm0, xmm0, xmm0, 0x55

for KNL.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-03-30 16:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 15:24 [Bug target/94343] New: [10 Regression] invalid AVX512VL vpternlogd instruction emitted for -march=knl kretz at kde dot org
2020-03-26 15:39 ` [Bug target/94343] " marxin at gcc dot gnu.org
2020-03-26 15:58 ` jakub at gcc dot gnu.org
2020-03-26 16:34 ` hjl.tools at gmail dot com
2020-03-26 16:41 ` jakub at gcc dot gnu.org
2020-03-26 17:08 ` jakub at gcc dot gnu.org
2020-03-26 17:14 ` hjl.tools at gmail dot com
2020-03-26 17:52 ` jakub at gcc dot gnu.org
2020-03-26 17:59 ` jakub at gcc dot gnu.org
2020-03-26 19:30 ` kretz at kde dot org
2020-03-26 19:44 ` jakub at gcc dot gnu.org
2020-03-27  7:00 ` jbeulich at suse dot com
2020-03-27  7:07 ` jbeulich at suse dot com
2020-03-27  7:31 ` jbeulich at suse dot com
2020-03-27  8:45 ` jakub at gcc dot gnu.org
2020-03-27  9:11 ` jakub at gcc dot gnu.org
2020-03-27  9:17 ` jbeulich at suse dot com
2020-03-27  9:21 ` jakub at gcc dot gnu.org
2020-03-30 16:05 ` cvs-commit at gcc dot gnu.org
2020-03-30 16:06 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).