def LLVM_CopySignOp : LLVM_BinarySameArgsIntrinsicOp<"copysign">;
def LLVM_CosOp : LLVM_UnaryIntrinsicOp<"cos">;
def LLVM_ExpOp : LLVM_UnaryIntrinsicOp<"exp">;
+def LLVM_Exp2Op : LLVM_UnaryIntrinsicOp<"exp2">;
def LLVM_FAbsOp : LLVM_UnaryIntrinsicOp<"fabs">;
def LLVM_FCeilOp : LLVM_UnaryIntrinsicOp<"ceil">;
def LLVM_FMAOp : LLVM_TernarySameArgsIntrinsicOp<"fma">;
}
//===----------------------------------------------------------------------===//
+// ExpOp
+//===----------------------------------------------------------------------===//
+
+def Exp2Op : FloatUnaryOp<"exp2"> {
+ let summary = "base-2 exponential of the specified value";
+}
+
+//===----------------------------------------------------------------------===//
// ExtractElementOp
//===----------------------------------------------------------------------===//
using CosOpLowering = VectorConvertToLLVMPattern<CosOp, LLVM::CosOp>;
using DivFOpLowering = VectorConvertToLLVMPattern<DivFOp, LLVM::FDivOp>;
using ExpOpLowering = VectorConvertToLLVMPattern<ExpOp, LLVM::ExpOp>;
+using Exp2OpLowering = VectorConvertToLLVMPattern<Exp2Op, LLVM::Exp2Op>;
using Log10OpLowering = VectorConvertToLLVMPattern<Log10Op, LLVM::Log10Op>;
using Log2OpLowering = VectorConvertToLLVMPattern<Log2Op, LLVM::Log2Op>;
using LogOpLowering = VectorConvertToLLVMPattern<LogOp, LLVM::LogOp>;
DialectCastOpLowering,
DivFOpLowering,
ExpOpLowering,
+ Exp2OpLowering,
LogOpLowering,
Log10OpLowering,
Log2OpLowering,
%12 = xor %arg2, %arg3 : i32
// CHECK-NEXT: %13 = "llvm.intr.exp"(%arg0) : (!llvm.float) -> !llvm.float
%13 = std.exp %arg0 : f32
-// CHECK-NEXT: %14 = llvm.mlir.constant(7.900000e-01 : f64) : !llvm.double
- %14 = constant 7.9e-01 : f64
-// CHECK-NEXT: %15 = llvm.shl %arg2, %arg3 : !llvm.i32
- %15 = shift_left %arg2, %arg3 : i32
-// CHECK-NEXT: %16 = llvm.ashr %arg2, %arg3 : !llvm.i32
- %16 = shift_right_signed %arg2, %arg3 : i32
-// CHECK-NEXT: %17 = llvm.lshr %arg2, %arg3 : !llvm.i32
- %17 = shift_right_unsigned %arg2, %arg3 : i32
+// CHECK-NEXT: %14 = "llvm.intr.exp2"(%arg0) : (!llvm.float) -> !llvm.float
+ %14 = std.exp2 %arg0 : f32
+// CHECK-NEXT: %15 = llvm.mlir.constant(7.900000e-01 : f64) : !llvm.double
+ %15 = constant 7.9e-01 : f64
+// CHECK-NEXT: %16 = llvm.shl %arg2, %arg3 : !llvm.i32
+ %16 = shift_left %arg2, %arg3 : i32
+// CHECK-NEXT: %17 = llvm.ashr %arg2, %arg3 : !llvm.i32
+ %17 = shift_right_signed %arg2, %arg3 : i32
+// CHECK-NEXT: %18 = llvm.lshr %arg2, %arg3 : !llvm.i32
+ %18 = shift_right_unsigned %arg2, %arg3 : i32
// CHECK-NEXT: %{{[0-9]+}} = "llvm.intr.sqrt"(%arg0) : (!llvm.float) -> !llvm.float
- %18 = std.sqrt %arg0 : f32
+ %19 = std.sqrt %arg0 : f32
// CHECK-NEXT: %{{[0-9]+}} = "llvm.intr.sqrt"(%arg4) : (!llvm.double) -> !llvm.double
- %19 = std.sqrt %arg4 : f64
+ %20 = std.sqrt %arg4 : f64
return %0, %4 : f32, i32
}
llvm.return
}
+// CHECK-LABEL: @exp2_test
+llvm.func @exp2_test(%arg0: !llvm.float, %arg1: !llvm<"<8 x float>">) {
+ // CHECK: call float @llvm.exp2.f32
+ "llvm.intr.exp2"(%arg0) : (!llvm.float) -> !llvm.float
+ // CHECK: call <8 x float> @llvm.exp2.v8f32
+ "llvm.intr.exp2"(%arg1) : (!llvm<"<8 x float>">) -> !llvm<"<8 x float>">
+ llvm.return
+}
+
// CHECK-LABEL: @log_test
llvm.func @log_test(%arg0: !llvm.float, %arg1: !llvm<"<8 x float>">) {
// CHECK: call float @llvm.log.f32