[clang] [PowerPC] Align bcdsetsign Sema validation with other BCD builtins (PR #178121)
Tony Varghese via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 3 21:12:20 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);
----------------
tonykuttai wrote:
I understand that we need validation since we are using `t` attribute for `TARGET_BUILTIN`. We should also be checking the second arg (`unsigned char`) as well right, not just the range of values it can take?
Basically we need type validation for both arguments as well as range validation for the second argument.
https://github.com/llvm/llvm-project/pull/178121
More information about the cfe-commits
mailing list