public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jbeulich at suse dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/105965] New: x86: single-element vectors don't have scalar FMA insns used anymore
Date: Tue, 14 Jun 2022 06:31:26 +0000	[thread overview]
Message-ID: <bug-105965-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105965
           Summary: x86: single-element vectors don't have scalar FMA
                    insns used anymore
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbeulich at suse dot com
  Target Milestone: ---

While this used to work fine up to gcc8, gcc9 and newer use
vmuls[sdh]+vadds[sdh] instead. No similar issue exists when operating on
scalars, or when operating on multi-element vectors not matching any available
register size (so my guess of "target" as the component may not be correct).

This has regressed the test harness of the Xen Project's insn emulator [1],
which no longer exercises any scalar FMA insns because of the compiler not
emitting any. (Note that using intrinsics is not really an option, as the
primary goal is to test insns with memory operands. Yet the intrinsics don't
lend themselves to such because of using 128-bit parameter types.)

The issue is uniform for FMA, FMA4, AVX512F, and AVX512-FP16. It can be easily
seen by compiling

T test(T x, T y, T z) {
        return x * y + z;
}

#define TEST(n) \
typedef T __attribute__((vector_size(n * sizeof(T)))) v##n##_t; \
v##n##_t test##n(v##n##_t x, v##n##_t y, v##n##_t z) { \
        return x * y + z; \
}

TEST(1)
TEST(2)
TEST(4)
TEST(8)
TEST(16)
TEST(32)
TEST(64)

with e.g. "-mfpmath=sse -O3 -c -mfma -DT=float", but obvious other option
combinations similarly demonstrate the issue.

[1] https://xenbits.xen.org/gitweb/?p=xen.git;a=tree;f=tools/tests/x86_emulator

             reply	other threads:[~2022-06-14  6:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14  6:31 jbeulich at suse dot com [this message]
2022-06-14  8:23 ` [Bug target/105965] " crazylht at gmail dot com
2022-06-14  8:40 ` [Bug target/105965] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org
2022-06-14 10:53 ` cvs-commit at gcc dot gnu.org
2022-06-14 10:53 ` [Bug target/105965] [10/11/12 " rguenth at gcc dot gnu.org
2022-06-21  1:52 ` [Bug tree-optimization/105965] " pinskia at gcc dot gnu.org
2022-06-21  6:59 ` rguenther at suse dot de
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
2022-07-19 11:39 ` [Bug tree-optimization/105965] [10/11 " rguenth at gcc dot gnu.org
2023-07-07 10:43 ` [Bug tree-optimization/105965] [11 " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105965-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).