diff --git a/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir b/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir --- a/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir +++ b/mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir @@ -33,6 +33,11 @@ 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) { @@ -95,25 +100,36 @@ call @test_unary(%sqrt_test_cast, %sqrt_func) : (tensor>, (complex) -> complex) -> () - // complex.atan2 test - %atan2_test = arith.constant dense<[ - (1.0, 2.0), (2.0, 1.0), - // CHECK: 0.785 - // CHECK-NEXT: 0.346 - (1.0, 1.0), (1.0, 0.0), - // CHECK-NEXT: 1.017 - // CHECK-NEXT: 0.402 - (1.0, 1.0), (1.0, 1.0) - // CHECK-NEXT: 0.785 + // 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 - ]> : tensor<6xcomplex> - %atan2_test_cast = tensor.cast %atan2_test - : tensor<6xcomplex> to tensor> + // 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) -> () - %atan2_func = func.constant @atan2 : (complex, complex) - -> complex - call @test_binary(%atan2_test_cast, %atan2_func) - : (tensor>, (complex, complex) - -> complex) -> () func.return }