[clang] [CIR] Add support for X86 pmovqd512_mask and pmovwb512_mask builtins (PR #173802)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 1 14:29:40 PST 2026
================
@@ -425,6 +425,22 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
// Cast/Conversion Operators
//===--------------------------------------------------------------------===//
+ /// Create an value truncation to a narrower type.
+ /// Returns the source if types already match. CIR casts do not
+ /// encode NUW/NSW; wrap semantics should be handled by callers.
+ /// Supports both scalar integers and vectors of integers.
+ mlir::Value createTrunc(mlir::Location loc, mlir::Value src,
+ mlir::Type newTy) {
+ auto srcIntTy = mlir::dyn_cast<cir::VectorType>(src.getType());
+ if (newTy == srcIntTy)
+ return src;
+ return createCast(loc, cir::CastKind::integral, src, newTy);
+ }
+
+ mlir::Value createTrunc(mlir::Value src, mlir::Type newTy) {
+ return createTrunc(src.getLoc(), src, newTy);
+ }
----------------
DannyDaoBoYang wrote:
Thank you, will combine.
https://github.com/llvm/llvm-project/pull/173802
More information about the cfe-commits
mailing list