Skip to content

Commit d5f8578

Browse files
authored
[clang][x86][bytecode] Replace interp__builtin_knot with static bool interp__builtin_elementwise_int_unaryop callback (#160332)
Fix #160287
1 parent e45993d commit d5f8578

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -666,16 +666,6 @@ static bool interp__builtin_abs(InterpState &S, CodePtr OpPC,
666666
return true;
667667
}
668668

669-
static bool interp__builtin_knot(InterpState &S, CodePtr OpPC,
670-
const InterpFrame *Frame,
671-
const CallExpr *Call) {
672-
APSInt Val =
673-
popToAPSInt(S.Stk, *S.getContext().classify(Call->getArg(0)->getType()));
674-
APInt Result = ~Val;
675-
pushInteger(S, APSInt(std::move(Result), true), Call->getType());
676-
return true;
677-
}
678-
679669
static bool interp__builtin_popcount(InterpState &S, CodePtr OpPC,
680670
const InterpFrame *Frame,
681671
const CallExpr *Call) {
@@ -3659,7 +3649,8 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
36593649
case X86::BI__builtin_ia32_knothi:
36603650
case X86::BI__builtin_ia32_knotsi:
36613651
case X86::BI__builtin_ia32_knotdi:
3662-
return interp__builtin_knot(S, OpPC, Frame, Call);
3652+
return interp__builtin_elementwise_int_unaryop(
3653+
S, OpPC, Call, [](const APSInt &Src) { return ~Src; });
36633654

36643655
case X86::BI__builtin_ia32_kaddqi:
36653656
case X86::BI__builtin_ia32_kaddhi:

0 commit comments

Comments
 (0)