@@ -623,6 +623,113 @@ def SPV_ReturnOp : SPV_Op<"Return", [Terminator]> {
623623
624624// -----
625625
626+ def SPV_SDivOp : SPV_ArithmeticOp<"SDiv", SPV_Integer> {
627+ let summary = "Signed-integer division of Operand 1 divided by Operand 2.";
628+
629+ let description = [{
630+ Result Type must be a scalar or vector of integer type.
631+
632+ The type of Operand 1 and Operand 2 must be a scalar or vector of
633+ integer type. They must have the same number of components as Result
634+ Type. They must have the same component width as Result Type.
635+
636+ Results are computed per component. The resulting value is undefined
637+ if Operand 2 is 0.
638+
639+ ### Custom assembly form
640+ ``` {.ebnf}
641+ integer-scalar-vector-type ::= integer-type |
642+ `vector<` integer-literal `x` integer-type `>`
643+ sdiv-op ::= ssa-id `=` `spv.SDiv` ssa-use, ssa-use
644+ `:` integer-scalar-vector-type
645+ ```
646+
647+ For example:
648+
649+ ```
650+ %4 = spv.SDiv %0, %1 : i32
651+ %5 = spv.SDiv %2, %3 : vector<4xi32>
652+
653+ ```
654+ }];
655+ }
656+
657+ // -----
658+
659+ def SPV_SModOp : SPV_ArithmeticOp<"SMod", SPV_Integer> {
660+ let summary = [{
661+ Signed remainder operation for the remainder whose sign matches the sign
662+ of Operand 2.
663+ }];
664+
665+ let description = [{
666+ Result Type must be a scalar or vector of integer type.
667+
668+ The type of Operand 1 and Operand 2 must be a scalar or vector of
669+ integer type. They must have the same number of components as Result
670+ Type. They must have the same component width as Result Type.
671+
672+ Results are computed per component. The resulting value is undefined
673+ if Operand 2 is 0. Otherwise, the result is the remainder r of Operand
674+ 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the
675+ sign of Operand 2.
676+
677+ ### Custom assembly form
678+ ``` {.ebnf}
679+ integer-scalar-vector-type ::= integer-type |
680+ `vector<` integer-literal `x` integer-type `>`
681+ smod-op ::= ssa-id `=` `spv.SMod` ssa-use, ssa-use
682+ `:` integer-scalar-vector-type
683+ ```
684+ For example:
685+
686+ ```
687+ %4 = spv.SMod %0, %1 : i32
688+ %5 = spv.SMod %2, %3 : vector<4xi32>
689+
690+ ```
691+ }];
692+ }
693+
694+ // -----
695+
696+ def SPV_SRemOp : SPV_ArithmeticOp<"SRem", SPV_Integer> {
697+ let summary = [{
698+ Signed remainder operation for the remainder whose sign matches the sign
699+ of Operand 1.
700+ }];
701+
702+ let description = [{
703+ Result Type must be a scalar or vector of integer type.
704+
705+ The type of Operand 1 and Operand 2 must be a scalar or vector of
706+ integer type. They must have the same number of components as Result
707+ Type. They must have the same component width as Result Type.
708+
709+ Results are computed per component. The resulting value is undefined
710+ if Operand 2 is 0. Otherwise, the result is the remainder r of Operand
711+ 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the
712+ sign of Operand 1.
713+
714+ ### Custom assembly form
715+ ``` {.ebnf}
716+ integer-scalar-vector-type ::= integer-type |
717+ `vector<` integer-literal `x` integer-type `>`
718+ srem-op ::= ssa-id `=` `spv.SRem` ssa-use, ssa-use
719+ `:` integer-scalar-vector-type
720+ ```
721+ For example:
722+
723+ ```
724+ %4 = spv.SRem %0, %1 : i32
725+ %5 = spv.SRem %2, %3 : vector<4xi32>
726+
727+ ```
728+ }];
729+ }
730+
731+ // -----
732+
626733def SPV_StoreOp : SPV_Op<"Store", []> {
627734 let summary = "Store through a pointer.";
628735
@@ -665,6 +772,70 @@ def SPV_StoreOp : SPV_Op<"Store", []> {
665772
666773// -----
667774
775+ def SPV_UDivOp : SPV_ArithmeticOp<"UDiv", SPV_Integer> {
776+ let summary = "Unsigned-integer division of Operand 1 divided by Operand 2.";
777+
778+ let description = [{
779+ Result Type must be a scalar or vector of integer type, whose Signedness
780+ operand is 0.
781+
782+ The types of Operand 1 and Operand 2 both must be the same as Result
783+ Type.
784+
785+ Results are computed per component. The resulting value is undefined
786+ if Operand 2 is 0.
787+
788+ ### Custom assembly form
789+ ``` {.ebnf}
790+ integer-scalar-vector-type ::= integer-type |
791+ `vector<` integer-literal `x` integer-type `>`
792+ udiv-op ::= ssa-id `=` `spv.UDiv` ssa-use, ssa-use
793+ `:` integer-scalar-vector-type
794+ ```
795+ For example:
796+
797+ ```
798+ %4 = spv.UDiv %0, %1 : i32
799+ %5 = spv.UDiv %2, %3 : vector<4xi32>
800+
801+ ```
802+ }];
803+ }
804+
805+ // -----
806+
807+ def SPV_UModOp : SPV_ArithmeticOp<"UMod", SPV_Integer> {
808+ let summary = "Unsigned modulo operation of Operand 1 modulo Operand 2.";
809+
810+ let description = [{
811+ Result Type must be a scalar or vector of integer type, whose Signedness
812+ operand is 0.
813+
814+ The types of Operand 1 and Operand 2 both must be the same as Result
815+ Type.
816+
817+ Results are computed per component. The resulting value is undefined
818+ if Operand 2 is 0.
819+
820+ ### Custom assembly form
821+ ``` {.ebnf}
822+ integer-scalar-vector-type ::= integer-type |
823+ `vector<` integer-literal `x` integer-type `>`
824+ umod-op ::= ssa-id `=` `spv.UMod` ssa-use, ssa-use
825+ `:` integer-scalar-vector-type
826+ ```
827+ For example:
828+
829+ ```
830+ %4 = spv.UMod %0, %1 : i32
831+ %5 = spv.UMod %2, %3 : vector<4xi32>
832+
833+ ```
834+ }];
835+ }
836+
837+ // -----
838+
668839def SPV_VariableOp : SPV_Op<"Variable", []> {
669840 let summary = [{
670841 Allocate an object in memory, resulting in a pointer to it, which can be
0 commit comments