Add integer shift ops to LLVM dialect.

PiperOrigin-RevId: 272140049
This commit is contained in:
Christian Sigg 2019-09-30 22:55:53 -07:00 committed by A. Unique TensorFlower
parent 66bcd05bb7
commit f479f816f9
2 changed files with 9 additions and 0 deletions

View File

@ -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>;

View File

@ -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 }">
}