@@ -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-
679669static 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