public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107933] New: std::sqrt complies in intrinsics for float even if --no-builtin  is provided
@ 2022-11-30  9:41 vincenzo.innocente at cern dot ch
  2022-11-30 10:21 ` [Bug c++/107933] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2022-11-30  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107933
           Summary: std::sqrt complies in intrinsics for float even if
                    --no-builtin  is provided
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

on x86_64

float f(float x) { return std::sqrt(x);}
compiles in
sqrtss  xmm0, xmm0
even if --no-builtin is provided
double d(double x) { return std::sqrt(x);}
calls libm as well as

float  fs(float x) { return sqrtf(x);}
double ds(double x) { return sqrt(x);}


see
https://godbolt.org/z/Mhf9hv6ns

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

* [Bug c++/107933] std::sqrt complies in intrinsics for float even if --no-builtin  is provided
  2022-11-30  9:41 [Bug c++/107933] New: std::sqrt complies in intrinsics for float even if --no-builtin is provided vincenzo.innocente at cern dot ch
@ 2022-11-30 10:21 ` redi at gcc dot gnu.org
  2022-11-30 10:22 ` [Bug libstdc++/107933] " redi at gcc dot gnu.org
  2022-11-30 13:07 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-30 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is because std::sqrt(float) uses __builtin_sqrtf and -fno-builtin doesn't
affect direct calls to the __builtin functions.

std::sqrt(double) isn't provided by libstdc++, it is just a using-declaration
for libc's function.

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

* [Bug libstdc++/107933] std::sqrt complies in intrinsics for float even if --no-builtin  is provided
  2022-11-30  9:41 [Bug c++/107933] New: std::sqrt complies in intrinsics for float even if --no-builtin is provided vincenzo.innocente at cern dot ch
  2022-11-30 10:21 ` [Bug c++/107933] " redi at gcc dot gnu.org
@ 2022-11-30 10:22 ` redi at gcc dot gnu.org
  2022-11-30 13:07 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-30 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
  using ::sqrt;

#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
  inline _GLIBCXX_CONSTEXPR float
  sqrt(float __x)
  { return __builtin_sqrtf(__x); }

  inline _GLIBCXX_CONSTEXPR long double
  sqrt(long double __x)
  { return __builtin_sqrtl(__x); }
#endif

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

* [Bug libstdc++/107933] std::sqrt complies in intrinsics for float even if --no-builtin  is provided
  2022-11-30  9:41 [Bug c++/107933] New: std::sqrt complies in intrinsics for float even if --no-builtin is provided vincenzo.innocente at cern dot ch
  2022-11-30 10:21 ` [Bug c++/107933] " redi at gcc dot gnu.org
  2022-11-30 10:22 ` [Bug libstdc++/107933] " redi at gcc dot gnu.org
@ 2022-11-30 13:07 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-30 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-11-30

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The standard library probably shouldn't use __builtin_* (but there's no way to
check for -fno-builtin).

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

end of thread, other threads:[~2022-11-30 13:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30  9:41 [Bug c++/107933] New: std::sqrt complies in intrinsics for float even if --no-builtin is provided vincenzo.innocente at cern dot ch
2022-11-30 10:21 ` [Bug c++/107933] " redi at gcc dot gnu.org
2022-11-30 10:22 ` [Bug libstdc++/107933] " redi at gcc dot gnu.org
2022-11-30 13:07 ` 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).