[clang] [Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow insertps intrinsic to be used in constexp (PR #165513)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 28 23:02:17 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,c -- clang/lib/AST/ByteCode/InterpBuiltin.cpp clang/lib/AST/ExprConstant.cpp clang/test/CodeGen/X86/sse41-builtins.c --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index c4d92804d..117b10b1c 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -3431,11 +3431,10 @@ static bool interp__builtin_ia32_shuffle_generic(
if (ShouldZero && ShouldZero(DstIdx, ShuffleMask)) {
// Zero out this element
if (ElemT == PT_Float) {
- Dst.elem<Floating>(DstIdx) = Floating(S.getASTContext().getFloatTypeSemantics(VecT->getElementType()));
+ Dst.elem<Floating>(DstIdx) = Floating(
+ S.getASTContext().getFloatTypeSemantics(VecT->getElementType()));
} else {
- INT_TYPE_SWITCH_NO_BOOL(ElemT, {
- Dst.elem<T>(DstIdx) = T::from(0);
- });
+ INT_TYPE_SWITCH_NO_BOOL(ElemT, { Dst.elem<T>(DstIdx) = T::from(0); });
}
} else {
auto [SrcVecIdx, SrcIdx] = GetSourceIndex(DstIdx, ShuffleMask);
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index d27e92394..d406ac52f 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -11647,7 +11647,8 @@ static bool evalShuffleGeneric(
if (ShouldZero && ShouldZero(DstIdx, ShuffleMask)) {
// Zero out this element
QualType ElemTy = VT->getElementType();
- ResultElements.push_back(APValue(APFloat::getZero(Info.Ctx.getFloatTypeSemantics(ElemTy))));
+ ResultElements.push_back(
+ APValue(APFloat::getZero(Info.Ctx.getFloatTypeSemantics(ElemTy))));
} else {
auto [SrcVecIdx, SrcIdx] = GetSourceIndex(DstIdx, ShuffleMask);
const APValue &Src = (SrcVecIdx == 0) ? A : B;
@@ -12492,7 +12493,8 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
APValue R;
if (!evalShuffleGeneric(
Info, E, R,
- [](unsigned DstIdx, unsigned Mask) -> std::pair<unsigned, unsigned> {
+ [](unsigned DstIdx,
+ unsigned Mask) -> std::pair<unsigned, unsigned> {
// Bits [7:6]: select element from source vector Y (0-3)
// Bits [5:4]: select destination position (0-3)
unsigned SrcElem = (Mask >> 6) & 0x3;
``````````
</details>
https://github.com/llvm/llvm-project/pull/165513
More information about the cfe-commits
mailing list