[Bug c++/111759] New: __FLT_HAS_INFINITY__ has value 1 even when -ffinite-math-only is used.

2023-10-10 Thread Zahira.Ammarguellat at intel dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111759

Bug ID: 111759
   Summary: __FLT_HAS_INFINITY__ has value 1 even when
-ffinite-math-only is used.
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: Zahira.Ammarguellat at intel dot com
  Target Milestone: ---

Not sure if this is a bug but would like community feedback. 

In https://godbolt.org/z/fqMdqfM7n we see that __FLT_HAS_INFINITY__ is set to 1
even when -ffast-math and -ffinite-math-only are used. Shouldn't this be set to
0 in presence of these options?

In limits header:
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;

That means the value of std::numeric_limits::has_infinity will always be
1 even with -ffast-math and -ffinite-math-only. See
https://godbolt.org/z/M6W6Ejc7W

Is this acceptable?

Any feedback appreciated.
Thanks.

[Bug c/106117] New: Use of option -fexcess-precision for operation-by-operation emulation for _Float16 arithmetics.

2022-06-28 Thread Zahira.Ammarguellat at intel dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106117

Bug ID: 106117
   Summary: Use of option -fexcess-precision for
operation-by-operation emulation for _Float16
arithmetics.
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: Zahira.Ammarguellat at intel dot com
  Target Milestone: ---

We are adding in Clang the support of '_Float16' on X86 targets with SSE2
enabled. 
When the target supports AVX512-FP16, Clang performs '_Float16' arithmetic
using native support. Otherwise, '_Float16' arithmetic is performed by
promoting to 'float', then performing the operation, and finally truncating to
'_Float16'. 

This operation-by-operation emulation is the default in Clang, and is in line
with the C standard's rules for excess precision arithmetic. We would like to
adopt the option '-fexcess-precision' to request this operation-by-operation
emulation by setting '-fexcess-precision=none'. 
First are there any objections in using this option to request
operation-by-operation emulation for '_Float16' arithmetic? 
Second is 'none' the right value to use?
Thanks.