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
* [Bug target/105965] x86: single-element vectors don't have scalar FMA insns used anymore
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 ` crazylht at gmail dot com
2022-06-14 8:40 ` [Bug target/105965] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2022-06-14 8:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Hongtao.liu <crazylht at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |crazylht at gmail dot com
--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
It looks like a regression since GCC9
typedef float v1sf __attribute__((vector_size(4)));
v1sf
foo43 (v1sf a, v1sf b, v1sf c)
{
return a * b + c;
}
gcc9 also don't generate vfmaddXXXss.
pushq %rbp
movq %rdi, %rax
movq %rsp, %rbp
andq $-32, %rsp
vmovss 24(%rbp), %xmm0
vmulss 16(%rbp), %xmm0, %xmm0
vaddss 32(%rbp), %xmm0, %xmm0
vmovss %xmm0, -64(%rsp)
movl -64(%rsp), %edx
movl %edx, (%rdi)
leave
ret
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/105965] [10/11/12/13 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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 ` rguenth at gcc dot gnu.org
2022-06-14 10:53 ` cvs-commit at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-14 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Target Milestone|--- |10.4
Priority|P3 |P2
Status|UNCONFIRMED |ASSIGNED
Summary|x86: single-element vectors |[10/11/12/13 Regression]
|don't have scalar FMA insns |x86: single-element vectors
|used anymore |don't have scalar FMA insns
| |used anymore
Last reconfirmed| |2022-06-14
Ever confirmed|0 |1
Keywords| |missed-optimization
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The widen-mul pass now sees
<bb 2> [local count: 1073741824]:
_8 = VIEW_CONVERT_EXPR<float>(a_3(D));
_9 = VIEW_CONVERT_EXPR<float>(b_4(D));
_10 = _8 * _9;
_1 = {_10};
_11 = VIEW_CONVERT_EXPR<float>(_1);
_12 = VIEW_CONVERT_EXPR<float>(c_5(D));
_13 = _11 + _12;
BIT_FIELD_REF <<retval>, 32, 0> = _13;
return <retval>;
which confuses it. The above is the result from vector lowering which
presumably
sees that V1SFmode isn't supported. In GCC 8 the above is instead
<bb 2> [local count: 1073741825]:
_8 = BIT_FIELD_REF <a_3(D), 32, 0>;
_9 = BIT_FIELD_REF <b_4(D), 32, 0>;
_10 = _8 * _9;
_11 = BIT_FIELD_REF <c_5(D), 32, 0>;
_12 = _10 + _11;
_2 = {_12};
<retval> = _2;
that means we are at least missing a match.pd pattern to simplify
_1 = {_10};
_11 = VIEW_CONVERT_EXPR<float>(_1);
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/105965] [10/11/12/13 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-14 10:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:90467f0ad649d0817f9e034596a0fb85605b55af
commit r13-1085-g90467f0ad649d0817f9e034596a0fb85605b55af
Author: Richard Biener <rguenther@suse.de>
Date: Tue Jun 14 10:59:49 2022 +0200
middle-end/105965 - add missing v_c_e <{ el }> simplification
When we got the simplification of bit-field-ref to view-convert
we lost the ability to detect FMAs since we cannot look through
_1 = {_10};
_11 = VIEW_CONVERT_EXPR<float>(_1);
the following amends the (view_convert CONSTRUCTOR) pattern
to handle this case.
2022-06-14 Richard Biener <rguenther@suse.de>
PR middle-end/105965
* match.pd (view_convert CONSTRUCTOR): Handle single-element
CTOR case.
* gcc.target/i386/pr105965.c: New testcase.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/105965] [10/11/12 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (2 preceding siblings ...)
2022-06-14 10:53 ` cvs-commit at gcc dot gnu.org
@ 2022-06-14 10:53 ` rguenth at gcc dot gnu.org
2022-06-21 1:52 ` [Bug tree-optimization/105965] " pinskia at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-14 10:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12/13 Regression] |[10/11/12 Regression] x86:
|x86: single-element vectors |single-element vectors
|don't have scalar FMA insns |don't have scalar FMA insns
|used anymore |used anymore
Known to work| |13.0
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/105965] [10/11/12 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (3 preceding siblings ...)
2022-06-14 10:53 ` [Bug target/105965] [10/11/12 " rguenth at gcc dot gnu.org
@ 2022-06-21 1:52 ` pinskia at gcc dot gnu.org
2022-06-21 6:59 ` rguenther at suse dot de
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-21 1:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |tree-optimization
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=101540
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> that means we are at least missing a match.pd pattern to simplify
>
> _1 = {_10};
> _11 = VIEW_CONVERT_EXPR<float>(_1);
I had an alternative patch which I had submitted in November:
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585597.html
I never followed up and such. Sorry about that.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/105965] [10/11/12 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (4 preceding siblings ...)
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
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenther at suse dot de @ 2022-06-21 6:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 21 Jun 2022, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
>
> Andrew Pinski <pinskia at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Component|target |tree-optimization
> See Also| |https://gcc.gnu.org/bugzill
> | |a/show_bug.cgi?id=101540
>
> --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #2)
> > that means we are at least missing a match.pd pattern to simplify
> >
> > _1 = {_10};
> > _11 = VIEW_CONVERT_EXPR<float>(_1);
>
> I had an alternative patch which I had submitted in November:
> https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585597.html
>
> I never followed up and such. Sorry about that.
Hmm, that's actually the opposite case where we want a vector type.
But sure, when we replace _1 = {_10} with _1 = V_C_E <..> (_10); then
the V_C_E series should fold away (hopefully ;))
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/105965] [10/11/12 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (5 preceding siblings ...)
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
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/105965] [10/11/12 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (6 preceding siblings ...)
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
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-19 11:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:1fe7321a6ce0dcb05763c8f1850a066824516342
commit r12-8578-g1fe7321a6ce0dcb05763c8f1850a066824516342
Author: Richard Biener <rguenther@suse.de>
Date: Tue Jun 14 10:59:49 2022 +0200
middle-end/105965 - add missing v_c_e <{ el }> simplification
When we got the simplification of bit-field-ref to view-convert
we lost the ability to detect FMAs since we cannot look through
_1 = {_10};
_11 = VIEW_CONVERT_EXPR<float>(_1);
the following amends the (view_convert CONSTRUCTOR) pattern
to handle this case.
2022-06-14 Richard Biener <rguenther@suse.de>
PR middle-end/105965
* match.pd (view_convert CONSTRUCTOR): Handle single-element
CTOR case.
* gcc.target/i386/pr105965.c: New testcase.
(cherry picked from commit 90467f0ad649d0817f9e034596a0fb85605b55af)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/105965] [10/11 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (7 preceding siblings ...)
2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
@ 2022-07-19 11:39 ` rguenth at gcc dot gnu.org
2023-07-07 10:43 ` [Bug tree-optimization/105965] [11 " rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-19 11:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] x86: |[10/11 Regression] x86:
|single-element vectors |single-element vectors
|don't have scalar FMA insns |don't have scalar FMA insns
|used anymore |used anymore
Known to work| |12.1.1
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on the GCC 12 branch as well. I'm not considering to backport further to
the more mature branches.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/105965] [11 Regression] x86: single-element vectors don't have scalar FMA insns used anymore
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
` (8 preceding siblings ...)
2022-07-19 11:39 ` [Bug tree-optimization/105965] [10/11 " rguenth at gcc dot gnu.org
@ 2023-07-07 10:43 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105965
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ 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).