forked from OSchip/llvm-project
[mlir][complex] Lower complex.log to libm log call
Lower complex.log to corresponding function call with libm. Reviewed By: bixia Differential Revision: https://reviews.llvm.org/D129417
This commit is contained in:
parent
9cf13067cb
commit
7769505ae9
|
@ -107,6 +107,8 @@ void mlir::populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
|
|||
"csinf", "csin", benefit);
|
||||
patterns.add<ScalarOpToLibmCall<complex::ConjOp>>(patterns.getContext(),
|
||||
"conjf", "conj", benefit);
|
||||
patterns.add<ScalarOpToLibmCall<complex::LogOp>>(patterns.getContext(),
|
||||
"clogf", "clog", benefit);
|
||||
patterns.add<ScalarOpToLibmCall<complex::AbsOp, FloatTypeResolver>>(
|
||||
patterns.getContext(), "cabsf", "cabs", benefit);
|
||||
patterns.add<ScalarOpToLibmCall<complex::AngleOp, FloatTypeResolver>>(
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
// CHECK-DAG: @csin(complex<f64>) -> complex<f64>
|
||||
// CHECK-DAG: @conj(complex<f64>) -> complex<f64>
|
||||
// CHECK-DAG: @cabs(complex<f64>) -> f64
|
||||
// CHECK-DAG: @carg(complex<f64>) -> f64
|
||||
// CHECK-DAG: @clog(complex<f64>) -> complex<f64>
|
||||
|
||||
// CHECK-LABEL: func @cpow_caller
|
||||
// CHECK-SAME: %[[FLOAT:.*]]: complex<f32>
|
||||
|
@ -105,4 +107,16 @@ func.func @carg_caller(%float: complex<f32>, %double: complex<f64>) -> (f32, f64
|
|||
%double_result = complex.angle %double : complex<f64>
|
||||
// CHECK: return %[[FLOAT_RESULT]], %[[DOUBLE_RESULT]]
|
||||
return %float_result, %double_result : f32, f64
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @clog_caller
|
||||
// CHECK-SAME: %[[FLOAT:.*]]: complex<f32>
|
||||
// CHECK-SAME: %[[DOUBLE:.*]]: complex<f64>
|
||||
func.func @clog_caller(%float: complex<f32>, %double: complex<f64>) -> (complex<f32>, complex<f64>) {
|
||||
// CHECK: %[[FLOAT_RESULT:.*]] = call @clogf(%[[FLOAT]])
|
||||
%float_result = complex.log %float : complex<f32>
|
||||
// CHECK: %[[DOUBLE_RESULT:.*]] = call @clog(%[[DOUBLE]])
|
||||
%double_result = complex.log %double : complex<f64>
|
||||
// CHECK: return %[[FLOAT_RESULT]], %[[DOUBLE_RESULT]]
|
||||
return %float_result, %double_result : complex<f32>, complex<f64>
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue