[clang] [PowerPC] Align bcdsetsign Sema validation with other BCD builtins (PR #178121)
Aditi Medhane via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 3 21:21:00 PST 2026
================
@@ -147,7 +147,14 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
switch (BuiltinID) {
default:
return false;
- case PPC::BI__builtin_ppc_bcdsetsign:
+ case PPC::BI__builtin_ppc_bcdsetsign: {
+ // Arg0 must be vector unsigned char
+ if (!IsTypeVecUChar(TheCall->getArg(0)->getType(), 0))
+ return false;
+
+ // Restrict Arg1 constant range (0–1)
+ return SemaRef.BuiltinConstantArgRange(TheCall, 1, 0, 1);
----------------
AditiRM wrote:
For`bcdsetsign`, the second argument is required to be a constant `0 or 1`. Enforcing the [0,1] constant range is sufficient and matches the documented semantics; an explicit unsigned char type check is unnecessary and consistent with prior BCD builtin handling.
https://github.com/llvm/llvm-project/pull/178121
More information about the cfe-commits
mailing list