[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-11-08 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-31 Thread Hubert Tong via 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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-31 Thread Hubert Tong via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-30 Thread via cfe-commits
@@ -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, +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-30 Thread via cfe-commits
@@ -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, +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-30 Thread Aaron Ballman via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread Andy Kaylor via cfe-commits
@@ -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, +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread Eli Friedman via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread via cfe-commits
@@ -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, +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread Michael Jones via cfe-commits
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`:

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread Aaron Ballman via cfe-commits
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.

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-25 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-23 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-23 Thread Timm Baeder via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-22 Thread via 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 +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-22 Thread Nikolas Klauser via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-22 Thread via 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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-21 Thread via 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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-21 Thread Nikolas Klauser via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-21 Thread Nikolas Klauser via 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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-21 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-19 Thread via 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 +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-19 Thread via 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 +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-19 Thread via cfe-commits
@@ -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: { +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-19 Thread via 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/2] constexpr fma --- clang/docs/ReleaseNotes.rst | 1 +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-19 Thread Timm Baeder via cfe-commits
@@ -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: { +

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-18 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-18 Thread via cfe-commits
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,

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-18 Thread via cfe-commits
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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-18 Thread via 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

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-18 Thread via 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