diff --git a/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir b/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir index e3a3aa605f860..67867f3cbd680 100644 --- a/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir +++ b/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir @@ -33,6 +33,11 @@ func.func @sqrt(%arg: complex) -> complex { func.return %sqrt : complex } +func.func @tanh(%arg: complex) -> complex { + %tanh = complex.tanh %arg : complex + func.return %tanh : complex +} + // %input contains pairs of lhs, rhs, i.e. [lhs_0, rhs_0, lhs_1, rhs_1,...] func.func @test_binary(%input: tensor>, %func: (complex, complex) -> complex) { @@ -115,5 +120,37 @@ func.func @entry() { call @test_binary(%atan2_test_cast, %atan2_func) : (tensor>, (complex, complex) -> complex) -> () + + // complex.tanh test + %tanh_test = arith.constant dense<[ + (-1.0, -1.0), + // CHECK: -1.08392 + // CHECK-NEXT: -0.271753 + (-1.0, 1.0), + // CHECK-NEXT: -1.08392 + // CHECK-NEXT: 0.271753 + (0.0, 0.0), + // CHECK-NEXT: 0 + // CHECK-NEXT: 0 + (0.0, 1.0), + // CHECK-NEXT: 0 + // CHECK-NEXT: 1.5574 + (1.0, -1.0), + // CHECK-NEXT: 1.08392 + // CHECK-NEXT: -0.271753 + (1.0, 0.0), + // CHECK-NEXT: 0.761594 + // CHECK-NEXT: 0 + (1.0, 1.0) + // CHECK-NEXT: 1.08392 + // CHECK-NEXT: 0.271753 + ]> : tensor<7xcomplex> + %tanh_test_cast = tensor.cast %tanh_test + : tensor<7xcomplex> to tensor> + + %tanh_func = func.constant @tanh : (complex) -> complex + call @test_unary(%tanh_test_cast, %tanh_func) + : (tensor>, (complex) -> complex) -> () + func.return }