[clang] [llvm] [PowerPC] Add AMO load builtins for conditional increment/decrement (PR #169435)
Lei Huang via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 14 07:01:35 PST 2026
================
@@ -281,6 +285,21 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
<< toString(Result, 10) << (IsUnsigned ? "0-4, 6" : "0, 5, 7") << "8"
<< Arg->getSourceRange();
}
+ case PPC::BI__builtin_amo_lwat_cond:
+ case PPC::BI__builtin_amo_ldat_cond:
+ case PPC::BI__builtin_amo_lwat_cond_s:
+ case PPC::BI__builtin_amo_ldat_cond_s: {
+ llvm::APSInt Result;
+ if (SemaRef.BuiltinConstantArg(TheCall, 1, Result))
+ return true;
+ unsigned Val = Result.getZExtValue();
+ if (llvm::is_contained({24u, 25u, 28u}, Val))
+ return false;
----------------
lei137 wrote:
Yes, so the function would basically test a `val` to a given `list` and error if it's not in the list. The message that the value is not `in the range` confused me originally. Maybe it's better in this case to create a new error to indicate we are checking a valid list of values instead of a range? But I am okay with that being in a follow up patch since I also feel these cases for amo should be place above the section where we are dealing with CUSTOM_BUILTINs . I think I left that comment on a previous patch but not sure if you saw that.
https://github.com/llvm/llvm-project/pull/169435
More information about the cfe-commits
mailing list