Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions flang/test/Lower/OpenMP/math-amdgpu.f90
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ subroutine omp_erf_f64(x, y)
y = erf(x)
end subroutine omp_erf_f64

subroutine omp_erfc_f32(x, y)
!$omp declare target
real :: x, y
!CHECK: call float @__ocml_erfc_f32(float {{.*}})
y = erfc(x)
end subroutine omp_erfc_f32

subroutine omp_erfc_f64(x, y)
!$omp declare target
real(8) :: x, y
!CHECK: call double @__ocml_erfc_f64(double {{.*}})
y = erfc(x)
end subroutine omp_erfc_f64

subroutine omp_exp_f32(x, y)
!$omp declare target
real :: x, y
Expand Down
2 changes: 2 additions & 0 deletions mlir/lib/Conversion/MathToROCDL/MathToROCDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ void mlir::populateMathToROCDLConversionPatterns(
"__ocml_tan_f64", "__ocml_tan_f16");
populateOpPatterns<math::ErfOp>(converter, patterns, "__ocml_erf_f32",
"__ocml_erf_f64", "__ocml_erf_f16");
populateOpPatterns<math::ErfcOp>(converter, patterns, "__ocml_erfc_f32",
"__ocml_erfc_f64", "__ocml_erfc_f16");
populateOpPatterns<math::FPowIOp>(converter, patterns, "__ocml_pown_f32",
"__ocml_pown_f64", "__ocml_pown_f16");
// Single arith pattern that needs a ROCDL call, probably not
Expand Down
18 changes: 18 additions & 0 deletions mlir/test/Conversion/MathToROCDL/math-to-rocdl.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,24 @@ module @test_module {

// -----

module @test_module {
// CHECK: llvm.func @__ocml_erfc_f16(f16) -> f16
// CHECK: llvm.func @__ocml_erfc_f32(f32) -> f32
// CHECK: llvm.func @__ocml_erfc_f64(f64) -> f64
// CHECK-LABEL: func @math_erfc
func.func @math_erfc(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) {
%result16 = math.erfc %arg_f16 : f16
// CHECK: llvm.call @__ocml_erfc_f16(%{{.*}}) : (f16) -> f16
%result32 = math.erfc %arg_f32 : f32
// CHECK: llvm.call @__ocml_erfc_f32(%{{.*}}) : (f32) -> f32
%result64 = math.erfc %arg_f64 : f64
// CHECK: llvm.call @__ocml_erfc_f64(%{{.*}}) : (f64) -> f64
func.return %result16, %result32, %result64 : f16, f32, f64
}
}

// -----

module @test_module {
// CHECK: llvm.func @__ocml_sin_f16(f16) -> f16
// CHECK: llvm.func @__ocml_sin_f32(f32) -> f32
Expand Down