@@ -93,6 +93,26 @@ class LLVM_IntArithmeticOpWithExactFlag<string mnemonic, string instName,
9393 "$res = builder.Create" # instName #
9494 "($lhs, $rhs, /*Name=*/\"\", op.getIsExact());";
9595}
96+ class LLVM_IntArithmeticOpWithDisjointFlag<string mnemonic, string instName,
97+ list<Trait> traits = []> :
98+ LLVM_ArithmeticOpBase<AnySignlessInteger, mnemonic, instName,
99+ !listconcat([DeclareOpInterfaceMethods<DisjointFlagInterface>], traits)> {
100+ let arguments = !con(commonArgs, (ins UnitAttr:$isDisjoint));
101+
102+ string mlirBuilder = [{
103+ auto op = $_builder.create<$_qualCppClassName>($_location, $lhs, $rhs);
104+ moduleImport.setDisjointFlag(inst, op);
105+ $res = op;
106+ }];
107+ let assemblyFormat = [{
108+ (`disjoint` $isDisjoint^)? $lhs `,` $rhs attr-dict `:` type($res)
109+ }];
110+ string llvmBuilder =
111+ [{auto inst = builder.Create}] # instName #
112+ [{($lhs, $rhs, /*Name=*/"");
113+ moduleTranslation.setDisjointFlag(op, inst);
114+ $res = inst;}];
115+ }
96116class LLVM_FloatArithmeticOp<string mnemonic, string instName,
97117 list<Trait> traits = []> :
98118 LLVM_ArithmeticOpBase<LLVM_AnyFloat, mnemonic, instName,
@@ -138,7 +158,7 @@ def LLVM_SDivOp : LLVM_IntArithmeticOpWithExactFlag<"sdiv", "SDiv">;
138158def LLVM_URemOp : LLVM_IntArithmeticOp<"urem", "URem">;
139159def LLVM_SRemOp : LLVM_IntArithmeticOp<"srem", "SRem">;
140160def LLVM_AndOp : LLVM_IntArithmeticOp<"and", "And">;
141- def LLVM_OrOp : LLVM_IntArithmeticOp <"or", "Or"> {
161+ def LLVM_OrOp : LLVM_IntArithmeticOpWithDisjointFlag <"or", "Or"> {
142162 let hasFolder = 1;
143163}
144164def LLVM_XOrOp : LLVM_IntArithmeticOp<"xor", "Xor">;
0 commit comments