[libclc] [libclc] Produce subnormal results for fmod on FP32 (PR #215768)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 03:20:32 PDT 2026


Lurie97 wrote:

Thanks @arsenm, I have tried https://github.com/llvm/llvm-project/pull/222369.
It does fix the flush-to-zero issue, but CTS math_brute_force fmod still fails on our device (i.MX95 Mali-G310,
Panfrost/Rusticl, CL_FP_DENORM): six fp32 points where x is subnormal and y is normal now return NaN instead of x.
e.g.

  fmod(-0x1.26e13p-128, -0x1.2afc64p+16) -> nan, expected -0x1.26e13p-128

The reduction is fine; the NaN comes from the new edge-case handling, where __clc_isfinite(x) lowers to __builtin_isfpclass and misclassifies subnormals on this target.
I open a PR to fix this issue, https://github.com/llvm/llvm-project/pull/225351
Reduction loop is untouched, only the classification goes back to plain bit arithmetic (+15/-8), so the instruction
count win is kept.
Could you help to take a look please? And this PR I will close.

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


More information about the cfe-commits mailing list