================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits