[libclc] [libclc] Reduce bithacking for INF/NAN values (PR #129738)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 08:20:34 PST 2025
================
@@ -46,9 +46,7 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_hypot(__CLC_GENTYPE x,
__CLC_GENTYPE retval = __clc_sqrt(__clc_mad(fx, fx, fy * fy)) * fx_exp;
retval = (ux > PINFBITPATT_SP32 || uy == 0) ? __CLC_AS_GENTYPE(ux) : retval;
- retval = (ux == PINFBITPATT_SP32 || uy == PINFBITPATT_SP32)
- ? __CLC_AS_GENTYPE((__CLC_UINTN)PINFBITPATT_SP32)
- : retval;
+ retval = __clc_isinf(x) || __clc_isinf(y) ? __CLC_GENTYPE_INF : retval;
----------------
frasercrmck wrote:
Right yeah, I see. Thank you for the explanation.
I'm still pondering the naming of the frexp and ldexp helpers you propose. It's not fully-fledged frexp or ldexp as far as I can tell. If it is, then our implementations of frexp and ldexp are far too complicated. Are we talking about a 'native' frexp and ldexp? A 'fast' one? That's just going on existing OpenCL terminology, which may or may not confuse things. Should they handle NaNs, Infs, subnormals?
https://github.com/llvm/llvm-project/pull/129738
More information about the cfe-commits
mailing list