On Wed, 2022-11-09 at 15:46 +0800, Lulu Cheng wrote:
> There is a paragraph in the explanation information for the compile 
> parameter '-fno-fp-int-builtin-inexact' in the gcc.pdf document:
> 
>      "Do not allow the built-in functions ceil, floor, round and
> trunc, 
> and their float and long double variants,
> 
>      to generate code that raises the “inexact” floating-point
> exception 
> for noninteger arguments.
> 
>      ISO C99 and C11 allow these functions to raise the “inexact” 
> exception, but ISO/IEC TS 18661-1:2014,
> 
>      the C bindings to IEEE 754-2008, as integrated into ISO C2X, does
> not allow these functions to do so."
> 
> So I think the implementation of these functions needs to be confirmed
> again.
> 
> Or am I misinterpreting this description?:-[

You are correct, I'm wrong :(.

This patch breaks:

long x(double d)
{
        return __builtin_ceil(d);
}

The compiler then folds it into __builtin_lceil and produce
ftintrp.l.d $f0,$f0, even if -fno-fp-int-builtin-inexact is used.

I'll revise this patch to limit lceil and lfloor for -ffp-int-builtin-
inexact only.


-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to