[clang] [clang][x86][bytecode] Replace interp__builtin_knot with static bool interp__builtin_elementwise_int_unaryop callback (PR #160332)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 23 08:46:21 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (fennecJ)
<details>
<summary>Changes</summary>
Fix #<!-- -->160287
---
Full diff: https://github.com/llvm/llvm-project/pull/160332.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+2-11)
``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index aaab8ade0ae01..5423d3ca73c81 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -666,16 +666,6 @@ static bool interp__builtin_abs(InterpState &S, CodePtr OpPC,
return true;
}
-static bool interp__builtin_knot(InterpState &S, CodePtr OpPC,
- const InterpFrame *Frame,
- const CallExpr *Call) {
- APSInt Val =
- popToAPSInt(S.Stk, *S.getContext().classify(Call->getArg(0)->getType()));
- APInt Result = ~Val;
- pushInteger(S, APSInt(std::move(Result), true), Call->getType());
- return true;
-}
-
static bool interp__builtin_popcount(InterpState &S, CodePtr OpPC,
const InterpFrame *Frame,
const CallExpr *Call) {
@@ -3659,7 +3649,8 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
case X86::BI__builtin_ia32_knothi:
case X86::BI__builtin_ia32_knotsi:
case X86::BI__builtin_ia32_knotdi:
- return interp__builtin_knot(S, OpPC, Frame, Call);
+ return interp__builtin_elementwise_int_unaryop(
+ S, OpPC, Call, [](const APSInt &Src) { return ~Src; });
case X86::BI__builtin_ia32_kaddqi:
case X86::BI__builtin_ia32_kaddhi:
``````````
</details>
https://github.com/llvm/llvm-project/pull/160332
More information about the cfe-commits
mailing list