forked from OSchip/llvm-project
[mlir][StandardToLLVM] Add SinOp to LLVM dialect and lowering of std.sin to this op.
Differential Revision: https://reviews.llvm.org/D79505
This commit is contained in:
parent
e9753822b5
commit
49e6c19100
|
@ -788,6 +788,7 @@ def LLVM_LogOp : LLVM_UnaryIntrinsicOp<"log">;
|
|||
def LLVM_Prefetch : LLVM_ZeroResultIntrOp<"prefetch", [0]>,
|
||||
Arguments<(ins LLVM_Type:$addr, LLVM_Type:$rw,
|
||||
LLVM_Type:$hint, LLVM_Type:$cache)>;
|
||||
def LLVM_SinOp : LLVM_UnaryIntrinsicOp<"sin">;
|
||||
def LLVM_SqrtOp : LLVM_UnaryIntrinsicOp<"sqrt">;
|
||||
|
||||
//
|
||||
|
|
|
@ -1315,6 +1315,7 @@ using SignedRemIOpLowering =
|
|||
VectorConvertToLLVMPattern<SignedRemIOp, LLVM::SRemOp>;
|
||||
using SignedShiftRightOpLowering =
|
||||
OneToOneConvertToLLVMPattern<SignedShiftRightOp, LLVM::AShrOp>;
|
||||
using SinOpLowering = VectorConvertToLLVMPattern<SinOp, LLVM::SinOp>;
|
||||
using SqrtOpLowering = VectorConvertToLLVMPattern<SqrtOp, LLVM::SqrtOp>;
|
||||
using SubFOpLowering = VectorConvertToLLVMPattern<SubFOp, LLVM::FSubOp>;
|
||||
using SubIOpLowering = VectorConvertToLLVMPattern<SubIOp, LLVM::SubOp>;
|
||||
|
@ -2972,6 +2973,7 @@ void mlir::populateStdToLLVMNonMemoryConversionPatterns(
|
|||
SignedDivIOpLowering,
|
||||
SignedRemIOpLowering,
|
||||
SignedShiftRightOpLowering,
|
||||
SinOpLowering,
|
||||
SplatOpLowering,
|
||||
SplatNdOpLowering,
|
||||
SqrtOpLowering,
|
||||
|
|
|
@ -30,6 +30,16 @@ func @rsqrt(%arg0 : f32) {
|
|||
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: func @sine(
|
||||
// CHECK-SAME: !llvm.float
|
||||
func @sine(%arg0 : f32) {
|
||||
// CHECK: "llvm.intr.sin"(%arg0) : (!llvm.float) -> !llvm.float
|
||||
%0 = sin %arg0 : f32
|
||||
std.return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: func @rsqrt_double(
|
||||
// CHECK-SAME: !llvm.double
|
||||
func @rsqrt_double(%arg0 : f64) {
|
||||
|
|
|
@ -97,6 +97,9 @@ func @ops(%arg0 : !llvm.i32, %arg1 : !llvm.float) {
|
|||
// CHECK: %29 = llvm.fneg %arg1 : !llvm.float
|
||||
%29 = llvm.fneg %arg1 : !llvm.float
|
||||
|
||||
// CHECK: "llvm.intr.sin"(%arg1) : (!llvm.float) -> !llvm.float
|
||||
%30 = "llvm.intr.sin"(%arg1) : (!llvm.float) -> !llvm.float
|
||||
|
||||
// CHECK: llvm.return
|
||||
llvm.return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue