[libclc] [libclc] Refine __clc_fp*_subnormals_supported and __clc_flush_denormal_if_not_supported (PR #157633)

Wenju He via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 2 23:00:03 PDT 2025


================
@@ -127,9 +127,9 @@ _CLC_DEF _CLC_OVERLOAD float __clc_sw_fma(float a, float b, float c) {
     return c;
   }
 
-  a = __clc_flush_denormal_if_not_supported(a);
-  b = __clc_flush_denormal_if_not_supported(b);
-  c = __clc_flush_denormal_if_not_supported(c);
+  a = __clc_soft_flush_denormal(a);
+  b = __clc_soft_flush_denormal(b);
+  c = __clc_soft_flush_denormal(c);
----------------
wenju-he wrote:

> Unconditionally forcing flush of denormals is not desirable. In this context I'm not sure why it's trying to flush in the first place.
> 
> The below code extracting the exponent can be replaced with frexp, and the return c on the above paths is missing a canonicalize.
> 
> But on a deeper level I don't think libclc should be trying to provide a software FMA implementation in the first place; that's a decision for the compiler when codegening llvm.fma, surely compiler-rt already has an implementation?

Deleted clc_sw_fma in https://github.com/llvm/llvm-project/pull/157633/commits/7b290a24e3662f203160e8df33421eb3928dd475

Now clc_fma is implemented with __builtin_elementwise_fma

https://github.com/llvm/llvm-project/pull/157633


More information about the cfe-commits mailing list