[sve2] Simulator test generator

Generate random instruction sequences that match a requested instruction form,
and print them out in a TEST() format, for use in simulator testing.

Change-Id: I39c9da158981503f96d5518c17b93a2c1366d9b2
diff --git a/test/test-runner.h b/test/test-runner.h
index ffc8c2a..bb72ce6 100644
--- a/test/test-runner.h
+++ b/test/test-runner.h
@@ -32,9 +32,12 @@
 
 namespace vixl {
 
-// Each actual test is represented by a Test instance.
+// Each test is represented by a Test instance.
 // Tests are appended to a static linked list upon creation.
 class Test {
+  typedef void(TestFunction)();
+  typedef void(TestFunctionWithConfig)(Test* config);
+
  public:
   // Most tests require no per-test configuration, and so take no arguments. A
   // few tests require dynamic configuration, and are passed a `Test` object.
@@ -52,6 +55,17 @@
     last_ = this;
   }
 
+  static Test* MakeSVETest(int vl,
+                           const char* name,
+                           TestFunctionWithConfig* fn) {
+    // We never free this memory, but we need it to live for as long as the
+    // static
+    // linked list of tests, and this is the easiest way to do it.
+    Test* test = new Test(name, fn);
+    test->set_sve_vl_in_bits(vl);
+    return test;
+  }
+
   const char* name() { return name_; }
   void run();
 
@@ -98,9 +112,6 @@
     generate_test_trace_ = value;
   }
 
-  typedef void(TestFunction)();
-  typedef void(TestFunctionWithConfig)(Test* config);
-
  private:
   const char* name_;