[Bug target/110762] [11/12/13 Regression] inappropriate use of SSE (or AVX) insns for v2sf mode operations

2023-08-25 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110762

Uroš Bizjak  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   Target Milestone|13.3|14.0
 Resolution|--- |FIXED

--- Comment #25 from Uroš Bizjak  ---
Let's keep this patch to gcc-14+. The compiler now sanitizes every partial
vector input to potentially trapping instructions. OTOH, the patch introduced
noticeable runtime regression, so in a follow-up patch (PR110832)
-fno-trapping-math removes sanitization fixups (and the documentation documents
possible issues with assembler and builtins passing non-conformat FP values),
and -m[no-]partial-vector-fp-math option is introduced to completely disable
potentially traping instructions for partial vectors.

So, fixed for gcc-14+.

[Bug target/110762] [11/12/13 Regression] inappropriate use of SSE (or AVX) insns for v2sf mode operations

2023-08-07 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110762

--- Comment #24 from CVS Commits  ---
The master branch has been updated by hongtao Liu :

https://gcc.gnu.org/g:831017d5e72173f2c58e5475b7fcd35ee07a601f

commit r14-3032-g831017d5e72173f2c58e5475b7fcd35ee07a601f
Author: liuhongt 
Date:   Fri Aug 4 15:35:54 2023 +0800

i386: Clear upper bits of XMM register for V4HFmode/V2HFmode operations
[PR110762]

Similar like r14-2786-gade30fad6669e5, the patch is for V4HF/V2HFmode.

gcc/ChangeLog:

PR target/110762
* config/i386/mmx.md (3): Changed from define_insn
to define_expand and break into ..
(v4hf3): .. this.
(divv4hf3): .. this.
(v2hf3): .. this.
(divv2hf3): .. this.
(movd_v2hf_to_sse): New define_expand.
(movq__to_sse): Extend to V4HFmode.
(mmxdoublevecmode): Ditto.
(V2FI_V4HF): New mode iterator.
* config/i386/sse.md (*vec_concatv4sf): Extend to hanlde V8HF
by using mode iterator V4SF_V8HF, renamed to ..
(*vec_concat): .. this.
(*vec_concatv4sf_0): Extend to handle V8HF by using mode
iterator V4SF_V8HF, renamed to ..
(*vec_concat_0): .. this.
(*vec_concatv8hf_movss): New define_insn.
(V4SF_V8HF): New mode iterator.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr110762-v4hf.c: New test.

[Bug target/110762] [11/12/13 Regression] inappropriate use of SSE (or AVX) insns for v2sf mode operations

2023-07-31 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110762

--- Comment #23 from Hongtao.liu  ---
(In reply to Uroš Bizjak from comment #22)
> It looks to me that partial vector half-float instructions have the same
> issue.

Yes, I'll take a look.

[Bug target/110762] [11/12/13 Regression] inappropriate use of SSE (or AVX) insns for v2sf mode operations

2023-07-31 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110762

--- Comment #22 from Uroš Bizjak  ---
It looks to me that partial vector half-float instructions have the same issue.

[Bug target/110762] [11/12/13 Regression] inappropriate use of SSE (or AVX) insns for v2sf mode operations

2023-07-28 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110762

Uroš Bizjak  changed:

   What|Removed |Added

 CC|uros at gcc dot gnu.org|
   Target Milestone|11.5|13.3

--- Comment #21 from Uroš Bizjak  ---
(In reply to Richard Biener from comment #20)
> Thanks a lot.  So this should now be fully fixed in GCC 14.  The original
> testcase is also broken in GCC 11, 12 and 13 but not 10, but I'm not sure
> how far we'd want to backport this change - I'd consider the 13 branch but
> that's probably it.  After some time soaking, that is.

The issue can be triggered only with a specially crafted code (such as the one
in Comment #0 / Comment #12) that deliberatelly exposes the problem. Otherwise,
the approach from PR 95046 is quite robust, and there have been no PRs in this
area reported, although V2SF is auto-vectorized by default.

The patch is written in such a way to minimize exposure to subregs (the
temporary V4SFmode output register is used and later copied via subreg to
target V2SFmode operand) to avoid eventual problems in RA. GCC 13.2 was just
released, so I think the patch could be backported to gcc-13 branch in the
first week of august, but as you propose, only to gcc-13 branch, and not any
further.

[Bug target/110762] [11/12/13 Regression] inappropriate use of SSE (or AVX) insns for v2sf mode operations

2023-07-28 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110762

Richard Biener  changed:

   What|Removed |Added

  Known to work||14.0
   Target Milestone|--- |11.5
Summary|inappropriate use of SSE|[11/12/13 Regression]
   |(or AVX) insns for v2sf |inappropriate use of SSE
   |mode operations |(or AVX) insns for v2sf
   ||mode operations

--- Comment #20 from Richard Biener  ---
Thanks a lot.  So this should now be fully fixed in GCC 14.  The original
testcase is also broken in GCC 11, 12 and 13 but not 10, but I'm not sure
how far we'd want to backport this change - I'd consider the 13 branch but
that's probably it.  After some time soaking, that is.