[clang] [clang] Allow builtin addc/subc to be constant evaluated (PR #81656)
Bryce Wilson via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 14 06:43:17 PST 2024
================
@@ -12696,6 +12696,56 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
return BuiltinOp == Builtin::BI__atomic_always_lock_free ?
Success(0, E) : Error(E);
}
+ case Builtin::BI__builtin_addcb:
+ case Builtin::BI__builtin_addcs:
+ case Builtin::BI__builtin_addc:
+ case Builtin::BI__builtin_addcl:
+ case Builtin::BI__builtin_addcll:
+ case Builtin::BI__builtin_subcb:
+ case Builtin::BI__builtin_subcs:
+ case Builtin::BI__builtin_subc:
+ case Builtin::BI__builtin_subcl:
+ case Builtin::BI__builtin_subcll: {
+ LValue CarryOutLValue;
+ APSInt LHS, RHS, CarryIn, Result;
----------------
Bryce-MW wrote:
IIRC, APSInt isn't always signed, it just knows if it is or not. `EvaluateInteger` always takes an APSInt
https://github.com/llvm/llvm-project/pull/81656
More information about the cfe-commits
mailing list