public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68125] New: std::sqrt prevent use of associative math
@ 2015-10-28  6:57 vincenzo.innocente at cern dot ch
  2015-10-28  7:35 ` [Bug c++/68125] " vincenzo.innocente at cern dot ch
  2015-10-28  8:43 ` vincenzo.innocente at cern dot ch
  0 siblings, 2 replies; 3+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2015-10-28  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68125
           Summary: std::sqrt prevent use of associative math
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

with -Ofast

the code generated differs
float rsqrt1(float a, float x, float y) {
   return a/std::sqrt(x)/std::sqrt(y);
}

float rsqrt2(float a, float x, float y) {
   return a/sqrtf(x)/sqrtf(y);
}

rsqrt1(float, float, float):
        sqrtss  %xmm2, %xmm2
        sqrtss  %xmm1, %xmm1
        mulss   %xmm2, %xmm1
        divss   %xmm1, %xmm0
        ret
rsqrt2(float, float, float):
        mulss   %xmm1, %xmm2
        rsqrtss %xmm2, %xmm1
        mulss   %xmm1, %xmm2
        mulss   %xmm1, %xmm2
        mulss   .LC9(%rip), %xmm1
        addss   .LC8(%rip), %xmm2
        mulss   %xmm1, %xmm2
        mulss   %xmm2, %xmm0
        ret


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

* [Bug c++/68125] std::sqrt prevent use of associative math
  2015-10-28  6:57 [Bug c++/68125] New: std::sqrt prevent use of associative math vincenzo.innocente at cern dot ch
@ 2015-10-28  7:35 ` vincenzo.innocente at cern dot ch
  2015-10-28  8:43 ` vincenzo.innocente at cern dot ch
  1 sibling, 0 replies; 3+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2015-10-28  7:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
Thanks Marc for the fast check
I am still with
gcc version 6.0.0 20150801 (experimental) [trunk revision 226463] (GCC) 
will update and verify


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

* [Bug c++/68125] std::sqrt prevent use of associative math
  2015-10-28  6:57 [Bug c++/68125] New: std::sqrt prevent use of associative math vincenzo.innocente at cern dot ch
  2015-10-28  7:35 ` [Bug c++/68125] " vincenzo.innocente at cern dot ch
@ 2015-10-28  8:43 ` vincenzo.innocente at cern dot ch
  1 sibling, 0 replies; 3+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2015-10-28  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
confirmed fixed in
gcc version 6.0.0 20151028 (experimental) [trunk revision 229474] (GCC) 
still generated code is NOT identical
__Z6rsqrt1fff:
LFB230:
        mulss   %xmm1, %xmm2
        rsqrtss %xmm2, %xmm3
        mulss   %xmm3, %xmm2
        movaps  %xmm2, %xmm1
        mulss   %xmm3, %xmm1
        addss   LC0(%rip), %xmm1
        mulss   LC1(%rip), %xmm3
        mulss   %xmm3, %xmm1
        mulss   %xmm1, %xmm0
        ret
LFE230:
        .align 4,0x90
        .globl __Z6rsqrt2fff
__Z6rsqrt2fff:
LFB228:
        mulss   %xmm2, %xmm1
        rsqrtss %xmm1, %xmm2
        mulss   %xmm2, %xmm1
        mulss   %xmm2, %xmm1
        addss   LC0(%rip), %xmm1
        mulss   LC1(%rip), %xmm2
        mulss   %xmm2, %xmm1
        mulss   %xmm1, %xmm0
        ret
LF


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

end of thread, other threads:[~2015-10-28  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28  6:57 [Bug c++/68125] New: std::sqrt prevent use of associative math vincenzo.innocente at cern dot ch
2015-10-28  7:35 ` [Bug c++/68125] " vincenzo.innocente at cern dot ch
2015-10-28  8:43 ` 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).