@@ -763,7 +763,7 @@ class LLVM_ABI MachineIRBuilder {
763763
764764 // / Build and insert \p Res = G_SEXT \p Op, \p Res = G_TRUNC \p Op, or
765765 // / \p Res = COPY \p Op depending on the differing sizes of \p Res and \p Op.
766- // / ///
766+ // /
767767 // / \pre setBasicBlock or setMI must have been called.
768768 // / \pre \p Res must be a generic virtual register with scalar or vector type.
769769 // / \pre \p Op must be a generic virtual register with scalar or vector type.
@@ -773,7 +773,7 @@ class LLVM_ABI MachineIRBuilder {
773773
774774 // / Build and insert \p Res = G_ZEXT \p Op, \p Res = G_TRUNC \p Op, or
775775 // / \p Res = COPY \p Op depending on the differing sizes of \p Res and \p Op.
776- // / ///
776+ // /
777777 // / \pre setBasicBlock or setMI must have been called.
778778 // / \pre \p Res must be a generic virtual register with scalar or vector type.
779779 // / \pre \p Op must be a generic virtual register with scalar or vector type.
@@ -783,7 +783,7 @@ class LLVM_ABI MachineIRBuilder {
783783
784784 // Build and insert \p Res = G_ANYEXT \p Op, \p Res = G_TRUNC \p Op, or
785785 // / \p Res = COPY \p Op depending on the differing sizes of \p Res and \p Op.
786- // / ///
786+ // /
787787 // / \pre setBasicBlock or setMI must have been called.
788788 // / \pre \p Res must be a generic virtual register with scalar or vector type.
789789 // / \pre \p Op must be a generic virtual register with scalar or vector type.
@@ -794,7 +794,7 @@ class LLVM_ABI MachineIRBuilder {
794794 // / Build and insert \p Res = \p ExtOpc, \p Res = G_TRUNC \p
795795 // / Op, or \p Res = COPY \p Op depending on the differing sizes of \p Res and
796796 // / \p Op.
797- // / ///
797+ // /
798798 // / \pre setBasicBlock or setMI must have been called.
799799 // / \pre \p Res must be a generic virtual register with scalar or vector type.
800800 // / \pre \p Op must be a generic virtual register with scalar or vector type.
@@ -809,6 +809,48 @@ class LLVM_ABI MachineIRBuilder {
809809 MachineInstrBuilder buildZExtInReg (const DstOp &Res, const SrcOp &Op,
810810 int64_t ImmOp);
811811
812+ // / Build and insert \p Res = \p G_TRUNC_SSAT_S \p Op
813+ // /
814+ // / G_TRUNC_SSAT_S truncates the signed input, \p Op, to a signed result with
815+ // / saturation.
816+ // /
817+ // / \pre setBasicBlock or setMI must have been called.
818+ // / \pre \p Res must be a generic virtual register with scalar or vector type.
819+ // / \pre \p Op must be a generic virtual register with scalar or vector type.
820+ // /
821+ // / \return The newly created instruction.
822+ MachineInstrBuilder buildTruncSSatS (const DstOp &Res, const SrcOp &Op) {
823+ return buildInstr (TargetOpcode::G_TRUNC_SSAT_S, {Res}, {Op});
824+ }
825+
826+ // / Build and insert \p Res = \p G_TRUNC_SSAT_U \p Op
827+ // /
828+ // / G_TRUNC_SSAT_U truncates the signed input, \p Op, to an unsigned result
829+ // / with saturation.
830+ // /
831+ // / \pre setBasicBlock or setMI must have been called.
832+ // / \pre \p Res must be a generic virtual register with scalar or vector type.
833+ // / \pre \p Op must be a generic virtual register with scalar or vector type.
834+ // /
835+ // / \return The newly created instruction.
836+ MachineInstrBuilder buildTruncSSatU (const DstOp &Res, const SrcOp &Op) {
837+ return buildInstr (TargetOpcode::G_TRUNC_SSAT_U, {Res}, {Op});
838+ }
839+
840+ // / Build and insert \p Res = \p G_TRUNC_USAT_U \p Op
841+ // /
842+ // / G_TRUNC_USAT_U truncates the unsigned input, \p Op, to an unsigned result
843+ // / with saturation.
844+ // /
845+ // / \pre setBasicBlock or setMI must have been called.
846+ // / \pre \p Res must be a generic virtual register with scalar or vector type.
847+ // / \pre \p Op must be a generic virtual register with scalar or vector type.
848+ // /
849+ // / \return The newly created instruction.
850+ MachineInstrBuilder buildTruncUSatU (const DstOp &Res, const SrcOp &Op) {
851+ return buildInstr (TargetOpcode::G_TRUNC_USAT_U, {Res}, {Op});
852+ }
853+
812854 // / Build and insert an appropriate cast between two registers of equal size.
813855 MachineInstrBuilder buildCast (const DstOp &Dst, const SrcOp &Src);
814856
0 commit comments