[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2021-07-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

Andrew Pinski  changed:

   What|Removed |Added

 CC||mathias at gaunard dot com

--- Comment #8 from Andrew Pinski  ---
*** Bug 57057 has been marked as a duplicate of this bug. ***

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-22 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

Uroš Bizjak  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |6.3

--- Comment #7 from Uroš Bizjak  ---
Fixed for gcc-6.3+.

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-22 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

--- Comment #6 from uros at gcc dot gnu.org ---
Author: uros
Date: Mon Aug 22 20:42:03 2016
New Revision: 239674

URL: https://gcc.gnu.org/viewcvs?rev=239674=gcc=rev
Log:
Backport from mainline
2016-08-15  Uros Bizjak  

PR target/72867
* config/i386/sse.md (3):
Emit ieee_3
for !flag_finite_math_only or flag_signed_zeros.
(*3): Rename from
*3_finite.  Do not
depend on flag_finite_math_only.
(ieee_3):
New insn pattern.
(*3): Remove.
(*ieee_smin3): Ditto.
(*ieee_smax3): Ditto.
* config/i386/mmx.md (mmx_v2sf3): Emit
mmx_ieee_v2sf3 for !flag_finite_math_only or
flag_signed_zeros.
(*mmx_v2sf3): Rename from *mmx_v2sf3_finite.  Do not
depend on flag_finite_math_only.
(mmx_ieee_v2sf3): New insn pattern.
(*mmx_v2sf3): Remove.
* config/i386/subst.md (round_saeonly_mask_arg3): New subst attribute.
* config/i386/i386.c (ix86_expand_sse_fp_mimnax): Check
flag_signed_zeros instead of !flag_unsafe_math_optimizations.

testsuite/ChangeLog:

Backport from mainline
2016-08-16  Jakub Jelinek  

PR target/72867
* gcc.target/i386/pr72867.c: Add -msse to dg-options.

Backport from mainline
2016-08-15  Uros Bizjak  

PR target/72867
* gcc.target/i386/pr72867.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/pr72867.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/i386/i386.c
branches/gcc-6-branch/gcc/config/i386/i386.md
branches/gcc-6-branch/gcc/config/i386/mmx.md
branches/gcc-6-branch/gcc/config/i386/sse.md
branches/gcc-6-branch/gcc/config/i386/subst.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Tue Aug 16 16:23:46 2016
New Revision: 239505

URL: https://gcc.gnu.org/viewcvs?rev=239505=gcc=rev
Log:
PR target/72867
* gcc.target/i386/pr72867.c: Add -msse to dg-options.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/i386/pr72867.c

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-15 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

--- Comment #4 from uros at gcc dot gnu.org ---
Author: uros
Date: Mon Aug 15 18:46:53 2016
New Revision: 239487

URL: https://gcc.gnu.org/viewcvs?rev=239487=gcc=rev
Log:
PR target/72867
* config/i386/sse.md (3):
Emit ieee_3
for !flag_finite_math_only or flag_signed_zeros.
(*3): Rename from
*3_finite.  Do not
depend on flag_finite_math_only.
(ieee_3):
New insn pattern.
(*3): Remove.
(*ieee_smin3): Ditto.
(*ieee_smax3): Ditto.
* config/i386/mmx.md (mmx_v2sf3): Emit
mmx_ieee_v2sf3 for !flag_finite_math_only or
flag_signed_zeros.
(*mmx_v2sf3): Rename from *mmx_v2sf3_finite.  Do not
depend on flag_finite_math_only.
(mmx_ieee_v2sf3): New insn pattern.
(*mmx_v2sf3): Remove.
* config/i386/subst.md (round_saeonly_mask_arg3): New subst attribute.
* config/i386/i386.c (ix86_expand_sse_fp_mimnax): Check
flag_signed_zeros instead of !flag_unsafe_math_optimizations.

testsuite/ChangeLog:

PR target/72867
* gcc.target/i386/pr72867.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr72867.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.md
trunk/gcc/config/i386/mmx.md
trunk/gcc/config/i386/sse.md
trunk/gcc/config/i386/subst.md
trunk/gcc/testsuite/ChangeLog

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-14 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

Uroš Bizjak  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-08-14
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com
 Ever confirmed|0   |1

--- Comment #3 from Uroš Bizjak  ---
Created attachment 39435
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39435=edit
Proposed patch

I'm testing the attached patch.

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-11 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

--- Comment #2 from Uroš Bizjak  ---
(In reply to Jakub Jelinek from comment #1)
> So shall we use the UNSPEC_IEEE_MIN/MAX patterns instead of the max/min RTL
> for the non-fast-math case?  Either generate those unspecs in the expanders
> if honoring nans or signed zeros, or use different expanders for the
> intrinsics that do that?
> 
> There is:
> ;; ??? For !flag_finite_math_only, the representation with SMIN/SMAX
> ;; isn't really correct, as those rtl operators aren't defined when
> ;; applied to NaNs.  Hopefully the optimizers won't get too smart on us.
> comment, as the intrinsics are preserved as md builtin calls during GIMPLE
> and I don't think we have gimple folders for those, it means the RTL
> optimizers are finally smart enough...

Yes, we should take the same approach as in i386.md (the iterators and
attributes for the implementation are already defined in i386.md). IEEE unspecs
with VF iterators are already present in sse.md, so I wonder why they are not
used in the above case.

(Please also note that another instance of SMIN/SMAX patterns is in mmx.md).

[Bug target/72867] SSE/AVX/AVX512: incorrect optimization of VMINPS/VMAXPS at compile time

2016-08-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||kyukhin at gcc dot gnu.org,
   ||uros at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
So shall we use the UNSPEC_IEEE_MIN/MAX patterns instead of the max/min RTL for
the non-fast-math case?  Either generate those unspecs in the expanders if
honoring nans or signed zeros, or use different expanders for the intrinsics
that do that?

There is:
;; ??? For !flag_finite_math_only, the representation with SMIN/SMAX
;; isn't really correct, as those rtl operators aren't defined when
;; applied to NaNs.  Hopefully the optimizers won't get too smart on us.
comment, as the intrinsics are preserved as md builtin calls during GIMPLE and
I don't think we have gimple folders for those, it means the RTL optimizers are
finally smart enough...