From: Mike Frysinger Date: Sun, 5 Dec 2021 17:32:34 +0000 (-0500) Subject: sim: testsuite: migrate to standard uintXX_t types X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=39a5fdbc652ee79f6c20a70c31eb40478ced27e2;p=binutils-gdb.git sim: testsuite: migrate to standard uintXX_t types This old code setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them. --- diff --git a/sim/testsuite/common/alu-n-tst.h b/sim/testsuite/common/alu-n-tst.h index cd218d4339d..14abe86e8a7 100644 --- a/sim/testsuite/common/alu-n-tst.h +++ b/sim/testsuite/common/alu-n-tst.h @@ -5,7 +5,7 @@ #include "symcat.h" /* NOTE: see end of file for #undef of these macros */ -#define unsignedN XCONCAT2(unsigned,N) +#define unsignedN XCONCAT3(uint,N,_t) #define MAX_INT XCONCAT2(MAX_INT,N) #define MIN_INT XCONCAT2(MIN_INT,N) #define alu_N_tests XCONCAT3(alu_,N,_tests) diff --git a/sim/testsuite/common/alu-tst.c b/sim/testsuite/common/alu-tst.c index 110427f62d8..63042cfe6b5 100644 --- a/sim/testsuite/common/alu-tst.c +++ b/sim/testsuite/common/alu-tst.c @@ -27,13 +27,13 @@ typedef struct { char *op; - unsigned64 arg; + uint64_t arg; } alu_op; typedef struct { - unsigned64 begin; + uint64_t begin; alu_op ops[4]; - unsigned64 result; + uint64_t result; int carry_borrow; int overflow; } alu_test; @@ -51,21 +51,21 @@ typedef struct { #define MIN_INT64 UNSIGNED64 (0x8000000000000000) static void -print_hex (unsigned64 val, int nr_bits) +print_hex (uint64_t val, int nr_bits) { switch (nr_bits) { case 8: - printf ("0x%02lx", (long) (unsigned8) (val)); + printf ("0x%02lx", (long) (uint8_t) (val)); break; case 16: - printf ("0x%04lx", (long) (unsigned16) (val)); + printf ("0x%04lx", (long) (uint16_t) (val)); break; case 32: - printf ("0x%08lx", (long) (unsigned32) (val)); + printf ("0x%08lx", (long) (uint32_t) (val)); break; case 64: - printf ("0x%016llx", (long long) (unsigned64) (val)); + printf ("0x%016llx", (long long) (uint64_t) (val)); break; default: abort (); diff --git a/sim/testsuite/common/bits-gen.c b/sim/testsuite/common/bits-gen.c index 5f35247f7f2..d1787fc608a 100644 --- a/sim/testsuite/common/bits-gen.c +++ b/sim/testsuite/common/bits-gen.c @@ -30,8 +30,8 @@ gen_struct (void) printf (" int line;\n"); printf (" int row;\n"); printf (" int col;\n"); - printf (" unsigned64 val;\n"); - printf (" unsigned64 check;\n"); + printf (" uint64_t val;\n"); + printf (" uint64_t check;\n"); printf ("} test_tuples;\n"); printf ("\n"); printf ("typedef struct _test_spec {\n"); diff --git a/sim/testsuite/common/fpu-tst.c b/sim/testsuite/common/fpu-tst.c index d347e12727d..5ae1e084d34 100644 --- a/sim/testsuite/common/fpu-tst.c +++ b/sim/testsuite/common/fpu-tst.c @@ -25,7 +25,7 @@ do { \ static int flags; -int8 +int8_t syst_float_flags_clear () { int old_flags = 0; @@ -72,7 +72,7 @@ syst_float_flags_clear () sim_fpu_round rounding_mode; void -syst_float_set_rounding_mode(int8 mode) +syst_float_set_rounding_mode(int8_t mode) { switch (mode) { @@ -93,7 +93,7 @@ syst_float_set_rounding_mode(int8 mode) float32 -syst_int32_to_float32(int32 a) +syst_int32_to_float32(int32_t a) { float32 z; sim_fpu s; @@ -104,7 +104,7 @@ syst_int32_to_float32(int32 a) } float64 -syst_int32_to_float64( int32 a ) +syst_int32_to_float64( int32_t a ) { float64 z; sim_fpu s; @@ -113,10 +113,10 @@ syst_int32_to_float64( int32 a ) return z; } -int32 +int32_t syst_float32_to_int32_round_to_zero( float32 a ) { - int32 z; + int32_t z; sim_fpu s; sim_fpu_32to (&s, a); flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero); @@ -312,9 +312,9 @@ flag syst_float32_lt_quiet( float32 a, float32 b ) return is; } -int32 syst_float64_to_int32_round_to_zero( float64 a ) +int32_t syst_float64_to_int32_round_to_zero( float64 a ) { - int32 z; + int32_t z; sim_fpu s; sim_fpu_64to (&s, a); flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero);