https://github.com/c8ef closed https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hubert-reinterpretcast wrote:
A problem with the current patch is that it does not evaluate, even in constant
expression contexts, cases that require rounding:
```cpp
extern constexpr float onepluszeroeps = __builtin_fmaf(__FLT_EPSILON__, .0f,
1.f);
extern constexpr float oneplushalfeps = __bui
https://github.com/hubert-reinterpretcast commented:
Needs tests for rounding cases and observance of rounding modes.
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bi
@@ -549,6 +562,22 @@ static bool interp__builtin_fpclassify(InterpState &S,
CodePtr OpPC,
return true;
}
+static bool interp__builtin_fma(InterpState &S, CodePtr OpPC,
+const InterpFrame *Frame, const Function *Func,
+
@@ -549,6 +562,22 @@ static bool interp__builtin_fpclassify(InterpState &S,
CodePtr OpPC,
return true;
}
+static bool interp__builtin_fma(InterpState &S, CodePtr OpPC,
+const InterpFrame *Frame, const Function *Func,
+
AaronBallman wrote:
> I suspect fma is not one of the functions we want to try to share, at least
> not short-term. It's one of the core IEEE operations, LLVM has
> APFloat::fusedMultiplyAdd since forever, and there's probably some weirdness
> with dependencies if we try to share it because ot
@@ -549,6 +562,22 @@ static bool interp__builtin_fpclassify(InterpState &S,
CodePtr OpPC,
return true;
}
+static bool interp__builtin_fma(InterpState &S, CodePtr OpPC,
+const InterpFrame *Frame, const Function *Func,
+
efriedma-quic wrote:
I suspect fma is not one of the functions we want to try to share, at least not
short-term. It's one of the core IEEE operations, LLVM has
APFloat::fusedMultiplyAdd since forever, and there's probably some weirdness
with dependencies if we try to share it because other op
lntue wrote:
> I've created an issue for planning out the LLVM-libc + clang code sharing
> (#114109). That being said I think FMA might be fine to implement within
> clang, due to its simplicity. Additionally, LLVM-libc may call
> `__builtin_fma`:
> https://github.com/llvm/llvm-project/blob/m
@@ -549,6 +562,22 @@ static bool interp__builtin_fpclassify(InterpState &S,
CodePtr OpPC,
return true;
}
+static bool interp__builtin_fma(InterpState &S, CodePtr OpPC,
+const InterpFrame *Frame, const Function *Func,
+
michaelrj-google wrote:
I've created an issue for planning out the LLVM-libc + clang code sharing
(https://github.com/llvm/llvm-project/issues/114109). That being said I think
FMA might be fine to implement within clang, due to its simplicity.
Additionally, LLVM-libc may call `__builtin_fma`:
AaronBallman wrote:
Given the massive amount of effort it takes to implement constant expression
floating-point math and the various edge cases it involves, I think the goal is
for Clang to share as much code with llvm-libc as possible because they have to
implement all the same logic anyway.
c8ef wrote:
Hi @cor3ntin @tbaederr, since @hubert-reinterpretcast is unavailable for
review, could you please help me find someone else who is capable and available
to review this? Thank you!
https://github.com/llvm/llvm-project/pull/113020
___
cfe-c
cor3ntin wrote:
I am waiting for Hubert as I don't trust my knowledge of floating points to
offer meaningful feedback here, sorry
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.ll
tbaederr wrote:
Ping @cor3ntin since he mentioned on Discord that he's available for reviews
this week :)
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/l
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/113020
>From 93c625ad60fc834e72df667addc6eec83247fc8c Mon Sep 17 00:00:00 2001
From: c8ef
Date: Sat, 19 Oct 2024 03:45:17 +
Subject: [PATCH 1/3] constexpr fma
---
clang/docs/ReleaseNotes.rst | 1 +
philnik777 wrote:
Sorry, I don't feel qualified to approve this.
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
c8ef wrote:
Friendly ping~ @cor3ntin @hubert-reinterpretcast @tbaederr @philnik777
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
c8ef wrote:
Actually, my reason for this patch is not necessarily related to libc++, but
more about #51787. This issue requires the implementation of constexpr vector
builtins. After some attempts, I found that some scalar versions of them cannot
be used in a constexpr context. Therefore, I de
philnik777 wrote:
Ah, it's #88978
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
philnik777 wrote:
This is definitely a requirement to implement this, but we also have to make
the non-`__builtin_`-prefixed versions `constexpr`, since libc++ doesn't
control their definitions. I'm pretty sure there was a PR that does this for
some math function, but I can't find it right now
c8ef wrote:
Dear reviewers, would you please take another look? @tbaederr @philnik777
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/113020
>From 93c625ad60fc834e72df667addc6eec83247fc8c Mon Sep 17 00:00:00 2001
From: c8ef
Date: Sat, 19 Oct 2024 03:45:17 +
Subject: [PATCH 1/3] constexpr fma
---
clang/docs/ReleaseNotes.rst | 1 +
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/113020
>From 93c625ad60fc834e72df667addc6eec83247fc8c Mon Sep 17 00:00:00 2001
From: c8ef
Date: Sat, 19 Oct 2024 03:45:17 +
Subject: [PATCH 1/3] constexpr fma
---
clang/docs/ReleaseNotes.rst | 1 +
@@ -15314,6 +15314,22 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr
*E) {
Result.changeSign();
return true;
+ case Builtin::BI__builtin_fma:
+ case Builtin::BI__builtin_fmaf:
+ case Builtin::BI__builtin_fmal:
+ case Builtin::BI__builtin_fmaf128: {
+
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/113020
>From 93c625ad60fc834e72df667addc6eec83247fc8c Mon Sep 17 00:00:00 2001
From: c8ef
Date: Sat, 19 Oct 2024 03:45:17 +
Subject: [PATCH 1/2] constexpr fma
---
clang/docs/ReleaseNotes.rst | 1 +
@@ -15314,6 +15314,22 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr
*E) {
Result.changeSign();
return true;
+ case Builtin::BI__builtin_fma:
+ case Builtin::BI__builtin_fmaf:
+ case Builtin::BI__builtin_fmal:
+ case Builtin::BI__builtin_fmaf128: {
+
c8ef wrote:
I'm not sure why there are noises in the Windows CI, as they seem unrelated.
The Linux CI is working as expected.
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.o
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: None (c8ef)
Changes
According to [P0533R9](https://wg21.link/P0533R9), the C++ standard library
functions `fma` are now `constexpr`:
```c++
constexpr floating-point-type fma(floating-point-type x, floating-point-type
y,
https://github.com/c8ef ready_for_review
https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/c8ef edited https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/c8ef edited https://github.com/llvm/llvm-project/pull/113020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
32 matches
Mail list logo