]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390x disasm-test: Remove command line flags --d12, --d20, --sint, --uint
authorFlorian Krohm <flo2030@eich-krohm.de>
Sun, 30 Mar 2025 21:32:37 +0000 (21:32 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Sun, 30 Mar 2025 21:32:37 +0000 (21:32 +0000)
These were somewhat useful in the early days of development. Not anymore.

none/tests/s390x/disasm-test/README
none/tests/s390x/disasm-test/generate.c
none/tests/s390x/disasm-test/main.c
none/tests/s390x/disasm-test/main.h

index d04292374a6826cd66eefade79c139ff06696c4f..36485aec337d12b2342bc576596c29f738570b8b 100644 (file)
@@ -77,28 +77,6 @@ Debugging options
 --debug
   Additional debugging output.
 
---d12=INT
-  Use INT as the value for d12 fields. The given value is checked
-  for feasibility.
-
---d20=INT
-  Use INT as the value for d20 fields. The given value is checked
-  for feasibility.
-
---sint=INT
-  Use INT as the only value for signed integer fields. The given value
-  is NOT checked for feasibility (as the field width is not known).
-  The value is expected to fit in 32 bits (and is complained about
-  if it doesn't), as there are no opcodes with immediate operands
-  that have more than 32 bits.
-
---uint=INT
-  Use INT as the only value for unsigned integer fields. The given value
-  is NOT checked for feasibility (as the field width is not known).
-  The value is expected to fit in 32 bits (and is complained about
-  if it doesn't), as there are no opcodes with immediate operands
-  that have more than 32 bits.
-
 
 Testcase generation
 -------------------
index 25bcdae26e01c3570ba1c2c4b8a05c302049ed3f..2dc19704256e7681232ef05d0cb9ae5913733852 100644 (file)
@@ -144,14 +144,14 @@ random_sint(unsigned num_bits)
 static unsigned
 d12_value(void)
 {
-   return d12_val_specified ? d12_val : random_uint(12);
+   return random_uint(12);
 }
 
 
 static int
 d20_value(void)
 {
-   return d20_val_specified ? d20_val : random_sint(20);
+   return random_sint(20);
 }
 
 
@@ -160,7 +160,7 @@ uint_value(unsigned num_bits)
 {
    if (num_bits > 32)
       fatal("integer operand > 32 bits not supported\n");
-   return uint_val_specified ? uint_val : random_uint(num_bits);
+   return random_uint(num_bits);
 }
 
 
@@ -169,7 +169,7 @@ sint_value(unsigned num_bits)
 {
    if (num_bits > 32)
       fatal("integer operand > 32 bits not supported\n");
-   return sint_val_specified ? sint_val : random_sint(num_bits);
+   return random_sint(num_bits);
 }
 #endif
 
@@ -338,17 +338,12 @@ iterate(FILE *fp, const opcode *opc, field fields[], unsigned ix)
    case OPND_D12LB:
    case OPND_D12VB:
       if (f->is_displacement) {
-         if (d12_val_specified) {
-            f->assigned_value = d12_val;
+         /* Choose these interesting values */
+         static const long long values[] = { 0, 1, 2, 0xfff };
+
+         for (int i = 0; i < sizeof values / sizeof *values; ++i) {
+            f->assigned_value = values[i];
             iterate(fp, opc, fields, ix + 1);
-         } else {
-            /* Choose these interesting values */
-            static const long long values[] = { 0, 1, 2, 0xfff };
-
-            for (int i = 0; i < sizeof values / sizeof *values; ++i) {
-               f->assigned_value = values[i];
-               iterate(fp, opc, fields, ix + 1);
-            }
          }
       } else if (f->is_length) {
          /* Choose these interesting values */
@@ -376,19 +371,14 @@ iterate(FILE *fp, const opcode *opc, field fields[], unsigned ix)
    case OPND_D20B:
    case OPND_D20XB:
       if (f->is_displacement) {
-         if (d20_val_specified) {
-            f->assigned_value = d20_val;
+         /* Choose these interesting values */
+         static const long long values[] = {
+            0, 1, 2, -1, -2, 0x7ffff, -0x80000
+         };
+
+         for (int i = 0; i < sizeof values / sizeof *values; ++i) {
+            f->assigned_value = values[i];
             iterate(fp, opc, fields, ix + 1);
-         } else {
-            /* Choose these interesting values */
-            static const long long values[] = {
-               0, 1, 2, -1, -2, 0x7ffff, -0x80000
-            };
-
-            for (int i = 0; i < sizeof values / sizeof *values; ++i) {
-               f->assigned_value = values[i];
-               iterate(fp, opc, fields, ix + 1);
-            }
          }
       } else {
          /* base or index register */
@@ -401,54 +391,44 @@ iterate(FILE *fp, const opcode *opc, field fields[], unsigned ix)
 
    case OPND_SINT:
    case OPND_PCREL:
-      if (sint_val_specified) {
-         f->assigned_value = sint_val;
-         iterate(fp, opc, fields, ix + 1);
+      if (operand->allowed_values == NULL) {
+         /* No constraint: Choose these interesting values */
+         const long long values[] = {
+            0, 1, 2, -1, -2, (1LL << (operand->num_bits - 1)) - 1,
+            -(1LL << (operand->num_bits - 1))
+         };
+
+         for (int i = 0; i < sizeof values / sizeof *values; ++i) {
+            f->assigned_value = values[i];
+            iterate(fp, opc, fields, ix + 1);
+         }
       } else {
-         if (operand->allowed_values == NULL) {
-            /* No constraint: Choose these interesting values */
-            const long long values[] = {
-               0, 1, 2, -1, -2, (1LL << (operand->num_bits - 1)) - 1,
-               -(1LL << (operand->num_bits - 1))
-            };
-
-            for (int i = 0; i < sizeof values / sizeof *values; ++i) {
-               f->assigned_value = values[i];
-               iterate(fp, opc, fields, ix + 1);
-            }
-         } else {
-            /* Constraint. Choose only allowed values */
-            unsigned num_val = operand->allowed_values[0];
-            for (int i = 1; i <= num_val; ++i) {
-               f->assigned_value = operand->allowed_values[i];
-               iterate(fp, opc, fields, ix + 1);
-            }
+         /* Constraint. Choose only allowed values */
+         unsigned num_val = operand->allowed_values[0];
+         for (int i = 1; i <= num_val; ++i) {
+            f->assigned_value = operand->allowed_values[i];
+            iterate(fp, opc, fields, ix + 1);
          }
       }
       break;
 
    case OPND_UINT:
-      if (uint_val_specified) {
-         f->assigned_value = uint_val;
-         iterate(fp, opc, fields, ix + 1);
+      if (operand->allowed_values == NULL) {
+         /* No constraint: Choose these interesting values */
+         const long long values[] = {
+            0, 1, 2, (1LL << operand->num_bits) - 1
+         };
+
+         for (int i = 0; i < sizeof values / sizeof *values; ++i) {
+            f->assigned_value = values[i];
+            iterate(fp, opc, fields, ix + 1);
+         }
       } else {
-         if (operand->allowed_values == NULL) {
-            /* No constraint: Choose these interesting values */
-            const long long values[] = {
-               0, 1, 2, (1LL << operand->num_bits) - 1
-            };
-
-            for (int i = 0; i < sizeof values / sizeof *values; ++i) {
-               f->assigned_value = values[i];
-               iterate(fp, opc, fields, ix + 1);
-            }
-         } else {
-            /* Constraint. Choose only allowed values */
-            unsigned num_val = operand->allowed_values[0];
-            for (int i = 1; i <= num_val; ++i) {
-               f->assigned_value = operand->allowed_values[i];
-               iterate(fp, opc, fields, ix + 1);
-            }
+         /* Constraint. Choose only allowed values */
+         unsigned num_val = operand->allowed_values[0];
+         for (int i = 1; i <= num_val; ++i) {
+            f->assigned_value = operand->allowed_values[i];
+            iterate(fp, opc, fields, ix + 1);
          }
       }
       break;
index 46f55cf4ce47985ef602ae967ccfeb3d6ef76712..f74dc738941554263b75aaf241195ceb501df993 100644 (file)
 #include "main.h"
 
 int verbose, debug, show_spec_exc, show_miscompares;
-int d12_val, d20_val;
-long long uint_val, sint_val;
-int d12_val_specified, d20_val_specified;
-int uint_val_specified, sint_val_specified;
 
 const char *gcc = "gcc";          // path to GCC
 const char *objdump = "objdump";  // path to objdump
@@ -62,10 +58,6 @@ static const char usage[] =
    "    --gcc=/path/to/gcc\n"
    "    --gcc-flags=FLAGS\n"
    "    --objdump=/path/to/objdump\n"
-   "    --d12=INT   - Use INT as value for d12 offsets\n"
-   "    --d20=INT   - Use INT as value for d20 offsets\n"
-   "    --sint=INT  - Use INT as value for signed integer fields\n"
-   "    --uint=INT  - Use INT as value for unsigned integer fields\n"
    "    --keep-temp - Do not remove temporary files\n"
    "    --summary   - Output test generation summary (with --all)\n"
    "    --unit-test - Run unit tests\n"
@@ -73,8 +65,6 @@ static const char usage[] =
    "    --no-show-miscompares - Do not show disassembly miscompares\n"
    ;
 
-static long long get_clo_value(const char *, const char *, long long,
-                               long long);
 static void remove_temp_files(const char *);
 static int  opcode_has_errors(const opcode *);
 
@@ -137,17 +127,6 @@ main(int argc, char *argv[])
          gcc_flags = strchr(clo, '=') + 1;
       } else if (CHECK_CLO(clo, "--objdump=")) {
          objdump = strchr(clo, '=') + 1;
-      } else if (CHECK_CLO(clo, "--d12=")) {
-         d12_val = get_clo_value(clo, "d12", 0, 0xfff);
-      } else if (CHECK_CLO(clo, "--d20=")) {
-         d20_val = get_clo_value(clo, "d20", -0x80000, 0x7ffff);
-      } else if (CHECK_CLO(clo, "--sint=")) {
-         /* Integer field is restricted to 32-bit */
-         long long max = 0x7fffffff;
-         sint_val = get_clo_value(clo, "sint", -max - 1, max);
-      } else if (CHECK_CLO(clo, "--uint=")) {
-         /* Integer field is restricted to 32-bit */
-         uint_val = get_clo_value(clo, "uint", 0, 0xffffffffU);
       } else {
          if (strncmp(clo, "--", 2) == 0)
             fatal("Invalid command line option '%s'\n", clo);
@@ -341,22 +320,6 @@ strnsave(const char *s, unsigned len)
 }
 
 
-static long long
-get_clo_value(const char *clo, const char *field_name, long long min,
-              long long max)
-{
-   long long value;
-
-   const char *p = strchr(clo, '=') + 1;   // succeeds
-
-   if  (sscanf(p, "%lld", &value) != 1)
-      fatal("%s value '%s' is not an integer\n", field_name, p);
-   if (value < min || value > max)
-      fatal("%s value '%lld' is out of range\n", field_name, value);
-   return value;
-}
-
-
 /* Return 1, if the given opcode has at least one invalid operand.
    This indicates that there were parse errors earlier. */
 static int
index f51ad0c0b7c5919e7198f6fd89f2b83ecfc9819c..8c51b1dc2043700572f6b82c475173a03ab8fcd0 100644 (file)
@@ -91,10 +91,6 @@ extern int verbose;
 extern int debug;
 extern int show_spec_exc;
 extern int show_miscompares;
-extern int d12_val, d20_val;
-extern long long sint_val, uint_val;
-extern int d12_val_specified, d20_val_specified;
-extern int uint_val_specified, sint_val_specified;
 extern unsigned num_opcodes;
 extern const char *gcc;
 extern const char *gcc_flags;