[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread via cfe-commits
c8ef wrote: > Thanks @c8ef - are you OK to add the remaining integer reduction cases next? > Also, please can you also update the LanguageExtensions docs page to mention > that they are constexpr legal? Will do. https://github.com/llvm/llvm-project/pull/116243

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread Simon Pilgrim via cfe-commits
RKSimon wrote: Thanks @c8ef - are you OK to add the remaining integer reduction cases next? Also, please can you also update the LanguageExtensions docs page to mention that they are constexpr legal? https://github.com/llvm/llvm-project/pull/116243 _

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread via cfe-commits
@@ -13528,6 +13528,24 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, return Success(DidOverflow, E); } + case Builtin::BI__builtin_reduce_add: { +APValue Source; +if (!EvaluateAsRValue(Info, E->getArg(0), Source)) + return false; + +

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread via cfe-commits
https://github.com/c8ef closed https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread via cfe-commits
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/116243 >From b2f4d35d33684381648ef6662cf9f943b90e146e Mon Sep 17 00:00:00 2001 From: c8ef Date: Thu, 14 Nov 2024 15:11:00 + Subject: [PATCH 1/4] constexpr reduce_add --- clang/docs/ReleaseNotes.rst |

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread Mariya Podchishchaeva via cfe-commits
@@ -13528,6 +13528,24 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, return Success(DidOverflow, E); } + case Builtin::BI__builtin_reduce_add: { +APValue Source; +if (!EvaluateAsRValue(Info, E->getArg(0), Source)) + return false; + +

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon edited https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-18 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread via cfe-commits
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/116243 >From b2f4d35d33684381648ef6662cf9f943b90e146e Mon Sep 17 00:00:00 2001 From: c8ef Date: Thu, 14 Nov 2024 15:11:00 + Subject: [PATCH 1/3] constexpr reduce_add --- clang/docs/ReleaseNotes.rst |

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread via cfe-commits
c8ef wrote: > This seems reasonable to me - I'd recommend you take a look at the min/max > reductions to see if signed/unsigned can be correctly handled with this > approach. Thank you for your suggestions! Signed integer overflow in C++ is undefined behavior and cannot occur in a constexpr c

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread via cfe-commits
@@ -723,3 +723,9 @@ not within the bounds of the input vectors; index of -1 found at position 0 is n permitted in a constexpr context}} vector4charConst1, vector4charConst2, -1, -1, -1, -1); + +static_assert(__builtin_reduce_add((vector4char){}) == 0);

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread via cfe-commits
https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/116243 >From b2f4d35d33684381648ef6662cf9f943b90e146e Mon Sep 17 00:00:00 2001 From: c8ef Date: Thu, 14 Nov 2024 15:11:00 + Subject: [PATCH 1/2] constexpr reduce_add --- clang/docs/ReleaseNotes.rst |

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread via cfe-commits
@@ -13528,6 +13528,20 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, return Success(DidOverflow, E); } + case Builtin::BI__builtin_reduce_add: { +APValue Source; +if (!EvaluateAsRValue(Info, E->getArg(0), Source)) + return false; + +

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread Simon Pilgrim via cfe-commits
@@ -723,3 +723,9 @@ not within the bounds of the input vectors; index of -1 found at position 0 is n permitted in a constexpr context}} vector4charConst1, vector4charConst2, -1, -1, -1, -1); + +static_assert(__builtin_reduce_add((vector4char){}) == 0);

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon commented: This seems reasonable to me - I'd recommend you take a look at the min/max reductions to see if signed/unsigned can be correctly handled with this approach. https://github.com/llvm/llvm-project/pull/116243 ___ cf

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread Simon Pilgrim via cfe-commits
@@ -13528,6 +13528,20 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, return Success(DidOverflow, E); } + case Builtin::BI__builtin_reduce_add: { +APValue Source; +if (!EvaluateAsRValue(Info, E->getArg(0), Source)) + return false; + +

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-15 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon edited https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-14 Thread via cfe-commits
https://github.com/c8ef ready_for_review https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-14 Thread via cfe-commits
https://github.com/c8ef edited https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (c8ef) Changes Part of #51787. This patch adds constexpr support for the built-in reduce add function. If this is the right way to go, I will add support for other reduce functions in later patches. --- Full diff: https://github.co

[clang] [clang] constexpr built-in reduce add function. (PR #116243)

2024-11-14 Thread via cfe-commits
https://github.com/c8ef edited https://github.com/llvm/llvm-project/pull/116243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits