[llvm] [TTI] Treat `*l` (long double) and `*f128` (_Float128) libcalls the same (PR #148311)
Trevor Gross via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 12 03:10:38 PDT 2025
https://github.com/tgross35 updated https://github.com/llvm/llvm-project/pull/148311
>From a2791cb5f88c64e15894667da4fbe3146841fcde Mon Sep 17 00:00:00 2001
From: Trevor Gross <tmgross at umich.edu>
Date: Fri, 11 Jul 2025 18:20:26 -0400
Subject: [PATCH 1/2] [TTI] Treat `*l` (long double) and `*f128` (_Float128)
libcalls the same
As noted in the preexisting FIXME above this hunk, the logic in this
function is not always accurate. However, the logic for `long double`
and `_Float128` should be approximately the same for these functions
(almost everything requiring a libcall), so it makes sense to treat them
the same.
This is meant to reduce churn in cases where `*l` and `*f128` lowerings
call to the same symbol so can be used interchangeably.
---
.../llvm/Analysis/TargetTransformInfoImpl.h | 37 ++++++++++---------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index ddc8a5eaffa94..bae499d99b092 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -189,27 +189,28 @@ class TargetTransformInfoImplBase {
// These will all likely lower to a single selection DAG node.
// clang-format off
- if (Name == "copysign" || Name == "copysignf" || Name == "copysignl" ||
- Name == "fabs" || Name == "fabsf" || Name == "fabsl" ||
- Name == "fmin" || Name == "fminf" || Name == "fminl" ||
- Name == "fmax" || Name == "fmaxf" || Name == "fmaxl" ||
- Name == "sin" || Name == "sinf" || Name == "sinl" ||
- Name == "cos" || Name == "cosf" || Name == "cosl" ||
- Name == "tan" || Name == "tanf" || Name == "tanl" ||
- Name == "asin" || Name == "asinf" || Name == "asinl" ||
- Name == "acos" || Name == "acosf" || Name == "acosl" ||
- Name == "atan" || Name == "atanf" || Name == "atanl" ||
- Name == "atan2" || Name == "atan2f" || Name == "atan2l"||
- Name == "sinh" || Name == "sinhf" || Name == "sinhl" ||
- Name == "cosh" || Name == "coshf" || Name == "coshl" ||
- Name == "tanh" || Name == "tanhf" || Name == "tanhl" ||
- Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl" ||
- Name == "exp10" || Name == "exp10l" || Name == "exp10f")
+ if (Name == "copysign" || Name == "copysignf" || Name == "copysignl" || Name == "copysignl128" ||
+ Name == "fabs" || Name == "fabsf" || Name == "fabsl" || Name == "fabsl128" ||
+ Name == "fmin" || Name == "fminf" || Name == "fminl" || Name == "fminl128" ||
+ Name == "fmax" || Name == "fmaxf" || Name == "fmaxl" || Name == "fmaxl128" ||
+ Name == "sin" || Name == "sinf" || Name == "sinl" || Name == "sinl128" ||
+ Name == "cos" || Name == "cosf" || Name == "cosl" || Name == "cosl128" ||
+ Name == "tan" || Name == "tanf" || Name == "tanl" || Name == "tanl128" ||
+ Name == "asin" || Name == "asinf" || Name == "asinl" || Name == "asinl128" ||
+ Name == "acos" || Name == "acosf" || Name == "acosl" || Name == "acosl128" ||
+ Name == "atan" || Name == "atanf" || Name == "atanl" || Name == "atanl128" ||
+ Name == "atan2" || Name == "atan2f" || Name == "atan2l"|| Name == "atan2128l"||
+ Name == "sinh" || Name == "sinhf" || Name == "sinhl" || Name == "sinhl128" ||
+ Name == "cosh" || Name == "coshf" || Name == "coshl" || Name == "coshl128" ||
+ Name == "tanh" || Name == "tanhf" || Name == "tanhl" || Name == "tanhl128" ||
+ Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl" || Name == "sqrtl128" ||
+ Name == "exp10" || Name == "exp10f" || Name == "exp10l"|| Name == "exp10f128")
return false;
// clang-format on
// These are all likely to be optimized into something smaller.
- if (Name == "pow" || Name == "powf" || Name == "powl" || Name == "exp2" ||
- Name == "exp2l" || Name == "exp2f" || Name == "floor" ||
+ if (Name == "pow" || Name == "powf" || Name == "powl" ||
+ Name == "powf128" || Name == "exp2" || Name == "exp2f" ||
+ Name == "exp2l" || Name == "powf128" || Name == "floor" ||
Name == "floorf" || Name == "ceil" || Name == "round" ||
Name == "ffs" || Name == "ffsl" || Name == "abs" || Name == "labs" ||
Name == "llabs")
>From e7170c7d0d637916555b36a69622e0d5576e9778 Mon Sep 17 00:00:00 2001
From: Trevor Gross <tmgross at umich.edu>
Date: Sat, 12 Jul 2025 06:10:17 -0400
Subject: [PATCH 2/2] remove duplicate powf128
---
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index bae499d99b092..e18a5fad37045 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -210,10 +210,9 @@ class TargetTransformInfoImplBase {
// These are all likely to be optimized into something smaller.
if (Name == "pow" || Name == "powf" || Name == "powl" ||
Name == "powf128" || Name == "exp2" || Name == "exp2f" ||
- Name == "exp2l" || Name == "powf128" || Name == "floor" ||
- Name == "floorf" || Name == "ceil" || Name == "round" ||
- Name == "ffs" || Name == "ffsl" || Name == "abs" || Name == "labs" ||
- Name == "llabs")
+ Name == "exp2l" || Name == "floor" || Name == "floorf" ||
+ Name == "ceil" || Name == "round" || Name == "ffs" || Name == "ffsl" ||
+ Name == "abs" || Name == "labs" || Name == "llabs")
return false;
return true;
More information about the llvm-commits
mailing list