[MLIR] Add lowerings for atan and atan2 to ROCDL intrinsics
Differential Revision: https://reviews.llvm.org/D93123
This commit is contained in:
parent
617cd01a4b
commit
1c6bc2c0b5
@ -105,6 +105,10 @@ void mlir::populateGpuToROCDLConversionPatterns(
|
||||
GPUFuncOpLowering<5>, GPUReturnOpLowering>(converter);
|
||||
patterns.insert<OpToFuncCallLowering<AbsFOp>>(converter, "__ocml_fabs_f32",
|
||||
"__ocml_fabs_f64");
|
||||
patterns.insert<OpToFuncCallLowering<AtanOp>>(converter, "__ocml_atan_f32",
|
||||
"__ocml_atan_f64");
|
||||
patterns.insert<OpToFuncCallLowering<Atan2Op>>(converter, "__ocml_atan2_f32",
|
||||
"__ocml_atan2_f64");
|
||||
patterns.insert<OpToFuncCallLowering<CeilFOp>>(converter, "__ocml_ceil_f32",
|
||||
"__ocml_ceil_f64");
|
||||
patterns.insert<OpToFuncCallLowering<CosOp>>(converter, "__ocml_cos_f32",
|
||||
|
||||
@ -280,3 +280,33 @@ gpu.module @test_module {
|
||||
std.return %result32, %result64 : f32, f64
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
gpu.module @test_module {
|
||||
// CHECK: llvm.func @__ocml_atan_f32(!llvm.float) -> !llvm.float
|
||||
// CHECK: llvm.func @__ocml_atan_f64(!llvm.double) -> !llvm.double
|
||||
// CHECK-LABEL: func @gpu_atan
|
||||
func @gpu_atan(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) {
|
||||
%result32 = std.atan %arg_f32 : f32
|
||||
// CHECK: llvm.call @__ocml_atan_f32(%{{.*}}) : (!llvm.float) -> !llvm.float
|
||||
%result64 = std.atan %arg_f64 : f64
|
||||
// CHECK: llvm.call @__ocml_atan_f64(%{{.*}}) : (!llvm.double) -> !llvm.double
|
||||
std.return %result32, %result64 : f32, f64
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
gpu.module @test_module {
|
||||
// CHECK: llvm.func @__ocml_atan2_f32(!llvm.float, !llvm.float) -> !llvm.float
|
||||
// CHECK: llvm.func @__ocml_atan2_f64(!llvm.double, !llvm.double) -> !llvm.double
|
||||
// CHECK-LABEL: func @gpu_atan2
|
||||
func @gpu_atan2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) {
|
||||
%result32 = std.atan2 %arg_f32, %arg_f32 : f32
|
||||
// CHECK: llvm.call @__ocml_atan2_f32(%{{.*}}) : (!llvm.float, !llvm.float) -> !llvm.float
|
||||
%result64 = std.atan2 %arg_f64, %arg_f64 : f64
|
||||
// CHECK: llvm.call @__ocml_atan2_f64(%{{.*}}) : (!llvm.double, !llvm.double) -> !llvm.double
|
||||
std.return %result32, %result64 : f32, f64
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user