The problem should be fixed after my value range patches being accepted.
[PATCH-1v3] Value Range: Add range op for builtin isinf
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653096.html
[PATCH-2v4] Value Range: Add range op for builtin isfinite
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653094.html
[PATCH-3v2] Value Range: Add range op for builtin isnormal
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653095.html



在 2024/6/29 9:35, Vineet Gupta 写道:
> 
> 
> On 6/28/24 17:53, Vineet Gupta wrote:
>> Currently isfinite and isnormal use float compare instructions with fp
>> flags save/restored around them. Our perf team complained this could be
>> costly in uarch. RV Base ISA already has FCLASS.{d,s,h} instruction to
>> do FP compares w/o disturbing FP exception flags.
>>
>> Coincidently, upstream ijust few days back got support for the
>> corresponding optabs. All that is needed is to wire these up in the
>> backend.
>>
>> I was also hoping to get __builtin_inf() done but unforutnately it
>> requires little more rtl foo/bar to implement a tri-modal return.
>>
>> Currently going thru CI testing.
> 
> My local testing spotted one additional failure.
> 
> FAIL: g++.dg/opt/pr107569.C  -std=gnu++20  scan-tree-dump-times vrp1
> "return 1;" 2
> 
> The reason being
> 
> bool
> bar (double x)
> {
>   [[assume (std::isfinite (x))]];
>   return std::isfinite (x);
> }
> 
> generating the new seq
> 
> .LFB4:
>     fclass.d    a0,fa0
>     andi    a0,a0,126
>     snez    a0,a0
>     ret
> 
> vs.
> 
>     li    a0,1
>     ret
> 
> I have a hunch this requires the pending value range patch from Hao Chen
> GUI.
> 
> Thx,
> -Vineet
> 
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653094.html

Reply via email to