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

Lei Huang via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 14 11:09:25 PST 2026


================
@@ -104,6 +104,33 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI,
     return Diag(TheCall->getBeginLoc(), diag::err_64_bit_builtin_32_bit_tgt)
            << TheCall->getSourceRange();
 
+  // Common BCD type-validation helpers
+  // Emit error diagnostics and return true on success
+  //  - IsVectorType: enforces vector unsigned char
+  //  - IsIntType: enforces any integer type
+  // Lambdas centralize type checks for BCD builtin handlers
+  QualType VecType = Context.getVectorType(Context.UnsignedCharTy, 16,
+                                           VectorKind::AltiVecVector);
----------------
lei137 wrote:

location of this is a bit strange to me... seems we are doing this even though not all builtins requires this.  If this is needed in the lambda for specific builtins, I think it's better to either:
* do this right before the call to the lambda and pass it in as a param
or
* do it directly in the `IsVectorType` lambda def.

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


More information about the cfe-commits mailing list