[libclc] libclc: Remove attempt at subnormal flush from trig functions (PR #186424)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 13 08:44:32 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/186424
There's no obligation to flush the result if DAZ. This also
wasn't consistently used in all of the functions, so it doesn't
make much sense to do it only in sin and tan, but not cos.
>From 8bca38b69417b1f39d15ac20aa6dd13c5a237c55 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 13 Mar 2026 11:58:52 +0100
Subject: [PATCH] libclc: Remove attempt at subnormal flush from trig functions
There's no obligation to flush the result if DAZ. This also
wasn't consistently used in all of the functions, so it doesn't
make much sense to do it only in sin and tan, but not cos.
---
libclc/clc/lib/generic/math/clc_sin.inc | 7 +------
libclc/clc/lib/generic/math/clc_tan.inc | 5 +----
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/libclc/clc/lib/generic/math/clc_sin.inc b/libclc/clc/lib/generic/math/clc_sin.inc
index b4f72eb625eb0..2018dcbe927a9 100644
--- a/libclc/clc/lib/generic/math/clc_sin.inc
+++ b/libclc/clc/lib/generic/math/clc_sin.inc
@@ -21,12 +21,7 @@ _CLC_OVERLOAD _CLC_DEF __CLC_FLOATN __clc_sin(__CLC_FLOATN x) {
s = __CLC_AS_FLOATN(__CLC_AS_INTN(s) ^ ((regn > 1) << 31) ^
(__CLC_AS_INTN(x) ^ __CLC_AS_INTN(absx)));
- s = __clc_select(s, __CLC_GENTYPE_NAN, __clc_isnan(x) || __clc_isinf(x));
-
- // Subnormals
- s = x == 0.0f ? x : s;
-
- return s;
+ return __clc_select(s, __CLC_GENTYPE_NAN, __clc_isnan(x) || __clc_isinf(x));
}
#elif __CLC_FPSIZE == 16
diff --git a/libclc/clc/lib/generic/math/clc_tan.inc b/libclc/clc/lib/generic/math/clc_tan.inc
index 8a318a53a34ba..79e36ea07e13c 100644
--- a/libclc/clc/lib/generic/math/clc_tan.inc
+++ b/libclc/clc/lib/generic/math/clc_tan.inc
@@ -18,10 +18,7 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_tan(__CLC_GENTYPE x) {
__CLC_GENTYPE t = __clc_tanf_piby4(r0 + r1, regn);
t = __CLC_AS_GENTYPE(__CLC_AS_UINTN(t) ^ x_signbit);
- t = __clc_select(t, __CLC_GENTYPE_NAN, __clc_isnan(x) || __clc_isinf(x));
- // Take care of subnormals
- t = (x == 0.0f) ? x : t;
- return t;
+ return __clc_select(t, __CLC_GENTYPE_NAN, __clc_isnan(x) || __clc_isinf(x));
}
#elif __CLC_FPSIZE == 64
More information about the cfe-commits
mailing list