diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td index edb854eb1046..002d2615c4d8 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -145,6 +145,9 @@ def LLVM_SRemOp : LLVM_ArithmeticOp<"srem", "CreateSRem">; def LLVM_AndOp : LLVM_ArithmeticOp<"and", "CreateAnd">; def LLVM_OrOp : LLVM_ArithmeticOp<"or", "CreateOr">; def LLVM_XOrOp : LLVM_ArithmeticOp<"xor", "CreateXor">; +def LLVM_ShlOp : LLVM_ArithmeticOp<"shl", "CreateShl">; +def LLVM_LShrOp : LLVM_ArithmeticOp<"lshr", "CreateLShr">; +def LLVM_AShrOp : LLVM_ArithmeticOp<"ashr", "CreateAShr">; // Predicate for integer comparisons. def ICmpPredicateEQ : I64EnumAttrCase<"eq", 0>; diff --git a/mlir/test/Target/llvmir.mlir b/mlir/test/Target/llvmir.mlir index c5a1cf15f1a4..cca5661b2733 100644 --- a/mlir/test/Target/llvmir.mlir +++ b/mlir/test/Target/llvmir.mlir @@ -796,6 +796,12 @@ func @ops(%arg0: !llvm.float, %arg1: !llvm.float, %arg2: !llvm.i32, %arg3: !llvm %14 = llvm.or %arg2, %arg3 : !llvm.i32 // CHECK-NEXT: %19 = xor i32 %2, %3 %15 = llvm.xor %arg2, %arg3 : !llvm.i32 +// CHECK-NEXT: %20 = shl i32 %2, %3 + %16 = llvm.shl %arg2, %arg3 : !llvm.i32 +// CHECK-NEXT: %21 = lshr i32 %2, %3 + %17 = llvm.lshr %arg2, %arg3 : !llvm.i32 +// CHECK-NEXT: %22 = ashr i32 %2, %3 + %18 = llvm.ashr %arg2, %arg3 : !llvm.i32 llvm.return %10 : !llvm<"{ float, i32 }"> }