From d70c5fc7c56fa9915f594aca8de15b478f3ab5b0 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 17 Feb 2006 14:36:28 +0000 Subject: Add support for the Infineon XC16X. --- gas/ChangeLog | 15 + gas/Makefile.am | 17 + gas/Makefile.in | 20 + gas/NEWS | 2 + gas/config/tc-xc16x.c | 395 ++++++++++ gas/config/tc-xc16x.h | 67 ++ gas/configure | 127 +++- gas/configure.in | 4 + gas/doc/all.texi | 1 + gas/doc/c-xc16x.texi | 55 ++ gas/testsuite/ChangeLog | 51 ++ gas/testsuite/gas/v850/v850e1.d | 2 +- gas/testsuite/gas/xc16x/add.s | 17 + gas/testsuite/gas/xc16x/add_test.s | 92 +++ gas/testsuite/gas/xc16x/addb.s | 11 + gas/testsuite/gas/xc16x/addc.s | 11 + gas/testsuite/gas/xc16x/addcb.s | 17 + gas/testsuite/gas/xc16x/and.s | 14 + gas/testsuite/gas/xc16x/andb.s | 10 + gas/testsuite/gas/xc16x/bfldl.s | 4 + gas/testsuite/gas/xc16x/bit.s | 11 + gas/testsuite/gas/xc16x/calla.s | 24 + gas/testsuite/gas/xc16x/calli.s | 21 + gas/testsuite/gas/xc16x/cmp.s | 9 + gas/testsuite/gas/xc16x/cmp_test.s | 45 ++ gas/testsuite/gas/xc16x/cmpb.s | 8 + gas/testsuite/gas/xc16x/cmpi.s | 18 + gas/testsuite/gas/xc16x/cpl.s | 7 + gas/testsuite/gas/xc16x/div.s | 8 + gas/testsuite/gas/xc16x/jmpa.s | 23 + gas/testsuite/gas/xc16x/jmpi.s | 24 + gas/testsuite/gas/xc16x/jmpr.s | 25 + gas/testsuite/gas/xc16x/mov.s | 20 + gas/testsuite/gas/xc16x/mov_test.s | 85 +++ gas/testsuite/gas/xc16x/movb.s | 26 + gas/testsuite/gas/xc16x/movbs.s | 8 + gas/testsuite/gas/xc16x/movbz.s | 9 + gas/testsuite/gas/xc16x/mul.s | 6 + gas/testsuite/gas/xc16x/neg.s | 6 + gas/testsuite/gas/xc16x/nop.s | 6 + gas/testsuite/gas/xc16x/or.s | 11 + gas/testsuite/gas/xc16x/orb.s | 10 + gas/testsuite/gas/xc16x/prior.s | 5 + gas/testsuite/gas/xc16x/pushpop.s | 5 + gas/testsuite/gas/xc16x/ret.s | 9 + gas/testsuite/gas/xc16x/scxt.s | 6 + gas/testsuite/gas/xc16x/shlrol.s | 14 + gas/testsuite/gas/xc16x/sub.s | 19 + gas/testsuite/gas/xc16x/sub_test.s | 70 ++ gas/testsuite/gas/xc16x/subb.s | 19 + gas/testsuite/gas/xc16x/subc.s | 19 + gas/testsuite/gas/xc16x/subcb.s | 20 + gas/testsuite/gas/xc16x/syscontrol1.s | 12 + gas/testsuite/gas/xc16x/syscontrol2.s | 26 + gas/testsuite/gas/xc16x/trap.s | 6 + gas/testsuite/gas/xc16x/xc16x.exp | 1317 +++++++++++++++++++++++++++++++++ gas/testsuite/gas/xc16x/xor.s | 10 + gas/testsuite/gas/xc16x/xorb.s | 10 + 58 files changed, 2898 insertions(+), 11 deletions(-) create mode 100644 gas/config/tc-xc16x.c create mode 100644 gas/config/tc-xc16x.h create mode 100644 gas/doc/c-xc16x.texi create mode 100644 gas/testsuite/gas/xc16x/add.s create mode 100644 gas/testsuite/gas/xc16x/add_test.s create mode 100644 gas/testsuite/gas/xc16x/addb.s create mode 100644 gas/testsuite/gas/xc16x/addc.s create mode 100644 gas/testsuite/gas/xc16x/addcb.s create mode 100644 gas/testsuite/gas/xc16x/and.s create mode 100644 gas/testsuite/gas/xc16x/andb.s create mode 100644 gas/testsuite/gas/xc16x/bfldl.s create mode 100644 gas/testsuite/gas/xc16x/bit.s create mode 100644 gas/testsuite/gas/xc16x/calla.s create mode 100644 gas/testsuite/gas/xc16x/calli.s create mode 100644 gas/testsuite/gas/xc16x/cmp.s create mode 100644 gas/testsuite/gas/xc16x/cmp_test.s create mode 100644 gas/testsuite/gas/xc16x/cmpb.s create mode 100644 gas/testsuite/gas/xc16x/cmpi.s create mode 100644 gas/testsuite/gas/xc16x/cpl.s create mode 100644 gas/testsuite/gas/xc16x/div.s create mode 100644 gas/testsuite/gas/xc16x/jmpa.s create mode 100644 gas/testsuite/gas/xc16x/jmpi.s create mode 100644 gas/testsuite/gas/xc16x/jmpr.s create mode 100644 gas/testsuite/gas/xc16x/mov.s create mode 100644 gas/testsuite/gas/xc16x/mov_test.s create mode 100644 gas/testsuite/gas/xc16x/movb.s create mode 100644 gas/testsuite/gas/xc16x/movbs.s create mode 100644 gas/testsuite/gas/xc16x/movbz.s create mode 100644 gas/testsuite/gas/xc16x/mul.s create mode 100644 gas/testsuite/gas/xc16x/neg.s create mode 100644 gas/testsuite/gas/xc16x/nop.s create mode 100644 gas/testsuite/gas/xc16x/or.s create mode 100644 gas/testsuite/gas/xc16x/orb.s create mode 100644 gas/testsuite/gas/xc16x/prior.s create mode 100644 gas/testsuite/gas/xc16x/pushpop.s create mode 100644 gas/testsuite/gas/xc16x/ret.s create mode 100644 gas/testsuite/gas/xc16x/scxt.s create mode 100644 gas/testsuite/gas/xc16x/shlrol.s create mode 100644 gas/testsuite/gas/xc16x/sub.s create mode 100644 gas/testsuite/gas/xc16x/sub_test.s create mode 100644 gas/testsuite/gas/xc16x/subb.s create mode 100644 gas/testsuite/gas/xc16x/subc.s create mode 100644 gas/testsuite/gas/xc16x/subcb.s create mode 100644 gas/testsuite/gas/xc16x/syscontrol1.s create mode 100644 gas/testsuite/gas/xc16x/syscontrol2.s create mode 100644 gas/testsuite/gas/xc16x/trap.s create mode 100644 gas/testsuite/gas/xc16x/xc16x.exp create mode 100644 gas/testsuite/gas/xc16x/xor.s create mode 100644 gas/testsuite/gas/xc16x/xorb.s (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 5f37c07..d8e3d09 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +2006-02-17 Shrirang Khisti + Anil Paranjape + Shilin Shakti + + * Makefile.am: Add xc16x related entry. + * Makefile.in: Regenerate. + * configure.in: Added xc16x related entry. + * configure: Regenerate. + * config/tc-xc16x.h: New file + * config/tc-xc16x.c: New file + * doc/c-xc16x.texi: New file for xc16x + * doc/all.texi: Entry for xc16x + * doc/Makefile.texi: Added c-xc16x.texi + * NEWS: Announce the support for the new target. + 2006-02-16 Nick Hudson * configure.tgt: set emulation for mips-*-netbsd* diff --git a/gas/Makefile.am b/gas/Makefile.am index e652da9..4cd7e26 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -87,6 +87,7 @@ CPU_TYPES = \ vax \ v850 \ xstormy16 \ + xc16x \ xtensa \ z80 \ z8k @@ -269,6 +270,7 @@ TARGET_CPU_CFILES = \ config/tc-vax.c \ config/tc-v850.c \ config/tc-xstormy16.c \ + config/tc-xc16x.c \ config/tc-xtensa.c \ config/tc-z80.c \ config/tc-z8k.c @@ -319,6 +321,7 @@ TARGET_CPU_HFILES = \ config/tc-vax.h \ config/tc-v850.h \ config/tc-xstormy16.h \ + config/tc-xc16x.h \ config/tc-xtensa.h \ config/tc-z80.h \ config/tc-z8k.h @@ -1498,6 +1501,12 @@ DEPTC_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/xstormy16-desc.h \ $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ $(srcdir)/../opcodes/xstormy16-opc.h cgen.h +DEPTC_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/xc16x-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/xc16x-opc.h cgen.h DEPTC_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ @@ -1978,6 +1987,11 @@ DEPOBJ_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h $(INCDIR)/aout/aout64.h +DEPOBJ_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h DEPOBJ_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ @@ -2337,6 +2351,9 @@ DEP_xstormy16_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ dwarf2dbg.h +DEP_xc16x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h DEP_xtensa_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ diff --git a/gas/Makefile.in b/gas/Makefile.in index a618160..9dde01c 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -317,6 +317,7 @@ CPU_TYPES = \ vax \ v850 \ xstormy16 \ + xc16x \ xtensa \ z80 \ z8k @@ -497,6 +498,7 @@ TARGET_CPU_CFILES = \ config/tc-vax.c \ config/tc-v850.c \ config/tc-xstormy16.c \ + config/tc-xc16x.c \ config/tc-xtensa.c \ config/tc-z80.c \ config/tc-z8k.c @@ -547,6 +549,7 @@ TARGET_CPU_HFILES = \ config/tc-vax.h \ config/tc-v850.h \ config/tc-xstormy16.h \ + config/tc-xc16x.h \ config/tc-xtensa.h \ config/tc-z80.h \ config/tc-z8k.h @@ -1368,6 +1371,13 @@ DEPTC_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ $(srcdir)/../opcodes/xstormy16-opc.h cgen.h +DEPTC_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/xc16x-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/xc16x-opc.h cgen.h + DEPTC_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ @@ -1956,6 +1966,12 @@ DEPOBJ_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h $(INCDIR)/aout/aout64.h +DEPOBJ_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + DEPOBJ_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ @@ -2422,6 +2438,10 @@ DEP_xstormy16_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ dwarf2dbg.h +DEP_xc16x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h + DEP_xtensa_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ diff --git a/gas/NEWS b/gas/NEWS index 2318fb3..4b4d029 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -1,5 +1,7 @@ -*- text -*- +* Support for the Infineon XC16X has been added by KPIT Cummins Infosystems. + * Support for ms2 architecture has been added. * Support for the Z80 processor family has been added. diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c new file mode 100644 index 0000000..7a369b4 --- /dev/null +++ b/gas/config/tc-xc16x.c @@ -0,0 +1,395 @@ +/* tc-xc16x.c -- Assembler for the Infineon XC16X. + Copyright 2006 Free Software Foundation, Inc. + Contributed by KPIT Cummins Infosystems + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + + +#include +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" +#include "symcat.h" +#include "opcodes/xc16x-desc.h" +#include "opcodes/xc16x-opc.h" +#include "cgen.h" +#include "bfd.h" +#include "dwarf2dbg.h" + + +#ifdef OBJ_ELF +#include "elf/xc16x.h" +#endif + +/* Structure to hold all of the different components describing + an individual instruction. */ +typedef struct +{ + const CGEN_INSN * insn; + const CGEN_INSN * orig_insn; + CGEN_FIELDS fields; +#if CGEN_INT_INSN_P + CGEN_INSN_INT buffer [1]; +#define INSN_VALUE(buf) (*(buf)) +#else + unsigned char buffer [CGEN_MAX_INSN_SIZE]; +#define INSN_VALUE(buf) (buf) +#endif + char * addr; + fragS * frag; + int num_fixups; + fixS * fixups [GAS_CGEN_MAX_FIXUPS]; + int indices [MAX_OPERAND_INSTANCES]; +} +xc16x_insn; + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = ""; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +#define XC16X_SHORTOPTS "" +const char * md_shortopts = XC16X_SHORTOPTS; + +struct option md_longopts[] = +{ + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof (md_longopts); + +static void +xc16xlmode (int arg ATTRIBUTE_UNUSED) +{ + if (stdoutput != NULL) + if (!bfd_set_arch_mach (stdoutput, bfd_arch_xc16x, bfd_mach_xc16xl)) + as_warn (_("could not set architecture and machine")); +} + +static void +xc16xsmode (int arg ATTRIBUTE_UNUSED) +{ + if (!bfd_set_arch_mach (stdoutput, bfd_arch_xc16x, bfd_mach_xc16xs)) + as_warn (_("could not set architecture and machine")); +} + +static void +xc16xmode (int arg ATTRIBUTE_UNUSED) +{ + if (!bfd_set_arch_mach (stdoutput, bfd_arch_xc16x, bfd_mach_xc16x)) + as_warn (_("could not set architecture and machine")); +} + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "word", cons, 2 }, + {"xc16xl", xc16xlmode, 0}, + {"xc16xs", xc16xsmode, 0}, + {"xc16x", xc16xmode, 0}, + { NULL, NULL, 0 } +}; + +void +md_begin (void) +{ + /* Initialize the `cgen' interface. */ + + /* Set the machine number and endian. */ + gas_cgen_cpu_desc = xc16x_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0, + CGEN_CPU_OPEN_ENDIAN, + CGEN_ENDIAN_LITTLE, + CGEN_CPU_OPEN_END); + xc16x_cgen_init_asm (gas_cgen_cpu_desc); + + /* This is a callback from cgen to gas to parse operands. */ + cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand); +} + +void +md_assemble (char *str) +{ + xc16x_insn insn; + char *errmsg; + + /* Initialize GAS's cgen interface for a new instruction. */ + gas_cgen_init_parse (); + + insn.insn = xc16x_cgen_assemble_insn + (gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, & errmsg); + + if (!insn.insn) + { + as_bad (errmsg); + return; + } + + /* Doesn't really matter what we pass for RELAX_P here. */ + gas_cgen_finish_insn (insn.insn, insn.buffer, + CGEN_FIELDS_BITSIZE (& insn.fields), 1, NULL); +} + +/* Return the bfd reloc type for OPERAND of INSN at fixup FIXP. + Returns BFD_RELOC_NONE if no reloc type can be found. + *FIXP may be modified if desired. */ + +bfd_reloc_code_real_type +md_cgen_lookup_reloc (const CGEN_INSN *insn ATTRIBUTE_UNUSED, + const CGEN_OPERAND *operand, + fixS *fixP) +{ + switch (operand->type) + { + case XC16X_OPERAND_REL: + fixP->fx_where += 1; + fixP->fx_pcrel = 1; + return BFD_RELOC_8_PCREL; + + case XC16X_OPERAND_CADDR: + fixP->fx_where += 2; + return BFD_RELOC_16; + + case XC16X_OPERAND_UIMM7: + fixP->fx_where += 1; + fixP->fx_pcrel = 1; + return BFD_RELOC_8_PCREL; + + case XC16X_OPERAND_UIMM16: + case XC16X_OPERAND_MEMORY: + fixP->fx_where += 2; + return BFD_RELOC_16; + + case XC16X_OPERAND_UPOF16: + fixP->fx_where += 2; + return BFD_RELOC_XC16X_POF; + + case XC16X_OPERAND_UPAG16: + fixP->fx_where += 2; + return BFD_RELOC_XC16X_PAG; + + case XC16X_OPERAND_USEG8: + fixP->fx_where += 1; + return BFD_RELOC_XC16X_SEG; + + case XC16X_OPERAND_USEG16: + case XC16X_OPERAND_USOF16: + fixP->fx_where += 2; + return BFD_RELOC_XC16X_SOF; + + default : /* avoid -Wall warning */ + break; + } + + fixP->fx_where += 2; + return BFD_RELOC_XC16X_SOF; +} + +/* Write a value out to the object file, using the appropriate endianness. */ + +void +md_number_to_chars (char * buf, valueT val, int n) +{ + number_to_chars_littleendian (buf, val, n); +} + +void +md_show_usage (FILE * stream) +{ + fprintf (stream, _(" XC16X specific command line options:\n")); +} + +int +md_parse_option (int c ATTRIBUTE_UNUSED, + char *arg ATTRIBUTE_UNUSED) +{ + return 0; +} + +/* Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +/* Equal to MAX_PRECISION in atof-ieee.c. */ +#define MAX_LITTLENUMS 6 + +char * +md_atof (int type, char *litP, int *sizeP) +{ + int i; + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + char *t; + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + /* FIXME: Some targets allow other format chars for bigger sizes + here. */ + + default: + *sizeP = 0; + return _("Bad call to md_atof()"); + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + *sizeP = prec * sizeof (LITTLENUM_TYPE); + + for (i = prec - 1; i >= 0; i--) + { + md_number_to_chars (litP, (valueT) words[i], + sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + + return NULL; +} + +valueT +md_section_align (segT segment, valueT size) +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} + +symbolS * +md_undefined_symbol (char *name ATTRIBUTE_UNUSED) +{ + return NULL; +} + +int +md_estimate_size_before_relax (fragS *fragP ATTRIBUTE_UNUSED, + segT segment_type ATTRIBUTE_UNUSED) +{ + printf (_("call tomd_estimate_size_before_relax \n")); + abort (); +} + + +long +md_pcrel_from (fixS *fixP) +{ + long temp_val; + temp_val=fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address; + + return temp_val; +} + +long +md_pcrel_from_section (fixS *fixP, segT sec) +{ + if (fixP->fx_addsy != (symbolS *) NULL + && (! S_IS_DEFINED (fixP->fx_addsy) + || S_GET_SEGMENT (fixP->fx_addsy) != sec + || S_IS_EXTERNAL (fixP->fx_addsy) + || S_IS_WEAK (fixP->fx_addsy))) + { + return 0; + } + + return md_pcrel_from (fixP); +} + +arelent * +tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) +{ + arelent *rel; + bfd_reloc_code_real_type r_type; + + if (fixp->fx_addsy && fixp->fx_subsy) + { + if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy)) + || S_GET_SEGMENT (fixp->fx_addsy) == undefined_section) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "Difference of symbols in different sections is not supported"); + return NULL; + } + } + + rel = xmalloc (sizeof (arelent)); + rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); + *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + rel->address = fixp->fx_frag->fr_address + fixp->fx_where; + rel->addend = fixp->fx_offset; + + r_type = fixp->fx_r_type; + +#define DEBUG 0 +#if DEBUG + fprintf (stderr, "%s\n", bfd_get_reloc_code_name (r_type)); + fflush(stderr); +#endif + + rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); + if (rel->howto == NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("Cannot represent relocation type %s"), + bfd_get_reloc_code_name (r_type)); + return NULL; + } + + return rel; +} + +void +md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) +{ + if(!strstr (seg->name,".debug")) + { + if (*valP < 128) + *valP /= 2; + if (*valP>268435455) + { + *valP = *valP * (-1); + *valP /= 2; + *valP = 256 - (*valP); + } + } + + gas_cgen_md_apply_fix (fixP, valP, seg); + return; +} + +void +md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, + segT seg ATTRIBUTE_UNUSED, + fragS *fragP ATTRIBUTE_UNUSED) +{ + printf (_("call to md_convert_frag \n")); + abort (); +} + + diff --git a/gas/config/tc-xc16x.h b/gas/config/tc-xc16x.h new file mode 100644 index 0000000..aa510d8 --- /dev/null +++ b/gas/config/tc-xc16x.h @@ -0,0 +1,67 @@ +/* This file is tc-xc16x.h + Copyright 2006 Free Software Foundation, Inc. + Contributed by KPIT Cummins Infosystems + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#define TC_XC16X + +#define TARGET_BYTES_BIG_ENDIAN 0 + +#define TARGET_ARCH bfd_arch_xc16x + +#ifdef BFD_ASSEMBLER +/* Fixup debug sections since we will never relax them. */ +#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC) +#endif + +#ifdef OBJ_ELF +#define TARGET_FORMAT "elf32-xc16x" +#define LOCAL_LABEL_PREFIX '.' +#define LOCAL_LABEL(NAME) (NAME[0] == '.' && NAME[1] == 'L') +#define FAKE_LABEL_NAME ".L0\001" +#endif + +#if ANSI_PROTOTYPES +struct fix; +struct internal_reloc; +#endif + +#define WORKING_DOT_WORD + +#define BFD_ARCH bfd_arch_xc16x +#define TC_COUNT_RELOC(x) 1 +#define IGNORE_NONSTANDARD_ESCAPES + +#define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) +extern void tc_reloc_mangle (struct fix *, struct internal_reloc *, bfd_vma); + +/* No shared lib support, so we don't need to ensure externally + visible symbols can be overridden. */ +#define EXTERN_FORCE_RELOC 0 + +/* Minimum instruction is of 16 bits. */ +#define DWARF2_LINE_MIN_INSN_LENGTH 2 + +#define DO_NOT_STRIP 0 +#define LISTING_HEADER "Infineon XC16X GAS " +#define NEED_FX_R_TYPE 1 +#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) +extern long md_pcrel_from_section (struct fix *, segT); + +#define md_operand(x) diff --git a/gas/configure b/gas/configure index 5cba97e..c97e02b 100755 --- a/gas/configure +++ b/gas/configure @@ -3340,6 +3340,7 @@ cygwin* | mingw* |pw32*) ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in @@ -3350,6 +3351,7 @@ darwin* | rhapsody*) lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac + lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu) @@ -3410,14 +3412,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) - case $host_cpu in - alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + lt_cv_deplibs_check_method=pass_all ;; netbsd* | knetbsd*-gnu) @@ -3478,6 +3473,67 @@ deplibs_check_method=$lt_cv_deplibs_check_method # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len" ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -3811,7 +3867,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 3814 "configure"' > conftest.$ac_ext + echo '#line 3870 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -3866,6 +3922,52 @@ ia64-*-hpux*) rm -rf conftest* ;; +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" @@ -4712,6 +4814,10 @@ _ACEOF using_cgen=yes ;; + xc16x) + using_cgen=yes + ;; + xtensa) echo ${extra_objects} | grep -s "xtensa-relax.o" if test $? -ne 0 ; then @@ -10104,8 +10210,9 @@ case "${need_libm}" in yes) LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm + # on darwin the libm is a symbolic link to libSystem.dylib ;; *-ncr-sysv4.3*) echo "$as_me:$LINENO: checking for _mwvalidcheckl in -lmw" >&5 diff --git a/gas/configure.in b/gas/configure.in index fd14bcf..f7a75cd 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -335,6 +335,10 @@ changequote([,])dnl using_cgen=yes ;; + xc16x) + using_cgen=yes + ;; + xtensa) echo ${extra_objects} | grep -s "xtensa-relax.o" if test $? -ne 0 ; then diff --git a/gas/doc/all.texi b/gas/doc/all.texi index 2476b2e..5192f54 100644 --- a/gas/doc/all.texi +++ b/gas/doc/all.texi @@ -43,6 +43,7 @@ @set IP2K @set M32C @set M32R +@set xc16x @set M68HC11 @set M680X0 @set MCORE diff --git a/gas/doc/c-xc16x.texi b/gas/doc/c-xc16x.texi new file mode 100644 index 0000000..73866e4 --- /dev/null +++ b/gas/doc/c-xc16x.texi @@ -0,0 +1,55 @@ +@c Copyright 2006 Free Software Foundation, Inc. +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. + +@page +@node xc16x-Dependent +@chapter Infineon xc16x Dependent Features + +@cindex xc16x support +@menu +* xc16x Directives:: xc16x Machine Directives +@end menu + +@node xc16x Directives +@section xc16x Machine Directives + +The xc16x version of the assembler supports the following machine +directives: + +@table @code +@cindex @code{align} directive, xc16x +@item .align +This directive aligns the section program counter on the next 2-byte +boundary. + + +@cindex @code{byte} directive, xc16x +@item .byte @var{expr} +This directive assembles a half-word (8-bit) constant. + +@cindex @code{word} directive, xc16x +@item .word @var{expr} +This assembles a word (16-bit) constant. + +@cindex @code{ascii} directive, xc16x +@item .ascii "@var{ascii}" +This directive used for copying @var{str} into the object file. +The string is terminated with a null byte. + +@cindex @code{set} directive, xc16x +@item .set @var{symbol}, @var{value} +This directive creates a symbol named @var{symbol} which is an alias for +another symbol (possibly not yet defined). This should not be confused +with the mnemonic @code{set}, which is a legitimate xc16x instruction. + + + +@cindex @code{bss} directive, xc16x +@item .bss @var{symbol}, @var{length} +Reserve @var{length} bytes in the bss section for a local @var{symbol}, +aligned to the power of two specified by @var{align}. @var{length} and +@var{align} must be positive absolute expressions. This directive +differs from @samp{.lcomm} only in that it permits you to specify +an alignment. +@end table diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 055fd43..2cb93d1 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,54 @@ +2006-02-17 Shrirang Khisti + Anil Paranjape + Shilin Shakti + + * gas/xc16x: New directory. + * gas/xc16x/xc16x.exp: New file + * gas/xc16x/add.s: New file + * gas/xc16x/add_test.s: New file + * gas/xc16x/addb.s: New file + * gas/xc16x/addc.s: New file + * gas/xc16x/addcb.s: New file + * gas/xc16x/and.s: New file + * gas/xc16x/andb.s: New file + * gas/xc16x/bfldl.s: New file + * gas/xc16x/bit.s: New file + * gas/xc16x/calla.s: New file + * gas/xc16x/calli.s: New file + * gas/xc16x/cmp.s: New file + * gas/xc16x/cmp_test.s: New file + * gas/xc16x/cmpb.s: New file + * gas/xc16x/cmpi.s: New file + * gas/xc16x/cpl.s: New file + * gas/xc16x/div.s: New file + * gas/xc16x/jmpa.s: New file + * gas/xc16x/jmpi.s: New file + * gas/xc16x/jmpr.s: New file + * gas/xc16x/mov.s: New file + * gas/xc16x/mov_test.s: New file + * gas/xc16x/movb.s: New file + * gas/xc16x/movbs.s: New file + * gas/xc16x/movbz.s: New file + * gas/xc16x/mul.s: New file + * gas/xc16x/neg.s: New file + * gas/xc16x/nop.s: New file + * gas/xc16x/or.s: New file + * gas/xc16x/orb.s: New file + * gas/xc16x/prior.s: New file + * gas/xc16x/pushpop.s: New file + * gas/xc16x/ret.s: New file + * gas/xc16x/scxt.s: New file + * gas/xc16x/shlrol.s: New file + * gas/xc16x/sub.s: New file + * gas/xc16x/sub_test.s: New file + * gas/xc16x/subb.s: New file + * gas/xc16x/subcb.s: New file + * gas/xc16x/syscontrol1.s: New file + * gas/xc16x/syscontrol2.s: New file + * gas/xc16x/trap.s: New file + * gas/xc16x/xor.s: New file + * gas/xc16x/xorb.s: New file + 2006-02-12 H.J. Lu * gas/i386/x86-64-crx-suffix.d: Undo the last change. diff --git a/gas/testsuite/gas/v850/v850e1.d b/gas/testsuite/gas/v850/v850e1.d index 9fb689b..3f176d1 100644 --- a/gas/testsuite/gas/v850/v850e1.d +++ b/gas/testsuite/gas/v850/v850e1.d @@ -11,7 +11,7 @@ Disassembly of section .text: 0x0+04 e0 1f 40 23 [ ]*bsw sp, gp 0x0+08 05 02 [ ]*callt 5 0x0+0a e8 3f e4 00 [ ]*clr1 r7, r8 -0x0+0e f6 17 14 1b [ ]*cmov nz, -10, r2, sp +0x0+0e f6 17 14 1b [ ]*cmov nz, 22, r2, sp 0x0+12 e1 17 34 1b [ ]*cmov nz, r1, r2, sp 0x0+16 e0 07 44 01 [ ]*ctret 0x0+1a e0 07 46 01 [ ]*dbret diff --git a/gas/testsuite/gas/xc16x/add.s b/gas/testsuite/gas/xc16x/add.s new file mode 100644 index 0000000..bab7c09 --- /dev/null +++ b/gas/testsuite/gas/xc16x/add.s @@ -0,0 +1,17 @@ +.text +xc16x_add: +add r0,r1 +add r0,[r1] +add r0,[r1+] +add r0,#3 +add r0,#1234 +add r0,0xffed +add 0xffed,r0 + + + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/add_test.s b/gas/testsuite/gas/xc16x/add_test.s new file mode 100644 index 0000000..7924f50 --- /dev/null +++ b/gas/testsuite/gas/xc16x/add_test.s @@ -0,0 +1,92 @@ +.text +_start: + add r0,r1 + add r0,r2 + add r0,r3 + add r0,r4 + add r0,r5 + add r0,r6 + add r0,r7 + add r0,r8 + add r0,r9 + add r0,r10 + add r0,r11 + add r0,r12 + add r0,r13 + add r0,r14 + add r0,r15 + + add r1,r0 + add r1,r2 + add r1,r3 + add r1,r4 + add r1,r5 + add r1,r6 + add r1,r7 + add r1,r8 + add r1,r9 + add r1,r10 + add r1,r11 + add r1,r12 + add r1,r13 + add r1,r14 + add r1,r15 + + add r2,r0 + add r2,r1 + add r2,r3 + add r2,r4 + add r2,r5 + add r2,r6 + add r2,r7 + add r2,r8 + add r2,r9 + add r2,r10 + add r2,r11 + add r2,r12 + add r2,r13 + add r2,r14 + add r2,r15 + + add r3,r0 + add r3,r1 + add r3,r2 + add r3,r4 + add r3,r5 + add r3,r6 + add r3,r7 + add r3,r8 + add r3,r9 + add r3,r10 + add r3,r11 + add r3,r12 + add r3,r13 + add r3,r14 + add r3,r15 + + add r0,[r1] + add r0,[r1+] + add r0,#3 + add r0,#0xffff + add r0,0xffff + add 0xffff,r0 + + addb rl0,rh0 + addb rl0[r0] + addb rl0,#3 + addb rl0,#0xff + addb r0,0xff10 + addb 0xff10,r0 + + addc r0,r1 + addc r0,[r1] + addc r0,#3 + addc r0,#0xff12 + addc r0,#0xff12 + addc r0,0xff12 + addc 0xff12,r0 + + addcb rl0,#3 + addcb rl0,#0xff + addcb r0,0xff10 + addcb 0xff10,r0 \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/addb.s b/gas/testsuite/gas/xc16x/addb.s new file mode 100644 index 0000000..7c7dd94 --- /dev/null +++ b/gas/testsuite/gas/xc16x/addb.s @@ -0,0 +1,11 @@ + .section .text + .global _fun +xc16x_add: + + addb rl0,rl1 + addb rl0,[r1] + addb rl0,[r1+] + addb rl0,#0x2 + addb rl0,#0x33 + addb rl0,0x2387 + addb 0x2387,rl0 diff --git a/gas/testsuite/gas/xc16x/addc.s b/gas/testsuite/gas/xc16x/addc.s new file mode 100644 index 0000000..8f33699 --- /dev/null +++ b/gas/testsuite/gas/xc16x/addc.s @@ -0,0 +1,11 @@ + .section .text + .global _fun +xc16x_add: + + addc r0,r1 + addc r0,[r1] + addc r0,[r1+] + addc r0,#0x34 + addc r0,#0x3456 + addc r0,0x2387 + addc 0x2387,r0 diff --git a/gas/testsuite/gas/xc16x/addcb.s b/gas/testsuite/gas/xc16x/addcb.s new file mode 100644 index 0000000..74cfca7 --- /dev/null +++ b/gas/testsuite/gas/xc16x/addcb.s @@ -0,0 +1,17 @@ + .section .text + .global _fun +xc16x_add: + + addcb rl0,rl1 + addcb rl0,[r1] + addcb rl0,[r1+] + addcb rl0,#0x02 + addcb rl0,#0x23 + addcb 0x2387,rl0 + + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/and.s b/gas/testsuite/gas/xc16x/and.s new file mode 100644 index 0000000..14e9c7e --- /dev/null +++ b/gas/testsuite/gas/xc16x/and.s @@ -0,0 +1,14 @@ +.section .text +.global _fun + +xc16x_and: + + and r0,r1 + and r0,[r1] + and r0,[r1+] + and r0,#3 + and r0,#0xfcbe + and r0,0x0230 + and 0x320,r0 + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/andb.s b/gas/testsuite/gas/xc16x/andb.s new file mode 100644 index 0000000..eee0ab8 --- /dev/null +++ b/gas/testsuite/gas/xc16x/andb.s @@ -0,0 +1,10 @@ + .section .text + .global _fun +xc16x_andb: + andb rl0,rl1 + andb rl0,[r1] + andb rl0,[r1+] + andb rl0,#3 + andb rl0,#0xbe + andb rl0,0x0230 + andb 0x320,rl0 diff --git a/gas/testsuite/gas/xc16x/bfldl.s b/gas/testsuite/gas/xc16x/bfldl.s new file mode 100644 index 0000000..7300c4a --- /dev/null +++ b/gas/testsuite/gas/xc16x/bfldl.s @@ -0,0 +1,4 @@ + .text + xc16x_bfldl: + BFLDL r0,#0x87,#0x0e + BFLDH r0,#0xff,#0x0e diff --git a/gas/testsuite/gas/xc16x/bit.s b/gas/testsuite/gas/xc16x/bit.s new file mode 100644 index 0000000..571e79e --- /dev/null +++ b/gas/testsuite/gas/xc16x/bit.s @@ -0,0 +1,11 @@ +.text +xc16x_bit: +bclr r0.1 +bset r0.1 +bmov r0.2,r0.1 +bmovn r0.3,r0.2 +band r0.1,r0.4 +bor r0.1,r0.2 +bxor r0.1,r0.2 +bcmp r0.1,r0.2 + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/calla.s b/gas/testsuite/gas/xc16x/calla.s new file mode 100644 index 0000000..3604e9a --- /dev/null +++ b/gas/testsuite/gas/xc16x/calla.s @@ -0,0 +1,24 @@ +.text +xc16x_calla: +calla cc_uc,0xaaaa +calla cc_z,0xaaaa +calla cc_nz,0xaaaa +calla cc_v,0xaaaa +calla cc_nv,0xaaaa +calla cc_n,0xaaaa +calla cc_nn,0xaaaa +calla cc_c,0xaaaa +calla cc_nc,0xaaaa +calla cc_eq,0xaaaa +calla cc_ne,0xaaaa +calla cc_ult,0xaaaa +calla cc_ule,0xaaaa +calla cc_uge,0xaaaa +calla cc_ugt,0xaaaa +calla cc_sle,0xaaaa +calla cc_sge,0xaaaa +calla cc_sgt,0xaaaa +calla cc_net,0xaaaa +calla cc_slt,0xaaaa + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/calli.s b/gas/testsuite/gas/xc16x/calli.s new file mode 100644 index 0000000..807ae1b --- /dev/null +++ b/gas/testsuite/gas/xc16x/calli.s @@ -0,0 +1,21 @@ +.text +xc16x_calli: +calli cc_uc,[r1] +calli cc_z,[r1] +calli cc_nz,[r1] +calli cc_v,[r1] +calli cc_nv,[r1] +calli cc_n,[r1] +calli cc_nn,[r1] +calli cc_c,[r1] +calli cc_nc,[r1] +calli cc_eq,[r1] +calli cc_ne,[r1] +calli cc_ult,[r1] +calli cc_ule,[r1] +calli cc_uge,[r1] +calli cc_ugt,[r1] +calli cc_sle,[r1] +calli cc_sge,[r1] +calli cc_net,[r1] +calli cc_slt,[r1] diff --git a/gas/testsuite/gas/xc16x/cmp.s b/gas/testsuite/gas/xc16x/cmp.s new file mode 100644 index 0000000..5003492 --- /dev/null +++ b/gas/testsuite/gas/xc16x/cmp.s @@ -0,0 +1,9 @@ +.text +xc16x_cmp: +cmp r0,r1 +cmp r0,[r1] +cmp r0,[r1+] +cmp r0,#3 +cmp r0,#0x0234 +cmp r0,0x3452 + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/cmp_test.s b/gas/testsuite/gas/xc16x/cmp_test.s new file mode 100644 index 0000000..932ce96 --- /dev/null +++ b/gas/testsuite/gas/xc16x/cmp_test.s @@ -0,0 +1,45 @@ +.text +cmp r0,r1 +cmp r0,[r1] +cmp r0,[r1+] +cmp r0,#3 +cmp r0,#0x0234 +cmp r0,0x3452 + +cmp r0,r1 +cmp r0,[r1] +cmp r0,[r1+] +cmp r0,#3 +cmp r0,#0xcdef +cmp r0,0xcdef + +cmpb rl0,rl1 +cmpb rl0,[r1] +cmpb rl0,[r1+] +cmpb rl0,#3 +cmpb rl0,#cd +cmpb rl0,0x0234 + +cmpb rl0,rl1 +cmpb rl0,[r1] +cmpb rl0,[r1+] +cmpb rl0,#3 +cmpb rl0,#cd +cmpb rl0,0xcdef + +cmpd1 r0,#0x0f +cmpd1 r0,#0x0fccb +cmpd1 r0,0xffcb +cmpd2 r0,#0x0f +cmpd2 r0,#0x0fccb +cmpd2 r0,0xffcb + +cmpi1 r0,#0x0f +cmpi1 r0,#0x0fccb +cmpi1 r0,0xffcb +cmpi2 r0,#0x0f +cmpi2 r0,#0x0fccb +cmpi2 r0,0xffcb + + + diff --git a/gas/testsuite/gas/xc16x/cmpb.s b/gas/testsuite/gas/xc16x/cmpb.s new file mode 100644 index 0000000..3dfc698 --- /dev/null +++ b/gas/testsuite/gas/xc16x/cmpb.s @@ -0,0 +1,8 @@ +.text +xc16x_cmpb: +cmpb rl0,rl1 +cmpb rl0,[r1] +cmpb rl0,[r1+] +cmpb rl0,#3 +cmpb rl0,#34 +cmpb rl0,0x0234 diff --git a/gas/testsuite/gas/xc16x/cmpi.s b/gas/testsuite/gas/xc16x/cmpi.s new file mode 100644 index 0000000..8136890 --- /dev/null +++ b/gas/testsuite/gas/xc16x/cmpi.s @@ -0,0 +1,18 @@ +.section .text +.global _fun + +xc16x_cmpd: + + cmpd1 r0,#0x0f + cmpd1 r0,#0x0fccb + cmpd1 r0,0xffcb + cmpd2 r0,#0x0f + cmpd2 r0,#0x0fccb + cmpd2 r0,0xffcb + cmpi1 r0,#0x0f + cmpi1 r0,#0x0fccb + cmpi1 r0,0xffcb + cmpi2 r0,#0x0f + cmpi2 r0,#0x0fccb + cmpi2 r0,0xffcb + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/cpl.s b/gas/testsuite/gas/xc16x/cpl.s new file mode 100644 index 0000000..b0d9817 --- /dev/null +++ b/gas/testsuite/gas/xc16x/cpl.s @@ -0,0 +1,7 @@ + .section .text + .global _fun + +xc16x_cpl_cplb: + + cpl r0 + cplb rl0 diff --git a/gas/testsuite/gas/xc16x/div.s b/gas/testsuite/gas/xc16x/div.s new file mode 100644 index 0000000..7b5ad9e --- /dev/null +++ b/gas/testsuite/gas/xc16x/div.s @@ -0,0 +1,8 @@ + .section .text + .global _fun +xc16x_div: + + div r0 + divl r0 + divlu r0 + divu r0 diff --git a/gas/testsuite/gas/xc16x/jmpa.s b/gas/testsuite/gas/xc16x/jmpa.s new file mode 100644 index 0000000..732cc47 --- /dev/null +++ b/gas/testsuite/gas/xc16x/jmpa.s @@ -0,0 +1,23 @@ +.text +xc16x_jmpa: + jmpa cc_UC,0xaaaa + jmpa cc_Z,0xaaaa + jmpa cc_NZ,0xaaaa + jmpa cc_V,0xaaaa + jmpa cc_NV,0xaaaa + jmpa cc_N,0xaaaa + jmpa cc_NN,0xaaaa + jmpa cc_ULT,0xaaaa + jmpa cc_UGE,0xaaaa + jmpa cc_Z,0xaaaa + jmpa cc_NZ,0xaaaa + jmpa cc_ULT,0xaaaa + jmpa cc_ULE,0xaaaa + jmpa cc_UGE,0xaaaa + jmpa cc_UGT,0xaaaa + jmpa cc_SLE,0xaaaa + jmpa cc_SGE,0xaaaa + jmpa cc_SGT,0xaaaa + jmpa cc_NET,0xaaaa + + diff --git a/gas/testsuite/gas/xc16x/jmpi.s b/gas/testsuite/gas/xc16x/jmpi.s new file mode 100644 index 0000000..337d5fa --- /dev/null +++ b/gas/testsuite/gas/xc16x/jmpi.s @@ -0,0 +1,24 @@ +.section .text +.global _fun + +xc16x_jmpi: + + jmpi cc_UC, [r7] + jmpi cc_z, [r7] + jmpi cc_NZ, [r7] + jmpi cc_V, [r7] + jmpi cc_NV, [r7] + jmpi cc_N, [r7] + jmpi cc_NN, [r7] + jmpi cc_C, [r7] + jmpi cc_NC, [r7] + jmpi cc_EQ, [r7] + jmpi cc_NE, [r7] + jmpi cc_ULT,[r7] + jmpi cc_ULE,[r7] + jmpi cc_UGE,[r7] + jmpi cc_UGT,[r7] + jmpi cc_SLE,[r7] + jmpi cc_SGE,[r7] + jmpi cc_SGT,[r7] + jmpi cc_NET,[r7] diff --git a/gas/testsuite/gas/xc16x/jmpr.s b/gas/testsuite/gas/xc16x/jmpr.s new file mode 100644 index 0000000..7fbdfac --- /dev/null +++ b/gas/testsuite/gas/xc16x/jmpr.s @@ -0,0 +1,25 @@ + .section .text + .global _fun + +xc16x_jmpr: + + jmpr cc_uc, xc16x_jmpr + jmpr cc_z, xc16x_jmpr + jmpr cc_nz, xc16x_jmpr + jmpr cc_v, xc16x_jmpr + jmpr cc_nv, xc16x_jmpr + jmpr cc_n, xc16x_jmpr + jmpr cc_nn, xc16x_jmpr + jmpr cc_c, xc16x_jmpr + jmpr cc_nc, xc16x_jmpr + jmpr cc_eq, xc16x_jmpr + jmpr cc_ne, xc16x_jmpr + jmpr cc_ult,xc16x_jmpr + jmpr cc_ule,xc16x_jmpr + jmpr cc_uge,xc16x_jmpr + jmpr cc_ugt,xc16x_jmpr + jmpr cc_sle,xc16x_jmpr + jmpr cc_sge,xc16x_jmpr + jmpr cc_sgt,xc16x_jmpr + jmpr cc_net,xc16x_jmpr + jmpr cc_slt,xc16x_jmpr diff --git a/gas/testsuite/gas/xc16x/mov.s b/gas/testsuite/gas/xc16x/mov.s new file mode 100644 index 0000000..164d97c --- /dev/null +++ b/gas/testsuite/gas/xc16x/mov.s @@ -0,0 +1,20 @@ + .section .text + .global _fun +xc16x_mov: + + mov r0,r1 + mov r0,#02 + mov r0,#0xfcbe + mov r0,[r1] + mov r0,[r1+] + mov [r0],r1 + mov [-r0],r1 + mov [r0],[r1] + mov [r0+],[r1] + mov [r0],[r1+] + mov r0,[r0+#0xffcb] + mov [r0+#0xffcb],r0 + mov [r0],0xffcb + mov 0xffcb,[r0] + mov r0,0xffcb + mov 0xffcb,r0 diff --git a/gas/testsuite/gas/xc16x/mov_test.s b/gas/testsuite/gas/xc16x/mov_test.s new file mode 100644 index 0000000..a3776c1 --- /dev/null +++ b/gas/testsuite/gas/xc16x/mov_test.s @@ -0,0 +1,85 @@ + .xc16x + mov r0,r1 + mov r0,#02 + mov r0,#0x0001 + mov r0,[r1] + mov r0,[r1+] + mov [r0],r1 + mov [-r0],r1 + mov [r0],[r1] + mov [r0+],[r1] + mov [r0],[r1+] + mov r0,[r0+#0x0001] + mov [r0+#0x0001],r0 + mov [r0],0x0001 + mov 0x0001,[r0] + mov r0,0x0001 + mov 0x0001,r0 + + mov r0,r1 + mov r0,#02 + mov r0,#0xffff + mov r0,[r1] + mov r0,[r1+] + mov [r0],r1 + mov [-r0],r1 + mov [r0],[r1] + mov [r0+],[r1] + mov [r0],[r1+] + mov r0,[r0+#0xffff] + mov [r0+#0xffff],r0 + mov [r0],0xffff + mov 0xffff,[r0] + mov r0,0xffff + mov 0xffff,r0 + + movb rl0,r2 + movb rl0,#0x12 + movb r3,[r2] + movb rl0,[r2+] + movb [-r2],rl0 + movb [r3],[r2+] + movb [r3],[r2] + movb [r2+],[r3] + movb [r2],[r3+] + movb rl0,[r3+#0x1234] + movb [r3+#0x1234],rl0 + movb [r3],0x1234 + movb [r3],0x1234 + movb 0x1234,[r3] + movb rl0,0x12 + movb 0x12,rl0 + + movb rl0,r2 + movb rl0,#0xff + movb r3,[r2] + movb rl0,[r2+] + movb [-r2],rl0 + movb [r3],[r2+] + movb [r3],[r2] + movb [r2+],[r3] + movb [r2],[r3+] + movb rl0,[r3+#0xffff] + movb [r3+#0xffff],rl0 + movb [r3],0xffff + movb [r3],0xffff + movb 0xffff,[r3] + movb rl0,0xff + movb 0xff,rl0 + + movbs r0,rl1 + movbs r0,0x12 + movbs 0x1234,rl0 + + movbs r0,rl1 + movbs r0,0xff + movbs 0xffff,rl0 + + movbz r2,rl0 + movbz r0,0x1234 + movbz 0x1234,rl0 + + movbz r2,rl0 + movbz r0,0xffff + movbz 0xffff,rl0 + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/movb.s b/gas/testsuite/gas/xc16x/movb.s new file mode 100644 index 0000000..3050704 --- /dev/null +++ b/gas/testsuite/gas/xc16x/movb.s @@ -0,0 +1,26 @@ + .section .text + .global _fun +xc16x_movb: + + movb rl0,r2 + movb rl0,#0x12 + movb r3,[r2] + movb rl0,[r2+] + movb [-r2],rl0 + movb [r3],[r2+] + movb [r3],[r2] + movb [r2+],[r3] + movb [r2],[r3+] + movb rl0,[r3+#0x1234] + movb [r3+#0x1234],rl0 + movb [r3],0x1234 + movb [r3],0xeeff + movb 0x1234,[r3] + movb rl0,0x12 + movb 0x12,rl0 + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/movbs.s b/gas/testsuite/gas/xc16x/movbs.s new file mode 100644 index 0000000..36bed4d --- /dev/null +++ b/gas/testsuite/gas/xc16x/movbs.s @@ -0,0 +1,8 @@ + .section .text + .global _fun + +xc16x_movbs: + + movbs r0,rl1 + movbs r0,0xff + movbs 0xffcb,rl0 diff --git a/gas/testsuite/gas/xc16x/movbz.s b/gas/testsuite/gas/xc16x/movbz.s new file mode 100644 index 0000000..8571f96 --- /dev/null +++ b/gas/testsuite/gas/xc16x/movbz.s @@ -0,0 +1,9 @@ + .section .text + .global _fun +xc16x_movbz: + + movbz r2,rl0 + movbz r0,0x23dd + movbz 0x23,rl0 + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/mul.s b/gas/testsuite/gas/xc16x/mul.s new file mode 100644 index 0000000..0e7c4be --- /dev/null +++ b/gas/testsuite/gas/xc16x/mul.s @@ -0,0 +1,6 @@ + .section .text + .global _fun +xc16x_mul: + + mul r0,r1 + mulu r0,r1 diff --git a/gas/testsuite/gas/xc16x/neg.s b/gas/testsuite/gas/xc16x/neg.s new file mode 100644 index 0000000..b95824e --- /dev/null +++ b/gas/testsuite/gas/xc16x/neg.s @@ -0,0 +1,6 @@ + .section .text + .global _fun +xc16x_neg: + + neg r0 + negb rl0 diff --git a/gas/testsuite/gas/xc16x/nop.s b/gas/testsuite/gas/xc16x/nop.s new file mode 100644 index 0000000..cc297e1 --- /dev/null +++ b/gas/testsuite/gas/xc16x/nop.s @@ -0,0 +1,6 @@ + .section .text + .global _fun +xc16x_nop: + nop + nop + diff --git a/gas/testsuite/gas/xc16x/or.s b/gas/testsuite/gas/xc16x/or.s new file mode 100644 index 0000000..46deecc --- /dev/null +++ b/gas/testsuite/gas/xc16x/or.s @@ -0,0 +1,11 @@ + .section .text + .global _fun +xc16x_or: + + or r0,r1 + or r0,[r1] + or r0,[r1+] + or r0,#3 + or r0,#0x0234 + or r0,0x4536 + or 0x4536,r0 diff --git a/gas/testsuite/gas/xc16x/orb.s b/gas/testsuite/gas/xc16x/orb.s new file mode 100644 index 0000000..62bfa76 --- /dev/null +++ b/gas/testsuite/gas/xc16x/orb.s @@ -0,0 +1,10 @@ + .section .text + .global _fun +xc16x_or: + orb rl0,rl1 + orb rl0,[r1] + orb rl0,[r1+] + orb rl0,#3 + orb rl0,#0x23 + orb rl0,0x0234 + orb 0x0234,rl0 diff --git a/gas/testsuite/gas/xc16x/prior.s b/gas/testsuite/gas/xc16x/prior.s new file mode 100644 index 0000000..aa4bb78 --- /dev/null +++ b/gas/testsuite/gas/xc16x/prior.s @@ -0,0 +1,5 @@ + .section .text + .global _fun +xc16x_prior: + + prior r0,r1 diff --git a/gas/testsuite/gas/xc16x/pushpop.s b/gas/testsuite/gas/xc16x/pushpop.s new file mode 100644 index 0000000..4fafde6 --- /dev/null +++ b/gas/testsuite/gas/xc16x/pushpop.s @@ -0,0 +1,5 @@ + .section .text + .global _fun +xc16x_pushpop: + pop r0 + push r0 diff --git a/gas/testsuite/gas/xc16x/ret.s b/gas/testsuite/gas/xc16x/ret.s new file mode 100644 index 0000000..62278a5 --- /dev/null +++ b/gas/testsuite/gas/xc16x/ret.s @@ -0,0 +1,9 @@ + .section .text + .global _fun + +xc16x_ret: + ret + reti + rets + retp r5 + diff --git a/gas/testsuite/gas/xc16x/scxt.s b/gas/testsuite/gas/xc16x/scxt.s new file mode 100644 index 0000000..e8a23c3 --- /dev/null +++ b/gas/testsuite/gas/xc16x/scxt.s @@ -0,0 +1,6 @@ + .section .text + .global _fun +xc16x_scxt: + scxt r0,#0xffff + scxt r0,0xffff + diff --git a/gas/testsuite/gas/xc16x/shlrol.s b/gas/testsuite/gas/xc16x/shlrol.s new file mode 100644 index 0000000..04e6591 --- /dev/null +++ b/gas/testsuite/gas/xc16x/shlrol.s @@ -0,0 +1,14 @@ + .section .text + .global _fun +xc16x_shlrol: + + shl r0,r1 + shl r0,#a + shr r0,r1 + shr r0,#a + rol r0,r1 + rol r0,#a + ror r0,r1 + ror r0,#a + ashr r0,r1 + ashr r0,#a diff --git a/gas/testsuite/gas/xc16x/sub.s b/gas/testsuite/gas/xc16x/sub.s new file mode 100644 index 0000000..5baad82 --- /dev/null +++ b/gas/testsuite/gas/xc16x/sub.s @@ -0,0 +1,19 @@ + .section .text + .global _fun +xc16x_sub: + + sub r0,r1 + sub r0,[r1] + sub r0,[r1+] + sub r0,#0x1 + sub r0,#0x7643 + sub r0,0x7643 + sub 0x7643,r0 + + + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/sub_test.s b/gas/testsuite/gas/xc16x/sub_test.s new file mode 100644 index 0000000..880102e --- /dev/null +++ b/gas/testsuite/gas/xc16x/sub_test.s @@ -0,0 +1,70 @@ + .text +_start: + sub r0,r1 + sub r0,[r1] + sub r0,[r1+] + sub r0,#0x1 + sub r0,#0x7643 + sub r0,0x7643 + sub 0x7643,r0 + + sub r1,r0 + sub r1,[r0] + sub r1,[r0+] + sub r1,#0x1 + sub r1,#0xCDEF + sub r1,0xCDEF + sub 0xCDEF,r1 + + + subb rl0,rl1 + subb rl0,[r1] + subb rl0,[r1+] + subb rl0,#0x1 + subb rl0,#0x43 + subb rl0,0x7643 + subb 0x7643,rl0 + + subb rl1,rl0 + subb rl1,[r0] + subb rl1,[r0+] + subb rl1,#0x1 + subb rl1,#0xCD + subb rl1,0xCDEF + subb 0xCDEF,rl1 + + + + subc r0,r1 + subc r0,[r1] + subc r0,[r1+] + subc r0,#0x2 + subc r0,#0x43 + subc r0,0x7643 + subc 0x7643,r0 + + subc r1,r0 + subc r1,[r0] + subc r1,[r0+] + subc r1,#0xC + subc r1,#0xCD + subc r1,0xCDEF + subc 0xCDEF,r1 + + subcb rl0,rl1 + subcb rl0,[r1] + subcb rl0,[r1+] + subcb rl0,#0x2 + subcb rl0,#0x43 + subcb rl0,0x7643 + subcb 0x7643,rl0 + + subcb rl0,rl1 + subcb rl0,[r1] + subcb rl0,[r1+] + subcb rl0,#0x2 + subcb rl0,#0x43 + subcb rl0,0x7643 + subcb 0x7643,rl0 + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/subb.s b/gas/testsuite/gas/xc16x/subb.s new file mode 100644 index 0000000..c066a43 --- /dev/null +++ b/gas/testsuite/gas/xc16x/subb.s @@ -0,0 +1,19 @@ + .section .text + .global _fun +xc16x_subb: + + subb rl0,rl1 + subb rl0,[r1] + subb rl0,[r1+] + subb rl0,#0x1 + subb rl0,#0x43 + subb rl0,0x7643 + subb 0x7643,rl0 + + + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/subc.s b/gas/testsuite/gas/xc16x/subc.s new file mode 100644 index 0000000..a8af7d0 --- /dev/null +++ b/gas/testsuite/gas/xc16x/subc.s @@ -0,0 +1,19 @@ + .section .text + .global _fun +xc16x_subc: + + subc r0,r1 + subc r0,[r1] + subc r0,[r1+] + subc r0,#0x2 + subc r0,#0x43 + subc r0,0x7643 + subc 0x7643,r0 + + + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/subcb.s b/gas/testsuite/gas/xc16x/subcb.s new file mode 100644 index 0000000..e8911ee --- /dev/null +++ b/gas/testsuite/gas/xc16x/subcb.s @@ -0,0 +1,20 @@ + .section .text + .global _fun +xc16x_subcb: + + subcb rl0,rl1 + subcb rl0,[r1] + subcb rl0,[r1+] + subcb rl0,#0x2 + subcb rl0,#0x43 + subcb rl0,0x7643 + subcb 0x7643,rl0 + + + + + + + + + \ No newline at end of file diff --git a/gas/testsuite/gas/xc16x/syscontrol1.s b/gas/testsuite/gas/xc16x/syscontrol1.s new file mode 100644 index 0000000..c21f07d --- /dev/null +++ b/gas/testsuite/gas/xc16x/syscontrol1.s @@ -0,0 +1,12 @@ + .section .text + .global _fun +xc16x_syscontrol: + srst + sbrk + idle + pwrdn + srvwdt + diswdt + enwdt + einit + diff --git a/gas/testsuite/gas/xc16x/syscontrol2.s b/gas/testsuite/gas/xc16x/syscontrol2.s new file mode 100644 index 0000000..61fb703 --- /dev/null +++ b/gas/testsuite/gas/xc16x/syscontrol2.s @@ -0,0 +1,26 @@ +.text +xc16x_syscontrol2: + extr #0x4 + extr #0x3 + extr #0x2 + extr #0x1 + + atomic #0x4 + atomic #0x3 + atomic #0x2 + atomic #0x1 + + extp r5,#0x4 + extp #0x3ff,#0x4 + extpr r5,#0x4 + extpr #0x3ff,#0x4 + + exts r5,#0x4 + exts #0x1,#0x4 + + extsr r5,#0x4 + extsr #0x1,#0x4 + + + + diff --git a/gas/testsuite/gas/xc16x/trap.s b/gas/testsuite/gas/xc16x/trap.s new file mode 100644 index 0000000..f8dc87b --- /dev/null +++ b/gas/testsuite/gas/xc16x/trap.s @@ -0,0 +1,6 @@ + .section .text + .global _fun + +xc16x_trap: + + trap #0x02 diff --git a/gas/testsuite/gas/xc16x/xc16x.exp b/gas/testsuite/gas/xc16x/xc16x.exp new file mode 100644 index 0000000..c53e657 --- /dev/null +++ b/gas/testsuite/gas/xc16x/xc16x.exp @@ -0,0 +1,1317 @@ +# +# Some xc16x tests +# +proc do_xc16x_add {} { + set testname "add.s: xc16x add word tests" + set x 0 + + gas_start "add.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 0809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 080D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 0803\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 06F0D204\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 02F0EDFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 04F0EDFF\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_addb {} { + set testname "addb.s: xc16x add byte tests" + set x 0 + + gas_start "addb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 0909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 090D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 0902\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 07F03300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 03F08723\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 05F08723\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_addc {} { + set testname "addc.s: xc16x add with carry tests" + set x 0 + + gas_start "addc.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 1001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 180D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 16F03400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 16F05634\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 12F08723\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 14F08723\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_addcb {} { + set testname "addcb.s: xc16x add byte with carry tests" + set x 0 + + gas_start "addcb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 1102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 190D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 17F00200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 17F02300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 15F08723\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 6] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_sub {} { + set testname "sub.s: xc16x sub tests" + set x 0 + + gas_start "sub.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 2001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 2809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 280D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 2801\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 26F04376\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 22F04376\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 24F04376\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_subb {} { + set testname "subb.s: xc16x sub byte tests" + set x 0 + + gas_start "subb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 2102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 2909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 290D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 2901\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 27F04300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 23F04376\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 25F04376\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_subc {} { + set testname "subc.s: xc16x sub with carry tests" + set x 0 + + gas_start "subc.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 3001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 3809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 380D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 3802\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 36F04300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 32F04376\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 34F04376\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_subcb {} { + set testname "subcb.s: xc16x sub byte with carry tests" + set x 0 + + gas_start "subcb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 3102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 3909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 390D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 3902\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 37F04300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 33F04376\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 35F04376\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_and {} { + set testname "and.s: xc16x and tests" + set x 0 + + gas_start "and.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 6001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 6809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 680D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 6803\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 66F0BEFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 62F03002\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 64F02003\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_andb {} { + set testname "andb.s: xc16x and byte tests" + set x 0 + + gas_start "andb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 6102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 6909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 690D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 6903\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 67F0BE00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 63F03002\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 65F02003\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_or {} { + set testname "or.s: xc16x or tests" + set x 0 + + gas_start "or.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 780D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7803\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 76F03402\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 72F03645\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 74F03645\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_xor {} { + set testname "xor.s: xc16x xor tests" + set x 0 + + gas_start "xor.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 5001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 580D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 5803\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 56F03402\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 52F03402\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 54F03402\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_xorb {} { + set testname "xorb.s: xc16x xorb tests" + set x 0 + + gas_start "xorb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 5102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 590D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 5903\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 57F03400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 53F00324\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 55F00324\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } + +} + +proc do_xc16x_mov {} { + set testname "mov.s: xc16x mov tests" + set x 0 + + gas_start "mov.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 F001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 E6F00200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 E6F0BEFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a A801\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 9801\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e B810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 8810\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 C801\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 D801\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 E801\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 D400CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c C400CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 8400CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 9400CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 F2F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c F6F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 16] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_movb {} { + set testname "movb.s: xc16x movb tests" + set x 0 + + gas_start "movb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 F3F00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 E7F01200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 B4020000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 9902\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 8902\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 E932\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 C932\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 D923\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 E923\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 F4033412\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c E4033412\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 A4033412\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 A403FFEE\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 B4033412\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c F3F01200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 F7F01200\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 16] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_movbs {} { + set testname "movbs.s: xc16x mov byte tests" + set x 0 + + gas_start "movbs.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 D020\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 D2F0FF00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 D5F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 3] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_movbz {} { + set testname "movbz.s: xc16x movbz tests" + set x 0 + + gas_start "movbz.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 C002\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 C2F0DD23\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 C5F02300\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 3] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_pushpop {} { + set testname "pushpop.s: xc16x push/pop tests" + set x 0 + + gas_start "pushpop.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 FCF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 ECF0\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_shlrol {} { + set testname "shlrol.s: xc16x shift and rotate tests" + set x 0 + + gas_start "shlrol.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 4C01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 6C01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 0C01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 1C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 2C01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 3C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 AC01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 BC00\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 10] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_neg {} { + set testname "neg.s: xc16x neg tests" + set x 0 + + gas_start "neg.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 8100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 A100\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} +proc do_xc16x_mul {} { + set testname "mul.s: xc16x multiply tests" + set x 0 + + gas_start "mul.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0B01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1B01\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_div {} { + set testname "div.s: xc16x division tests" + set x 0 + + gas_start "div.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 4B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 6B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 7B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 5B00\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 4] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_jmpa {} { + set testname "jmpa.s: xc16x jump absolute test" + set x 0 + + gas_start "jmpa.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 EA00AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 EA20AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 EA30AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c EA40AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 EA50AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 EA60AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 EA70AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c EA80AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 EA90AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 EA20AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 EA30AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c EA80AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 EAF0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 EA90AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 EAE0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c EAB0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 EAD0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 EAA0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 EA10AAAA\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 19] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_jmpi {} { + set testname "jmpi.s: xc16x jmp immidiate tests " + set x 0 + + gas_start "jmpi.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 9C07\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 9C27\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 9C37\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 9C47\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 9C57\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 9C67\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 9C77\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 9C87\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 9C97\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 9C27\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 9C37\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 9C87\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 9CF7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 9C97\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 9CE7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 9CB7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 9CD7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 9CA7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 9C17\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 19] then { pass $testname } else { fail $testname } +} + + +proc do_xc16x_jmpr {} { + set testname "jmpr.s: xc16x jump relative tests" + set x 0 + + gas_start "jmpr.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0DFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 2DFE\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 3DFD\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4DFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 5DFB\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 6DFA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 7DF9\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 8DF8\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 9DF7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 2DF6\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 3DF5\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 8DF4\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 FDF3\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 9DF2\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c EDF1\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e BDF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 DDEF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 ADEE\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 1DED\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 CDEC\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 20] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_syscontrol1 {} { + set testname "syscontrol1.s: xc16x system control insrutions tests" + set x 0 + + gas_start "syscontrol1.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 B748B7B7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 8C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 87788787\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 97689797\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e A758A7A7\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 A55AA5A5\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 857A8585\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a B54AB5B5\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 8] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_syscontrol2 {} { + set testname "syscontrol2.s: xc16x syscontrol2 tests" + set x 0 + + gas_start "syscontrol2.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 D1B0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 D1A0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 D190\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 D180\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 D130\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a D120\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c D110\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e D100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 DC75\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 D770FF03\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 DCF5\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 D7F0FF03\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c DC35\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e D7300100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 DCB5\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 D7B00100\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 16] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_cpl {} { + set testname "cpl.s: xc16x compliment tests" + set x 0 + + gas_start "cpl.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 9100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 B100\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_cmp {} { + set testname "cmp.s: xc16x misc tests" + set x 0 + + gas_start "cmp.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 4001\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 4809\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 480D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4803\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 46F03402\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 42F05234\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 6] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_cmpb {} { + set testname "cmpb.s: xc16x cmp byte tests" + set x 0 + + gas_start "cmpb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 4102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 4909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 490D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4903\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 47F02200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 43F03402\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 6] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_cmpi {} { + set testname "cmpi.s: xc16x cmpi tests" + set x 0 + + gas_start "cmpi.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 A0F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 A6F0CBFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 A2F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a B0F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c B6F0CBFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 B2F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 80F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 86F0CBFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 82F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 90F0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 96F0CBFC\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 92F0CBFF\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 12] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_calli {} { + set testname "calli.s: xc16x call tests" + set x 0 + + gas_start "calli.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 AB01\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 AB21\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 AB31\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 AB41\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 AB51\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a AB61\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c AB71\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e AB81\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 AB91\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 AB21\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 AB31\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 AB81\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 ABF1\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a AB91\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c ABE1\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e ABB1\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 ABD1\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 AB11\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 ABC1\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 19] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_calla {} { + set testname "calla.s: xc16x call tests" + set x 0 + + gas_start "calla.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 CA00AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 CA20AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 CA30AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c CA40AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 CA50AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 CA60AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 CA70AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c CA80AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 CA90AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 CA20AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 CA30AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c CA80AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 CAF0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 CA90AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 CAE0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c CAB0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 CAD0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 CAA0AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 CA10AAAA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c CAC0AAAA\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 20] then { pass $testname } else { fail $testname } +} + + +proc do_xc16x_bit {} { + set testname "bit.s: xc16x bit manipulation tests" + set x 0 + + gas_start "bit.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 1EF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 1FF0\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 4AF0F012\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 3AF0F023\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 6AF0F041\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 5AF0F021\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 7AF0F021\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 2AF0F021\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 8] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_bfldl {} { + set testname "bfldl.s: xc16x bitwise modify masked data tests" + set x 0 + + gas_start "bfldl.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 0AF0870E\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 1AF00EFF\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_ret {} { + set testname "ret.s: xc16x ret tests" + set x 0 + + gas_start "ret.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 CB00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 FB88\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 DB00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 EBF5\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 4] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_trap {} { + set testname "trap.s: xc16x add/sub tests" + set x 0 + + gas_start "trap.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 9B04\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 1] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_orb {} { + set testname "orb.s: xc16x or byte instructions tests" + set x 0 + + gas_start "orb.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 7102\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 7909\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 790D\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 7903\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 77F02300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 73F03402\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 75F03402\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 7] then { pass $testname } else { fail $testname } +} + + +proc do_xc16x_prior {} { + set testname "prior.s: Determine no shift cycles tests" + set x 0 + + gas_start "prior.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 2B01\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 1] then { pass $testname } else { fail $testname } +} + +proc do_xc16x_nop {} { + set testname "nop.s: no operation nop tests" + set x 0 + + gas_start "nop.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 CC00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 CC00\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + + +proc do_xc16x_scxt {} { + set testname "scxt.s: push direct word to system stack tests" + set x 0 + + gas_start "scxt.s" "-al" + + # Check each instruction bit pattern to verify it got + # assembled correctly. + while 1 { + expect { + -re " +\[0-9\]+ 0000 C6F0FFFF\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 D6F0FFFF\[^\n\]*\n" { set x [expr $x+1] } + timeout { perror "timeout\n; break } + eof { break } + } + } + + # This was intended to do any cleanup necessary. It kinda looks like it + # isn't needed, but just in case, please keep it in for now. + gas_finish + + # Did we find what we were looking for? If not, flunk it. + if [expr $x == 2] then { pass $testname } else { fail $testname } +} + + +if [istarget xc16x*-*-*] then { + # Test the basic xc16x instruction parser + do_xc16x_add + do_xc16x_addb + do_xc16x_addc + do_xc16x_addcb + do_xc16x_sub + do_xc16x_subb + do_xc16x_subc + do_xc16x_subcb + do_xc16x_and + do_xc16x_andb + do_xc16x_or + do_xc16x_xor + do_xc16x_xorb + do_xc16x_mov + do_xc16x_movb + do_xc16x_movbs + do_xc16x_movbz + do_xc16x_shlrol + do_xc16x_neg + do_xc16x_mul + do_xc16x_div + do_xc16x_jmpa + do_xc16x_jmpi + do_xc16x_jmpr + do_xc16x_syscontrol1 + do_xc16x_syscontrol2 + do_xc16x_cpl + do_xc16x_cmp + do_xc16x_cmpb + do_xc16x_cmpi + do_xc16x_calla + do_xc16x_calli + do_xc16x_bit + do_xc16x_bfldl + do_xc16x_ret + do_xc16x_trap + do_xc16x_orb + do_xc16x_prior + do_xc16x_nop + do_xc16x_scxt + +} diff --git a/gas/testsuite/gas/xc16x/xor.s b/gas/testsuite/gas/xc16x/xor.s new file mode 100644 index 0000000..bdc83d7 --- /dev/null +++ b/gas/testsuite/gas/xc16x/xor.s @@ -0,0 +1,10 @@ + .section .text + .global _fun +xc16x_or: + xor r0,r1 + xor r0,[r1] + xor r0,[r1+] + xor r0,#3 + xor r0,#0x0234 + xor r0,0x0234 + xor 0x0234,r0 diff --git a/gas/testsuite/gas/xc16x/xorb.s b/gas/testsuite/gas/xc16x/xorb.s new file mode 100644 index 0000000..faf4a76 --- /dev/null +++ b/gas/testsuite/gas/xc16x/xorb.s @@ -0,0 +1,10 @@ + .section .text + .global _fun +xc16x_xorb: + xorb rl0,rl1 + xorb rl0,[r1] + xorb rl0,[r1+] + xorb rl0,#3 + xorb rl0,#0x34 + xorb rl0,0x2403 + xorb 0x2403,rl0 -- cgit v1.1