summaryrefslogtreecommitdiff
path: root/sim/testsuite/common/alu-tst.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1999-04-16 01:34:07 +0000
committerStan Shebs <shebs@codesourcery.com>1999-04-16 01:34:07 +0000
commit071ea11e85eb9d529cc5eb3d35f6247466a21b99 (patch)
tree5deda65b8d7b04d1f4cbc534c3206d328e1267ec /sim/testsuite/common/alu-tst.c
parent1730ec6b1848f0f32154277f788fb29f88d8475b (diff)
downloadbinutils-gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.tar.gz
Initial creation of sourceware repository
Diffstat (limited to 'sim/testsuite/common/alu-tst.c')
-rw-r--r--sim/testsuite/common/alu-tst.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/sim/testsuite/common/alu-tst.c b/sim/testsuite/common/alu-tst.c
deleted file mode 100644
index f03ebd55322..00000000000
--- a/sim/testsuite/common/alu-tst.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#define WITH_TARGET_WORD_MSB 0
-#define WITH_TARGET_WORD_BITSIZE 64
-#define WITH_HOST_WORD_BITSIZE (sizeof (int) * 8)
-
-#define ASSERT(EXPRESSION) \
-{ \
- if (!(EXPRESSION)) { \
- fprintf (stderr, "%s:%d: assertion failed - %s\n", \
- __FILE__, __LINE__, #EXPRESSION); \
- abort (); \
- } \
-}
-
-#define SIM_BITS_INLINE (INCLUDE_MODULE | INCLUDED_BY_MODULE)
-
-#include "sim-basics.h"
-#include "sim-types.h"
-#include "sim-bits.h"
-
-#include "sim-alu.h"
-
-#include <stdio.h>
-
-
-typedef struct {
- char *op;
- unsigned64 arg;
-} alu_op;
-
-typedef struct {
- unsigned64 begin;
- alu_op ops[3];
- unsigned64 result;
- int carry;
- int overflow;
-} alu_test;
-
-#define MAX_INT16 (32767)
-#define MIN_INT16 (32768)
-
-const alu_test alu16_tests[] = {
- /* */
- { MAX_INT16, { { "ADD", 1 }, }, MIN_INT16, 0, 1, },
- { MIN_INT16, { { "ADD", -1 }, }, MAX_INT16, 1, 1, },
- { MAX_INT16, { { "ADD", MIN_INT16 }, }, -1, 0, 0, },
- { MIN_INT16, { { "ADD", MAX_INT16 }, }, -1, 0, 0, },
- { MAX_INT16, { { "ADD", MAX_INT16 }, }, MAX_INT16 * 2, 0, 1, },
- { MIN_INT16, { { "ADD", MIN_INT16 }, }, 0, 1, 1, },
- /* */
- { 0, { { "SUB", MIN_INT16 }, }, MIN_INT16, 0, 1, },
- { MAX_INT16, { { "SUB", MAX_INT16 }, }, 0, 0, 0, },
-};
-
-
-static void
-print_hex (unsigned64 val, int nr_bits)
-{
- switch (nr_bits)
- {
- case 16:
- printf ("0x%04lx", (long) (unsigned16) (val));
- break;
- case 32:
- printf ("0x%08lx", (long) (unsigned32) (val));
- break;
- case 64:
- printf ("0x%08lx%08lx",
- (long) (unsigned32) (val >> 32),
- (long) (unsigned32) (val));
- default:
- abort ();
- }
-}
-
-
-int errors = 0;
-
-
-#define N 16
-#include "alu-n-tst.h"
-#undef N
-
-#if 0
-#define N 32
-#include "alu-n-tst.h"
-#undef N
-
-#define N 64
-#include "alu-n-tst.h"
-#undef N
-#endif
-
-int
-main ()
-{
- int i;
- for (i = 0; i < sizeof (alu16_tests) / sizeof (*alu16_tests); i++)
- do_op_16 (alu16_tests + i);
- return (errors != 0);
-}