https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/155620
>From 131965becbc06c875557a51d48113d52df365f87 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 27 Aug 2025 07:56:44 -0400
Subject: [PATCH 1/5] [clang] Update typechecking of builtin elementwise
t
@@ -2339,68 +2339,88 @@ static bool
interp__builtin_elementwise_maxmin(InterpState &S, CodePtr OpPC,
assert(Call->getNumArgs() == 2);
QualType Arg0Type = Call->getArg(0)->getType();
+ QualType Arg1Type = Call->getArg(1)->getType();
- // TODO: Support floating-point ty
ckoparkar wrote:
Thanks everyone for reviewing :-)
https://github.com/llvm/llvm-project/pull/155620
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -266,6 +266,9 @@ Bug Fixes in This Version
calls another function that requires target features not enabled in the
caller. This
prevents a fatal error in the backend.
- Fixed scope of typedefs present inside a template class. (#GH91451)
+- Builtin elementwise operators
@@ -15884,6 +15884,55 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S,
Expr *LHS, Expr *RHS,
return false;
}
+/// Check if all arguments have the same type. If the types don't match, emit
an
+/// error message and return true. Otherwise return false.
+///
+/// For
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/155620
>From 131965becbc06c875557a51d48113d52df365f87 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 27 Aug 2025 07:56:44 -0400
Subject: [PATCH 1/6] [clang] Update typechecking of builtin elementwise
t
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/155620
>From 131965becbc06c875557a51d48113d52df365f87 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 27 Aug 2025 07:56:44 -0400
Subject: [PATCH 1/2] [clang] Update typechecking of builtin elementwise
t
ckoparkar wrote:
I saw the Linux tests fail at the 7min mark on a lot of other PRs yesterday.
Was waiting for that to be resolved, looks like it's OK now.
https://github.com/llvm/llvm-project/pull/155199
___
cfe-commits mailing list
cfe-commits@lists.
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/155199
>From 799837cedacea2efee26f76e36facf7e8ec5b0a6 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 23 Aug 2025 07:57:38 -0400
Subject: [PATCH] [Headers][X86] Allow AVX512VLBW integer reduction intrins
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/153572
>From 487266d5e53ff7d0aa57c26377c2443bc734b4fd Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH 1/5] [Clang] Enable constexpr handling for builtin element
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/153572
>From 487266d5e53ff7d0aa57c26377c2443bc734b4fd Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH 1/4] [Clang] Enable constexpr handling for builtin element
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S,
CodePtr OpPC,
return true;
}
+static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC,
+const CallExpr *Call,
+
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S,
CodePtr OpPC,
return true;
}
+static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC,
+const CallExpr *Call,
+
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/153572
>From 487266d5e53ff7d0aa57c26377c2443bc734b4fd Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH 1/3] [Clang] Enable constexpr handling for builtin element
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/155199
>From c5cf1b22f92c0c4d41b92ee45ee3f39c845c27be Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 23 Aug 2025 07:57:38 -0400
Subject: [PATCH] [Headers][X86] Allow AVX512VLBW integer reduction intrins
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/155199
>From 981fa7db5cd83b9c8b240e6b116a52592a59617a Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 23 Aug 2025 07:57:38 -0400
Subject: [PATCH] [Headers][X86] Allow AVX512VLBW integer reduction intrins
https://github.com/ckoparkar created
https://github.com/llvm/llvm-project/pull/155199
Fixes #154284
Add constexpr support for the following:
_mm_reduce_add_epi8 _mm_reduce_add_epi16 _mm256_reduce_add_epi8
_mm256_reduce_add_epi16 _mm_reduce_mul_epi8 _mm_reduce_mul_epi16
_mm256_reduce_mul_epi8
@@ -11874,6 +11874,28 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr
*E) {
return Success(APValue(ResultElements.data(), ResultElements.size()), E);
}
+
+ case Builtin::BI__builtin_elementwise_fma: {
+APValue SourceX, SourceY, SourceZ;
+if (!Evaluate
ckoparkar wrote:
The other PRs this required have been merged, this is ready for review again.
https://github.com/llvm/llvm-project/pull/153572
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/153572
>From 487266d5e53ff7d0aa57c26377c2443bc734b4fd Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH 1/2] [Clang] Enable constexpr handling for builtin element
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/153572
>From 487266d5e53ff7d0aa57c26377c2443bc734b4fd Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH 1/2] [Clang] Enable constexpr handling for builtin element
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/153572
>From 487266d5e53ff7d0aa57c26377c2443bc734b4fd Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH 1/2] [Clang] Enable constexpr handling for builtin element
ckoparkar wrote:
The fshl/r builtins also run into the same issue since they're ternary ops as
well. I can confirm that this patch fixes that case as well.
https://github.com/llvm/llvm-project/pull/154941
___
cfe-commits mailing list
cfe-commits@lists
@@ -957,3 +957,6 @@ static_assert(fmaDouble1[0] == 5.0);
static_assert(fmaDouble1[1] == 10.0);
static_assert(fmaDouble1[2] == 17.0);
static_assert(fmaDouble1[3] == 26.0);
+
+constexpr float fmaArray[] = {2.0f, 2.0f, 2.0f, 2.0f};
+constexpr float fmaResult = __builtin_elementwis
@@ -2778,6 +2778,40 @@ static bool interp__builtin_elementwise_fma(InterpState
&S, CodePtr OpPC,
return true;
}
+/// AVX512 predicated move: "Result = Mask[] ? LHS[] : RHS[]".
+static bool interp__builtin_select(InterpState &S, CodePtr OpPC,
+
ckoparkar wrote:
Could you please merge as well?
Thanks everyone for the reviews :-)
https://github.com/llvm/llvm-project/pull/152919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ckoparkar wrote:
@RKSimon Done. Also rebased against main.
I ignored the clang-format warning because the other version looked better IMO,
but I've updated it now.
https://github.com/llvm/llvm-project/pull/152919
___
cfe-commits mailing list
cfe-comm
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From 23185d21b73a60fdc222cbb5b4b2be1eb877ec67 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 20 Aug 2025 08:48:00 -0400
Subject: [PATCH] [clang] Enable constexpr handling for
__builtin_elementw
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From efb51f659b1b76530a6795a6bcb0bb2ef7036436 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 20 Aug 2025 08:48:00 -0400
Subject: [PATCH] [clang] Enable constexpr handling for
__builtin_elementw
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From 6d3acba2796345c56bc3df71d2bc6f6f131395af Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 20 Aug 2025 08:48:00 -0400
Subject: [PATCH] [clang] Enable constexpr handling for
__builtin_elementw
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From c314cb7b2aa3afa9b5e9079d6cfa0526ff7bafc9 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 9 Aug 2025 07:18:20 -0400
Subject: [PATCH] [clang] Enable constexpr handling for
__builtin_elementwi
@@ -11658,6 +11658,29 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr
*E) {
return Success(APValue(ResultElements.data(), ResultElements.size()), E);
}
+ case Builtin::BI__builtin_elementwise_fma: {
+APValue SourceX, SourceY, SourceZ;
+if (!EvaluateAs
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From dcf247bc9da809809e0a048e947f0439a6f004f3 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 9 Aug 2025 07:18:20 -0400
Subject: [PATCH] [clang] Enable constexpr handling for
__builtin_elementwi
https://github.com/ckoparkar deleted
https://github.com/llvm/llvm-project/pull/152919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ckoparkar wrote:
Sounds like the implementation of `fshl/r` looks OK. Let me create another PR
for the ADT changes like kuhar suggested, I'll add the fshl/r functions there.
https://github.com/llvm/llvm-project/pull/153572
___
cfe-commits mailing list
ckoparkar wrote:
> Can you move the ADT changes to a separate PR and add unit tests?
@kuhar Will do. I'll wait for some reviews on the usage of that ADT change to
be sure that it's actually going to be required for this and then create that
separate PR.
https://github.com/llvm/llvm-project/pu
ckoparkar wrote:
/cc @RKSimon @arsenm
https://github.com/llvm/llvm-project/pull/153572
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ckoparkar created
https://github.com/llvm/llvm-project/pull/153572
Fixes #153151.
>From f1d86bdd8bc9453806833bbb45796537e38de2b8 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Wed, 13 Aug 2025 08:13:03 -0400
Subject: [PATCH] [Clang] Enable constexpr handling for bui
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From 24139055908afd5d5f32c2ec975c5d831fa07174 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 9 Aug 2025 07:18:20 -0400
Subject: [PATCH 1/2] [clang] Enable constexpr handling for
__builtin_eleme
@@ -141,6 +141,16 @@ static void diagnoseNonConstexprBuiltin(InterpState &S,
CodePtr OpPC,
S.CCEDiag(Loc, diag::note_invalid_subexpr_in_const_expr);
}
+// Same implementation as Compiler::getRoundingMode.
+static llvm::RoundingMode getRoundingMode(const InterpState &S, co
@@ -11,3 +11,55 @@ float V3 = func_01(1.0F, 2.0F);
// CHECK: @V1 = {{.*}}global float 1.00e+00, align 4
// CHECK: @V2 = {{.*}}global float 1.00e+00, align 4
// CHECK: @V3 = {{.*}}global float 3.00e+00, align 4
+
+void test_builtin_elementwise_fma_round_upward() {
--
@@ -11,3 +11,55 @@ float V3 = func_01(1.0F, 2.0F);
// CHECK: @V1 = {{.*}}global float 1.00e+00, align 4
// CHECK: @V2 = {{.*}}global float 1.00e+00, align 4
// CHECK: @V3 = {{.*}}global float 3.00e+00, align 4
+
+void test_builtin_elementwise_fma_round_upward() {
+
https://github.com/ckoparkar edited
https://github.com/llvm/llvm-project/pull/152919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -141,6 +141,16 @@ static void diagnoseNonConstexprBuiltin(InterpState &S,
CodePtr OpPC,
S.CCEDiag(Loc, diag::note_invalid_subexpr_in_const_expr);
}
+// Same implementation as Compiler::getRoundingMode.
+static llvm::RoundingMode getRoundingMode(const InterpState &S, co
@@ -2320,6 +2330,65 @@ static bool interp__builtin_elementwise_sat(InterpState
&S, CodePtr OpPC,
return true;
}
+static bool interp__builtin_elementwise_fma(InterpState &S, CodePtr OpPC,
+const CallExpr *Call) {
+ assert(Call->ge
https://github.com/ckoparkar updated
https://github.com/llvm/llvm-project/pull/152919
>From 24139055908afd5d5f32c2ec975c5d831fa07174 Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 9 Aug 2025 07:18:20 -0400
Subject: [PATCH] [clang] Enable constexpr handling for
__builtin_elementwi
ckoparkar wrote:
> What about integers and integer vectors?
I believe `__builtin_elementwise_fma` only accepts direct floating point
numbers and vectors of floating point numbers as arguments, so we don't need to
handle integers.
https://github.com/llvm/llvm-project/pull/152919
__
@@ -2320,6 +2330,65 @@ static bool interp__builtin_elementwise_sat(InterpState
&S, CodePtr OpPC,
return true;
}
+static bool interp__builtin_elementwise_fma(InterpState &S, CodePtr OpPC,
+const CallExpr *Call) {
+ assert(Call->ge
@@ -15878,6 +15901,22 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr
*E) {
Result = minimumnum(Result, RHS);
return true;
}
+
+ case Builtin::BI__builtin_elementwise_fma: {
+if(!E->getArg(0)->isPRValue() ||
+ !E->getArg(1)->isPRValue() ||
+
https://github.com/ckoparkar created
https://github.com/llvm/llvm-project/pull/152919
Fixes https://github.com/llvm/llvm-project/issues/152455.
/cc @RKSimon
>From 48e382260a511c4cd6effadc89509022864b497b Mon Sep 17 00:00:00 2001
From: Chaitanya Koparkar
Date: Sat, 9 Aug 2025 07:18:20 -0400
S
50 matches
Mail list logo