Create MI tests for EW Unary: LOG, RECIPROCAL, RSQRT, EXP

Also fix the ERROR_IF conformance test generator to apply correct
operator filtering to create the tests.

Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: I5788932e3529ec9386900623b20c22c98e4201b7
diff --git a/verif/conformance/test_select.py b/verif/conformance/test_select.py
index 59feae1..05f6db8 100644
--- a/verif/conformance/test_select.py
+++ b/verif/conformance/test_select.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2021-2022, ARM Limited.
+# Copyright (c) 2021-2023, ARM Limited.
 # SPDX-License-Identifier: Apache-2.0
 """Select generated tests."""
 import argparse
@@ -464,6 +464,12 @@
     name = "equal"
 
 
+class ExpOperator(Operator):
+    """Test selector for the EXP operator."""
+
+    name = "exp"
+
+
 class FloorOperator(Operator):
     """Test selector for the FLOOR operator."""
 
@@ -507,11 +513,17 @@
 
 
 class IntDivOperator(Operator):
-    """Test selector for the INTDIV."""
+    """Test selector for the INTDIV operator."""
 
     name = "intdiv"
 
 
+class LogOperator(Operator):
+    """Test selector for the LOG operator."""
+
+    name = "log"
+
+
 class LogicalAndOperator(Operator):
     """Test selector for the LOGICAL_AND operator."""
 
@@ -600,6 +612,12 @@
     name = "pow"
 
 
+class ReciprocalOperator(Operator):
+    """Test selector for the RECIPROCAL operator."""
+
+    name = "reciprocal"
+
+
 class ReduceAllOperator(Operator):
     """Test selector for the REDUCE_ALL operator."""
 
@@ -678,6 +696,12 @@
     param_names = ["shape", "type", "axis"]
 
 
+class RsqrtOperator(Operator):
+    """Test selector for the RSQRT operator."""
+
+    name = "rsqrt"
+
+
 class ScatterOperator(Operator):
     """Test selector for the SCATTER operator."""
 
diff --git a/verif/conformance/tosa_main_profile_ops_info.json b/verif/conformance/tosa_main_profile_ops_info.json
index b55c894..47668db 100644
--- a/verif/conformance/tosa_main_profile_ops_info.json
+++ b/verif/conformance/tosa_main_profile_ops_info.json
@@ -499,6 +499,59 @@
             "tosa-mi"
         ]
     },
+    "exp": {
+        "group": "ew_unary",
+        "generator_args": [
+            [
+                "--target-dtype",
+                "fp32",
+                "--target-dtype",
+                "fp16",
+                "--target-dtype",
+                "bf16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "15,64",
+                "--target-rank",
+                "1",
+                "--target-rank",
+                "2",
+                "--target-rank",
+                "3"
+            ],
+            [
+                "--target-dtype",
+                "fp16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "1,15",
+                "--target-rank",
+                "4",
+                "--target-rank",
+                "5"
+            ],
+            [
+                "--target-dtype",
+                "fp32",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--target-shape",
+                "1,1,65535,4",
+                "--target-shape",
+                "2,65536,1,1,1"
+            ]
+        ],
+        "params": {},
+        "permutes": [
+            "shape",
+            "type"
+        ],
+        "profile": [
+            "tosa-mi"
+        ]
+    },
     "floor": {
         "group": "ew_unary",
         "generator_args": [
@@ -651,6 +704,65 @@
             "tosa-mi"
         ]
     },
+    "log": {
+        "group": "ew_unary",
+        "generator_args": [
+            [
+                "--filter",
+                "^log$",
+                "--target-dtype",
+                "fp32",
+                "--target-dtype",
+                "fp16",
+                "--target-dtype",
+                "bf16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "15,64",
+                "--target-rank",
+                "1",
+                "--target-rank",
+                "2",
+                "--target-rank",
+                "3"
+            ],
+            [
+                "--filter",
+                "^log$",
+                "--target-dtype",
+                "fp32",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "1,15",
+                "--target-rank",
+                "4",
+                "--target-rank",
+                "5"
+            ],
+            [
+                "--filter",
+                "^log$",
+                "--target-dtype",
+                "fp16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--target-shape",
+                "1,65530,1,2",
+                "--target-shape",
+                "3,1,65540,1,1"
+            ]
+        ],
+        "params": {},
+        "permutes": [
+            "shape",
+            "type"
+        ],
+        "profile": [
+            "tosa-mi"
+        ]
+    },
     "max_pool2d": {
         "group": "tensor",
         "generator_args": [
@@ -894,6 +1006,59 @@
             "tosa-mi"
         ]
     },
