[clang] [llvm] [PowerPC] Add Support for BCDSHIFT, BCDSHIFTR, BCDTRUNC, BCDUTRUNC, and BCDUSHIFT instruction support (PR #154715)

Lei Huang via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 10:47:32 PST 2025


================
@@ -112,6 +141,29 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
   case PPC::BI__builtin_ppc_packed2zoned:
   case PPC::BI__builtin_ppc_zoned2packed:
     return SemaRef.BuiltinConstantArgRange(TheCall, 1, 0, 1);
+  case PPC::BI__builtin_ppc_bcdshift:
+  case PPC::BI__builtin_ppc_bcdshiftround:
+  case PPC::BI__builtin_ppc_bcdtruncate: {
+
+    QualType Arg0Type = TheCall->getArg(0)->getType();
+    QualType Arg1Type = TheCall->getArg(1)->getType();
+    QualType Arg2Type = TheCall->getArg(2)->getType();
+
+    // Arg0 must be vector unsigned char
+    if (VerifyVectorType(Arg0Type, TheCall->getArg(0)->getBeginLoc(), 0))
+      return true;
+
+    // Arg1 must be integer type
+    if (VerifyIntType(Arg1Type, TheCall->getArg(1)->getBeginLoc(), 1))
+      return true;
+
+    // Arg2 must be integer type
+    if (VerifyIntType(Arg2Type, TheCall->getArg(2)->getBeginLoc(), 2))
+      return true;
----------------
lei137 wrote:

I don't think this is needed since you are checking arg2 to be a constant below.

https://github.com/llvm/llvm-project/pull/154715


More information about the llvm-commits mailing list