[libclc] libclc: Use fma and simplify inf handling in half hypot (PR #211362)
Jay Foad via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 23 04:09:08 PDT 2026
================
@@ -47,11 +47,9 @@ _CLC_OVERLOAD _CLC_DEF _CLC_CONST __CLC_GENTYPE __clc_hypot(__CLC_GENTYPE x,
__CLC_GENTYPE y) {
__CLC_FLOATN fx = __CLC_CONVERT_FLOATN(x);
__CLC_FLOATN fy = __CLC_CONVERT_FLOATN(y);
- __CLC_FLOATN d2 = __clc_mad(fx, fx, fy * fy);
+ __CLC_FLOATN d2 = __clc_fma(fx, fx, fy * fy);
----------------
jayfoad wrote:
This should not make any difference numerically since both args are half converted to float, the result of the multiply part will be exact as a float, so there is no intermediate rounding to worry about. I guess this is better on targets that have no mad and worse on targets that have no fma?
https://github.com/llvm/llvm-project/pull/211362
More information about the cfe-commits
mailing list