+    "reciprocal": {
+        "group": "ew_unary",
+        "generator_args": [
+            [
+                "--target-dtype",
+                "fp32",
+                "--target-dtype",
+                "fp16",
+                "--target-dtype",
+                "bf16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "15,64",
+                "--target-rank",
+                "1",
+                "--target-rank",
+                "2",
+                "--target-rank",
+                "3"
+            ],
+            [
+                "--target-dtype",
+                "fp16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "1,15",
+                "--target-rank",
+                "4",
+                "--target-rank",
+                "5"
+            ],
+            [
+                "--target-dtype",
+                "bf16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--target-shape",
+                "1,1,65536,4",
+                "--target-shape",
+                "2,65535,1,1,1"
+            ]
+        ],
+        "params": {},
+        "permutes": [
+            "shape",
+            "type"
+        ],
+        "profile": [
+            "tosa-mi"
+        ]
+    },
     "reshape": {
         "group": "data_layout",
         "generator_args": [
@@ -968,6 +1133,59 @@
             "tosa-mi"
         ]
     },
+    "rsqrt": {
+        "group": "ew_unary",
+        "generator_args": [
+            [
+                "--target-dtype",
+                "fp32",
+                "--target-dtype",
+                "fp16",
+                "--target-dtype",
+                "bf16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "15,64",
+                "--target-rank",
+                "1",
+                "--target-rank",
+                "2",
+                "--target-rank",
+                "3"
+            ],
+            [
+                "--target-dtype",
+                "bf16",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--tensor-dim-range",
+                "1,15",
+                "--target-rank",
+                "4",
+                "--target-rank",
+                "5"
+            ],
+            [
+                "--target-dtype",
+                "fp32",
+                "--fp-values-range",
+                "-2.0,2.0",
+                "--target-shape",
+                "1,1,3,65541",
+                "--target-shape",
+                "65532,1,3,1,1"
+            ]
+        ],
+        "params": {},
+        "permutes": [
+            "shape",
+            "type"
+        ],
+        "profile": [
+            "tosa-mi"
+        ]
+    },
     "scatter": {
         "group": "scatter_gather",
         "generator_args": [
diff --git a/verif/conformance/tosa_verif_conformance_generator.py b/verif/conformance/tosa_verif_conformance_generator.py
index 4b57f63..817b242 100644
--- a/verif/conformance/tosa_verif_conformance_generator.py
+++ b/verif/conformance/tosa_verif_conformance_generator.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-# Copyright (c) 2021-2022, ARM Limited.
+# Copyright (c) 2021-2023, ARM Limited.
 # SPDX-License-Identifier: Apache-2.0
 """Build conformance tests.
 
@@ -113,8 +113,9 @@
             build_cmds_list.append(build_cmd_pos_test)
 
     if args.test_type in ["negative", "both"]:
-        # Get target-dtypes options only to limit tests to those needed
+        # Get target-dtypes options and any filter string to limit tests
         target_dtypes_args = []
+        filter_str = None
         for arglist in test_params[operator]["generator_args"]:
             idx = 0
             while idx < len(arglist):
@@ -122,8 +123,13 @@
                     if arglist[idx + 1] not in target_dtypes_args:
                         target_dtypes_args.extend(arglist[idx : idx + 2])
                     idx += 1  # skip over option (and then argument below)
+                elif arglist[idx] == "--filter":
+                    filter_str = arglist[idx + 1]
+                    idx += 1  # skip over option (and then argument below)
                 idx += 1
         build_cmd_neg_test = build_cmd_base.copy()
+        if filter_str:
+            build_cmd_neg_test.extend(["--filter", filter_str])
         build_cmd_neg_test.extend(["--test-type", "negative"])
         # Limit sizes of negative tests
         dim_range = (