public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105965] New: x86: single-element vectors don't have scalar FMA insns used anymore
@ 2022-06-14  6:31 jbeulich at suse dot com
  2022-06-14  8:23 ` [Bug target/105965] " crazylht at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jbeulich at suse dot com @ 2022-06-14  6:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

end of thread, other threads:[~2023-07-07 10:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14  6:31 [Bug target/105965] New: x86: single-element vectors don't have scalar FMA insns used anymore jbeulich at suse dot com
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

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).