aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
index df8b7995ac88..bde442ae0429 100644
--- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
@@ -486,6 +486,15 @@ MachineInstrBuilder MachineIRBuilder::buildAnyExtOrTrunc(const DstOp &Res,
return buildExtOrTrunc(TargetOpcode::G_ANYEXT, Res, Op);
}
+MachineInstrBuilder MachineIRBuilder::buildZExtInReg(const DstOp &Res,
+ const SrcOp &Op,
+ int64_t ImmOp) {
+ LLT ResTy = Res.getLLTTy(*getMRI());
+ auto Mask = buildConstant(
+ ResTy, APInt::getLowBitsSet(ResTy.getScalarSizeInBits(), ImmOp));
+ return buildAnd(ResTy, Op, Mask);
+}
+
MachineInstrBuilder MachineIRBuilder::buildCast(const DstOp &Dst,
const SrcOp &Src) {
LLT SrcTy = Src.getLLTTy(*getMRI());