[clang] [llvm] [PowerPC] Support for Packed BCD conversion builtins (PR #142723)

Lei Huang via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 08:25:44 PDT 2025


================
@@ -294,6 +294,34 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
     return Builder.CreateCall(F, Ops, "");
   }
 
+  // BCD convert builtins for P9
+  case PPC::BI__builtin_ppc_national2packed:
+  case PPC::BI__builtin_ppc_packed2zoned:
+  case PPC::BI__builtin_ppc_zoned2packed: {
+    SmallVector<Value *, 3> Ops;
+    // Zero extending unsigned char to 32 bits by using Int32ty
+    llvm::Type *Int32Ty = llvm::IntegerType::get(getLLVMContext(), 32);
+    Ops.push_back(EmitScalarExpr(E->getArg(0)));
+    Ops.push_back(EmitScalarExpr(E->getArg(1)));
+    Ops.push_back(Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(2)),
----------------
lei137 wrote:

Why not just use `CreateZExt()`?

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


More information about the llvm-commits mailing list