diff --git a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp --- a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp +++ b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp @@ -107,6 +107,8 @@ "csinf", "csin", benefit); patterns.add>(patterns.getContext(), "conjf", "conj", benefit); + patterns.add>(patterns.getContext(), + "clogf", "clog", benefit); patterns.add>( patterns.getContext(), "cabsf", "cabs", benefit); patterns.add>( diff --git a/mlir/test/Conversion/ComplexToLibm/convert-to-libm.mlir b/mlir/test/Conversion/ComplexToLibm/convert-to-libm.mlir --- a/mlir/test/Conversion/ComplexToLibm/convert-to-libm.mlir +++ b/mlir/test/Conversion/ComplexToLibm/convert-to-libm.mlir @@ -10,6 +10,8 @@ // CHECK-DAG: @csin(complex) -> complex // CHECK-DAG: @conj(complex) -> complex // CHECK-DAG: @cabs(complex) -> f64 +// CHECK-DAG: @carg(complex) -> f64 +// CHECK-DAG: @clog(complex) -> complex // CHECK-LABEL: func @cpow_caller // CHECK-SAME: %[[FLOAT:.*]]: complex @@ -105,4 +107,16 @@ %double_result = complex.angle %double : complex // CHECK: return %[[FLOAT_RESULT]], %[[DOUBLE_RESULT]] return %float_result, %double_result : f32, f64 -} \ No newline at end of file +} + +// CHECK-LABEL: func @clog_caller +// CHECK-SAME: %[[FLOAT:.*]]: complex +// CHECK-SAME: %[[DOUBLE:.*]]: complex +func.func @clog_caller(%float: complex, %double: complex) -> (complex, complex) { + // CHECK: %[[FLOAT_RESULT:.*]] = call @clogf(%[[FLOAT]]) + %float_result = complex.log %float : complex + // CHECK: %[[DOUBLE_RESULT:.*]] = call @clog(%[[DOUBLE]]) + %double_result = complex.log %double : complex + // CHECK: return %[[FLOAT_RESULT]], %[[DOUBLE_RESULT]] + return %float_result, %double_result : complex, complex +}