public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified
@ 2022-06-17  9:17 vincenzo.innocente at cern dot ch
  2022-06-17 11:16 ` [Bug tree-optimization/106012] " ubizjak at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2022-06-17  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106012
           Summary: rsqrtss instruction generated even if -mno-recip
                    specified
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

with option -Ofast -mno-recip rsqrtss instruction is still generated.

https://godbolt.org/z/hGxrG7xPh

inhibiting rsqrtss and rcpss is critical to obtain identical results when
running on INTEL and AMD platforms. Having to inhibit Ofast is clearly a larger
performance penalty.

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

* [Bug tree-optimization/106012] rsqrtss instruction generated even if -mno-recip specified
  2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
@ 2022-06-17 11:16 ` ubizjak at gmail dot com
  2022-06-18 20:20 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2022-06-17 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-06-17
          Component|target                      |tree-optimization
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
recip pass is converting to .RSQRT, target is just expanding what it gets.

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

* [Bug tree-optimization/106012] rsqrtss instruction generated even if -mno-recip specified
  2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
  2022-06-17 11:16 ` [Bug tree-optimization/106012] " ubizjak at gmail dot com
@ 2022-06-18 20:20 ` pinskia at gcc dot gnu.org
  2022-06-19  9:18 ` [Bug tree-optimization/106012] rsqrtps and rcpps instructiona generated even if -fno-reciprocal-math specified vincenzo.innocente at cern dot ch
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-18 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You can use -fno-reciprocal-math if you don't want reciprocal instructions
produced.

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

* [Bug tree-optimization/106012] rsqrtps and rcpps instructiona generated even if -fno-reciprocal-math specified
  2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
  2022-06-17 11:16 ` [Bug tree-optimization/106012] " ubizjak at gmail dot com
  2022-06-18 20:20 ` pinskia at gcc dot gnu.org
@ 2022-06-19  9:18 ` vincenzo.innocente at cern dot ch
  2022-06-20 10:13 ` [Bug target/106012] rsqrtps and rcpps instructions " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2022-06-19  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

vincenzo Innocente <vincenzo.innocente at cern dot ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|rsqrtss instruction         |rsqrtps and rcpps
                   |generated even if           |instructiona generated even
                   |-mno-recip specified        |if -fno-reciprocal-math
                   |                            |specified
             Status|RESOLVED                    |NEW
         Resolution|WONTFIX                     |---

--- Comment #3 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
Thanks for the suggestion.

-fno-reciprocal-math does indeed inhibit scalar reciprocal instructions.

NOT in vectorized loop though.

see

https://godbolt.org/z/9eMb4Tjee

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

* [Bug target/106012] rsqrtps and rcpps instructions generated even if -fno-reciprocal-math specified
  2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2022-06-19  9:18 ` [Bug tree-optimization/106012] rsqrtps and rcpps instructiona generated even if -fno-reciprocal-math specified vincenzo.innocente at cern dot ch
@ 2022-06-20 10:13 ` rguenth at gcc dot gnu.org
  2022-06-20 10:15 ` rguenth at gcc dot gnu.org
  2022-12-20 14:23 ` vincenzo.innocente at cern dot ch
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-20 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
          Component|tree-optimization           |target

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to vincenzo Innocente from comment #3)
> Thanks for the suggestion.
> 
> -fno-reciprocal-math does indeed inhibit scalar reciprocal instructions.
> 
> NOT in vectorized loop though.
> 
> see
> 
> https://godbolt.org/z/9eMb4Tjee

For that you need -mno-recip as well ... (here it's the target expanding
the division).  Maybe the target should take -fno-reciprocal-math as
enabling -mno-recip.

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

* [Bug target/106012] rsqrtps and rcpps instructions generated even if -fno-reciprocal-math specified
  2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2022-06-20 10:13 ` [Bug target/106012] rsqrtps and rcpps instructions " rguenth at gcc dot gnu.org
@ 2022-06-20 10:15 ` rguenth at gcc dot gnu.org
  2022-12-20 14:23 ` vincenzo.innocente at cern dot ch
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-20 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #1)
> recip pass is converting to .RSQRT, target is just expanding what it gets.

But it queries the target for support for RSQRT, but yeah, we lack to ask for
"implicit" vs. "explicit" (via xmm intrinsics), so the target cannot possibly
disable RSQRT expanders I guess.

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

* [Bug target/106012] rsqrtps and rcpps instructions generated even if -fno-reciprocal-math specified
  2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2022-06-20 10:15 ` rguenth at gcc dot gnu.org
@ 2022-12-20 14:23 ` vincenzo.innocente at cern dot ch
  5 siblings, 0 replies; 7+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2022-12-20 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
just to confirm that
-Ofast  -fno-reciprocal-math -mno-recip
seems to inhibit all reciprocals...
https://godbolt.org/z/f4bccb9GP

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

end of thread, other threads:[~2022-12-20 14:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17  9:17 [Bug target/106012] New: rsqrtss instruction generated even if -mno-recip specified vincenzo.innocente at cern dot ch
2022-06-17 11:16 ` [Bug tree-optimization/106012] " ubizjak at gmail dot com
2022-06-18 20:20 ` pinskia at gcc dot gnu.org
2022-06-19  9:18 ` [Bug tree-optimization/106012] rsqrtps and rcpps instructiona generated even if -fno-reciprocal-math specified vincenzo.innocente at cern dot ch
2022-06-20 10:13 ` [Bug target/106012] rsqrtps and rcpps instructions " rguenth at gcc dot gnu.org
2022-06-20 10:15 ` rguenth at gcc dot gnu.org
2022-12-20 14:23 ` vincenzo.innocente at cern dot ch

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