aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain
diff options
context:
space:
mode:
authorIvan Kuten <ivan.kuten@promwad.com>2007-11-23 10:32:50 +0000
committerIvan Kuten <ivan.kuten@promwad.com>2007-11-23 10:32:50 +0000
commit7eb9574e2b79b0f23b945850c59c1695bd3d9dca (patch)
tree22a10d89d5b6ce795954e78267b653944a1c4d92 /toolchain
parentcf825074e61733bca94211863731891f51d21dc8 (diff)
downloadbuildroot-novena-7eb9574e2b79b0f23b945850c59c1695bd3d9dca.tar.gz
buildroot-novena-7eb9574e2b79b0f23b945850c59c1695bd3d9dca.zip
update the nios2-patches for binutils-2.15 and gcc-3.4.6 with the latest sources from Altera, and removes obsolete patches
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/binutils/2.15/700-nios2-2.15.patch3217
-rw-r--r--toolchain/binutils/2.15/701-nios2-gcc4-buildfix.patch20
-rw-r--r--toolchain/elf2flt/elf2flt.nios2.conditional11
-rw-r--r--toolchain/gcc/3.4.6/900-nios2.patch4950
-rw-r--r--toolchain/gcc/3.4.6/901-nios2-ctor_dtor.patch52
-rw-r--r--toolchain/gcc/3.4.6/nios2-config-fix.patch.conditional19
-rw-r--r--toolchain/gcc/gcc-uclibc-3.x.mk3
7 files changed, 6475 insertions, 1797 deletions
diff --git a/toolchain/binutils/2.15/700-nios2-2.15.patch b/toolchain/binutils/2.15/700-nios2-2.15.patch
index 42655f306..50f0caff6 100644
--- a/toolchain/binutils/2.15/700-nios2-2.15.patch
+++ b/toolchain/binutils/2.15/700-nios2-2.15.patch
@@ -1,5 +1,7 @@
---- binutils-2.15/bfd/Makefile.am 2004-05-17 21:35:56.000000000 +0200
-+++ binutils-2.15-nios2/bfd/Makefile.am 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/Makefile.am b/bfd/Makefile.am
+index de811af..d55e681 100644
+--- a/bfd/Makefile.am
++++ b/bfd/Makefile.am
@@ -82,6 +82,7 @@ ALL_MACHINES = \
cpu-mips.lo \
cpu-mmix.lo \
@@ -32,7 +34,7 @@
elf32-openrisc.c \
elf32-or32.c \
elf32-pj.c \
-@@ -943,6 +947,7 @@ cpu-mcore.lo: cpu-mcore.c $(INCDIR)/file
+@@ -943,6 +947,7 @@ cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h
cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h
cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h
cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h
@@ -40,7 +42,7 @@
cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h
cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h
cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h
-@@ -1250,6 +1255,10 @@ elf32-msp430.lo: elf32-msp430.c $(INCDIR
+@@ -1250,6 +1255,10 @@ elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
@@ -51,8 +53,10 @@
elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
---- binutils-2.15/bfd/Makefile.in 2004-05-17 21:35:56.000000000 +0200
-+++ binutils-2.15-nios2/bfd/Makefile.in 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/Makefile.in b/bfd/Makefile.in
+index a6685f2..1ea97fe 100644
+--- a/bfd/Makefile.in
++++ b/bfd/Makefile.in
@@ -210,6 +210,7 @@ ALL_MACHINES = \
cpu-mips.lo \
cpu-mmix.lo \
@@ -85,7 +89,7 @@
elf32-openrisc.c \
elf32-or32.c \
elf32-pj.c \
-@@ -1482,6 +1486,7 @@ cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filena
+@@ -1482,6 +1486,7 @@ cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h
cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h
cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h
cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h
@@ -93,7 +97,7 @@
cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h
cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h
cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h
-@@ -1787,6 +1792,10 @@ elf32-msp430.lo: elf32-msp430.c $(INCDIR
+@@ -1787,6 +1792,10 @@ elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
@@ -104,8 +108,10 @@
elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
---- binutils-2.15/bfd/archures.c 2003-12-03 18:38:48.000000000 +0100
-+++ binutils-2.15-nios2/bfd/archures.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/archures.c b/bfd/archures.c
+index f8aeeef..82fe291 100644
+--- a/bfd/archures.c
++++ b/bfd/archures.c
@@ -330,6 +330,8 @@ DESCRIPTION
.#define bfd_mach_msp44 44
. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
@@ -115,7 +121,7 @@
. bfd_arch_last
. };
*/
-@@ -422,6 +424,7 @@ extern const bfd_arch_info_type bfd_w65_
+@@ -422,6 +424,7 @@ extern const bfd_arch_info_type bfd_w65_arch;
extern const bfd_arch_info_type bfd_xstormy16_arch;
extern const bfd_arch_info_type bfd_xtensa_arch;
extern const bfd_arch_info_type bfd_z8k_arch;
@@ -123,7 +129,7 @@
static const bfd_arch_info_type * const bfd_archures_list[] =
{
-@@ -460,6 +463,7 @@ static const bfd_arch_info_type * const
+@@ -460,6 +463,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_mn10200_arch,
&bfd_mn10300_arch,
&bfd_msp430_arch,
@@ -131,291 +137,20 @@
&bfd_ns32k_arch,
&bfd_openrisc_arch,
&bfd_or32_arch,
---- binutils-2.15/bfd/bfd-in2.h 2004-05-17 21:35:56.000000000 +0200
-+++ binutils-2.15-nios2/bfd/bfd-in2.h 2005-05-17 12:20:13.000000000 +0200
-@@ -830,37 +830,48 @@ extern void bfd_elf64_ia64_after_parse
- (int);
-
- /* Extracted from init.c. */
--void bfd_init (void);
-+void
-+bfd_init PARAMS ((void));
-
- /* Extracted from opncls.c. */
--bfd *bfd_openr (const char *filename, const char *target);
-+bfd *
-+bfd_openr PARAMS ((const char *filename, const char *target));
-
--bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-+bfd *
-+bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd));
-
--bfd *bfd_openstreamr (const char *, const char *, void *);
-+bfd *
-+bfd_openstreamr PARAMS ((const char *, const char *, void *));
-
--bfd *bfd_openw (const char *filename, const char *target);
-+bfd *
-+bfd_openw PARAMS ((const char *filename, const char *target));
-
--bfd_boolean bfd_close (bfd *abfd);
-+bfd_boolean
-+bfd_close PARAMS ((bfd *abfd));
-
--bfd_boolean bfd_close_all_done (bfd *);
-+bfd_boolean
-+bfd_close_all_done PARAMS ((bfd *));
-
--bfd *bfd_create (const char *filename, bfd *templ);
-+bfd *
-+bfd_create PARAMS ((const char *filename, bfd *templ));
-
--bfd_boolean bfd_make_writable (bfd *abfd);
-+bfd_boolean
-+bfd_make_writable PARAMS ((bfd *abfd));
-
--bfd_boolean bfd_make_readable (bfd *abfd);
-+bfd_boolean
-+bfd_make_readable PARAMS ((bfd *abfd));
-
--unsigned long bfd_calc_gnu_debuglink_crc32
-- (unsigned long crc, const unsigned char *buf, bfd_size_type len);
-+unsigned long
-+bfd_calc_gnu_debuglink_crc32 PARAMS ((unsigned long crc, const unsigned char *buf, bfd_size_type len));
-
--char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
-+char *
-+bfd_follow_gnu_debuglink PARAMS ((bfd *abfd, const char *dir));
-
--struct bfd_section *bfd_create_gnu_debuglink_section
-- (bfd *abfd, const char *filename);
-+struct bfd_section *
-+bfd_create_gnu_debuglink_section PARAMS ((bfd *abfd, const char *filename));
-
--bfd_boolean bfd_fill_in_gnu_debuglink_section
-- (bfd *abfd, struct bfd_section *sect, const char *filename);
-+bfd_boolean
-+bfd_fill_in_gnu_debuglink_section PARAMS ((bfd *abfd, struct bfd_section *sect, const char *filename));
-
- /* Extracted from libbfd.c. */
-
-@@ -976,9 +987,11 @@ bfd_boolean bfd_fill_in_gnu_debuglink_se
-
-
- /* Extracted from bfdio.c. */
--long bfd_get_mtime (bfd *abfd);
-+long
-+bfd_get_mtime PARAMS ((bfd *abfd));
-
--long bfd_get_size (bfd *abfd);
-+long
-+bfd_get_size PARAMS ((bfd *abfd));
-
- /* Extracted from bfdwin.c. */
- /* Extracted from section.c. */
-@@ -1421,48 +1434,54 @@ extern const struct bfd_symbol * const b
- } \
- while (0)
-
--void bfd_section_list_clear (bfd *);
-+void
-+bfd_section_list_clear PARAMS ((bfd *));
-
--asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-+asection *
-+bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
-
--char *bfd_get_unique_section_name
-- (bfd *abfd, const char *templat, int *count);
-+char *
-+bfd_get_unique_section_name PARAMS ((bfd *abfd, const char *templat, int *count));
-
--asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-+asection *
-+bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
-
--asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-+asection *
-+bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
-
--asection *bfd_make_section (bfd *, const char *name);
-+asection *
-+bfd_make_section PARAMS ((bfd *, const char *name));
-
--bfd_boolean bfd_set_section_flags
-- (bfd *abfd, asection *sec, flagword flags);
-+bfd_boolean
-+bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
-
--void bfd_map_over_sections
-- (bfd *abfd,
-+void
-+bfd_map_over_sections PARAMS ((bfd *abfd,
- void (*func) (bfd *abfd, asection *sect, void *obj),
-- void *obj);
-+ void *obj));
-
--bfd_boolean bfd_set_section_size
-- (bfd *abfd, asection *sec, bfd_size_type val);
-+bfd_boolean
-+bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
-
--bfd_boolean bfd_set_section_contents
-- (bfd *abfd, asection *section, const void *data,
-- file_ptr offset, bfd_size_type count);
-+bfd_boolean
-+bfd_set_section_contents PARAMS ((bfd *abfd, asection *section, const void *data,
-+ file_ptr offset, bfd_size_type count));
-
--bfd_boolean bfd_get_section_contents
-- (bfd *abfd, asection *section, void *location, file_ptr offset,
-- bfd_size_type count);
-+bfd_boolean
-+bfd_get_section_contents PARAMS ((bfd *abfd, asection *section, void *location, file_ptr offset,
-+ bfd_size_type count));
-
--bfd_boolean bfd_copy_private_section_data
-- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
-+bfd_boolean
-+bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec));
-
- #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
- BFD_SEND (obfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
--void _bfd_strip_section_from_output
-- (struct bfd_link_info *info, asection *section);
-+void
-+_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
-
--bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
-+bfd_boolean
-+bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
-
- /* Extracted from archures.c. */
- enum bfd_architecture
-@@ -1728,6 +1747,8 @@ enum bfd_architecture
+diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
+index 2464d27..1938170 100644
+--- a/bfd/bfd-in2.h
++++ b/bfd/bfd-in2.h
+@@ -1728,6 +1728,8 @@ enum bfd_architecture
#define bfd_mach_msp44 44
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
+ bfd_arch_nios2,
-+#define bfd_mach_nios2 1
++#define bfd_mach_nios2 1
bfd_arch_last
};
-@@ -1754,37 +1775,47 @@ typedef struct bfd_arch_info
- }
- bfd_arch_info_type;
-
--const char *bfd_printable_name (bfd *abfd);
-+const char *
-+bfd_printable_name PARAMS ((bfd *abfd));
-
--const bfd_arch_info_type *bfd_scan_arch (const char *string);
-+const bfd_arch_info_type *
-+bfd_scan_arch PARAMS ((const char *string));
-
--const char **bfd_arch_list (void);
-+const char **
-+bfd_arch_list PARAMS ((void));
-
--const bfd_arch_info_type *bfd_arch_get_compatible
-- (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-+const bfd_arch_info_type *
-+bfd_arch_get_compatible PARAMS ((const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns));
-
--void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-+void
-+bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
-
--enum bfd_architecture bfd_get_arch (bfd *abfd);
-+enum bfd_architecture
-+bfd_get_arch PARAMS ((bfd *abfd));
-
--unsigned long bfd_get_mach (bfd *abfd);
-+unsigned long
-+bfd_get_mach PARAMS ((bfd *abfd));
-
--unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-+unsigned int
-+bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
-
--unsigned int bfd_arch_bits_per_address (bfd *abfd);
-+unsigned int
-+bfd_arch_bits_per_address PARAMS ((bfd *abfd));
-
--const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-+const bfd_arch_info_type *
-+bfd_get_arch_info PARAMS ((bfd *abfd));
-
--const bfd_arch_info_type *bfd_lookup_arch
-- (enum bfd_architecture arch, unsigned long machine);
-+const bfd_arch_info_type *
-+bfd_lookup_arch PARAMS ((enum bfd_architecture arch, unsigned long machine));
-
--const char *bfd_printable_arch_mach
-- (enum bfd_architecture arch, unsigned long machine);
-+const char *
-+bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine));
-
--unsigned int bfd_octets_per_byte (bfd *abfd);
-+unsigned int
-+bfd_octets_per_byte PARAMS ((bfd *abfd));
-
--unsigned int bfd_arch_mach_octets_per_byte
-- (enum bfd_architecture arch, unsigned long machine);
-+unsigned int
-+bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch, unsigned long machine));
-
- /* Extracted from reloc.c. */
- typedef enum bfd_reloc_status
-@@ -1967,7 +1998,8 @@ struct reloc_howto_struct
- } \
- }
-
--unsigned int bfd_get_reloc_size (reloc_howto_type *);
-+unsigned int
-+bfd_get_reloc_size PARAMS ((reloc_howto_type *));
-
- typedef struct relent_chain
- {
-@@ -1976,27 +2008,27 @@ typedef struct relent_chain
- }
- arelent_chain;
-
--bfd_reloc_status_type bfd_check_overflow
-- (enum complain_overflow how,
-+bfd_reloc_status_type
-+bfd_check_overflow PARAMS ((enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
-- bfd_vma relocation);
-+ bfd_vma relocation));
-
--bfd_reloc_status_type bfd_perform_relocation
-- (bfd *abfd,
-+bfd_reloc_status_type
-+bfd_perform_relocation PARAMS ((bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
-- char **error_message);
-+ char **error_message));
-
--bfd_reloc_status_type bfd_install_relocation
-- (bfd *abfd,
-+bfd_reloc_status_type
-+bfd_install_relocation PARAMS ((bfd *abfd,
- arelent *reloc_entry,
- void *data, bfd_vma data_start,
- asection *input_section,
-- char **error_message);
-+ char **error_message));
-
- enum bfd_reloc_code_real {
- _dummy_first_bfd_reloc_code_real,
-@@ -3439,6 +3471,23 @@ This is the 5 bits of a value. */
+@@ -3439,6 +3441,23 @@ This is the 5 bits of a value. */
BFD_RELOC_MSP430_16_PCREL_BYTE,
BFD_RELOC_MSP430_16_BYTE,
@@ -439,293 +174,11 @@
/* IQ2000 Relocations. */
BFD_RELOC_IQ2000_OFFSET_16,
BFD_RELOC_IQ2000_OFFSET_21,
-@@ -3477,10 +3526,11 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */
- BFD_RELOC_XTENSA_ASM_SIMPLIFY,
- BFD_RELOC_UNUSED };
- typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
--reloc_howto_type *bfd_reloc_type_lookup
-- (bfd *abfd, bfd_reloc_code_real_type code);
-+reloc_howto_type *
-+bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-
--const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-+const char *
-+bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
-
- /* Extracted from syms.c. */
-
-@@ -3611,9 +3661,11 @@ asymbol;
- #define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
--bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-+bfd_boolean
-+bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
-
--bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
-+bfd_boolean
-+bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name));
-
- #define bfd_is_local_label_name(abfd, name) \
- BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-@@ -3621,27 +3673,32 @@ bfd_boolean bfd_is_local_label_name (bfd
- #define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
--bfd_boolean bfd_set_symtab
-- (bfd *abfd, asymbol **location, unsigned int count);
-+bfd_boolean
-+bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
-
--void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-+void
-+bfd_print_symbol_vandf PARAMS ((bfd *abfd, void *file, asymbol *symbol));
-
- #define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
--asymbol *_bfd_generic_make_empty_symbol (bfd *);
-+asymbol *
-+_bfd_generic_make_empty_symbol PARAMS ((bfd *));
-
- #define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
--int bfd_decode_symclass (asymbol *symbol);
-+int
-+bfd_decode_symclass PARAMS ((asymbol *symbol));
-
--bfd_boolean bfd_is_undefined_symclass (int symclass);
-+bfd_boolean
-+bfd_is_undefined_symclass PARAMS ((int symclass));
-
--void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-+void
-+bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
-
--bfd_boolean bfd_copy_private_symbol_data
-- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-+bfd_boolean
-+bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
-
- #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
-@@ -3840,57 +3897,76 @@ typedef enum bfd_error
- }
- bfd_error_type;
-
--bfd_error_type bfd_get_error (void);
-+bfd_error_type
-+bfd_get_error PARAMS ((void));
-
--void bfd_set_error (bfd_error_type error_tag);
-+void
-+bfd_set_error PARAMS ((bfd_error_type error_tag));
-
--const char *bfd_errmsg (bfd_error_type error_tag);
-+const char *
-+bfd_errmsg PARAMS ((bfd_error_type error_tag));
-
--void bfd_perror (const char *message);
-+void
-+bfd_perror PARAMS ((const char *message));
-
- typedef void (*bfd_error_handler_type) (const char *, ...);
-
--bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-+bfd_error_handler_type
-+bfd_set_error_handler PARAMS ((bfd_error_handler_type));
-
--void bfd_set_error_program_name (const char *);
-+void
-+bfd_set_error_program_name PARAMS ((const char *));
-
--bfd_error_handler_type bfd_get_error_handler (void);
-+bfd_error_handler_type
-+bfd_get_error_handler PARAMS ((void));
-
--const char *bfd_archive_filename (bfd *);
-+const char *
-+bfd_archive_filename PARAMS ((bfd *));
-
--long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-+long
-+bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
-
--long bfd_canonicalize_reloc
-- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-+long
-+bfd_canonicalize_reloc PARAMS ((bfd *abfd, asection *sec, arelent **loc, asymbol **syms));
-
--void bfd_set_reloc
-- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-+void
-+bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count));
-
--bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-+bfd_boolean
-+bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
-
--int bfd_get_arch_size (bfd *abfd);
-+int
-+bfd_get_arch_size PARAMS ((bfd *abfd));
-
--int bfd_get_sign_extend_vma (bfd *abfd);
-+int
-+bfd_get_sign_extend_vma PARAMS ((bfd *abfd));
-
--bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-+bfd_boolean
-+bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
-
--unsigned int bfd_get_gp_size (bfd *abfd);
-+unsigned int
-+bfd_get_gp_size PARAMS ((bfd *abfd));
-
--void bfd_set_gp_size (bfd *abfd, unsigned int i);
-+void
-+bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
-
--bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-+bfd_vma
-+bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
-
--bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-+bfd_boolean
-+bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
- #define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
--bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
-+bfd_boolean
-+bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
- #define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
--bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
-+bfd_boolean
-+bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
-
- #define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-@@ -3968,7 +4044,8 @@ extern bfd_byte *bfd_get_relocated_secti
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bfd_boolean, asymbol **);
-
--bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
-+bfd_boolean
-+bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative));
-
- struct bfd_preserve
- {
-@@ -3982,27 +4059,34 @@ struct bfd_preserve
- struct bfd_hash_table section_htab;
- };
-
--bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-+bfd_boolean
-+bfd_preserve_save PARAMS ((bfd *, struct bfd_preserve *));
-
--void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-+void
-+bfd_preserve_restore PARAMS ((bfd *, struct bfd_preserve *));
-
--void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-+void
-+bfd_preserve_finish PARAMS ((bfd *, struct bfd_preserve *));
-
- /* Extracted from archive.c. */
--symindex bfd_get_next_mapent
-- (bfd *abfd, symindex previous, carsym **sym);
-+symindex
-+bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
-
--bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-+bfd_boolean
-+bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
-
--bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-+bfd *
-+bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
-
- /* Extracted from corefile.c. */
--const char *bfd_core_file_failing_command (bfd *abfd);
-+const char *
-+bfd_core_file_failing_command PARAMS ((bfd *abfd));
-
--int bfd_core_file_failing_signal (bfd *abfd);
-+int
-+bfd_core_file_failing_signal PARAMS ((bfd *abfd));
-
--bfd_boolean core_file_matches_executable_p
-- (bfd *core_bfd, bfd *exec_bfd);
-+bfd_boolean
-+core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-
- /* Extracted from targets.c. */
- #define BFD_SEND(bfd, message, arglist) \
-@@ -4362,35 +4446,42 @@ typedef struct bfd_target
-
- } bfd_target;
-
--bfd_boolean bfd_set_default_target (const char *name);
-+bfd_boolean
-+bfd_set_default_target PARAMS ((const char *name));
-
--const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-+const bfd_target *
-+bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
-
--const char ** bfd_target_list (void);
-+const char **
-+bfd_target_list PARAMS ((void));
-
--const bfd_target *bfd_search_for_target
-- (int (*search_func) (const bfd_target *, void *),
-- void *);
-+const bfd_target *
-+bfd_search_for_target PARAMS ((int (*search_func) (const bfd_target *, void *),
-+ void *));
-
- /* Extracted from format.c. */
--bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
-+bfd_boolean
-+bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
-
--bfd_boolean bfd_check_format_matches
-- (bfd *abfd, bfd_format format, char ***matching);
-+bfd_boolean
-+bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
-
--bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
-+bfd_boolean
-+bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
-
--const char *bfd_format_string (bfd_format format);
-+const char *
-+bfd_format_string PARAMS ((bfd_format format));
-
- /* Extracted from linker.c. */
--bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-+bfd_boolean
-+bfd_link_split_section PARAMS ((bfd *abfd, asection *sec));
-
- #define bfd_link_split_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
- /* Extracted from simple.c. */
--bfd_byte *bfd_simple_get_relocated_section_contents
-- (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
-+bfd_byte *
-+bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table));
-
- #ifdef __cplusplus
- }
---- binutils-2.15/bfd/config.bfd 2004-05-17 21:35:56.000000000 +0200
-+++ binutils-2.15-nios2/bfd/config.bfd 2005-05-17 12:20:13.000000000 +0200
-@@ -59,6 +59,7 @@ m6812*|m68hc12*) targ_archs="bfd_m68hc12
+diff --git a/bfd/config.bfd b/bfd/config.bfd
+index 1428831..caf64b5 100755
+--- a/bfd/config.bfd
++++ b/bfd/config.bfd
+@@ -59,6 +59,7 @@ m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
m68*) targ_archs=bfd_m68k_arch ;;
m88*) targ_archs=bfd_m88k_arch ;;
mips*) targ_archs=bfd_mips_arch ;;
@@ -733,39 +186,59 @@
or32*) targ_archs=bfd_or32_arch ;;
pdp11*) targ_archs=bfd_pdp11_arch ;;
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
-@@ -874,6 +875,10 @@ case "${targ}" in
+@@ -874,6 +875,21 @@ case "${targ}" in
targ_underscore=yes
;;
++ nios2eb-*-*)
++ targ_defvec=bfd_elf32_bignios2_vec
++ targ_selvecs=bfd_elf32_littlenios2_vec
++ ;;
++
++ nios2el-*-*)
++ targ_defvec=bfd_elf32_littlenios2_vec
++ targ_selvecs=bfd_elf32_bignios2_vec
++ ;;
++
+ nios2-*-*)
+ targ_defvec=bfd_elf32_littlenios2_vec
++ targ_selvecs=bfd_elf32_bignios2_vec
+ ;;
+
openrisc-*-elf)
targ_defvec=bfd_elf32_openrisc_vec
;;
---- binutils-2.15/bfd/configure 2004-05-17 21:35:57.000000000 +0200
-+++ binutils-2.15-nios2/bfd/configure 2005-05-17 12:20:13.000000000 +0200
-@@ -6322,6 +6322,7 @@ do
+diff --git a/bfd/configure b/bfd/configure
+index 46c8170..8c35166 100755
+--- a/bfd/configure
++++ b/bfd/configure
+@@ -6322,6 +6322,8 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+ bfd_elf32_littlenios2_vec) tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
++ bfd_elf32_bignios2_vec) tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
---- binutils-2.15/bfd/configure.in 2004-05-17 21:35:57.000000000 +0200
-+++ binutils-2.15-nios2/bfd/configure.in 2005-05-17 12:20:13.000000000 +0200
-@@ -631,6 +631,7 @@ do
+diff --git a/bfd/configure.in b/bfd/configure.in
+index 71f41f4..eed3fa0 100644
+--- a/bfd/configure.in
++++ b/bfd/configure.in
+@@ -631,6 +631,8 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+ bfd_elf32_littlenios2_vec) tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
++ bfd_elf32_bignios2_vec) tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
---- binutils-2.15/bfd/cpu-nios2.c 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/bfd/cpu-nios2.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/cpu-nios2.c b/bfd/cpu-nios2.c
+new file mode 100644
+index 0000000..c8f39c9
+--- /dev/null
++++ b/bfd/cpu-nios2.c
@@ -0,0 +1,70 @@
+/* bfd back-end for Altera Nios II support
+
@@ -837,8 +310,10 @@
+ so the linker can distinguish it */
+const bfd_arch_info_type bfd_nios2_arch =
+N (32, 32, 0, "nios2", TRUE, &arch_info_struct[0]);
---- binutils-2.15/bfd/elf.c 2004-05-17 21:35:57.000000000 +0200
-+++ binutils-2.15-nios2/bfd/elf.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/elf.c b/bfd/elf.c
+index a14fd35..3a061ec 100644
+--- a/bfd/elf.c
++++ b/bfd/elf.c
@@ -3286,9 +3286,14 @@ map_sections_to_segments (bfd *abfd)
phdr_size = elf_tdata (abfd)->program_header_size;
if (phdr_size == 0)
@@ -855,12 +330,15 @@
phdr_in_segment = FALSE;
}
---- binutils-2.15/bfd/elf32-nios2.c 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/bfd/elf32-nios2.c 2005-05-17 12:20:13.000000000 +0200
-@@ -0,0 +1,2188 @@
+diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
+new file mode 100644
+index 0000000..045b3a9
+--- /dev/null
++++ b/bfd/elf32-nios2.c
+@@ -0,0 +1,2191 @@
+/* New Jersey-specific support for 32-bit ELF
+
-+ Copyright (C) 2003
++ Copyright (C) 2005
+ by Nigel Gray (ngray@altera.com).
+
+
@@ -1028,6 +506,7 @@
+
+/* target vector */
+extern const bfd_target bfd_elf32_littlenios2_vec;
++extern const bfd_target bfd_elf32_bignios2_vec;
+
+/* The relocation table used for SHT_REL sections. */
+
@@ -2681,13 +2160,15 @@
+ }
+ else
+ {
++ bfd_vma symbol_address = rel->r_addend + relocation;
+ relocation = relocation + rel->r_addend - gp;
+ rel->r_addend = 0;
+ if ((signed) relocation < -32768
+ || (signed) relocation > 32767)
+ {
-+ format = _("global pointer relative offset %d at address 0x%08x out of range -32678 to 32767\n");
-+ sprintf(msgbuf, format, (signed)relocation, reloc_address);
++ format = _("Unable to reach %s (at 0x%08x) from the global pointer (at 0x%08x) "
++ "because the offset (%d) is out of the allowed range, -32678 to 32767.\n" );
++ sprintf(msgbuf, format, name, symbol_address, gp, (signed)relocation);
+ msg = msgbuf;
+ r = bfd_reloc_outofrange;
+ }
@@ -3042,49 +2523,15 @@
+/* Support for SGI-ish mips targets. */
+#define TARGET_LITTLE_SYM bfd_elf32_littlenios2_vec
+#define TARGET_LITTLE_NAME "elf32-littlenios2"
-+//#define TARGET_BIG_SYM bfd_elf32_bignios2_vec
-+//#define TARGET_BIG_NAME "elf32-bignios2"
++#define TARGET_BIG_SYM bfd_elf32_bignios2_vec
++#define TARGET_BIG_NAME "elf32-bignios2"
+
+#include "elf32-target.h"
---- binutils-2.15/bfd/libbfd.h 2004-02-12 00:23:20.000000000 +0100
-+++ binutils-2.15-nios2/bfd/libbfd.h 2005-05-17 12:20:13.000000000 +0200
-@@ -652,9 +652,11 @@ extern bfd_boolean _bfd_sh_align_load_sp
- #endif
- /* Extracted from init.c. */
- /* Extracted from libbfd.c. */
--bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-+bfd_boolean
-+bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
-
--unsigned int bfd_log2 (bfd_vma x);
-+unsigned int
-+bfd_log2 PARAMS ((bfd_vma x));
-
- /* Extracted from bfdio.c. */
- /* Extracted from bfdwin.c. */
-@@ -673,13 +675,17 @@ extern bfd *bfd_last_cache;
- ((x)==bfd_last_cache? \
- (FILE*) (bfd_last_cache->iostream): \
- bfd_cache_lookup_worker(x))
--bfd_boolean bfd_cache_init (bfd *abfd);
-+bfd_boolean
-+bfd_cache_init PARAMS ((bfd *abfd));
-
--bfd_boolean bfd_cache_close (bfd *abfd);
-+bfd_boolean
-+bfd_cache_close PARAMS ((bfd *abfd));
-
--FILE* bfd_open_file (bfd *abfd);
-+FILE*
-+bfd_open_file PARAMS ((bfd *abfd));
-
--FILE *bfd_cache_lookup_worker (bfd *abfd);
-+FILE *
-+bfd_cache_lookup_worker PARAMS ((bfd *abfd));
-
- /* Extracted from reloc.c. */
- #ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
-@@ -1504,6 +1510,21 @@ static const char *const bfd_reloc_code_
+diff --git a/bfd/libbfd.h b/bfd/libbfd.h
+index 62043f3..3335b04 100644
+--- a/bfd/libbfd.h
++++ b/bfd/libbfd.h
+@@ -1504,6 +1504,21 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MSP430_16",
"BFD_RELOC_MSP430_16_PCREL_BYTE",
"BFD_RELOC_MSP430_16_BYTE",
@@ -3106,69 +2553,10 @@
"BFD_RELOC_IQ2000_OFFSET_16",
"BFD_RELOC_IQ2000_OFFSET_21",
"BFD_RELOC_IQ2000_UHI16",
-@@ -1521,40 +1542,41 @@ static const char *const bfd_reloc_code_
- };
- #endif
-
--reloc_howto_type *bfd_default_reloc_type_lookup
-- (bfd *abfd, bfd_reloc_code_real_type code);
-+reloc_howto_type *
-+bfd_default_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-
--bfd_boolean bfd_generic_relax_section
-- (bfd *abfd,
-+bfd_boolean
-+bfd_generic_relax_section PARAMS ((bfd *abfd,
- asection *section,
- struct bfd_link_info *,
-- bfd_boolean *);
-+ bfd_boolean *));
-
--bfd_boolean bfd_generic_gc_sections
-- (bfd *, struct bfd_link_info *);
-+bfd_boolean
-+bfd_generic_gc_sections PARAMS ((bfd *, struct bfd_link_info *));
-
--bfd_boolean bfd_generic_merge_sections
-- (bfd *, struct bfd_link_info *);
-+bfd_boolean
-+bfd_generic_merge_sections PARAMS ((bfd *, struct bfd_link_info *));
-
--bfd_byte *bfd_generic_get_relocated_section_contents
-- (bfd *abfd,
-+bfd_byte *
-+bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
-- asymbol **symbols);
-+ asymbol **symbols));
-
- /* Extracted from archures.c. */
- extern const bfd_arch_info_type bfd_default_arch_struct;
--bfd_boolean bfd_default_set_arch_mach
-- (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-+bfd_boolean
-+bfd_default_set_arch_mach PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach));
-
--const bfd_arch_info_type *bfd_default_compatible
-- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-+const bfd_arch_info_type *
-+bfd_default_compatible PARAMS ((const bfd_arch_info_type *a, const bfd_arch_info_type *b));
-
--bfd_boolean bfd_default_scan
-- (const struct bfd_arch_info *info, const char *string);
-+bfd_boolean
-+bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string));
-
- /* Extracted from elf.c. */
--struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
-+struct elf_internal_shdr *
-+bfd_elf_find_section PARAMS ((bfd *abfd, char *name));
-
---- binutils-2.15/bfd/reloc.c 2004-01-21 12:17:53.000000000 +0100
-+++ binutils-2.15-nios2/bfd/reloc.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/reloc.c b/bfd/reloc.c
+index 9bffaa3..8807b30 100644
+--- a/bfd/reloc.c
++++ b/bfd/reloc.c
@@ -3943,6 +3943,39 @@ ENUMDOC
msp430 specific relocation codes
@@ -3209,8 +2597,10 @@
BFD_RELOC_IQ2000_OFFSET_16
ENUMX
BFD_RELOC_IQ2000_OFFSET_21
---- binutils-2.15/bfd/srec.c 2003-11-30 19:40:41.000000000 +0100
-+++ binutils-2.15-nios2/bfd/srec.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/bfd/srec.c b/bfd/srec.c
+index c0a3d58..1a1d0ce 100644
+--- a/bfd/srec.c
++++ b/bfd/srec.c
@@ -1009,9 +1009,14 @@ srec_write_header (abfd)
{
unsigned int len = strlen (abfd->filename);
@@ -3229,38 +2619,106 @@
return srec_write_record (abfd, 0, (bfd_vma) 0,
abfd->filename, abfd->filename + len);
---- binutils-2.15/bfd/targets.c 2004-05-17 21:36:04.000000000 +0200
-+++ binutils-2.15-nios2/bfd/targets.c 2005-05-17 12:20:13.000000000 +0200
-@@ -559,6 +559,7 @@ extern const bfd_target bfd_elf32_nbigmi
+diff --git a/bfd/targets.c b/bfd/targets.c
+index cec339c..1833c94 100644
+--- a/bfd/targets.c
++++ b/bfd/targets.c
+@@ -559,6 +559,8 @@ extern const bfd_target bfd_elf32_nbigmips_vec;
extern const bfd_target bfd_elf32_nlittlemips_vec;
extern const bfd_target bfd_elf32_ntradbigmips_vec;
extern const bfd_target bfd_elf32_ntradlittlemips_vec;
+extern const bfd_target bfd_elf32_littlenios2_vec;
++extern const bfd_target bfd_elf32_bignios2_vec;
extern const bfd_target bfd_elf32_openrisc_vec;
extern const bfd_target bfd_elf32_or32_big_vec;
extern const bfd_target bfd_elf32_pj_vec;
-@@ -746,6 +747,7 @@ extern const bfd_target sco5_core_vec;
+@@ -746,6 +748,8 @@ extern const bfd_target sco5_core_vec;
extern const bfd_target trad_core_vec;
extern const bfd_target bfd_elf32_am33lin_vec;
+extern const bfd_target bfd_elf32_littlenios2_vec;
++extern const bfd_target bfd_elf32_bignios2_vec;
static const bfd_target * const _bfd_target_vector[] = {
#ifdef SELECT_VECS
-@@ -854,6 +856,7 @@ static const bfd_target * const _bfd_tar
+@@ -854,6 +858,8 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_ntradbigmips_vec,
&bfd_elf32_ntradlittlemips_vec,
#endif
+ &bfd_elf32_littlenios2_vec,
++ &bfd_elf32_bignios2_vec,
&bfd_elf32_openrisc_vec,
&bfd_elf32_or32_big_vec,
&bfd_elf32_pj_vec,
---- binutils-2.15/binutils/nios2_binutils_xfail.lst 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/binutils/nios2_binutils_xfail.lst 2005-05-17 12:20:13.000000000 +0200
+diff --git a/binutils/nios2_binutils_xfail.lst b/binutils/nios2_binutils_xfail.lst
+new file mode 100644
+index 0000000..3219223
+--- /dev/null
++++ b/binutils/nios2_binutils_xfail.lst
@@ -0,0 +1 @@
+No xfails
---- binutils-2.15/binutils/readelf.c 2004-05-17 21:35:52.000000000 +0200
-+++ binutils-2.15-nios2/binutils/readelf.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/binutils/objcopy.c b/binutils/objcopy.c
+index 9623398..a1b7a05 100644
+--- a/binutils/objcopy.c
++++ b/binutils/objcopy.c
+@@ -1705,8 +1705,53 @@ copy_file (const char *input_filename, const char *output_filename,
+
+ delete = ! copy_object (ibfd, obfd);
+
++ if (!strcmp (obfd->xvec->name, "srec")
++ && (!strcmp (ibfd->xvec->name, "elf32-bignios2")
++ || !strcmp (ibfd->xvec->name, "elf32-littlenios2")))
++ {
++ /*
++ * We're copying a big-endian or little-endian elf to an srec.
++ * Tag the elf with a hardcoded S0 record so other tools know
++ * which endianness was in the original elf file.
++ *
++ * This is a hack, as srec files don't really have an
++ * endianness. We just need a way to tell tools like
++ * flash2dat.pl which endianness was originally present.
++ *
++ * At some point in the future, we should stop using srec files
++ * entirely: flash2dat and friends should just read the elf file
++ * directly.
++ */
++ char *new_filename = NULL;
++ const char *orig_filename = obfd->filename;
++ int result;
++
++ if (!strcmp (ibfd->xvec->name, "elf32-bignios2"))
++ {
++ new_filename = strdup("-EB");
++ }
++ else
++ {
++ new_filename = strdup("-EL");
++ }
++ obfd->filename = new_filename;
++
++ result = bfd_close (obfd);
++
++ if ( obfd != NULL && new_filename == obfd->filename )
++ {
++ free(new_filename);
++ obfd->filename = orig_filename;
++ }
++
++ if (!result)
++ RETURN_NONFATAL (output_filename);
++ }
++ else
++ {
+ if (!bfd_close (obfd))
+ RETURN_NONFATAL (output_filename);
++ }
+
+ if (!bfd_close (ibfd))
+ RETURN_NONFATAL (input_filename);
+diff --git a/binutils/readelf.c b/binutils/readelf.c
+index e95a501..a436778 100644
+--- a/binutils/readelf.c
++++ b/binutils/readelf.c
@@ -110,6 +110,8 @@
#include "aout/ar.h"
@@ -3297,8 +2755,10 @@
default:
sprintf (buff, _("<unknown>: %x"), e_machine);
return buff;
---- binutils-2.15/binutils/testsuite/binutils-all/bintest.s 1999-05-03 09:29:11.000000000 +0200
-+++ binutils-2.15-nios2/binutils/testsuite/binutils-all/bintest.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/binutils/testsuite/binutils-all/bintest.s b/binutils/testsuite/binutils-all/bintest.s
+index 9e00650..177b08c 100644
+--- a/binutils/testsuite/binutils-all/bintest.s
++++ b/binutils/testsuite/binutils-all/bintest.s
@@ -1,5 +1,8 @@
.globl text_symbol
.text
@@ -3308,50 +2768,40 @@
text_symbol:
static_text_symbol:
.long 1
---- binutils-2.15/binutils-2.15_copied 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/binutils-2.15_copied 2005-05-17 12:20:13.000000000 +0200
-@@ -0,0 +1 @@
-+timestamp
---- binutils-2.15/binutils-2.15_untarred 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/binutils-2.15_untarred 2005-05-17 12:20:13.000000000 +0200
-@@ -0,0 +1 @@
-+timestamp
---- binutils-2.15/configure 2004-05-17 21:36:20.000000000 +0200
-+++ binutils-2.15-nios2/configure 2005-05-17 12:20:13.000000000 +0200
+diff --git a/configure b/configure
+index d11c49b..41c0c64 100755
+--- a/configure
++++ b/configure
@@ -1434,6 +1434,10 @@ case "${target}" in
mips*-*-*)
noconfigdirs="$noconfigdirs gprof ${libgcj}"
;;
-+ nios2-*-*)
++ nios2*-*-*)
+ skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'`
+ noconfigdirs="$noconfigdirs"
+ ;;
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
---- binutils-2.15/configure.in 2004-05-17 21:40:54.000000000 +0200
-+++ binutils-2.15-nios2/configure.in 2005-05-17 12:20:13.000000000 +0200
-@@ -18,6 +18,7 @@
- ##############################################################################
- ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
-
-+
- AC_INIT(move-if-change)
- AC_PREREQ(2.13)
- AC_CANONICAL_SYSTEM
-@@ -667,6 +668,10 @@ case "${target}" in
+diff --git a/configure.in b/configure.in
+index 6c0c465..c770956 100644
+--- a/configure.in
++++ b/configure.in
+@@ -667,6 +667,10 @@ case "${target}" in
mips*-*-*)
noconfigdirs="$noconfigdirs gprof ${libgcj}"
;;
-+ nios2-*-*)
++ nios2*-*-*)
+ skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'`
+ noconfigdirs="$noconfigdirs"
+ ;;
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
;;
---- binutils-2.15/gas/Makefile.in 2004-05-17 21:36:07.000000000 +0200
-+++ binutils-2.15-nios2/gas/Makefile.in 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/Makefile.in b/gas/Makefile.in
+index 67ed432..7870a9e 100644
+--- a/gas/Makefile.in
++++ b/gas/Makefile.in
@@ -299,6 +299,7 @@ CPU_TYPES = \
mn10200 \
mn10300 \
@@ -3376,7 +2826,7 @@
config/tc-ns32k.h \
config/tc-openrisc.h \
config/tc-or32.h \
-@@ -1171,6 +1174,13 @@ DEPTC_msp430_elf = $(INCDIR)/symcat.h $(
+@@ -1171,6 +1174,13 @@ DEPTC_msp430_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/msp430.h \
$(INCDIR)/safe-ctype.h
@@ -3390,7 +2840,7 @@
DEPTC_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h
-@@ -1824,6 +1834,12 @@ DEPOBJ_msp430_elf = $(INCDIR)/symcat.h $
+@@ -1824,6 +1834,12 @@ DEPOBJ_msp430_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h
@@ -3403,7 +2853,7 @@
DEPOBJ_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h
-@@ -2349,6 +2365,10 @@ DEP_msp430_elf = $(srcdir)/config/obj-el
+@@ -2349,6 +2365,10 @@ DEP_msp430_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-msp430.h
@@ -3414,8 +2864,10 @@
DEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
---- binutils-2.15/gas/config/obj-elf.c 2004-05-17 21:36:08.000000000 +0200
-+++ binutils-2.15-nios2/gas/config/obj-elf.c 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
+index 14d48f2..6d9639f 100644
+--- a/gas/config/obj-elf.c
++++ b/gas/config/obj-elf.c
@@ -53,6 +53,10 @@
#include "elf/i370.h"
#endif
@@ -3427,9 +2879,12 @@
static void obj_elf_line (int);
static void obj_elf_size (int);
static void obj_elf_type (int);
---- binutils-2.15/gas/config/tc-nios2.c 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/config/tc-nios2.c 2005-05-17 12:20:13.000000000 +0200
-@@ -0,0 +1,2996 @@
+diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
+new file mode 100644
+index 0000000..21f994e
+--- /dev/null
++++ b/gas/config/tc-nios2.c
+@@ -0,0 +1,3197 @@
+/* tc-nios2.c -- assemble code for a New Jersey processor.
+
+ Copyright (C) 2003
@@ -3467,6 +2922,9 @@
+#include "subsegs.h"
+#include "safe-ctype.h"
+
++/* We can choose our endianness at run-time, regardless of configuration */
++extern int target_big_endian;
++
+#ifndef OBJ_ELF
+ /* we are not supporting any other target
+ so we throw a compile time error */
@@ -3649,6 +3107,12 @@
+static void output_cbranch (void);
+static void output_call (void);
+static void output_movia (void);
++static void output_andi (void);
++static void output_addi (void);
++static void output_ori (void);
++static void output_xori (void);
++static int can_evaluate_expr (void);
++static int get_expr_value (void);
+
+
+bfd_boolean nios2_check_overflow (valueT fixup, reloc_howto_type * howto);
@@ -3745,7 +3209,11 @@
+#define OPTION_NORELAX (OPTION_MD_BASE + 1)
+ {"no-relax", no_argument, NULL, OPTION_NORELAX},
+#define OPTION_RELAX_SECTION (OPTION_MD_BASE + 2)
-+ {"relax-section", no_argument, NULL, OPTION_RELAX_SECTION}
++ {"relax-section", no_argument, NULL, OPTION_RELAX_SECTION},
++#define OPTION_EB (OPTION_MD_BASE + 3)
++ {"EB", no_argument, NULL, OPTION_EB},
++#define OPTION_EL (OPTION_MD_BASE + 4)
++ {"EL", no_argument, NULL, OPTION_EL}
+};
+
+size_t md_longopts_size = sizeof (md_longopts);
@@ -4193,6 +3661,12 @@
+ case OPTION_RELAX_SECTION:
+ nios2_as_options.relax = relax_section;
+ break;
++ case OPTION_EB:
++ target_big_endian = 1;
++ break;
++ case OPTION_EL:
++ target_big_endian = 0;
++ break;
+ default:
+ return 0;
+ break;
@@ -4202,6 +3676,16 @@
+}
+
+/*
++ * We can choose to be big-endian or little-endian at runtime based
++ * on a switch.
++ */
++const char *
++nios2_target_format (void)
++{
++ return target_big_endian ? "elf32-bignios2" : "elf32-littlenios2";
++}
++
++/*
+ Function : md_show_usage(FILE* stream)
+
+ Description : machine-dependent usage message
@@ -4213,7 +3697,9 @@
+ NIOS2 options:\n\
+ -relax-all replace all branch and call instructions with jmp and callr sequences\n\
+ -relax-section replace identified out of range branches with jmp sequences (default)\n\
-+ -no-relax do not replace any branches or calls\n");
++ -no-relax do not replace any branches or calls\n\
++ -EB force big-endian byte ordering\n\
++ -EL force little-endian byte ordering\n");
+}
+
+/*
@@ -4397,6 +3883,14 @@
+ else if (nios2_as_options.relax == relax_all
+ && insn.insn_nios2_opcode->pinfo & NIOS2_INSN_CALL)
+ output_call ();
++ else if (insn.insn_nios2_opcode->pinfo & NIOS2_INSN_ANDI)
++ output_andi ();
++ else if (insn.insn_nios2_opcode->pinfo & NIOS2_INSN_ORI)
++ output_ori ();
++ else if (insn.insn_nios2_opcode->pinfo & NIOS2_INSN_XORI)
++ output_xori ();
++ else if (insn.insn_nios2_opcode->pinfo & NIOS2_INSN_ADDI)
++ output_addi ();
+ else if (saved_pinfo == NIOS2_INSN_MACRO_MOVIA)
+ output_movia ();
+ else
@@ -4551,6 +4045,123 @@
+ }
+}
+
++
++static int
++can_evaluate_expr ()
++{
++ /* remove this check for null and the invalid insn "ori r9, 1234" seg faults */
++ if (!insn.insn_reloc)
++ {
++ /* ??? Ideally we should do something other than as_fatal here as we can continue to assemble.
++ However this function (actually the output_* functions) should not have been called
++ in the first place once an illegal instruction had been encountered */
++ as_fatal (_("Invalid instruction encountered, cannot recover. No assembly attempted."));
++ }
++
++ if (insn.insn_reloc->reloc_expression.X_op == O_constant)
++ return 1;
++
++ return 0;
++}
++
++static int
++get_expr_value ()
++{
++ int value = 0;
++ if (insn.insn_reloc->reloc_expression.X_op == O_constant)
++ value = insn.insn_reloc->reloc_expression.X_add_number;
++ return value;
++}
++
++/* output an addi - will silently convert to
++ * orhi if rA = r0 and (expr & 0xffff0000) == 0 */
++static void
++output_addi ()
++{
++ int expr_val = 0;
++ if (can_evaluate_expr ())
++ {
++ expr_val = get_expr_value ();
++ if (GET_INSN_FIELD (RRS, insn.insn_code) == 0 &&
++ (expr_val & 0xffff) == 0 && expr_val != 0)
++ {
++
++ /* we really want a movhi (orhi) here */
++ insn.insn_code = (insn.insn_code & ~OP_MATCH_ADDI) | OP_MATCH_ORHI;
++ insn.insn_reloc->reloc_expression.X_add_number =
++ (insn.insn_reloc->reloc_expression.X_add_number >> 16) & 0xffff;
++ insn.insn_reloc->reloc_type = BFD_RELOC_NIOS2_U16;
++ }
++ }
++
++ /* output an instruction */
++ output_insn ();
++}
++
++static void
++output_andi ()
++{
++ int expr_val = 0;
++ if (can_evaluate_expr ())
++ {
++ expr_val = get_expr_value ();
++ if (expr_val != 0 && (expr_val & 0xffff) == 0)
++ {
++ /* we really want a movhi (orhi) here */
++ insn.insn_code = (insn.insn_code & ~OP_MATCH_ANDI) | OP_MATCH_ANDHI;
++ insn.insn_reloc->reloc_expression.X_add_number =
++ (insn.insn_reloc->reloc_expression.X_add_number >> 16) & 0xffff;
++ insn.insn_reloc->reloc_type = BFD_RELOC_NIOS2_U16;
++ }
++ }
++
++ /* output an instruction */
++ output_insn ();
++}
++
++static void
++output_ori ()
++{
++ int expr_val = 0;
++ if (can_evaluate_expr ())
++ {
++ expr_val = get_expr_value ();
++ if (expr_val != 0 && (expr_val & 0xffff) == 0)
++ {
++ /* we really want a movhi (orhi) here */
++ insn.insn_code = (insn.insn_code & ~OP_MATCH_ORI) | OP_MATCH_ORHI;
++ insn.insn_reloc->reloc_expression.X_add_number =
++ (insn.insn_reloc->reloc_expression.X_add_number >> 16) & 0xffff;
++ insn.insn_reloc->reloc_type = BFD_RELOC_NIOS2_U16;
++ }
++ }
++
++ /* output an instruction */
++ output_insn ();
++}
++
++static void
++output_xori ()
++{
++ int expr_val = 0;
++ if (can_evaluate_expr ())
++ {
++ expr_val = get_expr_value ();
++ if (expr_val != 0 && (expr_val & 0xffff) == 0)
++ {
++ /* we really want a movhi (orhi) here */
++ insn.insn_code = (insn.insn_code & ~OP_MATCH_XORI) | OP_MATCH_XORHI;
++ insn.insn_reloc->reloc_expression.X_add_number =
++ (insn.insn_reloc->reloc_expression.X_add_number >> 16) & 0xffff;
++ insn.insn_reloc->reloc_type = BFD_RELOC_NIOS2_U16;
++ }
++ }
++
++ /* output an instruction */
++ output_insn ();
++}
++
++
+/* output a movhi/addi pair for the movia pseudo-op */
+static void
+output_movia ()
@@ -4586,23 +4197,32 @@
+
+/*
+ Function md_chars_to_number takes the sequence of
-+ bytes in bug and returns the corresponding value
++ bytes in buf and returns the corresponding value
+ in an int. n must be 1, 2 or 4.
+ */
+valueT
+md_chars_to_number (char *buf, int n)
+{
-+ // this assumes little endian format
+ int i;
+ valueT val;
+
+ assert (n == 1 || n == 2 || n == 4);
+
+ val = 0;
++ if (target_big_endian)
++ {
++ for (i = 0; i < n; ++i)
++ {
++ val = val | ((buf[i] & 0xff) << 8 * (n - (i + 1)));
++ }
++ }
++ else
++ {
+ for (i = 0; i < n; ++i)
+ {
+ val = val | ((buf[i] & 0xff) << 8 * i);
+ }
++ }
+ return val;
+}
+
@@ -4617,13 +4237,14 @@
+void
+md_number_to_chars (char *buf, valueT val, int n)
+{
-+ /* this assumes little endian format */
-+ int i;
+ assert (n == 1 || n == 2 || n == 4);
-+ for (i = 0; i < n; ++i)
++ if (target_big_endian)
+ {
-+ buf[i] = val & 0xFF;
-+ val >>= 8;
++ number_to_chars_bigendian (buf, val, n);
++ }
++ else
++ {
++ number_to_chars_littleendian (buf, val, n);
+ }
+}
+
@@ -4699,12 +4320,22 @@
+
+ *sizeP = prec * 2;
+
-+ /* little endian target */
++ if (! target_big_endian)
++ {
+ for (i = prec - 1; i >= 0; i--)
+ {
+ md_number_to_chars (litP, (valueT) words[i], 2);
+ litP += 2;
+ }
++ }
++ else
++ {
++ for (i = 0; i < prec; i++)
++ {
++ md_number_to_chars (litP, (valueT) words[i], 2);
++ litP += 2;
++ }
++ }
+
+ return NULL;
+}
@@ -5093,7 +4724,7 @@
+
+
+ /* apply the rightshift */
-+ (signed) fixup >>= howto->rightshift;
++ fixup >>= howto->rightshift;
+
+ /* truncate the fixup to right size */
+ switch (fixP->fx_r_type)
@@ -5138,7 +4769,7 @@
+nios2_check_overflow (valueT fixup, reloc_howto_type * howto)
+{
+ /* apply the rightshift before checking for overflow */
-+ (signed) fixup >>= howto->rightshift;
++ fixup >>= howto->rightshift;
+
+ /* check for overflow - return TRUE if overflow, FALSE if not */
+ switch (howto->complain_on_overflow)
@@ -5331,11 +4962,16 @@
+ {
+ case 'c':
+ if (strncmp (argStr, "ctl", strlen ("ctl")) != 0
++ && strncmp (argStr, "cpuid", strlen ("cpuid")) != 0
+ && strncmp (argStr, "status", strlen ("status")) != 0
+ && strncmp (argStr, "estatus", strlen ("estatus")) != 0
+ && strncmp (argStr, "bstatus", strlen ("bstatus")) != 0
+ && strncmp (argStr, "ienable", strlen ("ienable")) != 0
-+ && strncmp (argStr, "ipending", strlen ("ipending")) != 0)
++ && strncmp (argStr, "ipending", strlen ("ipending")) != 0
++ && strncmp (argStr, "pteaddr", strlen ("pteaddr")) != 0
++ && strncmp (argStr, "tlbacc", strlen ("tlbacc")) != 0
++ && strncmp (argStr, "tlbmisc", strlen ("tlbmisc")) != 0
++ && strncmp (argStr, "fstatus", strlen ("fstatus")) != 0)
+ {
+ as_bad (_("expecting control register"));
+ }
@@ -5346,11 +4982,16 @@
+
+ /* we check to make sure we don't have a control register */
+ if (strncmp (argStr, "ctl", strlen ("ctl")) == 0
++ || strncmp (argStr, "cpuid", strlen ("cpuid")) == 0
+ || strncmp (argStr, "status", strlen ("status")) == 0
+ || strncmp (argStr, "estatus", strlen ("estatus")) == 0
+ || strncmp (argStr, "bstatus", strlen ("bstatus")) == 0
+ || strncmp (argStr, "ienable", strlen ("ienable")) == 0
-+ || strncmp (argStr, "ipending", strlen ("ipending")) == 0)
++ || strncmp (argStr, "ipending", strlen ("ipending")) == 0
++ || strncmp (argStr, "pteaddr", strlen ("pteaddr")) == 0
++ || strncmp (argStr, "tlbacc", strlen ("tlbacc")) == 0
++ || strncmp (argStr, "tlbmisc", strlen ("tlbmisc")) == 0
++ || strncmp (argStr, "fstatus", strlen ("fstatus")) == 0)
+ {
+ as_bad (_("illegal use of control register"));
+ }
@@ -5444,6 +5085,21 @@
+ default:
+ break;
+ }
++
++#if 0
++/* ??? SPR:173865 This is actually supported by the HW but the documentation is a bit funny.
++ The compiler really want the extra register, so let it have it! */
++ /* checks for jmp 31 */
++ /* TODO: move test that insn is jmp to somewhere better.*/
++ if ((strncmp (insn.insn_nios2_opcode->name, "jmp", strlen ("jmp")) == 0)
++ && (regno == 31
++ || strncmp (argStr, "ra", strlen ("ra")) == 0))
++ {
++ as_bad (_("It is illegal to jump to the address contained in register ra (r31). "
++ "To return from subroutines called by call or callr, use ret instead of jmp."));
++ }
++#endif
++
+ return argStr;
+}
+
@@ -6426,9 +6082,12 @@
+ nios2_current_align = 0;
+ nios2_current_align_seg = now_seg;
+}
---- binutils-2.15/gas/config/tc-nios2.h 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/config/tc-nios2.h 2005-05-17 12:20:13.000000000 +0200
-@@ -0,0 +1,98 @@
+diff --git a/gas/config/tc-nios2.h b/gas/config/tc-nios2.h
+new file mode 100644
+index 0000000..660aaa3
+--- /dev/null
++++ b/gas/config/tc-nios2.h
+@@ -0,0 +1,105 @@
+/* tc-nios2.h -- header file for tc-nios2.c.
+
+ Copyright (C) 2003
@@ -6454,11 +6113,18 @@
+#ifndef TC_NIOS2
+#define TC_NIOS2
+
-+
++/*
++ * If unspecified, default to little endian. We can explicitly specify
++ * a big-endian default by configuring with --target=nios2eb-elf. We
++ * can override the default with the -EB and -EL options.
++ */
++#ifndef TARGET_BYTES_BIG_ENDIAN
+#define TARGET_BYTES_BIG_ENDIAN 0
++#endif
+
+#ifdef OBJ_ELF
-+#define TARGET_FORMAT "elf32-littlenios2"
++extern const char *nios2_target_format (void);
++#define TARGET_FORMAT nios2_target_format ()
+#define TARGET_ARCH bfd_arch_nios2
+#endif
+
@@ -6527,62 +6193,70 @@
+
+
+#endif // TC_NIOS2
---- binutils-2.15/gas/configure 2004-05-17 21:36:07.000000000 +0200
-+++ binutils-2.15-nios2/gas/configure 2005-05-17 12:20:13.000000000 +0200
-@@ -4173,6 +4173,7 @@ for this_target in $target $canon_target
+diff --git a/gas/configure b/gas/configure
+index e66abca..cbb3889 100755
+--- a/gas/configure
++++ b/gas/configure
+@@ -4173,6 +4173,8 @@ for this_target in $target $canon_targets ; do
m8*) cpu_type=m88k ;;
mips*el) cpu_type=mips endian=little ;;
mips*) cpu_type=mips endian=big ;;
-+ nios2*|nios2*) cpu_type=nios2 ;;
++ nios2eb) cpu_type=nios2 endian=big ;;
++ nios2el|nios2) cpu_type=nios2 endian=little ;;
or32*) cpu_type=or32 endian=big ;;
pjl*) cpu_type=pj endian=little ;;
pj*) cpu_type=pj endian=big ;;
-@@ -4439,6 +4440,7 @@ echo "$as_me: error: Unknown vendor for
+@@ -4439,6 +4441,7 @@ echo "$as_me: error: Unknown vendor for mips-bsd configuration." >&2;}
mn10200-*-*) fmt=elf ;;
mn10300-*-*) fmt=elf ;;
msp430-*-*) fmt=elf ;;
-+ nios2-*-*) fmt=elf ;;
++ nios2*-*-*) fmt=elf ;;
openrisc-*-*) fmt=elf ;;
or32-*-rtems*) fmt=elf ;;
or32-*-coff) fmt=coff ;;
-@@ -4589,7 +4591,7 @@ _ACEOF
+@@ -4589,7 +4592,7 @@ _ACEOF
fi
case ${cpu_type}-${fmt} in
- alpha*-* | arm-* | i386-* | ia64*-* | mips-* | ns32k-* \
-+ alpha*-* | arm-* | i386-* | ia64*-* | mips-* | nios2-* | ns32k-* \
++ alpha*-* | arm-* | i386-* | ia64*-* | mips-* | nios2*-* | ns32k-* \
| pdp11-* | ppc-* | sparc-* | strongarm-* | xscale-* \
| *-elf | *-ecoff | *-som)
bfd_gas=yes ;;
---- binutils-2.15/gas/configure.in 2004-05-17 21:36:07.000000000 +0200
-+++ binutils-2.15-nios2/gas/configure.in 2005-05-17 12:20:13.000000000 +0200
-@@ -143,6 +143,7 @@ changequote([,])dnl
+diff --git a/gas/configure.in b/gas/configure.in
+index f7d0acb..e20754e 100644
+--- a/gas/configure.in
++++ b/gas/configure.in
+@@ -143,6 +143,8 @@ changequote([,])dnl
m8*) cpu_type=m88k ;;
mips*el) cpu_type=mips endian=little ;;
mips*) cpu_type=mips endian=big ;;
-+ nios2*|nios2*) cpu_type=nios2 ;;
++ nios2eb) cpu_type=nios2 endian=big ;;
++ nios2el|nios2) cpu_type=nios2 endian=little ;;
or32*) cpu_type=or32 endian=big ;;
pjl*) cpu_type=pj endian=little ;;
pj*) cpu_type=pj endian=big ;;
-@@ -400,6 +401,7 @@ changequote([,])dnl
+@@ -400,6 +402,7 @@ changequote([,])dnl
mn10200-*-*) fmt=elf ;;
mn10300-*-*) fmt=elf ;;
msp430-*-*) fmt=elf ;;
-+ nios2-*-*) fmt=elf ;;
++ nios2*-*-*) fmt=elf ;;
openrisc-*-*) fmt=elf ;;
or32-*-rtems*) fmt=elf ;;
or32-*-coff) fmt=coff ;;
-@@ -539,7 +541,7 @@ changequote([,])dnl
+@@ -539,7 +542,7 @@ changequote([,])dnl
fi
case ${cpu_type}-${fmt} in
- alpha*-* | arm-* | i386-* | ia64*-* | mips-* | ns32k-* \
-+ alpha*-* | arm-* | i386-* | ia64*-* | mips-* | nios2-* | ns32k-* \
++ alpha*-* | arm-* | i386-* | ia64*-* | mips-* | nios2*-* | ns32k-* \
| pdp11-* | ppc-* | sparc-* | strongarm-* | xscale-* \
| *-elf | *-ecoff | *-som)
bfd_gas=yes ;;
---- binutils-2.15/gas/doc/Makefile.am 2004-01-05 23:16:05.000000000 +0100
-+++ binutils-2.15-nios2/gas/doc/Makefile.am 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/doc/Makefile.am b/gas/doc/Makefile.am
+index 7f0f805..3e6af57 100644
+--- a/gas/doc/Makefile.am
++++ b/gas/doc/Makefile.am
@@ -24,6 +24,7 @@ asconfig.texi: $(CONFIG).texi
|| cp $(srcdir)/$(CONFIG).texi ./asconfig.texi
@@ -6591,9 +6265,11 @@
c-a29k.texi \
c-alpha.texi \
c-arc.texi \
---- binutils-2.15/gas/doc/Makefile.in 2004-05-17 21:36:11.000000000 +0200
-+++ binutils-2.15-nios2/gas/doc/Makefile.in 2005-05-17 12:20:13.000000000 +0200
-@@ -213,6 +213,7 @@ POD2MAN = pod2man --center="GNU Developm
+diff --git a/gas/doc/Makefile.in b/gas/doc/Makefile.in
+index 0c6a1b0..c7472d0 100644
+--- a/gas/doc/Makefile.in
++++ b/gas/doc/Makefile.in
+@@ -213,6 +213,7 @@ POD2MAN = pod2man --center="GNU Development Tools" \
man_MANS = as.1
info_TEXINFOS = as.texinfo
CPU_DOCS = \
@@ -6601,8 +6277,10 @@
c-a29k.texi \
c-alpha.texi \
c-arc.texi \
---- binutils-2.15/gas/doc/all.texi 2003-04-01 17:50:30.000000000 +0200
-+++ binutils-2.15-nios2/gas/doc/all.texi 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/doc/all.texi b/gas/doc/all.texi
+index 4e302ce..3094553 100644
+--- a/gas/doc/all.texi
++++ b/gas/doc/all.texi
@@ -26,6 +26,7 @@
@c CPUs of interest
@@ -6611,9 +6289,11 @@
@set A29K
@set ALPHA
@set ARC
---- binutils-2.15/gas/doc/as.texinfo 2004-01-09 03:34:04.000000000 +0100
-+++ binutils-2.15-nios2/gas/doc/as.texinfo 2005-05-17 12:20:13.000000000 +0200
-@@ -238,6 +238,15 @@ gcc(1), ld(1), and the Info entries for
+diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
+index d9d23df..ab2affa 100644
+--- a/gas/doc/as.texinfo
++++ b/gas/doc/as.texinfo
+@@ -238,6 +238,15 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
@c
@c Target dependent options are listed below. Keep the list sorted.
@c Add an empty line for separation.
@@ -6629,7 +6309,7 @@
@ifset A29K
@c am29k has no machine-dependent assembler options
@end ifset
-@@ -577,6 +586,21 @@ Standard input, or source files to assem
+@@ -577,6 +586,21 @@ Standard input, or source files to assemble.
@end table
@@ -6651,7 +6331,7 @@
@ifset ARC
The following options are available when @value{AS} is configured for
an ARC processor.
-@@ -2035,6 +2059,9 @@ This means you may not nest these commen
+@@ -2035,6 +2059,9 @@ This means you may not nest these comments.
@cindex line comment character
Anything from the @dfn{line comment} character to the next newline
is considered a comment and is ignored. The line comment character is
@@ -6661,7 +6341,7 @@
@ifset A29K
@samp{;} for the AMD 29K family;
@end ifset
-@@ -3876,7 +3903,7 @@ is already a multiple of 8, no change is
+@@ -3876,7 +3903,7 @@ is already a multiple of 8, no change is needed. For the tic54x, the
first expression is the alignment request in words.
For other systems, including the i386 using a.out format, and the arm and
@@ -6670,7 +6350,7 @@
number of low-order zero bits the location counter must have after
advancement. For example @samp{.align 3} advances the location
counter until it a multiple of 8. If the location counter is already a
-@@ -5864,6 +5891,9 @@ include details on any machine's instruc
+@@ -5864,6 +5891,9 @@ include details on any machine's instruction set. For details on that
subject, see the hardware manufacturer's manual.
@menu
@@ -6680,7 +6360,7 @@
@ifset A29K
* AMD29K-Dependent:: AMD 29K Dependent Features
@end ifset
-@@ -5974,6 +6004,11 @@ subject, see the hardware manufacturer's
+@@ -5974,6 +6004,11 @@ subject, see the hardware manufacturer's manual.
@c node and sectioning commands; hence the repetition of @chapter BLAH
@c in both conditional blocks.
@@ -6692,9 +6372,12 @@
@ifset A29K
@include c-a29k.texi
@end ifset
---- binutils-2.15/gas/doc/c-nios2.texi 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/doc/c-nios2.texi 2005-05-17 12:20:13.000000000 +0200
-@@ -0,0 +1,214 @@
+diff --git a/gas/doc/c-nios2.texi b/gas/doc/c-nios2.texi
+new file mode 100644
+index 0000000..b2d5d61
+--- /dev/null
++++ b/gas/doc/c-nios2.texi
+@@ -0,0 +1,222 @@
+@c Copyright 2004
+@c This is part of the GAS manual.
+@c For copying conditions, see the file as.texinfo.
@@ -6738,6 +6421,14 @@
+@item -no-relax
+Do not replace any branches or calls
+
++@cindex @code{EB} command line option, Nios II
++@item -EB
++Generate big-endian output
++
++@cindex @code{EL} command line option, Nios II
++@item -EL
++Generate little-endian output
++
+@end table
+
+
@@ -6909,36 +6600,47 @@
+For information on the Nios II machine instruction set, see the @cite{Nios II
+User's Manual}
+
---- binutils-2.15/gas/testsuite/gas/macros/irp.s 1999-06-10 15:48:35.000000000 +0200
-+++ binutils-2.15-nios2/gas/testsuite/gas/macros/irp.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/macros/irp.s b/gas/testsuite/gas/macros/irp.s
+index f37dd54..95a91e3 100644
+--- a/gas/testsuite/gas/macros/irp.s
++++ b/gas/testsuite/gas/macros/irp.s
@@ -1,3 +1,4 @@
+ .set norelax
.irp param,1,2,3
.long foo\param
.endr
---- binutils-2.15/gas/testsuite/gas/macros/rept.s 1999-06-10 15:48:39.000000000 +0200
-+++ binutils-2.15-nios2/gas/testsuite/gas/macros/rept.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/macros/rept.s b/gas/testsuite/gas/macros/rept.s
+index 571b6f8..d6f86c1 100644
+--- a/gas/testsuite/gas/macros/rept.s
++++ b/gas/testsuite/gas/macros/rept.s
@@ -1,3 +1,4 @@
+ .set norelax
.rept 3
.long foo1
.endr
---- binutils-2.15/gas/testsuite/gas/macros/test2.s 2004-02-06 17:00:21.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/macros/test2.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/macros/test2.s b/gas/testsuite/gas/macros/test2.s
+index 0cfca29..ad62adc 100644
+--- a/gas/testsuite/gas/macros/test2.s
++++ b/gas/testsuite/gas/macros/test2.s
@@ -1,3 +1,4 @@
+ .set norelax
.macro m arg1 arg2 arg3
.long \arg1
.ifc ,\arg2\arg3
---- binutils-2.15/gas/testsuite/gas/macros/test3.s 1999-06-10 15:48:44.000000000 +0200
-+++ binutils-2.15-nios2/gas/testsuite/gas/macros/test3.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/macros/test3.s b/gas/testsuite/gas/macros/test3.s
+index e80aa20..0070527 100644
+--- a/gas/testsuite/gas/macros/test3.s
++++ b/gas/testsuite/gas/macros/test3.s
@@ -1,3 +1,4 @@
+ .set norelax
.macro m arg1 arg2
\arg1
.exitm
---- binutils-2.15/gas/testsuite/gas/nios2/add.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/add.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/add.d b/gas/testsuite/gas/nios2/add.d
+new file mode 100644
+index 0000000..ba3d27f
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/add.d
@@ -0,0 +1,16 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 add
@@ -6956,8 +6658,11 @@
+0+0014 <[^>]*> addi r4,r4,-1
+0+0018 <[^>]*> addi r4,r4,13398
+0+001c <[^>]*> nop
---- binutils-2.15/gas/testsuite/gas/nios2/add.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/add.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/add.s b/gas/testsuite/gas/nios2/add.s
+new file mode 100644
+index 0000000..5b72a82
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/add.s
@@ -0,0 +1,13 @@
+# Source file used to test the add and addi instructions.
+
@@ -6972,8 +6677,11 @@
+
+# should disassemble to add r0,0,r0
+ nop
---- binutils-2.15/gas/testsuite/gas/nios2/align_fill.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/align_fill.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/align_fill.d b/gas/testsuite/gas/nios2/align_fill.d
+new file mode 100644
+index 0000000..90a9e5f
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/align_fill.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 align_fill
@@ -6998,8 +6706,11 @@
+0+0030 <[^>]*> addi sp,sp,8
+0+0034 <[^>]*> ret
+ ...
---- binutils-2.15/gas/testsuite/gas/nios2/align_fill.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/align_fill.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/align_fill.s b/gas/testsuite/gas/nios2/align_fill.s
+new file mode 100644
+index 0000000..5683839
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/align_fill.s
@@ -0,0 +1,20 @@
+ .file "a.c"
+ .section .text
@@ -7021,8 +6732,11 @@
+ ret
+ .size x, .-x
+ .ident "GCC: (GNU) 3.3.3 (Altera Nios II 1.0 b302)"
---- binutils-2.15/gas/testsuite/gas/nios2/align_text.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/align_text.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/align_text.d b/gas/testsuite/gas/nios2/align_text.d
+new file mode 100644
+index 0000000..d11e7fc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/align_text.d
@@ -0,0 +1,22 @@
+#objdump: -dr
+#name: NIOS2 align_test
@@ -7047,8 +6761,11 @@
+00000024 <label2>:
+ ...
\ No newline at end of file
---- binutils-2.15/gas/testsuite/gas/nios2/align_text.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/align_text.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/align_text.s b/gas/testsuite/gas/nios2/align_text.s
+new file mode 100644
+index 0000000..d073b6f
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/align_text.s
@@ -0,0 +1,15 @@
+ .asciz "" # empty string
+ .align 2
@@ -7065,8 +6782,11 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/and.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/and.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/and.d b/gas/testsuite/gas/nios2/and.d
+new file mode 100644
+index 0000000..350ca69
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/and.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 and
@@ -7085,8 +6805,11 @@
+0+0018 <[^>]*> andhi r4,r4,32768
+0+001c <[^>]*> andhi r4,r4,65535
+0+0020 <[^>]*> andhi r4,r4,0
---- binutils-2.15/gas/testsuite/gas/nios2/and.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/and.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/and.s b/gas/testsuite/gas/nios2/and.s
+new file mode 100644
+index 0000000..a7de05f
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/and.s
@@ -0,0 +1,13 @@
+# Source file used to test the and, andhi and andi instructions
+
@@ -7102,18 +6825,27 @@
+ andhi r4,r4,0x0
+
\ No newline at end of file
---- binutils-2.15/gas/testsuite/gas/nios2/blt.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/blt.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/blt.d b/gas/testsuite/gas/nios2/blt.d
+new file mode 100644
+index 0000000..aed1b26
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/blt.d
@@ -0,0 +1 @@
+This file is obsolete
\ No newline at end of file
---- binutils-2.15/gas/testsuite/gas/nios2/blt.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/blt.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/blt.s b/gas/testsuite/gas/nios2/blt.s
+new file mode 100644
+index 0000000..aed1b26
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/blt.s
@@ -0,0 +1 @@
+This file is obsolete
\ No newline at end of file
---- binutils-2.15/gas/testsuite/gas/nios2/branch.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/branch.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/branch.d b/gas/testsuite/gas/nios2/branch.d
+new file mode 100644
+index 0000000..b689dee
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/branch.d
@@ -0,0 +1,16 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 branch
@@ -7131,8 +6863,11 @@
+0+0018 <[^>]*> br 0000001c <text_label\+0x1c>
+[ ]*18: R_NIOS2_PCREL16 external_label
+
---- binutils-2.15/gas/testsuite/gas/nios2/branch.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/branch.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/branch.s b/gas/testsuite/gas/nios2/branch.s
+new file mode 100644
+index 0000000..0853167
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/branch.s
@@ -0,0 +1,15 @@
+# Source file used to test the beq macro.
+ .globl text_label
@@ -7149,8 +6884,11 @@
+# Branch to an external label.
+ br external_label
+
---- binutils-2.15/gas/testsuite/gas/nios2/break.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/break.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/break.d b/gas/testsuite/gas/nios2/break.d
+new file mode 100644
+index 0000000..be487bb
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/break.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 break
@@ -7164,8 +6902,11 @@
+0+000c <[^>]*> break 14
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/break.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/break.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/break.s b/gas/testsuite/gas/nios2/break.s
+new file mode 100644
+index 0000000..88d3422
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/break.s
@@ -0,0 +1,8 @@
+# Source file used to test the 20-bit break instructions
+foo:
@@ -7175,8 +6916,11 @@
+ break 14
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/bret.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/bret.d 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/bret.d b/gas/testsuite/gas/nios2/bret.d
+new file mode 100644
+index 0000000..a12530b
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/bret.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 bret
@@ -7186,16 +6930,22 @@
+Disassembly of section .text:
+0+0000 <[^>]*> bret
+
---- binutils-2.15/gas/testsuite/gas/nios2/bret.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/bret.s 2005-05-17 12:20:13.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/bret.s b/gas/testsuite/gas/nios2/bret.s
+new file mode 100644
+index 0000000..d368e64
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/bret.s
@@ -0,0 +1,5 @@
+# Source file used to test the bret instructions
+foo:
+ bret
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/cache.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/cache.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/cache.d b/gas/testsuite/gas/nios2/cache.d
+new file mode 100644
+index 0000000..7c278d8
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/cache.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 cache
@@ -7214,8 +6964,11 @@
+0+0018 <[^>]*> flushi r2
+0+001c <[^>]*> flushp
+
---- binutils-2.15/gas/testsuite/gas/nios2/cache.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/cache.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/cache.s b/gas/testsuite/gas/nios2/cache.s
+new file mode 100644
+index 0000000..1701c19
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/cache.s
@@ -0,0 +1,21 @@
+# Source file used to test the cache instruction
+foo:
@@ -7238,8 +6991,11 @@
+ flushp
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/call.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/call.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/call.d b/gas/testsuite/gas/nios2/call.d
+new file mode 100644
+index 0000000..cfa6aec
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/call.d
@@ -0,0 +1,11 @@
+# objdump: -dr --prefix-addresses
+#name: NIOS2 call
@@ -7252,8 +7008,11 @@
+0+0004 <[^>]*> callr r10
+0+0008 <[^>]*> call 00000000 <foo>
+[ ]*8: R_NIOS2_CALL26 external
---- binutils-2.15/gas/testsuite/gas/nios2/call.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/call.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/call.s b/gas/testsuite/gas/nios2/call.s
+new file mode 100644
+index 0000000..39409b7
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/call.s
@@ -0,0 +1,13 @@
+# Source file used to test the call and callr instructions
+.text
@@ -7268,8 +7027,11 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/cmp.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/cmp.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/cmp.d b/gas/testsuite/gas/nios2/cmp.d
+new file mode 100644
+index 0000000..07bf9f5
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/cmp.d
@@ -0,0 +1,24 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 cmp
@@ -7296,8 +7058,11 @@
+0+0030 <[^>]*> cmplti r11,r2,-32768
+0+0034 <[^>]*> cmpltui r11,r2,65535
\ No newline at end of file
---- binutils-2.15/gas/testsuite/gas/nios2/cmp.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/cmp.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/cmp.s b/gas/testsuite/gas/nios2/cmp.s
+new file mode 100644
+index 0000000..6f7c15b
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/cmp.s
@@ -0,0 +1,22 @@
+# Source file used to test the compare instructions
+foo:
@@ -7321,8 +7086,11 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/comments.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/comments.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/comments.d b/gas/testsuite/gas/nios2/comments.d
+new file mode 100644
+index 0000000..890dcc2
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/comments.d
@@ -0,0 +1,26 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 comments
@@ -7350,8 +7118,11 @@
+0+003c <[^>]*> ldw r21,0\(r2\)
+0+0040 <[^>]*> br 00000010 <end>
+0+0044 <[^>]*> br 00000044 <exit>
---- binutils-2.15/gas/testsuite/gas/nios2/comments.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/comments.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/comments.s b/gas/testsuite/gas/nios2/comments.s
+new file mode 100644
+index 0000000..7ab2027
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/comments.s
@@ -0,0 +1,28 @@
+.set norelax
+_main: br start
@@ -7381,8 +7152,11 @@
+
+
+exit: br exit
---- binutils-2.15/gas/testsuite/gas/nios2/complex.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/complex.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/complex.d b/gas/testsuite/gas/nios2/complex.d
+new file mode 100644
+index 0000000..d2af6ae
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/complex.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 complex
@@ -7396,16 +7170,22 @@
+0+0004 <[^>]*> ldw r2,1\(r3\)
+0+0008 <[^>]*> ldw r2,0\(r3\)
+ 8: R_NIOS2_S16 stack_top\+0xffffffff
---- binutils-2.15/gas/testsuite/gas/nios2/complex.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/complex.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/complex.s b/gas/testsuite/gas/nios2/complex.s
+new file mode 100644
+index 0000000..65141f9
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/complex.s
@@ -0,0 +1,5 @@
+foo:
+ ldw r2, (2-3)(r3)
+ ldw r2, 2 + (2-3)(r3)
+ ldw r2, 2 + (stack_top-3)(r3)
+
---- binutils-2.15/gas/testsuite/gas/nios2/ctl.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ctl.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ctl.d b/gas/testsuite/gas/nios2/ctl.d
+new file mode 100644
+index 0000000..f698ce6
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ctl.d
@@ -0,0 +1,20 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ctl
@@ -7427,8 +7207,11 @@
+0+0024 <[^>]*> wrctl status,r8
+0+0028 <[^>]*> wrctl bstatus,r8
+0+002c <[^>]*> wrctl estatus,r8
---- binutils-2.15/gas/testsuite/gas/nios2/ctl.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ctl.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ctl.s b/gas/testsuite/gas/nios2/ctl.s
+new file mode 100644
+index 0000000..dc6c983
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ctl.s
@@ -0,0 +1,18 @@
+# Source file used to test the nor instruction
+
@@ -7448,8 +7231,11 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/custom.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/custom.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/custom.d b/gas/testsuite/gas/nios2/custom.d
+new file mode 100644
+index 0000000..c1e17be
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/custom.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 custom
@@ -7464,8 +7250,11 @@
+0+0008 <[^>]*> custom 150,c1,r2,r3
+0+000c <[^>]*> custom 24,c1,c2,r3
+0+0010 <[^>]*> custom 56,c1,c2,c3
---- binutils-2.15/gas/testsuite/gas/nios2/custom.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/custom.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/custom.s b/gas/testsuite/gas/nios2/custom.s
+new file mode 100644
+index 0000000..903122a
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/custom.s
@@ -0,0 +1,8 @@
+# test progam for assembling user instructions
+
@@ -7475,8 +7264,11 @@
+ custom 150, c1, r2, r3
+ custom 0x18, c1, c2, r3
+ custom 070, c1, c2, c3
---- binutils-2.15/gas/testsuite/gas/nios2/etbt.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/etbt.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/etbt.d b/gas/testsuite/gas/nios2/etbt.d
+new file mode 100644
+index 0000000..58b8e32
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/etbt.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 etbt
@@ -7488,21 +7280,58 @@
+Disassembly of section .text:
+0+0000 <[^>]*> add et,bt,r6
+0+0004 <[^>]*> add et,bt,r6
---- binutils-2.15/gas/testsuite/gas/nios2/etbt.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/etbt.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/etbt.s b/gas/testsuite/gas/nios2/etbt.s
+new file mode 100644
+index 0000000..3e5fc24
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/etbt.s
@@ -0,0 +1,4 @@
+.set nobreak
+foo:
+ add r24, r25, r6
+ add et, bt, r6
---- binutils-2.15/gas/testsuite/gas/nios2/hilo_symbol.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/hilo_symbol.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/flushda.d b/gas/testsuite/gas/nios2/flushda.d
+new file mode 100644
+index 0000000..f3b5e3e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/flushda.d
+@@ -0,0 +1,10 @@
++#objdump: -dr --prefix-addresses
++#name: NIOS2 flushda
++
++# Test the jmp instruction.
++
++.*: +file format elf32-littlenios2
++
++Disassembly of section .text:
++0+0000 <[^>]*> flushda 12\(r2\)
++
+diff --git a/gas/testsuite/gas/nios2/flushda.s b/gas/testsuite/gas/nios2/flushda.s
+new file mode 100644
+index 0000000..3a32474
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/flushda.s
+@@ -0,0 +1,6 @@
++# Source file used to test the flushda instruction.
++.text
++.set nobreak
++foo:
++ flushda 12(r2)
++
+diff --git a/gas/testsuite/gas/nios2/hilo_symbol.s b/gas/testsuite/gas/nios2/hilo_symbol.s
+new file mode 100644
+index 0000000..88fdddc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/hilo_symbol.s
@@ -0,0 +1,3 @@
+.global long_symbol
+.set long_symbol, 0xDEADBEEF
+
---- binutils-2.15/gas/testsuite/gas/nios2/illegal.l 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/illegal.l 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/illegal.l b/gas/testsuite/gas/nios2/illegal.l
+new file mode 100644
+index 0000000..6248567
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/illegal.l
@@ -0,0 +1,14 @@
+.*illegal.s: Assembler messages:
+.*illegal.s:5: Error: unknown register r56
@@ -7518,8 +7347,11 @@
+.*illegal.s:16: Error: too many arguments
+.*illegal.s:17: Error: too many arguments
+.*illegal.s:17: Error: unknown register r2,r4
---- binutils-2.15/gas/testsuite/gas/nios2/illegal.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/illegal.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/illegal.s b/gas/testsuite/gas/nios2/illegal.s
+new file mode 100644
+index 0000000..75b6d89
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/illegal.s
@@ -0,0 +1,17 @@
+# Source file used to test illegal operands.
+
@@ -7538,15 +7370,21 @@
+# Extra operands
+ nop Crapola
+ add r2, r2, r2, r4
---- binutils-2.15/gas/testsuite/gas/nios2/imm5_symbol.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/imm5_symbol.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/imm5_symbol.s b/gas/testsuite/gas/nios2/imm5_symbol.s
+new file mode 100644
+index 0000000..d988951
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/imm5_symbol.s
@@ -0,0 +1,4 @@
+.global imm5
+.text
+.byte imm5
+.set imm5, 31
---- binutils-2.15/gas/testsuite/gas/nios2/jmp.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/jmp.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/jmp.d b/gas/testsuite/gas/nios2/jmp.d
+new file mode 100644
+index 0000000..b8727b3
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/jmp.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 jmp
@@ -7558,8 +7396,11 @@
+Disassembly of section .text:
+0+0000 <[^>]*> jmp bt
+
---- binutils-2.15/gas/testsuite/gas/nios2/jmp.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/jmp.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/jmp.s b/gas/testsuite/gas/nios2/jmp.s
+new file mode 100644
+index 0000000..8d859f2
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/jmp.s
@@ -0,0 +1,6 @@
+# Source file used to test the jmp instruction.
+.text
@@ -7567,8 +7408,11 @@
+foo:
+ jmp r25
+
---- binutils-2.15/gas/testsuite/gas/nios2/ldb.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ldb.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ldb.d b/gas/testsuite/gas/nios2/ldb.d
+new file mode 100644
+index 0000000..10ad705
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ldb.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ldb
@@ -7766,8 +7610,11 @@
+[ ]*190: R_NIOS2_S16 .bss\+0xffff8000
+0+0194 <[^>]*> ldbio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss\+0xffffc000
---- binutils-2.15/gas/testsuite/gas/nios2/ldb.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ldb.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ldb.s b/gas/testsuite/gas/nios2/ldb.s
+new file mode 100644
+index 0000000..71c51f1
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ldb.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
@@ -7886,8 +7733,11 @@
+ ldbio r4,small_external_common-0x8000(r5)
+ ldbio r4,big_local_common-0x8000(r5)
+ ldbio r4,small_local_common-0x8000(r5)
---- binutils-2.15/gas/testsuite/gas/nios2/ldh.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ldh.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ldh.d b/gas/testsuite/gas/nios2/ldh.d
+new file mode 100644
+index 0000000..54c2f7e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ldh.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ldh
@@ -8085,8 +7935,11 @@
+[ ]*190: R_NIOS2_S16 .bss\+0xffff8000
+0+0194 <[^>]*> ldhio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss\+0xffffc000
---- binutils-2.15/gas/testsuite/gas/nios2/ldh.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ldh.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ldh.s b/gas/testsuite/gas/nios2/ldh.s
+new file mode 100644
+index 0000000..87040ee
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ldh.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
@@ -8205,8 +8058,11 @@
+ ldhio r4,small_external_common-0x8000(r5)
+ ldhio r4,big_local_common-0x8000(r5)
+ ldhio r4,small_local_common-0x8000(r5)
---- binutils-2.15/gas/testsuite/gas/nios2/ldw.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ldw.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ldw.d b/gas/testsuite/gas/nios2/ldw.d
+new file mode 100644
+index 0000000..a9a6905
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ldw.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ldw
@@ -8404,8 +8260,11 @@
+[ ]*190: R_NIOS2_S16 .bss\+0xffff8000
+0+0194 <[^>]*> ldwio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss\+0xffffc000
---- binutils-2.15/gas/testsuite/gas/nios2/ldw.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ldw.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ldw.s b/gas/testsuite/gas/nios2/ldw.s
+new file mode 100644
+index 0000000..cf6de19
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ldw.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
@@ -8524,8 +8383,11 @@
+ ldwio r4,small_external_common-0x8000(r5)
+ ldwio r4,big_local_common-0x8000(r5)
+ ldwio r4,small_local_common-0x8000(r5)
---- binutils-2.15/gas/testsuite/gas/nios2/lineseparator.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/lineseparator.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/lineseparator.d b/gas/testsuite/gas/nios2/lineseparator.d
+new file mode 100644
+index 0000000..09c66ea
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/lineseparator.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 lineseparator
@@ -8537,15 +8399,21 @@
+Disassembly of section .text:
+0x0+0000 mov r5,r4
+0x0+0004 mov r4,r5
---- binutils-2.15/gas/testsuite/gas/nios2/lineseparator.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/lineseparator.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/lineseparator.s b/gas/testsuite/gas/nios2/lineseparator.s
+new file mode 100644
+index 0000000..d16efc3
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/lineseparator.s
@@ -0,0 +1,4 @@
+mov r5, r4 ; mov r4, r5
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/link1.lds 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/link1.lds 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/link1.lds b/gas/testsuite/gas/nios2/link1.lds
+new file mode 100644
+index 0000000..df6c220
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/link1.lds
@@ -0,0 +1,11 @@
+/* Simple script for testing relaxation */
+
@@ -8558,8 +8426,11 @@
+ text2 0 : { *(text2) }
+ text1 0x8000 : { *(text1) }
+}
---- binutils-2.15/gas/testsuite/gas/nios2/link2.lds 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/link2.lds 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/link2.lds b/gas/testsuite/gas/nios2/link2.lds
+new file mode 100644
+index 0000000..ee46354
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/link2.lds
@@ -0,0 +1,11 @@
+/* Simple script for testing relaxation */
+
@@ -8572,8 +8443,11 @@
+ text1 0 : { *(text1) }
+ text2 0x80000000 : { *(text2) }
+}
---- binutils-2.15/gas/testsuite/gas/nios2/link3.lds 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/link3.lds 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/link3.lds b/gas/testsuite/gas/nios2/link3.lds
+new file mode 100644
+index 0000000..bc02d40
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/link3.lds
@@ -0,0 +1,11 @@
+/* Simple script for testing relaxation */
+
@@ -8586,8 +8460,11 @@
+ text1 0 : { *(text1) }
+ text2 0x08000000 : { *(text2) }
+}
---- binutils-2.15/gas/testsuite/gas/nios2/mov.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/mov.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/mov.d b/gas/testsuite/gas/nios2/mov.d
+new file mode 100644
+index 0000000..13bf6db
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/mov.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 mov
@@ -8600,16 +8477,22 @@
+0+0000 <[^>]*> movz \$4,\$5,\$6
+0+0004 <[^>]*> movnz \$4,\$5,\$6
+
---- binutils-2.15/gas/testsuite/gas/nios2/mov.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/mov.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/mov.s b/gas/testsuite/gas/nios2/mov.s
+new file mode 100644
+index 0000000..a66aaeb
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/mov.s
@@ -0,0 +1,5 @@
+# Source file used to test the movz and movnz instructions
+
+foo:
+ movz $4,$5,$6
+ movnz $4,$5,$6
---- binutils-2.15/gas/testsuite/gas/nios2/movi.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/movi.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/movi.d b/gas/testsuite/gas/nios2/movi.d
+new file mode 100644
+index 0000000..9e35c7b
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/movi.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 movi
@@ -8624,8 +8507,11 @@
+0+000c <[^>]*> orhi r2,r5,65535
+0+0010 <[^>]*> xorhi r2,r10,65535
+0+0014 <[^>]*> andhi r2,r15,65535
---- binutils-2.15/gas/testsuite/gas/nios2/movi.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/movi.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/movi.s b/gas/testsuite/gas/nios2/movi.s
+new file mode 100644
+index 0000000..07d9fed
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/movi.s
@@ -0,0 +1,21 @@
+# Source file used to test silent conversion of
+# movi to orhi etc
@@ -8648,8 +8534,11 @@
+andi r2, r15, 0xffff0000
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/movia.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/movia.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/movia.d b/gas/testsuite/gas/nios2/movia.d
+new file mode 100644
+index 0000000..78a2559
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/movia.d
@@ -0,0 +1,18 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 movia
@@ -8669,8 +8558,11 @@
+ 10: R_NIOS2_HIADJ16 sym\+0x80000001
+0+0014 <[^>]*> addi r4,r4,0
+ 14: R_NIOS2_LO16 sym\+0x80000001
---- binutils-2.15/gas/testsuite/gas/nios2/movia.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/movia.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/movia.s b/gas/testsuite/gas/nios2/movia.s
+new file mode 100644
+index 0000000..fe1d56c
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/movia.s
@@ -0,0 +1,6 @@
+# Test program for movia reg, immed32 macro
+
@@ -8678,8 +8570,11 @@
+ movia r2, 0x80808080
+ movia r3, sym + 0x80000000
+ movia r4, sym - 0x7fffffff
---- binutils-2.15/gas/testsuite/gas/nios2/mul.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/mul.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/mul.d b/gas/testsuite/gas/nios2/mul.d
+new file mode 100644
+index 0000000..79e86d1
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/mul.d
@@ -0,0 +1,19 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 mul
@@ -8700,8 +8595,11 @@
+0+001c <[^>]*> mulxss r4,r5,r6
+0+0020 <[^>]*> mulxsu r4,r5,r6
+0+0024 <[^>]*> mulxuu r4,r5,r6
---- binutils-2.15/gas/testsuite/gas/nios2/mul.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/mul.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/mul.s b/gas/testsuite/gas/nios2/mul.s
+new file mode 100644
+index 0000000..3e47bc7
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/mul.s
@@ -0,0 +1,15 @@
+# Source file used to test the mul macro.
+
@@ -8718,8 +8616,11 @@
+ mulxuu r4,r5,r6
+.data
+.set defined_symbol, 0x4040
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.d b/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.d
+new file mode 100644
+index 0000000..21c69e3
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 reloc against merged strings
@@ -8738,8 +8639,11 @@
+0+0018 <[^>]*> addi r4,r4,132
+0+001c <[^>]*> call 00000000 <func1>
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.s b/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.s
+new file mode 100644
+index 0000000..1e14fdc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-merged_strings.s
@@ -0,0 +1,21 @@
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
@@ -8762,8 +8666,11 @@
+ addi r4, r4, .LC2
+ .size func1, .-func1
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.d
+new file mode 100644
+index 0000000..047745b
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.d
@@ -0,0 +1,8 @@
+#objdump: -s
+#name: NIOS2 R_NIOS2_BFD_RELOC_XX
@@ -8773,8 +8680,11 @@
+
+Contents of section .text:
+ 0000 fa00cefa efbeadde facefaef beadde00 ................
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.s
+new file mode 100644
+index 0000000..fff5ace
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-bfd-reloc-xx.s
@@ -0,0 +1,9 @@
+# Test for New Jersey 32-bit, 16 and 8-bit relocations
+
@@ -8785,8 +8695,11 @@
+.set byte_sym, 0xFA
+.set short_sym, 0xFACE
+.set long_sym, 0xDEADBEEF
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.d
+new file mode 100644
+index 0000000..2ee02e8
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 R_NIOS2_CACHE_OPX
@@ -8798,8 +8711,11 @@
+0+0000 <[^>]*> cache 0x1f,0x1000\(\$1\)
+0+0004 <[^>]*> Address 0x4 is out of bounds.
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.s
+new file mode 100644
+index 0000000..2c59174
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-cache-opx.s
@@ -0,0 +1,6 @@
+# Test the imm5 relocation
+
@@ -8807,8 +8723,11 @@
+ cache imm5, 0x1000($1)
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.d
+new file mode 100644
+index 0000000..63364ef
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.d
@@ -0,0 +1,76 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 nios2-reloc-r-nios2-call26
@@ -8886,8 +8805,11 @@
+ ...
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.s
+new file mode 100644
+index 0000000..b81896d
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-call26.s
@@ -0,0 +1,12 @@
+# Test for New Jersey 32-bit relocations
+
@@ -8901,8 +8823,11 @@
+.align 8
+localfunc:
+ nop
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.d
+new file mode 100644
+index 0000000..00c0023
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.d
@@ -0,0 +1,15 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 gp-relative relocations
@@ -8919,8 +8844,11 @@
+0+0010 <[^>]*> ldw at,-32744\(gp\)
+0+0014 <[^>]*> ldw r2,-32740\(gp\)
+0+0018 <[^>]*> ldb r3,-32736\(gp\)
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.s
+new file mode 100644
+index 0000000..5bdcc46
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-gprel.s
@@ -0,0 +1,24 @@
+.sdata
+sym1:
@@ -8946,8 +8874,11 @@
+ ldw r1, %gprel(sym4)(gp)
+ ldw r2, %gprel(sym5)(gp)
+ ldb r3, %gprel(sym6)(gp)
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.d
+new file mode 100644
+index 0000000..7a9e707
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 R_NIOS2_HI16,LO16,HIADJ16
@@ -8959,8 +8890,11 @@
+0+0000 <[^>]*> addi at,at,-8531
+0+0004 <[^>]*> addi at,at,-16657
+0+0008 <[^>]*> addi at,at,-8530
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.s
+new file mode 100644
+index 0000000..266f2c7
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-hilo16.s
@@ -0,0 +1,6 @@
+# Test the %hi, lo and %hiadj relocations
+
@@ -8968,8 +8902,11 @@
+ addi r1, r1, %hi(long_symbol)
+ addi r1, r1, %lo(long_symbol)
+ addi r1, r1, %hiadj(long_symbol)
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.d
+new file mode 100644
+index 0000000..8457747
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 R_NIOS2_IMM5
@@ -8981,8 +8918,11 @@
+0+0000 <[^>]*> roli at,at,31
+0+0004 <.[^>]*> Address 0x4 is out of bounds.
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.s
+new file mode 100644
+index 0000000..fdec546
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-imm5.s
@@ -0,0 +1,6 @@
+# Test the imm5 relocation
+
@@ -8990,8 +8930,11 @@
+ roli r1, r1, imm5
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.d
+new file mode 100644
+index 0000000..b9f9ae5
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.d
@@ -0,0 +1,12 @@
+#objdump: -s
+#name: NIOS2 R_NIOS2_PCREL16
@@ -9005,8 +8948,11 @@
+0+0004 <[^>]*> br 00000018 <__bss_start\+0x8>
+0+0008 <[^>]*> nop
+0+000c <[^>]*> nop
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.s
+new file mode 100644
+index 0000000..72970cc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-pcrel16.s
@@ -0,0 +1,6 @@
+# Test for pc-relative relocations
+.set norelax
@@ -9014,8 +8960,11 @@
+ br ext_label
+ br ext_label + 16
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s.d
+new file mode 100644
+index 0000000..0230d0e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s.d
@@ -0,0 +1,8 @@
+
+a.exe: file format elf32-littlenios2
@@ -9025,8 +8974,11 @@
+ 0010 44004008 D.@.
+Contents of section .data:
+Contents of section .sbss:
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.d
+new file mode 100644
+index 0000000..0d0f535
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.d
@@ -0,0 +1,9 @@
+#objdump: -s
+#name: NIOS2 R_NIOS2_S16
@@ -9037,8 +8989,11 @@
+Contents of section .text:
+ 0000 04004408 04006008 c4ff5f08 44004808 ..D...`..._.D.H.
+ 0010 44004008 D.@.
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.s
+new file mode 100644
+index 0000000..11986d1
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-s16.s
@@ -0,0 +1,13 @@
+# Test for New Jersey 32-bit, 16 and 8-bit relocations
+
@@ -9053,8 +9008,11 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.d b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.d
+new file mode 100644
+index 0000000..160dba2
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.d
@@ -0,0 +1,9 @@
+#objdump: -s
+#name: NIOS2 R_NIOS2_U16
@@ -9065,8 +9023,11 @@
+Contents of section .text:
+ 0000 0c004408 0c004008 ccff7f08 4c004808 ..D...@.....L.H.
+ 0010 4c004008 L.@.
---- binutils-2.15/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.s b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.s
+new file mode 100644
+index 0000000..0d78368
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2-reloc-r-nios2-u16.s
@@ -0,0 +1,13 @@
+# Test for New Jersey 32-bit, 16 and 8-bit relocations
+
@@ -9081,9 +9042,12 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/nios2.exp 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nios2.exp 2005-05-17 12:20:14.000000000 +0200
-@@ -0,0 +1,200 @@
+diff --git a/gas/testsuite/gas/nios2/nios2.exp b/gas/testsuite/gas/nios2/nios2.exp
+new file mode 100644
+index 0000000..475e5e5
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nios2.exp
+@@ -0,0 +1,201 @@
+#
+# Some generic New Jersey tests
+#
@@ -9230,7 +9194,8 @@
+ run_dump_test "ldw"
+ run_dump_test "ldh"
+ run_dump_test "ldb"
-+
++
++ run_dump_test "flushda"
+
+ run_dump_test "mul"
+
@@ -9284,8 +9249,11 @@
+ run_relax_test "relax_callr" "-relax-all" "link3.lds" "-dr --prefix-addresses"
+ run_relax_section_test "relax_section" "-relax-section" "-dr --prefix-addresses"
+}
---- binutils-2.15/gas/testsuite/gas/nios2/nor.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nor.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nor.d b/gas/testsuite/gas/nios2/nor.d
+new file mode 100644
+index 0000000..fab8e69
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nor.d
@@ -0,0 +1,9 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 nor
@@ -9296,16 +9264,22 @@
+
+Disassembly of section .text:
+0+0000 <[^>]*> nor r6,r8,r10
---- binutils-2.15/gas/testsuite/gas/nios2/nor.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/nor.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/nor.s b/gas/testsuite/gas/nios2/nor.s
+new file mode 100644
+index 0000000..da78254
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/nor.s
@@ -0,0 +1,5 @@
+# Source file used to test the nor instruction
+
+foo:
+ nor r6,r8,r10
+
---- binutils-2.15/gas/testsuite/gas/nios2/or.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/or.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/or.d b/gas/testsuite/gas/nios2/or.d
+new file mode 100644
+index 0000000..e5035bc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/or.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 or
@@ -9318,8 +9292,11 @@
+0+0000 <[^>]*> or r6,r8,r10
+0+0004 <[^>]*> orhi r6,r7,65535
+0+0008 <[^>]*> ori r6,r7,65535
---- binutils-2.15/gas/testsuite/gas/nios2/or.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/or.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/or.s b/gas/testsuite/gas/nios2/or.s
+new file mode 100644
+index 0000000..675df17
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/or.s
@@ -0,0 +1,7 @@
+# Source file used to test the nor instruction
+
@@ -9328,16 +9305,22 @@
+ orhi r6,r7,0xffff
+ ori r6,r7,0xffff
+
---- binutils-2.15/gas/testsuite/gas/nios2/pcrel_label.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/pcrel_label.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/pcrel_label.s b/gas/testsuite/gas/nios2/pcrel_label.s
+new file mode 100644
+index 0000000..3a76612
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/pcrel_label.s
@@ -0,0 +1,5 @@
+.text
+ext_label:
+ nop
+ nop
+.global ext_label
---- binutils-2.15/gas/testsuite/gas/nios2/relax_callr.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_callr.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_callr.d b/gas/testsuite/gas/nios2/relax_callr.d
+new file mode 100644
+index 0000000..6218c6d
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_callr.d
@@ -0,0 +1,22 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 relax_callr
@@ -9361,8 +9344,11 @@
+08000014 <[^>]*> nop
+08000018 <[^>]*> nop
+0800001c <[^>]*> nop
---- binutils-2.15/gas/testsuite/gas/nios2/relax_callr.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_callr.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_callr.s b/gas/testsuite/gas/nios2/relax_callr.s
+new file mode 100644
+index 0000000..b4cc2c4
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_callr.s
@@ -0,0 +1,17 @@
+# relaxation test for callr
+
@@ -9381,8 +9367,11 @@
+ nop
+func1:
+ nop
---- binutils-2.15/gas/testsuite/gas/nios2/relax_cjmp.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_cjmp.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_cjmp.d b/gas/testsuite/gas/nios2/relax_cjmp.d
+new file mode 100644
+index 0000000..2b6d907
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_cjmp.d
@@ -0,0 +1,8227 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 relax_cjmp
@@ -17611,8 +17600,11 @@
+00010020 <[^>]*> nop
+00010024 <[^>]*> nop
+ ...
---- binutils-2.15/gas/testsuite/gas/nios2/relax_cjmp.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_cjmp.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_cjmp.s b/gas/testsuite/gas/nios2/relax_cjmp.s
+new file mode 100644
+index 0000000..4cd24a4
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_cjmp.s
@@ -0,0 +1,37 @@
+# relaxing unconditional jumps
+
@@ -17651,8 +17643,11 @@
+sym:
+ nop
+
---- binutils-2.15/gas/testsuite/gas/nios2/relax_section.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_section.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_section.d b/gas/testsuite/gas/nios2/relax_section.d
+new file mode 100644
+index 0000000..31cfe42
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_section.d
@@ -0,0 +1,8206 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 relax_section
@@ -25860,8 +25855,11 @@
+0+800c <out_of_range> nop
+ ...
+
---- binutils-2.15/gas/testsuite/gas/nios2/relax_section.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_section.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_section.s b/gas/testsuite/gas/nios2/relax_section.s
+new file mode 100644
+index 0000000..85c8e1d
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_section.s
@@ -0,0 +1,10 @@
+ beq r2, r3, out_of_range
+ bne r2, r3, in_range
@@ -25873,8 +25871,11 @@
+ br 0
+out_of_range:
+ nop
---- binutils-2.15/gas/testsuite/gas/nios2/relax_ujmp.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_ujmp.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_ujmp.d b/gas/testsuite/gas/nios2/relax_ujmp.d
+new file mode 100644
+index 0000000..6c9269e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_ujmp.d
@@ -0,0 +1,8221 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 relax_ujmp
@@ -34097,8 +34098,11 @@
+00010014 <[^>]*> nop
+00010018 <[^>]*> nop
+ ...
---- binutils-2.15/gas/testsuite/gas/nios2/relax_ujmp.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/relax_ujmp.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/relax_ujmp.s b/gas/testsuite/gas/nios2/relax_ujmp.s
+new file mode 100644
+index 0000000..8982d73
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/relax_ujmp.s
@@ -0,0 +1,37 @@
+# relaxing unconditional jumps
+
@@ -34137,8 +34141,11 @@
+
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/reloc_symbols.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/reloc_symbols.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/reloc_symbols.s b/gas/testsuite/gas/nios2/reloc_symbols.s
+new file mode 100644
+index 0000000..532acf3
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/reloc_symbols.s
@@ -0,0 +1,21 @@
+.text
+# byte aligned
@@ -34161,8 +34168,11 @@
+#.align 2
+#nop
+
---- binutils-2.15/gas/testsuite/gas/nios2/ret.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ret.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ret.d b/gas/testsuite/gas/nios2/ret.d
+new file mode 100644
+index 0000000..b071931
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ret.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ret
@@ -34172,16 +34182,22 @@
+Disassembly of section .text:
+0+0000 <[^>]*> ret
+
---- binutils-2.15/gas/testsuite/gas/nios2/ret.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/ret.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/ret.s b/gas/testsuite/gas/nios2/ret.s
+new file mode 100644
+index 0000000..69b76bc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/ret.s
@@ -0,0 +1,5 @@
+# Source file used to test the ret instructions
+foo:
+ ret
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/rol.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/rol.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/rol.d b/gas/testsuite/gas/nios2/rol.d
+new file mode 100644
+index 0000000..2128dd5
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/rol.d
@@ -0,0 +1,40 @@
+#objdump: -dr --prefix-addresses -mmips:3000
+#as: -march=r3000 -mtune=r3000
@@ -34223,8 +34239,11 @@
+0+0070 <[^>]*> or a0,a0,at
+0+0074 <[^>]*> srl a0,a1,0x0
+ ...
---- binutils-2.15/gas/testsuite/gas/nios2/rol.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/rol.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/rol.s b/gas/testsuite/gas/nios2/rol.s
+new file mode 100644
+index 0000000..988d702
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/rol.s
@@ -0,0 +1,15 @@
+# Source file used to test the rol and ror macros.
+
@@ -34241,8 +34260,11 @@
+ ror $4,$5,1
+ ror $4,$5,0
+ .space 8
---- binutils-2.15/gas/testsuite/gas/nios2/rotate.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/rotate.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/rotate.d b/gas/testsuite/gas/nios2/rotate.d
+new file mode 100644
+index 0000000..0f54f43
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/rotate.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 rotate
@@ -34261,8 +34283,11 @@
+0+0018 <[^>]*> srai r4,r4,10
+0+001c <[^>]*> srl r4,r4,r4
+0+0020 <[^>]*> srli r4,r4,5
---- binutils-2.15/gas/testsuite/gas/nios2/rotate.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/rotate.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/rotate.s b/gas/testsuite/gas/nios2/rotate.s
+new file mode 100644
+index 0000000..81c4ee1
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/rotate.s
@@ -0,0 +1,13 @@
+# test New Jersey rotate instructions
+
@@ -34277,8 +34302,11 @@
+ srai r4,r4,10
+ srl r4,r4,r4
+ srli r4,r4,5
---- binutils-2.15/gas/testsuite/gas/nios2/s16_symbol.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/s16_symbol.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/s16_symbol.s b/gas/testsuite/gas/nios2/s16_symbol.s
+new file mode 100644
+index 0000000..3902177
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/s16_symbol.s
@@ -0,0 +1,10 @@
+.global some_sym
+.global some_other_sym
@@ -34290,8 +34318,11 @@
+.set some_sym, 0x1000
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/stb.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/stb.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/stb.d b/gas/testsuite/gas/nios2/stb.d
+new file mode 100644
+index 0000000..82f04ca
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/stb.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 stb
@@ -34489,8 +34520,11 @@
+[ ]*190: R_NIOS2_S16 .bss\+0xffff8000
+0+0194 <[^>]*> stbio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss\+0xffffc000
---- binutils-2.15/gas/testsuite/gas/nios2/stb.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/stb.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/stb.s b/gas/testsuite/gas/nios2/stb.s
+new file mode 100644
+index 0000000..8078e94
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/stb.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
@@ -34609,8 +34643,11 @@
+ stbio r4,small_external_common-0x8000(r5)
+ stbio r4,big_local_common-0x8000(r5)
+ stbio r4,small_local_common-0x8000(r5)
---- binutils-2.15/gas/testsuite/gas/nios2/sth.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/sth.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/sth.d b/gas/testsuite/gas/nios2/sth.d
+new file mode 100644
+index 0000000..dd9ec69
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/sth.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 sth
@@ -34808,8 +34845,11 @@
+[ ]*190: R_NIOS2_S16 .bss\+0xffff8000
+0+0194 <[^>]*> sthio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss\+0xffffc000
---- binutils-2.15/gas/testsuite/gas/nios2/sth.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/sth.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/sth.s b/gas/testsuite/gas/nios2/sth.s
+new file mode 100644
+index 0000000..4b9390b
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/sth.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
@@ -34928,8 +34968,11 @@
+ sthio r4,small_external_common-0x8000(r5)
+ sthio r4,big_local_common-0x8000(r5)
+ sthio r4,small_local_common-0x8000(r5)
---- binutils-2.15/gas/testsuite/gas/nios2/str2.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/str2.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/str2.s b/gas/testsuite/gas/nios2/str2.s
+new file mode 100644
+index 0000000..5310d4e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/str2.s
@@ -0,0 +1,21 @@
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
@@ -34952,8 +34995,11 @@
+ addi r4, r4, .LC2
+ .size func2, .-func2
+
---- binutils-2.15/gas/testsuite/gas/nios2/stw.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/stw.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/stw.d b/gas/testsuite/gas/nios2/stw.d
+new file mode 100644
+index 0000000..e291bda
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/stw.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 stw
@@ -35151,8 +35197,11 @@
+[ ]*190: R_NIOS2_S16 .bss\+0xffff8000
+0+0194 <[^>]*> stwio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss\+0xffffc000
---- binutils-2.15/gas/testsuite/gas/nios2/stw.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/stw.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/stw.s b/gas/testsuite/gas/nios2/stw.s
+new file mode 100644
+index 0000000..fa5c72f
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/stw.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
@@ -35271,8 +35320,11 @@
+ stwio r4,small_external_common-0x8000(r5)
+ stwio r4,big_local_common-0x8000(r5)
+ stwio r4,small_local_common-0x8000(r5)
---- binutils-2.15/gas/testsuite/gas/nios2/sub.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/sub.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/sub.d b/gas/testsuite/gas/nios2/sub.d
+new file mode 100644
+index 0000000..69b0285
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/sub.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 sub
@@ -35284,15 +35336,21 @@
+Disassembly of section .text:
+0+0000 <[^>]*> sub r4,r4,r4
+
---- binutils-2.15/gas/testsuite/gas/nios2/sub.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/sub.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/sub.s b/gas/testsuite/gas/nios2/sub.s
+new file mode 100644
+index 0000000..34f00da
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/sub.s
@@ -0,0 +1,4 @@
+# Source file used to test the add and addi instructions.
+
+foo:
+ sub r4,r4,r4
---- binutils-2.15/gas/testsuite/gas/nios2/sync.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/sync.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/sync.d b/gas/testsuite/gas/nios2/sync.d
+new file mode 100644
+index 0000000..f0949e2
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/sync.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 sync
@@ -35302,16 +35360,22 @@
+Disassembly of section \.text:
+0+0000 <foo> sync
+
---- binutils-2.15/gas/testsuite/gas/nios2/sync.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/sync.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/sync.s b/gas/testsuite/gas/nios2/sync.s
+new file mode 100644
+index 0000000..fe05d47
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/sync.s
@@ -0,0 +1,5 @@
+# Source file used to test the sync instructions
+foo:
+ sync
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/trap.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/trap.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/trap.d b/gas/testsuite/gas/nios2/trap.d
+new file mode 100644
+index 0000000..003ff69
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/trap.d
@@ -0,0 +1,7 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 trap
@@ -35320,14 +35384,20 @@
+
+Disassembly of section .text:
+0+0000 <[^>]*> trap
---- binutils-2.15/gas/testsuite/gas/nios2/trap.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/trap.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/trap.s b/gas/testsuite/gas/nios2/trap.s
+new file mode 100644
+index 0000000..1eb3c7e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/trap.s
@@ -0,0 +1,3 @@
+# Source file used to test the ret instructions
+foo:
+ trap
---- binutils-2.15/gas/testsuite/gas/nios2/tret.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/tret.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/tret.d b/gas/testsuite/gas/nios2/tret.d
+new file mode 100644
+index 0000000..48e2b51
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/tret.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 tret
@@ -35337,16 +35407,22 @@
+Disassembly of section .text:
+0+0000 <[^>]*> eret
+
---- binutils-2.15/gas/testsuite/gas/nios2/tret.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/tret.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/tret.s b/gas/testsuite/gas/nios2/tret.s
+new file mode 100644
+index 0000000..42179f1
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/tret.s
@@ -0,0 +1,5 @@
+# Source file used to test the ret instructions
+foo:
+ eret
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/u16_symbol.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/u16_symbol.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/u16_symbol.s b/gas/testsuite/gas/nios2/u16_symbol.s
+new file mode 100644
+index 0000000..518b4de
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/u16_symbol.s
@@ -0,0 +1,9 @@
+.global some_sym
+.global min
@@ -35357,16 +35433,22 @@
+.set some_sym, 0x1000
+
+
---- binutils-2.15/gas/testsuite/gas/nios2/warn_noat.l 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/warn_noat.l 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/warn_noat.l b/gas/testsuite/gas/nios2/warn_noat.l
+new file mode 100644
+index 0000000..6bc5150
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/warn_noat.l
@@ -0,0 +1,5 @@
+.*warn_noat.s: Assembler messages:
+.*warn_noat.s:2: Warning: Register at \(r1\) can sometimes be corrupted by assembler optimizations.
+Use .set noat to turn off those optimizations \(and this warning\).
+.*warn_noat.s:8: Warning: Register at \(r1\) can sometimes be corrupted by assembler optimizations.
+Use .set noat to turn off those optimizations \(and this warning\).
---- binutils-2.15/gas/testsuite/gas/nios2/warn_noat.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/warn_noat.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/warn_noat.s b/gas/testsuite/gas/nios2/warn_noat.s
+new file mode 100644
+index 0000000..e99126e
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/warn_noat.s
@@ -0,0 +1,8 @@
+.set noat, 2 # This should not cause warning for at to be turned off
+add at, r2, r2
@@ -35376,8 +35458,11 @@
+add at, r2, r2
+.set at # this should turn the warnings on
+add at, r2, r2
---- binutils-2.15/gas/testsuite/gas/nios2/warn_nobreak.l 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/warn_nobreak.l 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/warn_nobreak.l b/gas/testsuite/gas/nios2/warn_nobreak.l
+new file mode 100644
+index 0000000..539813d
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/warn_nobreak.l
@@ -0,0 +1,9 @@
+.*warn_nobreak.s: Assembler messages:
+.*warn_nobreak.s:2: Warning: The debugger will corrupt ba \(r30\). If you don't need to debug this
@@ -35388,8 +35473,11 @@
+code then use .set nobreak to turn off this warning.
+.*warn_nobreak.s:12: Warning: The debugger will corrupt bt \(r25\). If you don't need to debug this
+code then use .set nobreak to turn off this warning.
---- binutils-2.15/gas/testsuite/gas/nios2/warn_nobreak.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/warn_nobreak.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/warn_nobreak.s b/gas/testsuite/gas/nios2/warn_nobreak.s
+new file mode 100644
+index 0000000..8e495c0
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/warn_nobreak.s
@@ -0,0 +1,12 @@
+.set nobreak , 2 # This should not cause warning for ba, bt to be turned off
+add ba, r2, r2
@@ -35403,8 +35491,11 @@
+.set break # this should turn the warnings on
+add ba, r3, r4
+add bt, r3, r4
---- binutils-2.15/gas/testsuite/gas/nios2/xor.d 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/xor.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/xor.d b/gas/testsuite/gas/nios2/xor.d
+new file mode 100644
+index 0000000..de137dc
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/xor.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 xor
@@ -35417,8 +35508,11 @@
+0+0000 <[^>]*> xor r6,r8,r10
+0+0004 <[^>]*> xorhi r6,r7,65535
+0+0008 <[^>]*> xori r6,r7,65535
---- binutils-2.15/gas/testsuite/gas/nios2/xor.s 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/gas/nios2/xor.s 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/gas/nios2/xor.s b/gas/testsuite/gas/nios2/xor.s
+new file mode 100644
+index 0000000..2c558f7
+--- /dev/null
++++ b/gas/testsuite/gas/nios2/xor.s
@@ -0,0 +1,7 @@
+# Source file used to test the nor instruction
+
@@ -35427,15 +35521,20 @@
+ xorhi r6,r7,0xffff
+ xori r6,r7,0xffff
+
---- binutils-2.15/gas/testsuite/nios2_as_xfail.lst 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/gas/testsuite/nios2_as_xfail.lst 2005-05-17 12:20:14.000000000 +0200
+diff --git a/gas/testsuite/nios2_as_xfail.lst b/gas/testsuite/nios2_as_xfail.lst
+new file mode 100644
+index 0000000..27a4cd5
+--- /dev/null
++++ b/gas/testsuite/nios2_as_xfail.lst
@@ -0,0 +1,4 @@
+FAIL: vtable inherit0
+FAIL: vtable entry1
+
+
---- binutils-2.15/include/bfdlink.h 2004-05-17 21:36:06.000000000 +0200
-+++ binutils-2.15-nios2/include/bfdlink.h 2005-05-17 12:20:14.000000000 +0200
+diff --git a/include/bfdlink.h b/include/bfdlink.h
+index cc2043e..ee821bf 100644
+--- a/include/bfdlink.h
++++ b/include/bfdlink.h
@@ -688,4 +688,14 @@ struct bfd_elf_version_tree
struct bfd_elf_version_expr *prev, const char *sym);
};
@@ -35451,18 +35550,23 @@
+extern void _bfd_set_force_make_executable (bfd_boolean force);
+
#endif
---- binutils-2.15/include/dis-asm.h 2003-11-14 16:12:43.000000000 +0100
-+++ binutils-2.15-nios2/include/dis-asm.h 2005-05-17 12:20:14.000000000 +0200
-@@ -247,6 +247,7 @@ extern int print_insn_sh64 (bfd_vma, di
+diff --git a/include/dis-asm.h b/include/dis-asm.h
+index 3670c51..202c511 100644
+--- a/include/dis-asm.h
++++ b/include/dis-asm.h
+@@ -247,6 +247,8 @@ extern int print_insn_sh64 (bfd_vma, disassemble_info *);
extern int print_insn_sh64x_media (bfd_vma, disassemble_info *);
extern int print_insn_frv (bfd_vma, disassemble_info *);
extern int print_insn_iq2000 (bfd_vma, disassemble_info *);
-+extern int print_insn_nios2 (bfd_vma, disassemble_info *);
++extern int print_insn_big_nios2 (bfd_vma, disassemble_info *);
++extern int print_insn_little_nios2 (bfd_vma, disassemble_info *);
extern disassembler_ftype arc_get_disassembler (void *);
extern disassembler_ftype cris_get_disassembler (bfd *);
---- binutils-2.15/include/elf/common.h 2004-01-29 03:41:18.000000000 +0100
-+++ binutils-2.15-nios2/include/elf/common.h 2005-05-17 12:20:14.000000000 +0200
+diff --git a/include/elf/common.h b/include/elf/common.h
+index bf233f6..8c758ca 100644
+--- a/include/elf/common.h
++++ b/include/elf/common.h
@@ -182,6 +182,8 @@
#define EM_IP2K 101 /* Ubicom IP2022 micro controller */
#define EM_MSP430 105 /* TI msp430 micro controller */
@@ -35472,8 +35576,11 @@
/* If it is necessary to assign new unofficial EM_* values, please pick large
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
with official or non-GNU unofficial values.
---- binutils-2.15/include/elf/nios2.h 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/include/elf/nios2.h 2005-05-17 12:20:14.000000000 +0200
+diff --git a/include/elf/nios2.h b/include/elf/nios2.h
+new file mode 100644
+index 0000000..ef810c5
+--- /dev/null
++++ b/include/elf/nios2.h
@@ -0,0 +1,65 @@
+/* Altera New Jersey ELF support for BFD
+
@@ -35540,23 +35647,58 @@
+#define SHF_NIOS2_GPREL 0x10000000
+
+#endif //_ELF_NIOS2_H
---- binutils-2.15/include/opcode/nios2-isa.h 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/include/opcode/nios2-isa.h 2005-05-17 12:20:14.000000000 +0200
-@@ -0,0 +1,1453 @@
-+/* This file is automatically generated by gen_isa.pl - do not edit */
+diff --git a/include/opcode/nios2-isa.h b/include/opcode/nios2-isa.h
+new file mode 100644
+index 0000000..0023880
+--- /dev/null
++++ b/include/opcode/nios2-isa.h
+@@ -0,0 +1,1860 @@
++/*
++ * This file defines Nios II instruction set constants.
++ * To include it in assembly code (.S file), define ALT_ASM_SRC
++ * before including this file.
++ *
++ * This file is automatically generated by gen_isa.pl - do not edit
++ */
+
+#ifndef _NIOS2_ISA_H_
+#define _NIOS2_ISA_H_
+
+/* OP instruction opcode values (index is OP field) */
+#define NUM_OP_INSTS 64
++
++#ifndef ALT_ASM_SRC
+extern const char* op_names[NUM_OP_INSTS];
++#endif /* ALT_ASM_SRC */
+
+/* OPX instruction opcode values (index is OPX field) */
+#define NUM_OPX_INSTS 64
++
++#ifndef ALT_ASM_SRC
+extern const char* opx_names[NUM_OPX_INSTS];
++#endif /* ALT_ASM_SRC */
+
+/* Constants for instruction fields and ISA */
++#define CPU_RESET_EXC_ID 1
++#define DIV_ERROR_EXC_ID 9
++#define DTLB_MISS_EXC_ID 15
++#define DTLB_PERM_EXC_ID 16
++#define FAST_INTR_EXC_ID 3
++#define HBREAK_EXC_ID 0
++#define ITLB_MISS_EXC_ID 13
++#define ITLB_PERM_EXC_ID 14
++#define MISALIGNED_DATA_ADDR_EXC_ID 7
++#define MISALIGNED_TARGET_PC_EXC_ID 8
++#define NMI_EXC_ID 2
++#define NORM_INTR_EXC_ID 4
++#define SBREAK_EXC_ID 6
++#define SLAVE_DATA_ACCESS_ERROR_EXC_ID 18
++#define SLAVE_INST_ACCESS_ERROR_EXC_ID 17
++#define SUPERVISOR_DATA_ADDR_EXC_ID 12
++#define SUPERVISOR_INST_ADDR_EXC_ID 10
++#define SUPERVISOR_INST_EXC_ID 11
++#define TRAP_EXC_ID 5
++#define AT_REGNUM 1
+#define BRETADDR_REGNUM 30
+#define BSTATUS_REG_LSB 2
+#define BSTATUS_REG_MMU_LSB 0
@@ -35570,6 +35712,10 @@
+#define BSTATUS_REG_REGNUM 2
+#define BSTATUS_REG_SZ 3
+#define BSTATUS_REG_MASK 0x7
++#define BT_REGNUM 25
++#define CACHE_MAX_BYTES 65536
++#define CACHE_MAX_LINE_BYTES 32
++#define CACHE_MIN_LINE_BYTES 4
+#define COMPARE_OP_EQ 0x0
+#define COMPARE_OP_GE 0x1
+#define COMPARE_OP_LSB 3
@@ -35589,6 +35735,7 @@
+#define DATAPATH_MSB 31
+#define DATAPATH_SZ 32
+#define DATAPATH_MASK 0xffffffff
++#define EMPTY_CRST_IW 127034
+#define EMPTY_HBREAK_IW 4040762
+#define EMPTY_INTR_IW 3926074
+#define EMPTY_NOP_IW 100410
@@ -35607,7 +35754,22 @@
+#define ESTATUS_REG_REGNUM 1
+#define ESTATUS_REG_SZ 3
+#define ESTATUS_REG_MASK 0x7
++#define ET_REGNUM 24
++#define EXCEPTION_REG_LSB 0
++#define EXCEPTION_REG_MEA_LSB 0
++#define EXCEPTION_REG_MEA_MSB 0
++#define EXCEPTION_REG_MEA_SZ 1
++#define EXCEPTION_REG_MEA_MASK 0x1
++#define EXCEPTION_REG_MEE_LSB 1
++#define EXCEPTION_REG_MEE_MSB 1
++#define EXCEPTION_REG_MEE_SZ 1
++#define EXCEPTION_REG_MEE_MASK 0x1
++#define EXCEPTION_REG_MSB 1
++#define EXCEPTION_REG_REGNUM 7
++#define EXCEPTION_REG_SZ 2
++#define EXCEPTION_REG_MASK 0x3
+#define FP_REGNUM 28
++#define FSTATUS_REG_REGNUM 11
+#define GP_REGNUM 26
+#define IENABLE_REG_LSB 0
+#define IENABLE_REG_MSB 31
@@ -35715,12 +35877,14 @@
+#define MMU_ADDR_IO_REGION_MSB 31
+#define MMU_ADDR_IO_REGION_SZ 3
+#define MMU_ADDR_IO_REGION_MASK 0x7
++#define MMU_ADDR_IO_REGION_VPN 0xe0000
+#define MMU_ADDR_KERNEL_MMU_REGION 0x2
+#define MMU_ADDR_KERNEL_MMU_REGION_LSB 30
+#define MMU_ADDR_KERNEL_MMU_REGION_MSB 31
+#define MMU_ADDR_KERNEL_MMU_REGION_SZ 2
+#define MMU_ADDR_KERNEL_MMU_REGION_MASK 0x3
+#define MMU_ADDR_KERNEL_REGION 0x6
++#define MMU_ADDR_KERNEL_REGION_INT 6
+#define MMU_ADDR_KERNEL_REGION_LSB 29
+#define MMU_ADDR_KERNEL_REGION_MSB 31
+#define MMU_ADDR_KERNEL_REGION_SZ 3
@@ -35742,19 +35906,6 @@
+#define MMU_ADDR_VPN_MSB 31
+#define MMU_ADDR_VPN_SZ 20
+#define MMU_ADDR_VPN_MASK 0xfffff
-+#define PERF_CNT_REG_CLR_LSB 1
-+#define PERF_CNT_REG_CLR_MSB 1
-+#define PERF_CNT_REG_CLR_SZ 1
-+#define PERF_CNT_REG_CLR_MASK 0x1
-+#define PERF_CNT_REG_EN_LSB 0
-+#define PERF_CNT_REG_EN_MSB 0
-+#define PERF_CNT_REG_EN_SZ 1
-+#define PERF_CNT_REG_EN_MASK 0x1
-+#define PERF_CNT_REG_LSB 0
-+#define PERF_CNT_REG_MSB 1
-+#define PERF_CNT_REG_REGNUM 7
-+#define PERF_CNT_REG_SZ 2
-+#define PERF_CNT_REG_MASK 0x3
+#define PTEADDR_REG_LSB 0
+#define PTEADDR_REG_MSB 31
+#define PTEADDR_REG_PTBASE_LSB 22
@@ -35780,17 +35931,25 @@
+#define RF_NUM_REG 32
+#define SIM_REG_LSB 0
+#define SIM_REG_MSB 3
++#define SIM_REG_PERF_CNT_CLR_LSB 2
++#define SIM_REG_PERF_CNT_CLR_MSB 2
++#define SIM_REG_PERF_CNT_CLR_SZ 1
++#define SIM_REG_PERF_CNT_CLR_MASK 0x1
++#define SIM_REG_PERF_CNT_EN_LSB 1
++#define SIM_REG_PERF_CNT_EN_MSB 1
++#define SIM_REG_PERF_CNT_EN_SZ 1
++#define SIM_REG_PERF_CNT_EN_MASK 0x1
+#define SIM_REG_REGNUM 6
-+#define SIM_REG_SHOW_DTLB_LSB 2
-+#define SIM_REG_SHOW_DTLB_MSB 2
++#define SIM_REG_SHOW_DTLB_LSB 4
++#define SIM_REG_SHOW_DTLB_MSB 4
+#define SIM_REG_SHOW_DTLB_SZ 1
+#define SIM_REG_SHOW_DTLB_MASK 0x1
-+#define SIM_REG_SHOW_ITLB_LSB 1
-+#define SIM_REG_SHOW_ITLB_MSB 1
++#define SIM_REG_SHOW_ITLB_LSB 3
++#define SIM_REG_SHOW_ITLB_MSB 3
+#define SIM_REG_SHOW_ITLB_SZ 1
+#define SIM_REG_SHOW_ITLB_MASK 0x1
-+#define SIM_REG_SHOW_MMU_REGS_LSB 3
-+#define SIM_REG_SHOW_MMU_REGS_MSB 3
++#define SIM_REG_SHOW_MMU_REGS_LSB 5
++#define SIM_REG_SHOW_MMU_REGS_MSB 5
+#define SIM_REG_SHOW_MMU_REGS_SZ 1
+#define SIM_REG_SHOW_MMU_REGS_MASK 0x1
+#define SIM_REG_STOP_LSB 0
@@ -35807,11 +35966,19 @@
+#define STATUS_REG_LSB 0
+#define STATUS_REG_MMU_LSB 0
+#define STATUS_REG_MMU_MSB 2
++#define STATUS_REG_MMU_RSV_LSB 3
++#define STATUS_REG_MMU_RSV_MSB 31
++#define STATUS_REG_MMU_RSV_SZ 29
++#define STATUS_REG_MMU_RSV_MASK 0x1fffffff
+#define STATUS_REG_MMU_SZ 3
+#define STATUS_REG_MMU_MASK 0x7
+#define STATUS_REG_MSB 2
+#define STATUS_REG_NO_MMU_LSB 0
+#define STATUS_REG_NO_MMU_MSB 0
++#define STATUS_REG_NO_MMU_RSV_LSB 1
++#define STATUS_REG_NO_MMU_RSV_MSB 31
++#define STATUS_REG_NO_MMU_RSV_SZ 31
++#define STATUS_REG_NO_MMU_RSV_MASK 0x7fffffff
+#define STATUS_REG_NO_MMU_SZ 1
+#define STATUS_REG_NO_MMU_MASK 0x1
+#define STATUS_REG_PIE_LSB 0
@@ -35845,6 +36012,10 @@
+#define TLBACC_REG_G_MSB 20
+#define TLBACC_REG_G_SZ 1
+#define TLBACC_REG_G_MASK 0x1
++#define TLBACC_REG_IG_LSB 25
++#define TLBACC_REG_IG_MSB 31
++#define TLBACC_REG_IG_SZ 7
++#define TLBACC_REG_IG_MASK 0x7f
+#define TLBACC_REG_LSB 0
+#define TLBACC_REG_MSB 24
+#define TLBACC_REG_PFN_LSB 0
@@ -35879,7 +36050,7 @@
+#define TLBMISC_REG_DBL_SZ 1
+#define TLBMISC_REG_DBL_MASK 0x1
+#define TLBMISC_REG_LSB 0
-+#define TLBMISC_REG_MSB 22
++#define TLBMISC_REG_MSB 23
+#define TLBMISC_REG_PERM_LSB 1
+#define TLBMISC_REG_PERM_MSB 1
+#define TLBMISC_REG_PERM_SZ 1
@@ -35888,21 +36059,29 @@
+#define TLBMISC_REG_PID_MSB 17
+#define TLBMISC_REG_PID_SZ 14
+#define TLBMISC_REG_PID_MASK 0x3fff
-+#define TLBMISC_REG_RD_LSB 23
-+#define TLBMISC_REG_RD_MSB 23
++#define TLBMISC_REG_RD_LSB 24
++#define TLBMISC_REG_RD_MSB 24
+#define TLBMISC_REG_RD_SZ 1
+#define TLBMISC_REG_RD_MASK 0x1
+#define TLBMISC_REG_REGNUM 10
-+#define TLBMISC_REG_RSV_LSB 18
-+#define TLBMISC_REG_RSV_MSB 19
-+#define TLBMISC_REG_RSV_SZ 2
-+#define TLBMISC_REG_RSV_MASK 0x3
-+#define TLBMISC_REG_SZ 23
-+#define TLBMISC_REG_MASK 0x7fffff
++#define TLBMISC_REG_RSV0_LSB 18
++#define TLBMISC_REG_RSV0_MSB 19
++#define TLBMISC_REG_RSV0_SZ 2
++#define TLBMISC_REG_RSV0_MASK 0x3
++#define TLBMISC_REG_RSV1_LSB 25
++#define TLBMISC_REG_RSV1_MSB 31
++#define TLBMISC_REG_RSV1_SZ 7
++#define TLBMISC_REG_RSV1_MASK 0x7f
++#define TLBMISC_REG_SZ 24
++#define TLBMISC_REG_MASK 0xffffff
+#define TLBMISC_REG_WAY_LSB 20
+#define TLBMISC_REG_WAY_MSB 22
+#define TLBMISC_REG_WAY_SZ 3
+#define TLBMISC_REG_WAY_MASK 0x7
++#define TLBMISC_REG_WE_LSB 23
++#define TLBMISC_REG_WE_MSB 23
++#define TLBMISC_REG_WE_SZ 1
++#define TLBMISC_REG_WE_MASK 0x1
+
+/* Macros to extract instruction fields */
+#define GET_IW_A(Iw) \
@@ -36002,16 +36181,16 @@
+#define SET_ESTATUS_REG_NO_MMU(Reg, Val) \
+ Reg = (((Reg) & (~(ESTATUS_REG_NO_MMU_MASK << ESTATUS_REG_NO_MMU_LSB))) | \
+ (((Val) & ESTATUS_REG_NO_MMU_MASK) << ESTATUS_REG_NO_MMU_LSB))
-+#define GET_PERF_CNT_REG_CLR(Reg) \
-+ (((Reg) >> PERF_CNT_REG_CLR_LSB) & PERF_CNT_REG_CLR_MASK)
-+#define SET_PERF_CNT_REG_CLR(Reg, Val) \
-+ Reg = (((Reg) & (~(PERF_CNT_REG_CLR_MASK << PERF_CNT_REG_CLR_LSB))) | \
-+ (((Val) & PERF_CNT_REG_CLR_MASK) << PERF_CNT_REG_CLR_LSB))
-+#define GET_PERF_CNT_REG_EN(Reg) \
-+ (((Reg) >> PERF_CNT_REG_EN_LSB) & PERF_CNT_REG_EN_MASK)
-+#define SET_PERF_CNT_REG_EN(Reg, Val) \
-+ Reg = (((Reg) & (~(PERF_CNT_REG_EN_MASK << PERF_CNT_REG_EN_LSB))) | \
-+ (((Val) & PERF_CNT_REG_EN_MASK) << PERF_CNT_REG_EN_LSB))
++#define GET_EXCEPTION_REG_MEA(Reg) \
++ (((Reg) >> EXCEPTION_REG_MEA_LSB) & EXCEPTION_REG_MEA_MASK)
++#define SET_EXCEPTION_REG_MEA(Reg, Val) \
++ Reg = (((Reg) & (~(EXCEPTION_REG_MEA_MASK << EXCEPTION_REG_MEA_LSB))) | \
++ (((Val) & EXCEPTION_REG_MEA_MASK) << EXCEPTION_REG_MEA_LSB))
++#define GET_EXCEPTION_REG_MEE(Reg) \
++ (((Reg) >> EXCEPTION_REG_MEE_LSB) & EXCEPTION_REG_MEE_MASK)
++#define SET_EXCEPTION_REG_MEE(Reg, Val) \
++ Reg = (((Reg) & (~(EXCEPTION_REG_MEE_MASK << EXCEPTION_REG_MEE_LSB))) | \
++ (((Val) & EXCEPTION_REG_MEE_MASK) << EXCEPTION_REG_MEE_LSB))
+#define GET_PTEADDR_REG_PTBASE(Reg) \
+ (((Reg) >> PTEADDR_REG_PTBASE_LSB) & PTEADDR_REG_PTBASE_MASK)
+#define SET_PTEADDR_REG_PTBASE(Reg, Val) \
@@ -36027,6 +36206,16 @@
+#define SET_PTEADDR_REG_VPN(Reg, Val) \
+ Reg = (((Reg) & (~(PTEADDR_REG_VPN_MASK << PTEADDR_REG_VPN_LSB))) | \
+ (((Val) & PTEADDR_REG_VPN_MASK) << PTEADDR_REG_VPN_LSB))
++#define GET_SIM_REG_PERF_CNT_CLR(Reg) \
++ (((Reg) >> SIM_REG_PERF_CNT_CLR_LSB) & SIM_REG_PERF_CNT_CLR_MASK)
++#define SET_SIM_REG_PERF_CNT_CLR(Reg, Val) \
++ Reg = (((Reg) & (~(SIM_REG_PERF_CNT_CLR_MASK << SIM_REG_PERF_CNT_CLR_LSB))) | \
++ (((Val) & SIM_REG_PERF_CNT_CLR_MASK) << SIM_REG_PERF_CNT_CLR_LSB))
++#define GET_SIM_REG_PERF_CNT_EN(Reg) \
++ (((Reg) >> SIM_REG_PERF_CNT_EN_LSB) & SIM_REG_PERF_CNT_EN_MASK)
++#define SET_SIM_REG_PERF_CNT_EN(Reg, Val) \
++ Reg = (((Reg) & (~(SIM_REG_PERF_CNT_EN_MASK << SIM_REG_PERF_CNT_EN_LSB))) | \
++ (((Val) & SIM_REG_PERF_CNT_EN_MASK) << SIM_REG_PERF_CNT_EN_LSB))
+#define GET_SIM_REG_SHOW_DTLB(Reg) \
+ (((Reg) >> SIM_REG_SHOW_DTLB_LSB) & SIM_REG_SHOW_DTLB_MASK)
+#define SET_SIM_REG_SHOW_DTLB(Reg, Val) \
@@ -36057,11 +36246,21 @@
+#define SET_STATUS_REG_MMU(Reg, Val) \
+ Reg = (((Reg) & (~(STATUS_REG_MMU_MASK << STATUS_REG_MMU_LSB))) | \
+ (((Val) & STATUS_REG_MMU_MASK) << STATUS_REG_MMU_LSB))
++#define GET_STATUS_REG_MMU_RSV(Reg) \
++ (((Reg) >> STATUS_REG_MMU_RSV_LSB) & STATUS_REG_MMU_RSV_MASK)
++#define SET_STATUS_REG_MMU_RSV(Reg, Val) \
++ Reg = (((Reg) & (~(STATUS_REG_MMU_RSV_MASK << STATUS_REG_MMU_RSV_LSB))) | \
++ (((Val) & STATUS_REG_MMU_RSV_MASK) << STATUS_REG_MMU_RSV_LSB))
+#define GET_STATUS_REG_NO_MMU(Reg) \
+ (((Reg) >> STATUS_REG_NO_MMU_LSB) & STATUS_REG_NO_MMU_MASK)
+#define SET_STATUS_REG_NO_MMU(Reg, Val) \
+ Reg = (((Reg) & (~(STATUS_REG_NO_MMU_MASK << STATUS_REG_NO_MMU_LSB))) | \
+ (((Val) & STATUS_REG_NO_MMU_MASK) << STATUS_REG_NO_MMU_LSB))
++#define GET_STATUS_REG_NO_MMU_RSV(Reg) \
++ (((Reg) >> STATUS_REG_NO_MMU_RSV_LSB) & STATUS_REG_NO_MMU_RSV_MASK)
++#define SET_STATUS_REG_NO_MMU_RSV(Reg, Val) \
++ Reg = (((Reg) & (~(STATUS_REG_NO_MMU_RSV_MASK << STATUS_REG_NO_MMU_RSV_LSB))) | \
++ (((Val) & STATUS_REG_NO_MMU_RSV_MASK) << STATUS_REG_NO_MMU_RSV_LSB))
+#define GET_STATUS_REG_PIE(Reg) \
+ (((Reg) >> STATUS_REG_PIE_LSB) & STATUS_REG_PIE_MASK)
+#define SET_STATUS_REG_PIE(Reg, Val) \
@@ -36082,6 +36281,11 @@
+#define SET_TLBACC_REG_G(Reg, Val) \
+ Reg = (((Reg) & (~(TLBACC_REG_G_MASK << TLBACC_REG_G_LSB))) | \
+ (((Val) & TLBACC_REG_G_MASK) << TLBACC_REG_G_LSB))
++#define GET_TLBACC_REG_IG(Reg) \
++ (((Reg) >> TLBACC_REG_IG_LSB) & TLBACC_REG_IG_MASK)
++#define SET_TLBACC_REG_IG(Reg, Val) \
++ Reg = (((Reg) & (~(TLBACC_REG_IG_MASK << TLBACC_REG_IG_LSB))) | \
++ (((Val) & TLBACC_REG_IG_MASK) << TLBACC_REG_IG_LSB))
+#define GET_TLBACC_REG_PFN(Reg) \
+ (((Reg) >> TLBACC_REG_PFN_LSB) & TLBACC_REG_PFN_MASK)
+#define SET_TLBACC_REG_PFN(Reg, Val) \
@@ -36132,16 +36336,26 @@
+#define SET_TLBMISC_REG_RD(Reg, Val) \
+ Reg = (((Reg) & (~(TLBMISC_REG_RD_MASK << TLBMISC_REG_RD_LSB))) | \
+ (((Val) & TLBMISC_REG_RD_MASK) << TLBMISC_REG_RD_LSB))
-+#define GET_TLBMISC_REG_RSV(Reg) \
-+ (((Reg) >> TLBMISC_REG_RSV_LSB) & TLBMISC_REG_RSV_MASK)
-+#define SET_TLBMISC_REG_RSV(Reg, Val) \
-+ Reg = (((Reg) & (~(TLBMISC_REG_RSV_MASK << TLBMISC_REG_RSV_LSB))) | \
-+ (((Val) & TLBMISC_REG_RSV_MASK) << TLBMISC_REG_RSV_LSB))
++#define GET_TLBMISC_REG_RSV0(Reg) \
++ (((Reg) >> TLBMISC_REG_RSV0_LSB) & TLBMISC_REG_RSV0_MASK)
++#define SET_TLBMISC_REG_RSV0(Reg, Val) \
++ Reg = (((Reg) & (~(TLBMISC_REG_RSV0_MASK << TLBMISC_REG_RSV0_LSB))) | \
++ (((Val) & TLBMISC_REG_RSV0_MASK) << TLBMISC_REG_RSV0_LSB))
++#define GET_TLBMISC_REG_RSV1(Reg) \
++ (((Reg) >> TLBMISC_REG_RSV1_LSB) & TLBMISC_REG_RSV1_MASK)
++#define SET_TLBMISC_REG_RSV1(Reg, Val) \
++ Reg = (((Reg) & (~(TLBMISC_REG_RSV1_MASK << TLBMISC_REG_RSV1_LSB))) | \
++ (((Val) & TLBMISC_REG_RSV1_MASK) << TLBMISC_REG_RSV1_LSB))
+#define GET_TLBMISC_REG_WAY(Reg) \
+ (((Reg) >> TLBMISC_REG_WAY_LSB) & TLBMISC_REG_WAY_MASK)
+#define SET_TLBMISC_REG_WAY(Reg, Val) \
+ Reg = (((Reg) & (~(TLBMISC_REG_WAY_MASK << TLBMISC_REG_WAY_LSB))) | \
+ (((Val) & TLBMISC_REG_WAY_MASK) << TLBMISC_REG_WAY_LSB))
++#define GET_TLBMISC_REG_WE(Reg) \
++ (((Reg) >> TLBMISC_REG_WE_LSB) & TLBMISC_REG_WE_MASK)
++#define SET_TLBMISC_REG_WE(Reg, Val) \
++ Reg = (((Reg) & (~(TLBMISC_REG_WE_MASK << TLBMISC_REG_WE_LSB))) | \
++ (((Val) & TLBMISC_REG_WE_MASK) << TLBMISC_REG_WE_LSB))
+
+/* Macros to extract MMU fields */
+#define GET_MMU_ADDR_BYPASS_TLB_CACHEABLE(Addr) \
@@ -36215,7 +36429,9 @@
+#define OP_CMPNEI 24
+#define OP_CUSTOM 50
+#define OP_FLUSHD 59
++#define OP_FLUSHDA 27
+#define OP_INITD 51
++#define OP_JMPI 1
+#define OP_LDB 7
+#define OP_LDBIO 39
+#define OP_LDBU 3
@@ -36251,6 +36467,7 @@
+#define OPX_CMPLT 16
+#define OPX_CMPLTU 48
+#define OPX_CMPNE 24
++#define OPX_CRST 62
+#define OPX_DIV 37
+#define OPX_DIVU 36
+#define OPX_ERET 1
@@ -36295,25 +36512,51 @@
+
+#define IW_PROP_RESERVED(Iw) (0)
+
-+#define IW_PROP_FLUSH_PIPE(Iw) ( \
++#define IW_PROP_SUPERVISOR_ONLY(Iw) ( \
++ (op_prop_supervisor_only[GET_IW_OP(Iw)] || \
++ (IS_OPX_INST(Iw) && opx_prop_supervisor_only[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
++extern unsigned char op_prop_supervisor_only[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
++extern unsigned char opx_prop_supervisor_only[64];
++#endif /* ALT_ASM_SRC */
++
++#define IW_PROP_INITI_FLUSHI(Iw) ( \
+ ( \
-+ ((GET_IW_OPX((Iw)) == OPX_FLUSHP) && IS_OPX_INST(Iw)) || \
-+ ((GET_IW_OPX((Iw)) == OPX_BRET) && IS_OPX_INST(Iw)) \
++ ((GET_IW_OPX((Iw)) == OPX_INITI) && IS_OPX_INST(Iw)) || \
++ ((GET_IW_OPX((Iw)) == OPX_FLUSHI) && IS_OPX_INST(Iw)) \
+ ) \
+ \
+)
+
++#define IW_PROP_FLUSH_PIPE(Iw) ( \
++ (IS_OPX_INST(Iw) && opx_prop_flush_pipe[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
++extern unsigned char opx_prop_flush_pipe[64];
++#endif /* ALT_ASM_SRC */
++
+#define IW_PROP_JMP_INDIRECT_NON_TRAP(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_jmp_indirect_non_trap[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_jmp_indirect_non_trap[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_JMP_INDIRECT(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_jmp_indirect[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_jmp_indirect[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_JMP_DIRECT(Iw) ( \
+ ( \
-+ ((GET_IW_OP((Iw)) == OP_CALL)) \
++ ((GET_IW_OP((Iw)) == OP_CALL)) || \
++ ((GET_IW_OP((Iw)) == OP_JMPI)) \
+ ) \
+ \
+)
@@ -36328,13 +36571,22 @@
+
+#define IW_PROP_MULX(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_mulx[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_mulx[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_MUL(Iw) ( \
+ (op_prop_mul[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_mul[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_mul[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_mul[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_DIV_UNSIGNED(Iw) ( \
+ ( \
@@ -36385,21 +36637,43 @@
+ \
+)
+
++#define IW_PROP_CRST(Iw) ( \
++ ( \
++ ((GET_IW_OPX((Iw)) == OPX_CRST) && IS_OPX_INST(Iw)) \
++ ) \
++ \
++)
++
+#define IW_PROP_WR_CTL_REG(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_wr_ctl_reg[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_wr_ctl_reg[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_UNCOND_CTI_NON_BR(Iw) ( \
+ (op_prop_uncond_cti_non_br[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_uncond_cti_non_br[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_uncond_cti_non_br[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_uncond_cti_non_br[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_RETADDR(Iw) ( \
+ (op_prop_retaddr[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_retaddr[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_retaddr[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_retaddr[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SHIFT_LEFT(Iw) ( \
+ ( \
@@ -36411,7 +36685,10 @@
+
+#define IW_PROP_SHIFT_LOGICAL(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_shift_logical[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_shift_logical[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_ROT_LEFT(Iw) ( \
+ ( \
@@ -36423,7 +36700,10 @@
+
+#define IW_PROP_SHIFT_ROT_LEFT(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_shift_rot_left[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_shift_rot_left[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SHIFT_RIGHT_LOGICAL(Iw) ( \
+ ( \
@@ -36443,7 +36723,10 @@
+
+#define IW_PROP_SHIFT_RIGHT(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_shift_right[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_shift_right[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_ROT_RIGHT(Iw) ( \
+ ( \
@@ -36454,47 +36737,83 @@
+
+#define IW_PROP_SHIFT_ROT_RIGHT(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_shift_rot_right[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_shift_rot_right[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SHIFT_ROT(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_shift_rot[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_shift_rot[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SHIFT_ROT_IMM(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_shift_rot_imm[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_shift_rot_imm[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_ROTATE(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_rotate[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_rotate[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOGIC_REG(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_logic_reg[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_logic_reg[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOGIC_HI_IMM16(Iw) ( \
+ (op_prop_logic_hi_imm16[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_logic_hi_imm16[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOGIC_LO_IMM16(Iw) ( \
+ (op_prop_logic_lo_imm16[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_logic_lo_imm16[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOGIC_IMM16(Iw) ( \
+ (op_prop_logic_imm16[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_logic_imm16[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOGIC(Iw) ( \
+ (op_prop_logic[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_logic[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_logic[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_logic[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_UNSIGNED_LO_IMM16(Iw) ( \
+ (op_prop_unsigned_lo_imm16[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_unsigned_lo_imm16[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_unsigned_lo_imm16[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_unsigned_lo_imm16[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_ARITH_IMM16(Iw) ( \
+ ( \
@@ -36504,43 +36823,76 @@
+ \
+)
+
-+#define IW_PROP_CMP_IMM16_NO_CALL(Iw) ( \
-+ (op_prop_cmp_imm16_no_call[GET_IW_OP(Iw)]))
-+extern unsigned char op_prop_cmp_imm16_no_call[64];
++#define IW_PROP_CMP_IMM16(Iw) ( \
++ (op_prop_cmp_imm16[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
++extern unsigned char op_prop_cmp_imm16[64];
++#endif /* ALT_ASM_SRC */
++
++#define IW_PROP_JMPI(Iw) ( \
++ ( \
++ ((GET_IW_OP((Iw)) == OP_JMPI)) \
++ ) \
++ \
++)
++
++#define IW_PROP_CMP_IMM16_WITH_CALL_JMPI(Iw) ( \
++ (op_prop_cmp_imm16_with_call_jmpi[GET_IW_OP(Iw)]))
+
-+#define IW_PROP_CMP_IMM16_WITH_CALL(Iw) ( \
-+ (op_prop_cmp_imm16_with_call[GET_IW_OP(Iw)]))
-+extern unsigned char op_prop_cmp_imm16_with_call[64];
++#ifndef ALT_ASM_SRC
++extern unsigned char op_prop_cmp_imm16_with_call_jmpi[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_CMP_REG(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_cmp_reg[GET_IW_OPX(Iw)]))
-+extern unsigned char opx_prop_cmp_reg[64];
+
-+#define IW_PROP_SRC_IMM16(Iw) ( \
-+ (op_prop_src_imm16[GET_IW_OP(Iw)]))
-+extern unsigned char op_prop_src_imm16[64];
++#ifndef ALT_ASM_SRC
++extern unsigned char opx_prop_cmp_reg[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SRC_IMM5(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_src_imm5[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_src_imm5[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_CMP_WITH_LT(Iw) ( \
+ (op_prop_cmp_with_lt[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_cmp_with_lt[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_cmp_with_lt[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_cmp_with_lt[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_CMP_WITH_EQ(Iw) ( \
+ (op_prop_cmp_with_eq[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_cmp_with_eq[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_cmp_with_eq[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_cmp_with_eq[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_CMP_WITH_GE(Iw) ( \
+ (op_prop_cmp_with_ge[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_cmp_with_ge[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_cmp_with_ge[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_cmp_with_ge[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_CMP_WITH_NE(Iw) ( \
+ ( \
@@ -36553,14 +36905,26 @@
+#define IW_PROP_CMP_ALU_SIGNED(Iw) ( \
+ (op_prop_cmp_alu_signed[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_cmp_alu_signed[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_cmp_alu_signed[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_cmp_alu_signed[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_CMP(Iw) ( \
+ (op_prop_cmp[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_cmp[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_cmp[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_cmp[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_BR_WITH_LT(Iw) ( \
+ ( \
@@ -36580,7 +36944,10 @@
+
+#define IW_PROP_BR_WITH_EQ(Iw) ( \
+ (op_prop_br_with_eq[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_br_with_eq[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_BR_WITH_NE(Iw) ( \
+ ( \
@@ -36599,7 +36966,10 @@
+
+#define IW_PROP_BR_COND(Iw) ( \
+ (op_prop_br_cond[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_br_cond[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_BR_UNCOND(Iw) ( \
+ ( \
@@ -36610,27 +36980,48 @@
+
+#define IW_PROP_BR(Iw) ( \
+ (op_prop_br[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_br[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_ALU_SUB(Iw) ( \
+ (op_prop_alu_sub[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_alu_sub[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_alu_sub[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_alu_sub[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_FORCE_XOR(Iw) ( \
+ (op_prop_force_xor[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_force_xor[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_force_xor[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_force_xor[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOAD8(Iw) ( \
+ (op_prop_load8[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load8[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOAD16(Iw) ( \
+ (op_prop_load16[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load16[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOAD32(Iw) ( \
+ ( \
@@ -36642,23 +37033,38 @@
+
+#define IW_PROP_LOAD_SIGNED(Iw) ( \
+ (op_prop_load_signed[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load_signed[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOAD_UNSIGNED(Iw) ( \
+ (op_prop_load_unsigned[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load_unsigned[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOAD(Iw) ( \
+ (op_prop_load[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load[64];
++#endif /* ALT_ASM_SRC */
+
-+#define IW_PROP_LOAD_INITD_FLUSHD(Iw) ( \
-+ (op_prop_load_initd_flushd[GET_IW_OP(Iw)]))
-+extern unsigned char op_prop_load_initd_flushd[64];
++#define IW_PROP_LOAD_INITD_FLUSHD_FLUSHDA(Iw) ( \
++ (op_prop_load_initd_flushd_flushda[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
++extern unsigned char op_prop_load_initd_flushd_flushda[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_LOAD_NON_IO(Iw) ( \
+ (op_prop_load_non_io[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load_non_io[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_STORE8(Iw) ( \
+ ( \
@@ -36686,15 +37092,24 @@
+
+#define IW_PROP_STORE(Iw) ( \
+ (op_prop_store[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_store[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_STORE_NON_IO(Iw) ( \
+ (op_prop_store_non_io[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_store_non_io[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_MEM(Iw) ( \
+ (op_prop_mem[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_mem[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_INITD(Iw) ( \
+ ( \
@@ -36718,35 +37133,65 @@
+ \
+)
+
-+#define IW_PROP_INITI_FLUSHI(Iw) ( \
++#define IW_PROP_FLUSHDA(Iw) ( \
+ ( \
-+ ((GET_IW_OPX((Iw)) == OPX_INITI) && IS_OPX_INST(Iw)) || \
-+ ((GET_IW_OPX((Iw)) == OPX_FLUSHI) && IS_OPX_INST(Iw)) \
++ ((GET_IW_OP((Iw)) == OP_FLUSHDA)) \
+ ) \
+ \
+)
+
++#define IW_PROP_FLUSHD_FLUSHDA(Iw) ( \
++ ( \
++ ((GET_IW_OP((Iw)) == OP_FLUSHD)) || \
++ ((GET_IW_OP((Iw)) == OP_FLUSHDA)) \
++ ) \
++ \
++)
++
++#define IW_PROP_INITD_FLUSHD_FLUSHDA(Iw) ( \
++ (op_prop_initd_flushd_flushda[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
++extern unsigned char op_prop_initd_flushd_flushda[64];
++#endif /* ALT_ASM_SRC */
++
+#define IW_PROP_LOAD_IO(Iw) ( \
+ (op_prop_load_io[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_load_io[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_STORE_IO(Iw) ( \
+ (op_prop_store_io[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_store_io[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_MEM_IO(Iw) ( \
+ (op_prop_mem_io[GET_IW_OP(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_mem_io[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_ARITH(Iw) ( \
+ (op_prop_arith[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_arith[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_arith[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_arith[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_A_NOT_SRC(Iw) ( \
+ ( \
-+ ((GET_IW_OP((Iw)) == OP_CALL)) \
++ ((GET_IW_OP((Iw)) == OP_CALL)) || \
++ ((GET_IW_OP((Iw)) == OP_JMPI)) \
+ ) \
+ || (IS_CUSTOM_INST(Iw) && !GET_IW_CUSTOM_READRA(Iw)) \
+)
@@ -36754,18 +37199,30 @@
+#define IW_PROP_B_NOT_SRC(Iw) ( \
+ (op_prop_b_not_src[GET_IW_OP(Iw)]) \
+ || (IS_CUSTOM_INST(Iw) && !GET_IW_CUSTOM_READRB(Iw)))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_b_not_src[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_IGNORE_DST(Iw) ( \
+ (op_prop_ignore_dst[GET_IW_OP(Iw)]) \
+ || (IS_CUSTOM_INST(Iw) && !GET_IW_CUSTOM_WRITERC(Iw)))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_ignore_dst[64];
++#endif /* ALT_ASM_SRC */
+
-+#define IW_PROP_SRC2_IS_IMM(Iw) ( \
-+ (op_prop_src2_is_imm[GET_IW_OP(Iw)] || \
-+ (IS_OPX_INST(Iw) && opx_prop_src2_is_imm[GET_IW_OPX(Iw)])))
-+extern unsigned char op_prop_src2_is_imm[64];
-+extern unsigned char opx_prop_src2_is_imm[64];
++#define IW_PROP_SRC2_CHOOSE_IMM(Iw) ( \
++ (op_prop_src2_choose_imm[GET_IW_OP(Iw)] || \
++ (IS_OPX_INST(Iw) && opx_prop_src2_choose_imm[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
++extern unsigned char op_prop_src2_choose_imm[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
++extern unsigned char opx_prop_src2_choose_imm[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_WRCTL_INST(Iw) ( \
+ ( \
@@ -36798,7 +37255,10 @@
+
+#define IW_PROP_MUL_SHIFT_SRC1_SIGNED(Iw) ( \
+ (IS_OPX_INST(Iw) && opx_prop_mul_shift_src1_signed[GET_IW_OPX(Iw)]))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_mul_shift_src1_signed[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_MUL_SHIFT_SRC2_SIGNED(Iw) ( \
+ ( \
@@ -36810,39 +37270,62 @@
+#define IW_PROP_DONT_DISPLAY_DST_REG(Iw) ( \
+ (op_prop_dont_display_dst_reg[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_dont_display_dst_reg[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_dont_display_dst_reg[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_dont_display_dst_reg[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_DONT_DISPLAY_SRC1_REG(Iw) ( \
+ (op_prop_dont_display_src1_reg[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_dont_display_src1_reg[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_dont_display_src1_reg[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_dont_display_src1_reg[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_DONT_DISPLAY_SRC2_REG(Iw) ( \
+ (op_prop_dont_display_src2_reg[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_dont_display_src2_reg[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_dont_display_src2_reg[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_dont_display_src2_reg[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SRC1_NO_X(Iw) ( \
+ (op_prop_src1_no_x[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_src1_no_x[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_src1_no_x[64];
++#endif /* ALT_ASM_SRC */
++
++#ifndef ALT_ASM_SRC
+extern unsigned char opx_prop_src1_no_x[64];
++#endif /* ALT_ASM_SRC */
+
+#define IW_PROP_SRC2_NO_X(Iw) ( \
+ (op_prop_src2_no_x[GET_IW_OP(Iw)] || \
+ (IS_OPX_INST(Iw) && opx_prop_src2_no_x[GET_IW_OPX(Iw)])))
++
++#ifndef ALT_ASM_SRC
+extern unsigned char op_prop_src2_no_x[64];
-+extern unsigned char opx_prop_src2_no_x[64];
++#endif /* ALT_ASM_SRC */
+
-+/* Instruction information entry */
-+typedef struct {
-+ const char* name; /* Assembly-language instruction name */
-+ int instType; /* INST_TYPE_OP or INST_TYPE_OPX */
-+ unsigned opcode; /* Value of instruction word OP/OPX field */
-+} Nios2InstInfo;
++#ifndef ALT_ASM_SRC
++extern unsigned char opx_prop_src2_no_x[64];
++#endif /* ALT_ASM_SRC */
+
+/* Instruction types */
+#define INST_TYPE_OP 0
@@ -36850,103 +37333,129 @@
+
+/* Canonical instruction codes independent of encoding */
+#define CALL_INST_CODE 0
-+#define LDBU_INST_CODE 1
-+#define ADDI_INST_CODE 2
-+#define STB_INST_CODE 3
-+#define BR_INST_CODE 4
-+#define LDB_INST_CODE 5
-+#define CMPGEI_INST_CODE 6
-+#define LDHU_INST_CODE 7
-+#define ANDI_INST_CODE 8
-+#define STH_INST_CODE 9
-+#define BGE_INST_CODE 10
-+#define LDH_INST_CODE 11
-+#define CMPLTI_INST_CODE 12
-+#define ORI_INST_CODE 13
-+#define STW_INST_CODE 14
-+#define BLT_INST_CODE 15
-+#define LDW_INST_CODE 16
-+#define CMPNEI_INST_CODE 17
-+#define XORI_INST_CODE 18
-+#define BNE_INST_CODE 19
-+#define CMPEQI_INST_CODE 20
-+#define LDBUIO_INST_CODE 21
-+#define MULI_INST_CODE 22
-+#define STBIO_INST_CODE 23
-+#define BEQ_INST_CODE 24
-+#define LDBIO_INST_CODE 25
-+#define CMPGEUI_INST_CODE 26
-+#define LDHUIO_INST_CODE 27
-+#define ANDHI_INST_CODE 28
-+#define STHIO_INST_CODE 29
-+#define BGEU_INST_CODE 30
-+#define LDHIO_INST_CODE 31
-+#define CMPLTUI_INST_CODE 32
-+#define CUSTOM_INST_CODE 33
-+#define INITD_INST_CODE 34
-+#define ORHI_INST_CODE 35
-+#define STWIO_INST_CODE 36
-+#define BLTU_INST_CODE 37
-+#define LDWIO_INST_CODE 38
-+#define FLUSHD_INST_CODE 39
-+#define XORHI_INST_CODE 40
-+#define ERET_INST_CODE 41
-+#define ROLI_INST_CODE 42
-+#define ROL_INST_CODE 43
-+#define FLUSHP_INST_CODE 44
-+#define RET_INST_CODE 45
-+#define NOR_INST_CODE 46
-+#define MULXUU_INST_CODE 47
-+#define CMPGE_INST_CODE 48
-+#define BRET_INST_CODE 49
-+#define ROR_INST_CODE 50
-+#define FLUSHI_INST_CODE 51
-+#define JMP_INST_CODE 52
-+#define AND_INST_CODE 53
-+#define CMPLT_INST_CODE 54
-+#define SLLI_INST_CODE 55
-+#define SLL_INST_CODE 56
-+#define OR_INST_CODE 57
-+#define MULXSU_INST_CODE 58
-+#define CMPNE_INST_CODE 59
-+#define SRLI_INST_CODE 60
-+#define SRL_INST_CODE 61
-+#define NEXTPC_INST_CODE 62
-+#define CALLR_INST_CODE 63
-+#define XOR_INST_CODE 64
-+#define MULXSS_INST_CODE 65
-+#define CMPEQ_INST_CODE 66
-+#define DIVU_INST_CODE 67
-+#define DIV_INST_CODE 68
-+#define RDCTL_INST_CODE 69
-+#define MUL_INST_CODE 70
-+#define CMPGEU_INST_CODE 71
-+#define INITI_INST_CODE 72
-+#define TRAP_INST_CODE 73
-+#define WRCTL_INST_CODE 74
-+#define CMPLTU_INST_CODE 75
-+#define ADD_INST_CODE 76
-+#define BREAK_INST_CODE 77
-+#define HBREAK_INST_CODE 78
-+#define SYNC_INST_CODE 79
-+#define SUB_INST_CODE 80
-+#define SRAI_INST_CODE 81
-+#define SRA_INST_CODE 82
-+#define INTR_INST_CODE 83
-+#define RSV_INST_CODE 84
-+#define NUM_NIOS2_INST_CODES 85
++#define JMPI_INST_CODE 1
++#define LDBU_INST_CODE 2
++#define ADDI_INST_CODE 3
++#define STB_INST_CODE 4
++#define BR_INST_CODE 5
++#define LDB_INST_CODE 6
++#define CMPGEI_INST_CODE 7
++#define LDHU_INST_CODE 8
++#define ANDI_INST_CODE 9
++#define STH_INST_CODE 10
++#define BGE_INST_CODE 11
++#define LDH_INST_CODE 12
++#define CMPLTI_INST_CODE 13
++#define ORI_INST_CODE 14
++#define STW_INST_CODE 15
++#define BLT_INST_CODE 16
++#define LDW_INST_CODE 17
++#define CMPNEI_INST_CODE 18
++#define FLUSHDA_INST_CODE 19
++#define XORI_INST_CODE 20
++#define BNE_INST_CODE 21
++#define CMPEQI_INST_CODE 22
++#define LDBUIO_INST_CODE 23
++#define MULI_INST_CODE 24
++#define STBIO_INST_CODE 25
++#define BEQ_INST_CODE 26
++#define LDBIO_INST_CODE 27
++#define CMPGEUI_INST_CODE 28
++#define LDHUIO_INST_CODE 29
++#define ANDHI_INST_CODE 30
++#define STHIO_INST_CODE 31
++#define BGEU_INST_CODE 32
++#define LDHIO_INST_CODE 33
++#define CMPLTUI_INST_CODE 34
++#define CUSTOM_INST_CODE 35
++#define INITD_INST_CODE 36
++#define ORHI_INST_CODE 37
++#define STWIO_INST_CODE 38
++#define BLTU_INST_CODE 39
++#define LDWIO_INST_CODE 40
++#define FLUSHD_INST_CODE 41
++#define XORHI_INST_CODE 42
++#define ERET_INST_CODE 43
++#define ROLI_INST_CODE 44
++#define ROL_INST_CODE 45
++#define FLUSHP_INST_CODE 46
++#define RET_INST_CODE 47
++#define NOR_INST_CODE 48
++#define MULXUU_INST_CODE 49
++#define CMPGE_INST_CODE 50
++#define BRET_INST_CODE 51
++#define ROR_INST_CODE 52
++#define FLUSHI_INST_CODE 53
++#define JMP_INST_CODE 54
++#define AND_INST_CODE 55
++#define CMPLT_INST_CODE 56
++#define SLLI_INST_CODE 57
++#define SLL_INST_CODE 58
++#define OR_INST_CODE 59
++#define MULXSU_INST_CODE 60
++#define CMPNE_INST_CODE 61
++#define SRLI_INST_CODE 62
++#define SRL_INST_CODE 63
++#define NEXTPC_INST_CODE 64
++#define CALLR_INST_CODE 65
++#define XOR_INST_CODE 66
++#define MULXSS_INST_CODE 67
++#define CMPEQ_INST_CODE 68
++#define DIVU_INST_CODE 69
++#define DIV_INST_CODE 70
++#define RDCTL_INST_CODE 71
++#define MUL_INST_CODE 72
++#define CMPGEU_INST_CODE 73
++#define INITI_INST_CODE 74
++#define TRAP_INST_CODE 75
++#define WRCTL_INST_CODE 76
++#define CMPLTU_INST_CODE 77
++#define ADD_INST_CODE 78
++#define BREAK_INST_CODE 79
++#define HBREAK_INST_CODE 80
++#define SYNC_INST_CODE 81
++#define SUB_INST_CODE 82
++#define SRAI_INST_CODE 83
++#define SRA_INST_CODE 84
++#define INTR_INST_CODE 85
++#define CRST_INST_CODE 86
++#define RSV_INST_CODE 87
++#define NUM_NIOS2_INST_CODES 88
++
++#ifndef ALT_ASM_SRC
++/* Instruction information entry */
++typedef struct {
++ const char* name; /* Assembly-language instruction name */
++ int instType; /* INST_TYPE_OP or INST_TYPE_OPX */
++ unsigned opcode; /* Value of instruction word OP/OPX field */
++} Nios2InstInfo;
+
+extern Nios2InstInfo nios2InstInfo[NUM_NIOS2_INST_CODES];
++#endif /* ALT_ASM_SRC */
+
+/* Returns the instruction code given the 32-bit instruction word */
+#define GET_INST_CODE(Iw) \
+ (IS_OPX_INST(Iw) ? opxToInstCode[GET_IW_OPX(Iw)] : opToInstCode[GET_IW_OP(Iw)])
++
++#ifndef ALT_ASM_SRC
+extern int opToInstCode[64];
+extern int opxToInstCode[64];
++#endif /* ALT_ASM_SRC */
++
++/*
++ * MMU Memory Region Macros
++ */
++#define USER_REGION_MIN_VADDR 0x00000000
++#define USER_REGION_MAX_VADDR 0x7fffffff
++#define KERNEL_MMU_REGION_MIN_VADDR 0x80000000
++#define KERNEL_MMU_REGION_MAX_VADDR 0xbfffffff
++#define KERNEL_REGION_MIN_VADDR 0xc0000000
++#define KERNEL_REGION_MAX_VADDR 0xdfffffff
++#define IO_REGION_MIN_VADDR 0xe0000000
++#define IO_REGION_MAX_VADDR 0xffffffff
++
++#define MMU_PAGE_SIZE (0x1 << (MMU_ADDR_PAGE_OFFSET_SZ))
+
-+//
-+// MMU Memory Region Macros
-+//
+#define isMmuUserRegion(Vaddr) \
+ (GET_MMU_ADDR_USER_REGION(Vaddr) == MMU_ADDR_USER_REGION)
+#define isMmuKernelMmuRegion(Vaddr) \
@@ -36956,49 +37465,60 @@
+#define isMmuIORegion(Vaddr) \
+ (GET_MMU_ADDR_IO_REGION(Vaddr) == MMU_ADDR_IO_REGION)
+
-+// Does this virtual address bypass the TLB?
++/* Does this virtual address bypass the TLB? */
+#define vaddrBypassTlb(Vaddr) \
+ (GET_MMU_ADDR_BYPASS_TLB(Vaddr) == MMU_ADDR_BYPASS_TLB)
+
-+// If TLB is bypassed, is the address cacheable or uncachable.
++/* If TLB is bypassed, is the address cacheable or uncachable. */
+#define vaddrBypassTlbCacheable(Vaddr) \
+ (GET_MMU_ADDR_BYPASS_TLB_CACHEABLE(Vaddr) == MMU_ADDR_BYPASS_TLB_CACHEABLE)
+
-+// Compute physical address for regions that bypass the TLB.
-+// Just need to clear some top bits.
++/*
++ * Compute physical address for regions that bypass the TLB.
++ * Just need to clear some top bits.
++ */
+#define bypassTlbVaddrToPaddr(Vaddr) \
+ ((Vaddr) & (MMU_ADDR_BYPASS_TLB_PADDR_MASK << MMU_ADDR_BYPASS_TLB_PADDR_LSB))
+
-+// Will the physical address fit in the Kernel/IO region virtual address space?
++/*
++ * Will the physical address fit in the Kernel/IO region virtual address space?
++ */
+#define fitsInKernelRegion(Paddr) \
+ (GET_MMU_ADDR_KERNEL_REGION(Paddr) == 0)
+#define fitsInIORegion(Paddr) \
+ (GET_MMU_ADDR_IO_REGION(Paddr) == 0)
+
-+// Convert a physical address to a Kernel/IO region virtual address.
++/* Convert a physical address to a Kernel/IO region virtual address. */
+#define paddrToKernelRegionVaddr(Paddr) \
+ ((Paddr) | (MMU_ADDR_KERNEL_REGION << MMU_ADDR_KERNEL_REGION_LSB))
+#define paddrToIORegionVaddr(Paddr) \
+ ((Paddr) | (MMU_ADDR_IO_REGION << MMU_ADDR_IO_REGION_LSB))
+
-+// Convert a virtual address to a Kernel/IO region virtual address.
-+// Uses bypassTlbVaddrToPaddr to clear top bits.
++/*
++ * Convert a virtual address to a Kernel/IO region virtual address.
++ * Uses bypassTlbVaddrToPaddr to clear top bits.
++ */
+#define vaddrToKernelRegionVaddr(Vaddr) \
+ paddrToKernelRegionVaddr(bypassTlbVaddrToPaddr(Vaddr))
+#define vaddrToIORegionVaddr(Vaddr) \
+ paddrToIORegionVaddr(bypassTlbVaddrToPaddr(Vaddr))
+
-+// Convert between VPN/PFN and virtual/physical addresses.
++/* Convert between VPN/PFN and virtual/physical addresses. */
+#define vpnToVaddr(Vpn) ((Vpn) << MMU_ADDR_VPN_LSB)
+#define pfnToPaddr(Pfn) ((Pfn) << MMU_ADDR_PFN_LSB)
+#define vaddrToVpn(Vaddr) GET_MMU_ADDR_VPN(Vaddr)
+#define paddrToPfn(Paddr) GET_MMU_ADDR_PFN(Paddr)
+
++/* Bitwise OR with a KERNEL region address to make it an IO region address */
++#define KERNEL_TO_IO_REGION 0x20000000
+
+#endif /* _NIOS2_ISA_H_ */
---- binutils-2.15/include/opcode/nios2.h 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/include/opcode/nios2.h 2005-05-17 12:20:14.000000000 +0200
-@@ -0,0 +1,357 @@
+diff --git a/include/opcode/nios2.h b/include/opcode/nios2.h
+new file mode 100644
+index 0000000..992bb80
+--- /dev/null
++++ b/include/opcode/nios2.h
+@@ -0,0 +1,361 @@
+/* nios2.h. Altera New Jersey opcode list for GAS, the GNU assembler.
+
+ Copyright (C) 2003
@@ -37217,6 +37737,7 @@
+#define OP_MATCH_BNE OP_BNE
+#define OP_MATCH_BR OP_BR
+#define OP_MATCH_FLUSHD OP_FLUSHD
++#define OP_MATCH_FLUSHDA OP_FLUSHDA
+#define OP_MATCH_INITD OP_INITD
+#define OP_MATCH_CALL OP_CALL
+#define OP_MATCH_CMPEQI OP_CMPEQI
@@ -37225,6 +37746,7 @@
+#define OP_MATCH_CMPLTI OP_CMPLTI
+#define OP_MATCH_CMPLTUI OP_CMPLTUI
+#define OP_MATCH_CMPNEI OP_CMPNEI
++#define OP_MATCH_JMPI OP_JMPI
+#define OP_MATCH_LDB OP_LDB
+#define OP_MATCH_LDBIO OP_LDBIO
+#define OP_MATCH_LDBU OP_LDBU
@@ -37250,6 +37772,8 @@
+#define OP_MATCH_XORI OP_XORI
+#define OP_MATCH_OPX OP_OPX
+
++
++
+/* OPX instruction values */
+#define OP_MATCH_ADD ((OPX_ADD << IW_OPX_LSB) | (OP_OPX))
+#define OP_MATCH_AND ((OPX_AND << IW_OPX_LSB) | (OP_OPX))
@@ -37356,13 +37880,18 @@
+extern char *overflow_msgs[];
+
+#endif // _NIOS2_H
---- binutils-2.15/include/opcode/s-nios2-isa 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/include/opcode/s-nios2-isa 2005-05-17 12:20:14.000000000 +0200
+diff --git a/include/opcode/s-nios2-isa b/include/opcode/s-nios2-isa
+new file mode 100644
+index 0000000..9788f70
+--- /dev/null
++++ b/include/opcode/s-nios2-isa
@@ -0,0 +1 @@
+timestamp
---- binutils-2.15/ld/Makefile.am 2004-05-17 21:36:15.000000000 +0200
-+++ binutils-2.15-nios2/ld/Makefile.am 2005-05-17 12:20:14.000000000 +0200
-@@ -1440,6 +1440,9 @@ eelf32frvfd.c: $(srcdir)/emulparams/elf3
+diff --git a/ld/Makefile.am b/ld/Makefile.am
+index a2f1ac1..665db8b 100644
+--- a/ld/Makefile.am
++++ b/ld/Makefile.am
+@@ -1440,6 +1440,9 @@ eelf32frvfd.c: $(srcdir)/emulparams/elf32frvfd.sh \
$(srcdir)/emulparams/elf32frv.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32frvfd "$(tdir_frv)"
@@ -37372,9 +37901,11 @@
# We need this for automake to use YLWRAP.
EXTRA_ld_new_SOURCES = deffilep.y
---- binutils-2.15/ld/Makefile.in 2004-05-17 21:36:15.000000000 +0200
-+++ binutils-2.15-nios2/ld/Makefile.in 2005-05-17 12:20:14.000000000 +0200
-@@ -2166,6 +2166,9 @@ eelf32frvfd.c: $(srcdir)/emulparams/elf3
+diff --git a/ld/Makefile.in b/ld/Makefile.in
+index 976d5db..1be09a3 100644
+--- a/ld/Makefile.in
++++ b/ld/Makefile.in
+@@ -2166,6 +2166,9 @@ eelf32frvfd.c: $(srcdir)/emulparams/elf32frvfd.sh \
$(srcdir)/emulparams/elf32frv.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32frvfd "$(tdir_frv)"
@@ -37384,21 +37915,28 @@
# The generated emulation files mostly have the same dependencies.
$(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \
---- binutils-2.15/ld/configure.tgt 2004-05-17 21:36:15.000000000 +0200
-+++ binutils-2.15-nios2/ld/configure.tgt 2005-05-17 12:20:14.000000000 +0200
+diff --git a/ld/configure.tgt b/ld/configure.tgt
+index 9b29291..3064c1d 100644
+--- a/ld/configure.tgt
++++ b/ld/configure.tgt
@@ -450,6 +450,7 @@ mn10200-*-*) targ_emul=mn10200 ;;
mn10300-*-*) targ_emul=mn10300 ;;
msp430-*-*) targ_emul=msp430x110
targ_extra_emuls="msp430x112 msp430x1101 msp430x1111 msp430x1121 msp430x1122 msp430x1132 msp430x122 msp430x123 msp430x1222 msp430x1232 msp430x133 msp430x135 msp430x1331 msp430x1351 msp430x147 msp430x148 msp430x149 msp430x155 msp430x156 msp430x157 msp430x167 msp430x168 msp430x169 msp430x311 msp430x312 msp430x313 msp430x314 msp430x315 msp430x323 msp430x325 msp430x336 msp430x337 msp430x412 msp430x413 msp430xE423 msp430xE425 msp430xE427 msp430xW423 msp430xW425 msp430xW427 msp430x435 msp430x436 msp430x437 msp430x447 msp430x448 msp430x449" ;;
-+nios2-*-*|nios2-*-*) targ_emul=nios2elf ;;
++nios2*-*-*) targ_emul=nios2elf ;;
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_emul=elf64alpha_fbsd
targ_extra_emuls="elf64alpha alpha"
---- binutils-2.15/ld/emulparams/nios2elf.sh 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/ld/emulparams/nios2elf.sh 2005-05-17 12:20:14.000000000 +0200
-@@ -0,0 +1,15 @@
+diff --git a/ld/emulparams/nios2elf.sh b/ld/emulparams/nios2elf.sh
+new file mode 100644
+index 0000000..9c9e588
+--- /dev/null
++++ b/ld/emulparams/nios2elf.sh
+@@ -0,0 +1,17 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlenios2"
++LITTLE_OUTPUT_FORMAT="elf32-littlenios2"
++BIG_OUTPUT_FORMAT="elf32-bignios2"
+TEXT_START_ADDR=0x0
+OTHER_GOT_SYMBOLS='
+ _gp = ALIGN(16) + 0x7ff0;
@@ -37412,8 +37950,28 @@
+DATA_ADDR=.
+NOP=0x0001883a
+
---- binutils-2.15/ld/ldmain.c 2004-05-17 21:36:16.000000000 +0200
-+++ binutils-2.15-nios2/ld/ldmain.c 2005-05-17 12:20:14.000000000 +0200
+diff --git a/ld/ldlang.c b/ld/ldlang.c
+index 0c08601..78a2dfe 100644
+--- a/ld/ldlang.c
++++ b/ld/ldlang.c
+@@ -2855,10 +2855,11 @@ os_region_check (lang_output_section_statement_type *os,
+ }
+ else
+ {
+- einfo (_("%X%P: region %s is full (%B section %s)\n"),
++ einfo (_("%X%P: region %s is full (%B section %s). Region needs to be %d bytes larger.\n"),
+ region->name,
+ os->bfd_section->owner,
+- os->bfd_section->name);
++ os->bfd_section->name,
++ region->current - (region->origin + region->length));
+ }
+ /* Reset the region pointer. */
+ region->current = region->origin;
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index d0e0b12..fe24494 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
@@ -397,6 +397,14 @@ main (int argc, char **argv)
yyparse ();
lex_string = NULL;
@@ -37429,14 +37987,19 @@
if (trace_file_tries)
{
---- binutils-2.15/ld/nios2_ld_xfail.lst 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/ld/nios2_ld_xfail.lst 2005-05-17 12:20:14.000000000 +0200
+diff --git a/ld/nios2_ld_xfail.lst b/ld/nios2_ld_xfail.lst
+new file mode 100644
+index 0000000..b28b04f
+--- /dev/null
++++ b/ld/nios2_ld_xfail.lst
@@ -0,0 +1,3 @@
+
+
+
---- binutils-2.15/ld/testsuite/ld-elf/merge.d 2003-05-07 07:08:02.000000000 +0200
-+++ binutils-2.15-nios2/ld/testsuite/ld-elf/merge.d 2005-05-17 12:20:14.000000000 +0200
+diff --git a/ld/testsuite/ld-elf/merge.d b/ld/testsuite/ld-elf/merge.d
+index 4038cc8..13c9e00 100644
+--- a/ld/testsuite/ld-elf/merge.d
++++ b/ld/testsuite/ld-elf/merge.d
@@ -5,6 +5,7 @@
#xfail: "hppa*-*-*" "h8300-*-*" "i960-*-*" "ip2k-*-*" "m32r-*-*" "mcore-*-*"
#xfail: "mn10*-*-*" "mips64*-*-linux*" "openrisc-*-*" "pj-*-*" "sparc*-*-*"
@@ -37445,21 +38008,25 @@
.*: file format .*elf.*
---- binutils-2.15/ld/testsuite/ld-elfcomm/elfcomm.exp 2003-06-18 05:38:05.000000000 +0200
-+++ binutils-2.15-nios2/ld/testsuite/ld-elfcomm/elfcomm.exp 2005-05-17 12:20:14.000000000 +0200
+diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp
+index e5bd29b..cbeb00e 100644
+--- a/ld/testsuite/ld-elfcomm/elfcomm.exp
++++ b/ld/testsuite/ld-elfcomm/elfcomm.exp
@@ -56,6 +56,10 @@ proc dump_common1 { testname } {
return 1
}
-+if [istarget nios2-*-*] {
++if [istarget nios2*-*-*] {
+ set CFLAGS "$CFLAGS -G0"
+}
+
if { ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
|| ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/common1b.c tmpdir/common1b.o] } {
unresolved $test1
---- binutils-2.15/ld/testsuite/ld-scripts/cross2.t 2001-08-27 12:49:55.000000000 +0200
-+++ binutils-2.15-nios2/ld/testsuite/ld-scripts/cross2.t 2005-05-17 12:20:14.000000000 +0200
+diff --git a/ld/testsuite/ld-scripts/cross2.t b/ld/testsuite/ld-scripts/cross2.t
+index a0cdcbb..7cb7d6b 100644
+--- a/ld/testsuite/ld-scripts/cross2.t
++++ b/ld/testsuite/ld-scripts/cross2.t
@@ -2,5 +2,9 @@ NOCROSSREFS ( .text .data )
SECTIONS
{
@@ -37471,8 +38038,10 @@
+ *(.sdata) *(.rw) *(.tc0) *(.tc) *(.toc)
+ }
}
---- binutils-2.15/opcodes/Makefile.am 2004-01-07 19:39:40.000000000 +0100
-+++ binutils-2.15-nios2/opcodes/Makefile.am 2005-05-17 12:20:14.000000000 +0200
+diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
+index ea621f2..1fe2456 100644
+--- a/opcodes/Makefile.am
++++ b/opcodes/Makefile.am
@@ -125,6 +125,8 @@ CFILES = \
mmix-dis.c \
mmix-opc.c \
@@ -37491,7 +38060,7 @@
openrisc-asm.lo \
openrisc-desc.lo \
openrisc-dis.lo \
-@@ -739,6 +743,13 @@ mmix-opc.lo: mmix-opc.c $(INCDIR)/opcode
+@@ -739,6 +743,13 @@ mmix-opc.lo: mmix-opc.c $(INCDIR)/opcode/mmix.h $(INCDIR)/symcat.h
ns32k-dis.lo: ns32k-dis.c $(BFD_H) $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/dis-asm.h \
$(INCDIR)/opcode/ns32k.h opintl.h
@@ -37505,8 +38074,10 @@
openrisc-asm.lo: openrisc-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h $(INCDIR)/opcode/cgen.h \
openrisc-opc.h opintl.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h \
---- binutils-2.15/opcodes/Makefile.in 2004-01-07 19:39:40.000000000 +0100
-+++ binutils-2.15-nios2/opcodes/Makefile.in 2005-05-17 12:20:14.000000000 +0200
+diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
+index 559194d..dc31a88 100644
+--- a/opcodes/Makefile.in
++++ b/opcodes/Makefile.in
@@ -236,6 +236,8 @@ CFILES = \
mmix-dis.c \
mmix-opc.c \
@@ -37525,7 +38096,7 @@
ns32k-dis.lo \
openrisc-asm.lo \
openrisc-desc.lo \
-@@ -1232,6 +1236,13 @@ mmix-dis.lo: mmix-dis.c $(INCDIR)/opcode
+@@ -1232,6 +1236,13 @@ mmix-dis.lo: mmix-dis.c $(INCDIR)/opcode/mmix.h $(INCDIR)/dis-asm.h \
$(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \
opintl.h
mmix-opc.lo: mmix-opc.c $(INCDIR)/opcode/mmix.h $(INCDIR)/symcat.h
@@ -37539,8 +38110,10 @@
ns32k-dis.lo: ns32k-dis.c $(BFD_H) $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/dis-asm.h \
$(INCDIR)/opcode/ns32k.h opintl.h
---- binutils-2.15/opcodes/configure 2003-08-05 11:39:31.000000000 +0200
-+++ binutils-2.15-nios2/opcodes/configure 2005-05-17 12:20:14.000000000 +0200
+diff --git a/opcodes/configure b/opcodes/configure
+index 4a95a9a..561f1e0 100755
+--- a/opcodes/configure
++++ b/opcodes/configure
@@ -4661,6 +4661,7 @@ if test x${all_targets} = xfalse ; then
bfd_mn10200_arch) ta="$ta m10200-dis.lo m10200-opc.lo" ;;
bfd_mn10300_arch) ta="$ta m10300-dis.lo m10300-opc.lo" ;;
@@ -37549,8 +38122,10 @@
bfd_ns32k_arch) ta="$ta ns32k-dis.lo" ;;
bfd_openrisc_arch) ta="$ta openrisc-asm.lo openrisc-desc.lo openrisc-dis.lo openrisc-ibld.lo openrisc-opc.lo" using_cgen=yes ;;
bfd_or32_arch) ta="$ta or32-dis.lo or32-opc.lo" using_cgen=yes ;;
---- binutils-2.15/opcodes/configure.in 2003-08-05 11:39:31.000000000 +0200
-+++ binutils-2.15-nios2/opcodes/configure.in 2005-05-17 12:20:14.000000000 +0200
+diff --git a/opcodes/configure.in b/opcodes/configure.in
+index 8919924..bfdcabc 100644
+--- a/opcodes/configure.in
++++ b/opcodes/configure.in
@@ -202,6 +202,7 @@ if test x${all_targets} = xfalse ; then
bfd_mn10200_arch) ta="$ta m10200-dis.lo m10200-opc.lo" ;;
bfd_mn10300_arch) ta="$ta m10300-dis.lo m10300-opc.lo" ;;
@@ -37559,16 +38134,11 @@
bfd_ns32k_arch) ta="$ta ns32k-dis.lo" ;;
bfd_openrisc_arch) ta="$ta openrisc-asm.lo openrisc-desc.lo openrisc-dis.lo openrisc-ibld.lo openrisc-opc.lo" using_cgen=yes ;;
bfd_or32_arch) ta="$ta or32-dis.lo or32-opc.lo" using_cgen=yes ;;
---- binutils-2.15/opcodes/disassemble.c 2003-11-14 16:12:44.000000000 +0100
-+++ binutils-2.15-nios2/opcodes/disassemble.c 2005-05-17 12:20:14.000000000 +0200
-@@ -1,5 +1,5 @@
- /* Select disassembly routine for specified architecture.
-- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
-@@ -72,6 +72,7 @@ Foundation, Inc., 59 Temple Place - Suit
+diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
+index d5b17be..877e582 100644
+--- a/opcodes/disassemble.c
++++ b/opcodes/disassemble.c
+@@ -72,6 +72,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ARCH_z8k
#define ARCH_frv
#define ARCH_iq2000
@@ -37576,21 +38146,27 @@
#define INCLUDE_SHMEDIA
#endif
-@@ -375,6 +376,11 @@ disassembler (abfd)
+@@ -375,6 +376,14 @@ disassembler (abfd)
disassemble = print_insn_iq2000;
break;
#endif
+#ifdef ARCH_nios2
+ case bfd_arch_nios2:
-+ disassemble = print_insn_nios2;
++ if (bfd_big_endian (abfd))
++ disassemble = print_insn_big_nios2;
++ else
++ disassemble = print_insn_little_nios2;
+ break;
+#endif
default:
return 0;
}
---- binutils-2.15/opcodes/nios2-dis.c 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/opcodes/nios2-dis.c 2005-05-17 12:20:14.000000000 +0200
-@@ -0,0 +1,445 @@
+diff --git a/opcodes/nios2-dis.c b/opcodes/nios2-dis.c
+new file mode 100644
+index 0000000..c164436
+--- /dev/null
++++ b/opcodes/nios2-dis.c
+@@ -0,0 +1,462 @@
+/* nios2-dis.c -- Altera New Jersey disassemble routines.
+
+ Copyright (C) 2003
@@ -37640,14 +38216,16 @@
+
+
+/* print_insn_nios2 is the main disassemble function for New Jersey.
-+ The function diassembler(abfd) (source in disassemble.c)
-+ returns a pointer to this function when the bfd machine type is
-+ New Jersey. print_insn_nios2 reads the instruction word at the
-+ address given, and prints the disassembled instruction on the
-+ stream info->stream using info->fprintf_func. */
-+
-+int
-+print_insn_nios2 (bfd_vma address, disassemble_info * info)
++ The function diassembler(abfd) (source in disassemble.c) returns a
++ pointer to this either print_insn_big_nios2 or
++ print_insn_little_nios2, which in turn call this function, when the
++ bfd machine type is New Jersey. print_insn_nios2 reads the
++ instruction word at the address given, and prints the disassembled
++ instruction on the stream info->stream using info->fprintf_func. */
++
++static int
++print_insn_nios2 (bfd_vma address, disassemble_info * info,
++ enum bfd_endian endianness)
+{
+ /* buffer into which the instruction bytes are written */
+ bfd_byte buffer[INSNLEN];
@@ -37659,9 +38237,12 @@
+ status = (*info->read_memory_func) (address, buffer, INSNLEN, info);
+ if (status == 0)
+ {
-+ status =
-+ nios2_disassemble (address, (unsigned long) bfd_getl32 (buffer),
-+ info);
++ unsigned long insn;
++ if (endianness == BFD_ENDIAN_BIG)
++ insn = (unsigned long) bfd_getb32 (buffer);
++ else
++ insn = (unsigned long) bfd_getl32 (buffer);
++ status = nios2_disassemble (address, insn, info);
+ }
+ else
+ {
@@ -37671,6 +38252,18 @@
+ return status;
+}
+
++int
++print_insn_big_nios2 (bfd_vma address, disassemble_info * info)
++{
++ return print_insn_nios2 (address, info, BFD_ENDIAN_BIG);
++}
++
++int
++print_insn_little_nios2 (bfd_vma address, disassemble_info * info)
++{
++ return print_insn_nios2 (address, info, BFD_ENDIAN_LITTLE);
++}
++
+/* Data structures used by the opcode hash table */
+
+typedef struct _nios2_opcode_hash
@@ -38036,9 +38629,12 @@
+ }
+ return 0;
+}
---- binutils-2.15/opcodes/nios2-opc.c 1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.15-nios2/opcodes/nios2-opc.c 2005-05-17 12:20:14.000000000 +0200
-@@ -0,0 +1,315 @@
+diff --git a/opcodes/nios2-opc.c b/opcodes/nios2-opc.c
+new file mode 100644
+index 0000000..c860207
+--- /dev/null
++++ b/opcodes/nios2-opc.c
+@@ -0,0 +1,320 @@
+/* nios2-opc.c -- Altera New Jersey opcode list.
+
+ Copyright (C) 2003
@@ -38123,7 +38719,7 @@
+ {"pteaddr", 8},
+ {"tlbacc", 9},
+ {"tlbmisc", 10},
-+ {"ctl11", 11},
++ {"fstatus", 11},
+ {"ctl12", 12},
+ {"ctl13", 13},
+ {"ctl14", 14},
@@ -38144,6 +38740,8 @@
+ {"ctl29", 29},
+ {"ctl30", 30},
+ {"ctl31", 31},
++
++ /* alternative names for special control registers */
+ {"ctl0", 0},
+ {"ctl1", 1},
+ {"ctl2", 2},
@@ -38153,6 +38751,7 @@
+ {"ctl8", 8},
+ {"ctl9", 9},
+ {"ctl10", 10},
++ {"ctl11", 11},
+
+ /* coprocessor register names */
+ {"c0", 0},
@@ -38259,6 +38858,7 @@
+ {"break", "b", "b,E", 1, OP_MATCH_BREAK, OP_MASK_BREAK, 0, no_overflow },
+ {"bret", "", "E", 0, OP_MATCH_BRET, OP_MASK, 0, no_overflow },
+ {"flushd", "i(s)", "i(s)E", 2, OP_MATCH_FLUSHD, OP_MASK_IOP, 0, signed_immed16_overflow },
++ {"flushda", "i(s)", "i(s)E", 2, OP_MATCH_FLUSHDA, OP_MASK_IOP, 0, signed_immed16_overflow },
+ {"flushi", "s", "s,E", 1, OP_MATCH_FLUSHI, OP_MASK_FLUSHI, 0, no_overflow },
+ {"flushp", "", "E", 0, OP_MATCH_FLUSHP, OP_MASK, 0, no_overflow },
+ {"initd", "i(s)", "i(s)E", 2, OP_MATCH_INITD, OP_MASK_IOP, 0, signed_immed16_overflow },
@@ -38288,6 +38888,7 @@
+ {"div", "d,s,t", "d,s,t,E", 3, OP_MATCH_DIV, OP_MASK_ROPX | OP_MASK_ROP, 0, no_overflow },
+ {"divu", "d,s,t", "d,s,t,E", 3, OP_MATCH_DIVU, OP_MASK_ROPX | OP_MASK_ROP, 0, no_overflow },
+ {"jmp", "s", "s,E", 1, OP_MATCH_JMP, OP_MASK_JMP, 0, no_overflow },
++ {"jmpi", "m", "m,E", 1, OP_MATCH_JMPI, OP_MASK_IOP, 0, no_overflow },
+ {"ldb", "t,i(s)", "t,i(s)E", 3, OP_MATCH_LDB, OP_MASK_IOP, 0, address_offset_overflow },
+ {"ldbio", "t,i(s)", "t,i(s)E", 3, OP_MATCH_LDBIO, OP_MASK_IOP, 0, address_offset_overflow },
+ {"ldbu", "t,i(s)", "t,i(s)E", 3, OP_MATCH_LDBU, OP_MASK_IOP, 0, address_offset_overflow },
diff --git a/toolchain/binutils/2.15/701-nios2-gcc4-buildfix.patch b/toolchain/binutils/2.15/701-nios2-gcc4-buildfix.patch
index bfc8015b8..e69de29bb 100644
--- a/toolchain/binutils/2.15/701-nios2-gcc4-buildfix.patch
+++ b/toolchain/binutils/2.15/701-nios2-gcc4-buildfix.patch
@@ -1,20 +0,0 @@
---- binutils/gas/config/tc-nios2.c 2007/01/04 16:54:43 194
-+++ binutils/gas/config/tc-nios2.c 2007/01/04 16:58:16 195
-@@ -1661,7 +1661,7 @@
-
-
- /* apply the rightshift */
-- (signed) fixup >>= howto->rightshift;
-+ fixup >>= howto->rightshift;
-
- /* truncate the fixup to right size */
- switch (fixP->fx_r_type)
-@@ -1706,7 +1706,7 @@
- nios2_check_overflow (valueT fixup, reloc_howto_type * howto)
- {
- /* apply the rightshift before checking for overflow */
-- (signed) fixup >>= howto->rightshift;
-+ fixup >>= howto->rightshift;
-
- /* check for overflow - return TRUE if overflow, FALSE if not */
- switch (howto->complain_on_overflow)
diff --git a/toolchain/elf2flt/elf2flt.nios2.conditional b/toolchain/elf2flt/elf2flt.nios2.conditional
index ca99cb3a1..96a3a9710 100644
--- a/toolchain/elf2flt/elf2flt.nios2.conditional
+++ b/toolchain/elf2flt/elf2flt.nios2.conditional
@@ -1,6 +1,6 @@
--- elf2flt/elf2flt.ld
+++ elf2flt/elf2flt.ld
-@@ -62,6 +62,10 @@
+@@ -63,12 +63,16 @@
*(.eh_frame)
*(.gcc_except_table)
@@ -11,8 +11,6 @@
/* Microblaze has .sdata and .sbss (small bss). They must
be contiguous, so please don't move any of this. JW */
_ssrw = . ;
-@@ -72,7 +72,7 @@
- _ssrw = . ;
*(.sdata)
*(.sdata.*)
- *(.sbss) /* Don't move this! */
@@ -20,6 +18,13 @@
_essrw = . ;
_ssrw_size = _essrw - _ssrw;
+@@ -176,4 +180,6 @@
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
++ .debug_frame 0 : { *(.debug_frame) }
++ .debug_str 0 : { *(.debug_str) }
+ }
--- elf2flt/ld-elf2flt.in
+++ elf2flt/ld-elf2flt.in
@@ -132,7 +132,7 @@
diff --git a/toolchain/gcc/3.4.6/900-nios2.patch b/toolchain/gcc/3.4.6/900-nios2.patch
index bfa06a21c..3a84d01ab 100644
--- a/toolchain/gcc/3.4.6/900-nios2.patch
+++ b/toolchain/gcc/3.4.6/900-nios2.patch
@@ -1,17 +1,28 @@
---- gcc-3.4.3/gcc/Makefile.in
-+++ gcc-3.4.3-nios2/gcc/Makefile.in
-@@ -3085,7 +3085,7 @@ install-mkheaders: stmp-int-hdrs $(STMP_
- $(INSTALL_DATA) $(srcdir)/README-fixinc \
- $(DESTDIR)$(itoolsdatadir)/include/README ; \
- $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \
-- $(INSTALL_PROGRAM) fixinc/fixincl $(DESTDIR)$(itoolsdir)/fixincl ; \
-+ $(INSTALL_PROGRAM) fixinc/fixincl$(build_exeext) $(DESTDIR)$(itoolsdir)/fixincl$(build_exeext) ; \
- $(INSTALL_DATA) $(srcdir)/gsyslimits.h \
- $(DESTDIR)$(itoolsdatadir)/gsyslimits.h ; \
- else :; fi
---- gcc-3.4.3/gcc/combine.c
-+++ gcc-3.4.3-nios2/gcc/combine.c
-@@ -4380,6 +4380,14 @@ combine_simplify_rtx (rtx x, enum machin
+diff --git a/config.sub b/config.sub
+index d2e3557..2297c30 100755
+--- a/config.sub
++++ b/config.sub
+@@ -276,6 +276,15 @@ case $basic_machine in
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
++ # JBG
++ nios2 | nios2-* | nios2el | nios2el-*)
++ basic_machine=nios2-altera
++ os=-none_el
++ ;;
++ nios2eb | nios2eb-*)
++ basic_machine=nios2-altera
++ os=-none_eb
++ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+diff --git a/gcc/combine.c b/gcc/combine.c
+index 8f43c23..02648b1 100644
+--- a/gcc/combine.c
++++ b/gcc/combine.c
+@@ -4381,6 +4381,14 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int last,
mode);
}
@@ -26,7 +37,7 @@
else if (STORE_FLAG_VALUE == 1
&& new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
&& op1 == const0_rtx
-@@ -4391,6 +4399,7 @@ combine_simplify_rtx (rtx x, enum machin
+@@ -4392,6 +4400,7 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int last,
gen_lowpart_for_combine (mode, op0),
const1_rtx);
}
@@ -34,8 +45,62 @@
else if (STORE_FLAG_VALUE == 1
&& new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
---- gcc-3.4.3/gcc/config/nios2/crti.asm
-+++ gcc-3.4.3-nios2/gcc/config/nios2/crti.asm
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index d22f34b..4ecb6e9 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -1337,6 +1337,17 @@ m32rle-*-linux*)
+ thread_file='posix'
+ fi
+ ;;
++# JBG
++nios2-*-elf*_eb)
++ tm_file="elfos.h nios2/big.h ${tm_file}"
++ ;;
++nios2-*-elf*)
++ tm_file="elfos.h ${tm_file}"
++ ;;
++nios2-*-uclibc*) # Altera Nios2 running uClinux with uClibc
++ tm_file="elfos.h ${tm_file} nios2/nios2-uclibc.h"
++ tmake_file=nios2/t-nios2-uclibc
++ ;;
+ # m68hc11 and m68hc12 share the same machine description.
+ m68hc11-*-*|m6811-*-*)
+ tm_file="dbxelf.h elfos.h m68hc11/m68hc11.h"
+diff --git a/gcc/config/nios2/big.h b/gcc/config/nios2/big.h
+new file mode 100644
+index 0000000..b7b1731
+--- /dev/null
++++ b/gcc/config/nios2/big.h
+@@ -0,0 +1,23 @@
++/*
++ big.h - Additional definitions for nios2 targets that default to big-endian
++
++ Copyright (C) 2006 Altera
++
++This file is part of GNU CC.
++
++GNU CC 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.
++
++GNU CC 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 GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define TARGET_ENDIAN_DEFAULT BIG_ENDIAN_FLAG
+diff --git a/gcc/config/nios2/crti.asm b/gcc/config/nios2/crti.asm
+new file mode 100644
+index 0000000..1fcfeb2
+--- /dev/null
++++ b/gcc/config/nios2/crti.asm
@@ -0,0 +1,88 @@
+/*
+ Copyright (C) 2003
@@ -125,8 +190,11 @@
+ mov fp, sp
+
+
---- gcc-3.4.3/gcc/config/nios2/crtn.asm
-+++ gcc-3.4.3-nios2/gcc/config/nios2/crtn.asm
+diff --git a/gcc/config/nios2/crtn.asm b/gcc/config/nios2/crtn.asm
+new file mode 100644
+index 0000000..e337480
+--- /dev/null
++++ b/gcc/config/nios2/crtn.asm
@@ -0,0 +1,70 @@
+/*
+ Copyright (C) 2003
@@ -198,8 +266,11 @@
+ addi sp, sp, -48
+ ret
+
---- gcc-3.4.3/gcc/config/nios2/lib2-divmod-hi.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divmod-hi.c
+diff --git a/gcc/config/nios2/lib2-divmod-hi.c b/gcc/config/nios2/lib2-divmod-hi.c
+new file mode 100644
+index 0000000..10bd6e4
+--- /dev/null
++++ b/gcc/config/nios2/lib2-divmod-hi.c
@@ -0,0 +1,123 @@
+
+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is
@@ -324,8 +395,11 @@
+ return udivmodhi4 (a, b, 1);
+}
+
---- gcc-3.4.3/gcc/config/nios2/lib2-divmod.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divmod.c
+diff --git a/gcc/config/nios2/lib2-divmod.c b/gcc/config/nios2/lib2-divmod.c
+new file mode 100644
+index 0000000..00e730d
+--- /dev/null
++++ b/gcc/config/nios2/lib2-divmod.c
@@ -0,0 +1,126 @@
+
+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is
@@ -453,8 +527,11 @@
+ return udivmodsi4 (a, b, 1);
+}
+
---- gcc-3.4.3/gcc/config/nios2/lib2-divtable.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divtable.c
+diff --git a/gcc/config/nios2/lib2-divtable.c b/gcc/config/nios2/lib2-divtable.c
+new file mode 100644
+index 0000000..48a7bd7
+--- /dev/null
++++ b/gcc/config/nios2/lib2-divtable.c
@@ -0,0 +1,46 @@
+
+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is
@@ -502,8 +579,11 @@
+ 0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15,
+};
+
---- gcc-3.4.3/gcc/config/nios2/lib2-mul.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-mul.c
+diff --git a/gcc/config/nios2/lib2-mul.c b/gcc/config/nios2/lib2-mul.c
+new file mode 100644
+index 0000000..8511b33
+--- /dev/null
++++ b/gcc/config/nios2/lib2-mul.c
@@ -0,0 +1,103 @@
+/* while we are debugging (ie compile outside of gcc build)
+ disable gcc specific headers */
@@ -608,10 +688,16 @@
+ return error;
+}
+#endif
---- gcc-3.4.3/gcc/config/nios2/nios2-dp-bit.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/nios2-dp-bit.c
-@@ -0,0 +1,1652 @@
-+
+diff --git a/gcc/config/nios2/nios2-dp-bit.c b/gcc/config/nios2/nios2-dp-bit.c
+new file mode 100644
+index 0000000..4d63748
+--- /dev/null
++++ b/gcc/config/nios2/nios2-dp-bit.c
+@@ -0,0 +1,1655 @@
++
++#ifndef __nios2_big_endian__
++#define FLOAT_BIT_ORDER_MISMATCH
++#endif
+/* This is a software floating point library which can be used
+ for targets without hardware floating point.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004
@@ -2263,10 +2349,16 @@
+
+#endif /* ! FLOAT */
+#endif /* !EXTENDED_FLOAT_STUBS */
---- gcc-3.4.3/gcc/config/nios2/nios2-fp-bit.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/nios2-fp-bit.c
-@@ -0,0 +1,1652 @@
+diff --git a/gcc/config/nios2/nios2-fp-bit.c b/gcc/config/nios2/nios2-fp-bit.c
+new file mode 100644
+index 0000000..839ffcc
+--- /dev/null
++++ b/gcc/config/nios2/nios2-fp-bit.c
+@@ -0,0 +1,1655 @@
+#define FLOAT
++#ifndef __nios2_big_endian__
++#define FLOAT_BIT_ORDER_MISMATCH
++#endif
+/* This is a software floating point library which can be used
+ for targets without hardware floating point.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004
@@ -3918,9 +4010,12 @@
+
+#endif /* ! FLOAT */
+#endif /* !EXTENDED_FLOAT_STUBS */
---- gcc-3.4.3/gcc/config/nios2/nios2-protos.h
-+++ gcc-3.4.3-nios2/gcc/config/nios2/nios2-protos.h
-@@ -0,0 +1,70 @@
+diff --git a/gcc/config/nios2/nios2-protos.h b/gcc/config/nios2/nios2-protos.h
+new file mode 100644
+index 0000000..dc75c4f
+--- /dev/null
++++ b/gcc/config/nios2/nios2-protos.h
+@@ -0,0 +1,78 @@
+/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version.
+ Copyright (C) 2003 Altera
+ Contributed by Jonah Graham (jgraham@altera.com).
@@ -3951,7 +4046,8 @@
+extern void expand_prologue (void);
+extern void expand_epilogue (bool);
+extern void function_profiler (FILE *, int);
-+
++extern enum reg_class reg_class_from_constraint (char, const char *);
++extern void nios2_register_target_pragmas (void);
+
+#ifdef RTX_CODE
+extern int nios2_legitimate_address (rtx, enum machine_mode, int);
@@ -3975,11 +4071,18 @@
+extern int custom_insn_opcode (rtx, enum machine_mode);
+extern int rdwrctl_operand (rtx, enum machine_mode);
+
++/* custom fpu instruction output */
++extern const char *nios2_output_fpu_insn_cmps (rtx, enum rtx_code);
++extern const char *nios2_output_fpu_insn_cmpd (rtx, enum rtx_code);
++
+# ifdef HAVE_MACHINE_MODES
+# if defined TREE_CODE
-+extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
+extern rtx function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int);
++extern int nios2_must_pass_in_stack (enum machine_mode, tree);
+extern int function_arg_partial_nregs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int);
++extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
++extern int nios2_function_arg_padding (enum machine_mode, tree);
++extern int nios2_block_reg_padding (enum machine_mode, tree, int);
+extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
+extern int nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int);
+
@@ -3991,12 +4094,96 @@
+extern int nios2_return_in_memory (tree);
+
+#endif /* TREE_CODE */
---- gcc-3.4.3/gcc/config/nios2/nios2.c
-+++ gcc-3.4.3-nios2/gcc/config/nios2/nios2.c
-@@ -0,0 +1,2853 @@
+diff --git a/gcc/config/nios2/nios2-uclibc.h b/gcc/config/nios2/nios2-uclibc.h
+new file mode 100644
+index 0000000..af98cdd
+--- /dev/null
++++ b/gcc/config/nios2/nios2-uclibc.h
+@@ -0,0 +1,75 @@
++#ifdef USE_UCLIBC
++
++#undef TARGET_SWITCHES
++#define TARGET_SWITCHES \
++{ \
++ { "hw-div", HAS_DIV_FLAG, \
++ N_("Enable DIV, DIVU") }, \
++ { "no-hw-div", -HAS_DIV_FLAG, \
++ N_("Disable DIV, DIVU (default)") }, \
++ { "hw-mul", HAS_MUL_FLAG, \
++ N_("Enable MUL instructions (default)") }, \
++ { "hw-mulx", HAS_MULX_FLAG, \
++ N_("Enable MULX instructions, assume fast shifter") }, \
++ { "no-hw-mul", -HAS_MUL_FLAG, \
++ N_("Disable MUL instructions") }, \
++ { "no-hw-mulx", -HAS_MULX_FLAG, \
++ N_("Disable MULX instructions, assume slow shifter (default and implied by -mno-hw-mul)") }, \
++ { "fast-sw-div", FAST_SW_DIV_FLAG, \
++ N_("Use table based fast divide (default at -O3)") }, \
++ { "no-fast-sw-div", -FAST_SW_DIV_FLAG, \
++ N_("Don't use table based fast divide ever") }, \
++ { "inline-memcpy", INLINE_MEMCPY_FLAG, \
++ N_("Inline small memcpy (default when optimizing)") }, \
++ { "no-inline-memcpy", -INLINE_MEMCPY_FLAG, \
++ N_("Don't Inline small memcpy") }, \
++ { "cache-volatile", CACHE_VOLATILE_FLAG, \
++ N_("Volatile accesses use non-io variants of instructions (default)") }, \
++ { "no-cache-volatile", -CACHE_VOLATILE_FLAG, \
++ N_("Volatile accesses use io variants of instructions") }, \
++ { "bypass-cache", BYPASS_CACHE_FLAG, \
++ N_("All ld/st instructins use io variants") }, \
++ { "no-bypass-cache", -BYPASS_CACHE_FLAG, \
++ N_("All ld/st instructins do not use io variants (default)") }, \
++ { "smallc", 0, \
++ N_("Link with a limited version of the C library") }, \
++ { "stack-check", STACK_CHECK_FLAG, \
++ N_("Enable stack limit checking.") }, \
++ { "no-stack-check", -STACK_CHECK_FLAG, \
++ N_("Disable stack limit checking (default).") }, \
++ { "reverse-bitfields", REVERSE_BITFIELDS_FLAG, \
++ N_("Reverse the order of bitfields in a struct.") }, \
++ { "no-reverse-bitfields", -REVERSE_BITFIELDS_FLAG, \
++ N_("Use the normal order of bitfields in a struct (default).") }, \
++ { "eb", BIG_ENDIAN_FLAG, \
++ N_("Use big-endian byte order") }, \
++ { "el", -BIG_ENDIAN_FLAG, \
++ N_("Use little-endian byte order") }, \
++ { "", TARGET_DEFAULT, 0 } \
++}
++
++/* The GNU C++ standard library requires that these macros be defined. */
++#undef CPLUSPLUS_CPP_SPEC
++#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
++
++#undef LIB_SPEC
++#define LIB_SPEC \
++"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \
++ %{msys-lib=*: -l%*} \
++ %{!msys-lib=*: -lc} \
++ --end-group \
++ %{msys-lib=: %eYou need a library name for -msys-lib=} \
++"
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC \
++"%{msys-crt0=*: %*} %{!msys-crt0=*: crt1%O%s} \
++ %{msys-crt0=: %eYou need a C startup file for -msys-crt0=} \
++ crti%O%s crtbegin%O%s \
++"
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC \
++ " crtend%O%s crtn%O%s"
++
++#endif /* USE_UCLIBC */
+diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
+new file mode 100644
+index 0000000..8723a86
+--- /dev/null
++++ b/gcc/config/nios2/nios2.c
+@@ -0,0 +1,4694 @@
+/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version.
-+ Copyright (C) 2003 Altera
-+ Contributed by Jonah Graham (jgraham@altera.com).
++ Copyright (C) 2005 Altera
++ Contributed by Jonah Graham (jgraham@altera.com) and Will Reece (wreece@altera.com).
+
+This file is part of GNU CC.
+
@@ -4043,6 +4230,8 @@
+#include "optabs.h"
+#include "target.h"
+#include "target-def.h"
++#include "c-pragma.h" /* for c_register_pragma */
++#include "cpplib.h" /* for CPP_NUMBER */
+
+/* local prototypes */
+static bool nios2_rtx_costs (rtx, int, int, int *);
@@ -4055,6 +4244,16 @@
+static rtx save_reg (int, HOST_WIDE_INT, rtx);
+static rtx restore_reg (int, HOST_WIDE_INT);
+static unsigned int nios2_section_type_flags (tree, const char *, int);
++
++/* 0 --> no #pragma seen
++ 1 --> in scope of #pragma reverse_bitfields
++ -1 --> in scope of #pragma no_reverse_bitfields */
++static int nios2_pragma_reverse_bitfields_flag = 0;
++static void nios2_pragma_reverse_bitfields (struct cpp_reader *);
++static void nios2_pragma_no_reverse_bitfields (struct cpp_reader *);
++static tree nios2_handle_struct_attribute (tree *, tree, tree, int, bool *);
++static void nios2_insert_attributes (tree, tree *);
++static bool nios2_reverse_bitfield_layout_p (tree record_type);
+static void nios2_init_builtins (void);
+static rtx nios2_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
+static bool nios2_function_ok_for_sibcall (tree, tree);
@@ -4076,6 +4275,9 @@
+#undef TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS nios2_section_type_flags
+
++#undef TARGET_REVERSE_BITFIELD_LAYOUT_P
++#define TARGET_REVERSE_BITFIELD_LAYOUT_P nios2_reverse_bitfield_layout_p
++
+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS nios2_init_builtins
+#undef TARGET_EXPAND_BUILTIN
@@ -4087,6 +4289,24 @@
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS nios2_rtx_costs
+
++const struct attribute_spec nios2_attribute_table[] =
++{
++ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
++ { "reverse_bitfields", 0, 0, false, false, false, nios2_handle_struct_attribute },
++ { "no_reverse_bitfields", 0, 0, false, false, false, nios2_handle_struct_attribute },
++ { "pragma_reverse_bitfields", 0, 0, false, false, false, NULL },
++ { "pragma_no_reverse_bitfields", 0, 0, false, false, false, NULL },
++ { NULL, 0, 0, false, false, false, NULL }
++};
++
++#undef TARGET_ATTRIBUTE_TABLE
++#define TARGET_ATTRIBUTE_TABLE nios2_attribute_table
++
++#undef TARGET_INSERT_ATTRIBUTES
++#define TARGET_INSERT_ATTRIBUTES nios2_insert_attributes
++
++/* ??? Might want to redefine TARGET_RETURN_IN_MSB here to handle
++ big-endian case; depends on what ABI we choose. */
+
+struct gcc_target targetm = TARGET_INITIALIZER;
+
@@ -4125,11 +4345,27 @@
+
+
+/***************************************
-+ * Section encodings
++ * Register Classes
+ ***************************************/
+
++enum reg_class
++reg_class_from_constraint (char chr, const char *str)
++{
++ if (chr == 'D' && ISDIGIT (str[1]) && ISDIGIT (str[2]))
++ {
++ int regno;
++ int ones = str[2] - '0';
++ int tens = str[1] - '0';
++
++ regno = ones + (10 * tens);
++ if (regno < 0 || regno > 31)
++ return NO_REGS;
+
++ return D00_REG + regno;
++ }
+
++ return NO_REGS;
++}
+
+
+/***************************************
@@ -4239,7 +4475,7 @@
+{
+ int i;
+ HOST_WIDE_INT total_frame_size;
-+ int cfa_store_offset;
++ int cfa_store_offset = 0;
+ rtx insn;
+ rtx cfa_store_reg = 0;
+
@@ -4304,6 +4540,11 @@
+ = cfun->machine->frame.save_regs_offset
+ + cfun->machine->frame.save_reg_rounded;
+ }
++
++ if (current_function_limit_stack)
++ {
++ emit_insn (gen_stack_overflow_detect_and_trap ());
++ }
+ }
+
+ if (MUST_SAVE_REGISTER (RA_REGNO))
@@ -4433,17 +4674,11 @@
+ * ----------------------- */
+
+void
-+function_profiler (FILE *file, int labelno)
-+{
-+ fprintf (file, "\t%s mcount begin, label: .LP%d\n",
-+ ASM_COMMENT_START, labelno);
-+ fprintf (file, "\tnextpc\tr8\n");
-+ fprintf (file, "\tmov\tr9, ra\n");
-+ fprintf (file, "\tmovhi\tr10, %%hiadj(.LP%d)\n", labelno);
-+ fprintf (file, "\taddi\tr10, r10, %%lo(.LP%d)\n", labelno);
++function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED)
++{
++ fprintf (file, "\tmov\tr8, ra\n");
+ fprintf (file, "\tcall\tmcount\n");
-+ fprintf (file, "\tmov\tra, r9\n");
-+ fprintf (file, "\t%s mcount end\n", ASM_COMMENT_START);
++ fprintf (file, "\tmov\tra, r8\n");
+}
+
+
@@ -4593,13 +4828,490 @@
+ *
+ ***************************************/
+
++/*
++ * Try to take a bit of tedium out of the __builtin_custom_<blah>
++ * builtin functions, too.
++ */
++
++#define NIOS2_FOR_ALL_CUSTOM_BUILTINS \
++ NIOS2_DO_BUILTIN (N, n, n ) \
++ NIOS2_DO_BUILTIN (NI, ni, nX ) \
++ NIOS2_DO_BUILTIN (NF, nf, nX ) \
++ NIOS2_DO_BUILTIN (NP, np, nX ) \
++ NIOS2_DO_BUILTIN (NII, nii, nXX ) \
++ NIOS2_DO_BUILTIN (NIF, nif, nXX ) \
++ NIOS2_DO_BUILTIN (NIP, nip, nXX ) \
++ NIOS2_DO_BUILTIN (NFI, nfi, nXX ) \
++ NIOS2_DO_BUILTIN (NFF, nff, nXX ) \
++ NIOS2_DO_BUILTIN (NFP, nfp, nXX ) \
++ NIOS2_DO_BUILTIN (NPI, npi, nXX ) \
++ NIOS2_DO_BUILTIN (NPF, npf, nXX ) \
++ NIOS2_DO_BUILTIN (NPP, npp, nXX ) \
++ NIOS2_DO_BUILTIN (IN, in, Xn ) \
++ NIOS2_DO_BUILTIN (INI, ini, XnX ) \
++ NIOS2_DO_BUILTIN (INF, inf, XnX ) \
++ NIOS2_DO_BUILTIN (INP, inp, XnX ) \
++ NIOS2_DO_BUILTIN (INII, inii, XnXX ) \
++ NIOS2_DO_BUILTIN (INIF, inif, XnXX ) \
++ NIOS2_DO_BUILTIN (INIP, inip, XnXX ) \
++ NIOS2_DO_BUILTIN (INFI, infi, XnXX ) \
++ NIOS2_DO_BUILTIN (INFF, inff, XnXX ) \
++ NIOS2_DO_BUILTIN (INFP, infp, XnXX ) \
++ NIOS2_DO_BUILTIN (INPI, inpi, XnXX ) \
++ NIOS2_DO_BUILTIN (INPF, inpf, XnXX ) \
++ NIOS2_DO_BUILTIN (INPP, inpp, XnXX ) \
++ NIOS2_DO_BUILTIN (FN, fn, Xn ) \
++ NIOS2_DO_BUILTIN (FNI, fni, XnX ) \
++ NIOS2_DO_BUILTIN (FNF, fnf, XnX ) \
++ NIOS2_DO_BUILTIN (FNP, fnp, XnX ) \
++ NIOS2_DO_BUILTIN (FNII, fnii, XnXX ) \
++ NIOS2_DO_BUILTIN (FNIF, fnif, XnXX ) \
++ NIOS2_DO_BUILTIN (FNIP, fnip, XnXX ) \
++ NIOS2_DO_BUILTIN (FNFI, fnfi, XnXX ) \
++ NIOS2_DO_BUILTIN (FNFF, fnff, XnXX ) \
++ NIOS2_DO_BUILTIN (FNFP, fnfp, XnXX ) \
++ NIOS2_DO_BUILTIN (FNPI, fnpi, XnXX ) \
++ NIOS2_DO_BUILTIN (FNPF, fnpf, XnXX ) \
++ NIOS2_DO_BUILTIN (FNPP, fnpp, XnXX ) \
++ NIOS2_DO_BUILTIN (PN, pn, Xn ) \
++ NIOS2_DO_BUILTIN (PNI, pni, XnX ) \
++ NIOS2_DO_BUILTIN (PNF, pnf, XnX ) \
++ NIOS2_DO_BUILTIN (PNP, pnp, XnX ) \
++ NIOS2_DO_BUILTIN (PNII, pnii, XnXX ) \
++ NIOS2_DO_BUILTIN (PNIF, pnif, XnXX ) \
++ NIOS2_DO_BUILTIN (PNIP, pnip, XnXX ) \
++ NIOS2_DO_BUILTIN (PNFI, pnfi, XnXX ) \
++ NIOS2_DO_BUILTIN (PNFF, pnff, XnXX ) \
++ NIOS2_DO_BUILTIN (PNFP, pnfp, XnXX ) \
++ NIOS2_DO_BUILTIN (PNPI, pnpi, XnXX ) \
++ NIOS2_DO_BUILTIN (PNPF, pnpf, XnXX ) \
++ NIOS2_DO_BUILTIN (PNPP, pnpp, XnXX )
++
+const char *nios2_sys_nosys_string; /* for -msys=nosys */
+const char *nios2_sys_lib_string; /* for -msys-lib= */
+const char *nios2_sys_crt0_string; /* for -msys-crt0= */
+
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++static const char *NIOS2_CONCAT (nios2_output_fpu_insn_, insn) (rtx); \
++static void NIOS2_CONCAT (nios2_pragma_, insn) (struct cpp_reader *); \
++static void NIOS2_CONCAT (nios2_pragma_no_, insn) (struct cpp_reader *);
++NIOS2_FOR_ALL_FPU_INSNS
++
++nios2_fpu_info nios2_fpu_insns[nios2_fpu_max_insn] = {
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ { NIOS2_STRINGIFY (opt), \
++ NIOS2_STRINGIFY (insn), \
++ NIOS2_STRINGIFY (args), \
++ 0, \
++ -1, \
++ NIOS2_CONCAT (nios2_output_fpu_insn_, insn), \
++ "custom_" NIOS2_STRINGIFY (opt), \
++ NIOS2_CONCAT (nios2_pragma_, insn), \
++ "no_custom_" NIOS2_STRINGIFY (opt), \
++ NIOS2_CONCAT (nios2_pragma_no_, insn), \
++ 0, \
++ 0, \
++ 0, \
++ 0, \
++ 0 },
++ NIOS2_FOR_ALL_FPU_INSNS
++};
++
++const char *nios2_custom_fpu_cfg_string;
++
++static const char *builtin_custom_seen[256];
++
++static void
++nios2_custom_switch (const char *parameter, int *value, const char *opt)
++{
++ /*
++ * We only document values from 0-255, but we secretly allow -1 so
++ * that the -mno-custom-<opt> switches work.
++ */
++ if (parameter && *parameter)
++ {
++ char *endptr;
++ long v = strtol (parameter, &endptr, 0);
++ if (*endptr)
++ {
++ error ("switch `-mcustom-%s' value `%s' must be a number between 0 and 255",
++ opt, parameter);
++ }
++ if (v < -1 || v > 255)
++ {
++ error ("switch `-mcustom-%s' value %ld must be between 0 and 255",
++ opt, v);
++ }
++ *value = (int)v;
++ }
++}
++
++static void
++nios2_custom_check_insns (int is_pragma)
++{
++ int i;
++ int has_double = 0;
++ int errors = 0;
++ const char *ns[256];
++ int ps[256];
++
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ if (nios2_fpu_insns[i].is_double && nios2_fpu_insns[i].N >= 0)
++ {
++ has_double = 1;
++ }
++ }
++
++ if (has_double)
++ {
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ if (nios2_fpu_insns[i].needed_by_double
++ && nios2_fpu_insns[i].N < 0)
++ {
++ if (is_pragma)
++ {
++ error ("either switch `-mcustom-%s' or `#pragma custom_%s' is required for double precision floating point",
++ nios2_fpu_insns[i].option,
++ nios2_fpu_insns[i].option);
++ }
++ else
++ {
++ error ("switch `-mcustom-%s' is required for double precision floating point",
++ nios2_fpu_insns[i].option);
++ }
++ errors = 1;
++ }
++ }
++ }
++
++ /*
++ * Warn if the user has certain exotic operations that won't get used
++ * without -funsafe-math-optimizations, See expand_builtin () in
++ * bulitins.c.
++ */
++ if (!flag_unsafe_math_optimizations)
++ {
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ if (nios2_fpu_insns[i].needs_unsafe && nios2_fpu_insns[i].N >= 0)
++ {
++ warning ("%s%s' has no effect unless -funsafe-math-optimizations is specified",
++ is_pragma ? "`#pragma custom_" : "switch `-mcustom-",
++ nios2_fpu_insns[i].option);
++ /* Just one warning per function per compilation unit, please. */
++ nios2_fpu_insns[i].needs_unsafe = 0;
++ }
++ }
++ }
++
++ /*
++ * Warn if the user is trying to use -mcustom-fmins et. al, that won't
++ * get used without -ffinite-math-only. See fold in fold () in
++ * fold-const.c
++ */
++ if (!flag_finite_math_only)
++ {
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ if (nios2_fpu_insns[i].needs_finite && nios2_fpu_insns[i].N >= 0)
++ {
++ warning ("%s%s' has no effect unless -ffinite-math-only is specified",
++ is_pragma ? "`#pragma custom_" : "switch `-mcustom-",
++ nios2_fpu_insns[i].option);
++ /* Just one warning per function per compilation unit, please. */
++ nios2_fpu_insns[i].needs_finite = 0;
++ }
++ }
++ }
++
++ /*
++ * Warn the user about double precision divide braindamage until we
++ * can fix it properly. See the RDIV_EXPR case of expand_expr_real in
++ * expr.c.
++ */
++ {
++ static int warned = 0;
++ if (flag_unsafe_math_optimizations
++ && !optimize_size
++ && nios2_fpu_insns[nios2_fpu_divdf3].N >= 0
++ && !warned)
++ {
++ warning ("%s%s' behaves poorly without -Os",
++ is_pragma ? "`#pragma custom_" : "switch `-mcustom-",
++ nios2_fpu_insns[nios2_fpu_divdf3].option);
++ warned = 1;
++ }
++ }
++
++ /*
++ * The following bit of voodoo is lifted from the generated file
++ * insn-opinit.c: to allow #pragmas to work properly, we have to tweak
++ * the optab_table manually -- it only gets initialized once after the
++ * switches are handled and before any #pragmas are seen.
++ */
++ if (is_pragma)
++ {
++ /* Only do this if the optabs have already been defined, not
++ when we're handling command line switches. */
++ addv_optab->handlers[SFmode].insn_code =
++ add_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ addv_optab->handlers[DFmode].insn_code =
++ add_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ subv_optab->handlers[SFmode].insn_code =
++ sub_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ subv_optab->handlers[DFmode].insn_code =
++ sub_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ smulv_optab->handlers[SFmode].insn_code =
++ smul_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ smulv_optab->handlers[DFmode].insn_code =
++ smul_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ sdiv_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ sdiv_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ negv_optab->handlers[SFmode].insn_code =
++ neg_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ negv_optab->handlers[DFmode].insn_code =
++ neg_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ smin_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ smin_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ smax_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ smax_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ absv_optab->handlers[SFmode].insn_code =
++ abs_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ absv_optab->handlers[DFmode].insn_code =
++ abs_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ sqrt_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ sqrt_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ cos_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ cos_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ sin_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ sin_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ tan_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ tan_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ atan_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ atan_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ exp_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ exp_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ log_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ log_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++ sfloat_optab->handlers[SFmode][SImode].insn_code = CODE_FOR_nothing;
++ sfloat_optab->handlers[DFmode][SImode].insn_code = CODE_FOR_nothing;
++ ufloat_optab->handlers[SFmode][SImode].insn_code = CODE_FOR_nothing;
++ ufloat_optab->handlers[DFmode][SImode].insn_code = CODE_FOR_nothing;
++ sfix_optab->handlers[SImode][SFmode].insn_code = CODE_FOR_nothing;
++ sfix_optab->handlers[SImode][DFmode].insn_code = CODE_FOR_nothing;
++ ufix_optab->handlers[SImode][SFmode].insn_code = CODE_FOR_nothing;
++ ufix_optab->handlers[SImode][DFmode].insn_code = CODE_FOR_nothing;
++ sext_optab->handlers[DFmode][SFmode].insn_code = CODE_FOR_nothing;
++ trunc_optab->handlers[SFmode][DFmode].insn_code = CODE_FOR_nothing;
++ cmp_optab->handlers[SFmode].insn_code = CODE_FOR_nothing;
++ cmp_optab->handlers[DFmode].insn_code = CODE_FOR_nothing;
++
++ if (HAVE_addsf3)
++ addv_optab->handlers[SFmode].insn_code =
++ add_optab->handlers[SFmode].insn_code = CODE_FOR_addsf3;
++ if (HAVE_adddf3)
++ addv_optab->handlers[DFmode].insn_code =
++ add_optab->handlers[DFmode].insn_code = CODE_FOR_adddf3;
++ if (HAVE_subsf3)
++ subv_optab->handlers[SFmode].insn_code =
++ sub_optab->handlers[SFmode].insn_code = CODE_FOR_subsf3;
++ if (HAVE_subdf3)
++ subv_optab->handlers[DFmode].insn_code =
++ sub_optab->handlers[DFmode].insn_code = CODE_FOR_subdf3;
++ if (HAVE_mulsf3)
++ smulv_optab->handlers[SFmode].insn_code =
++ smul_optab->handlers[SFmode].insn_code = CODE_FOR_mulsf3;
++ if (HAVE_muldf3)
++ smulv_optab->handlers[DFmode].insn_code =
++ smul_optab->handlers[DFmode].insn_code = CODE_FOR_muldf3;
++ if (HAVE_divsf3)
++ sdiv_optab->handlers[SFmode].insn_code = CODE_FOR_divsf3;
++ if (HAVE_divdf3)
++ sdiv_optab->handlers[DFmode].insn_code = CODE_FOR_divdf3;
++ if (HAVE_negsf2)
++ negv_optab->handlers[SFmode].insn_code =
++ neg_optab->handlers[SFmode].insn_code = CODE_FOR_negsf2;
++ if (HAVE_negdf2)
++ negv_optab->handlers[DFmode].insn_code =
++ neg_optab->handlers[DFmode].insn_code = CODE_FOR_negdf2;
++ if (HAVE_minsf3)
++ smin_optab->handlers[SFmode].insn_code = CODE_FOR_minsf3;
++ if (HAVE_mindf3)
++ smin_optab->handlers[DFmode].insn_code = CODE_FOR_mindf3;
++ if (HAVE_maxsf3)
++ smax_optab->handlers[SFmode].insn_code = CODE_FOR_maxsf3;
++ if (HAVE_maxdf3)
++ smax_optab->handlers[DFmode].insn_code = CODE_FOR_maxdf3;
++ if (HAVE_abssf2)
++ absv_optab->handlers[SFmode].insn_code =
++ abs_optab->handlers[SFmode].insn_code = CODE_FOR_abssf2;
++ if (HAVE_absdf2)
++ absv_optab->handlers[DFmode].insn_code =
++ abs_optab->handlers[DFmode].insn_code = CODE_FOR_absdf2;
++ if (HAVE_sqrtsf2)
++ sqrt_optab->handlers[SFmode].insn_code = CODE_FOR_sqrtsf2;
++ if (HAVE_sqrtdf2)
++ sqrt_optab->handlers[DFmode].insn_code = CODE_FOR_sqrtdf2;
++ if (HAVE_cossf2)
++ cos_optab->handlers[SFmode].insn_code = CODE_FOR_cossf2;
++ if (HAVE_cosdf2)
++ cos_optab->handlers[DFmode].insn_code = CODE_FOR_cosdf2;
++ if (HAVE_sinsf2)
++ sin_optab->handlers[SFmode].insn_code = CODE_FOR_sinsf2;
++ if (HAVE_sindf2)
++ sin_optab->handlers[DFmode].insn_code = CODE_FOR_sindf2;
++ if (HAVE_tansf2)
++ tan_optab->handlers[SFmode].insn_code = CODE_FOR_tansf2;
++ if (HAVE_tandf2)
++ tan_optab->handlers[DFmode].insn_code = CODE_FOR_tandf2;
++ if (HAVE_atansf2)
++ atan_optab->handlers[SFmode].insn_code = CODE_FOR_atansf2;
++ if (HAVE_atandf2)
++ atan_optab->handlers[DFmode].insn_code = CODE_FOR_atandf2;
++ if (HAVE_expsf2)
++ exp_optab->handlers[SFmode].insn_code = CODE_FOR_expsf2;
++ if (HAVE_expdf2)
++ exp_optab->handlers[DFmode].insn_code = CODE_FOR_expdf2;
++ if (HAVE_logsf2)
++ log_optab->handlers[SFmode].insn_code = CODE_FOR_logsf2;
++ if (HAVE_logdf2)
++ log_optab->handlers[DFmode].insn_code = CODE_FOR_logdf2;
++ if (HAVE_floatsisf2)
++ sfloat_optab->handlers[SFmode][SImode].insn_code = CODE_FOR_floatsisf2;
++ if (HAVE_floatsidf2)
++ sfloat_optab->handlers[DFmode][SImode].insn_code = CODE_FOR_floatsidf2;
++ if (HAVE_floatunssisf2)
++ ufloat_optab->handlers[SFmode][SImode].insn_code = CODE_FOR_floatunssisf2;
++ if (HAVE_floatunssidf2)
++ ufloat_optab->handlers[DFmode][SImode].insn_code = CODE_FOR_floatunssidf2;
++ if (HAVE_fixsfsi2)
++ sfix_optab->handlers[SImode][SFmode].insn_code = CODE_FOR_fixsfsi2;
++ if (HAVE_fixdfsi2)
++ sfix_optab->handlers[SImode][DFmode].insn_code = CODE_FOR_fixdfsi2;
++ if (HAVE_fixunssfsi2)
++ ufix_optab->handlers[SImode][SFmode].insn_code = CODE_FOR_fixunssfsi2;
++ if (HAVE_fixunsdfsi2)
++ ufix_optab->handlers[SImode][DFmode].insn_code = CODE_FOR_fixunsdfsi2;
++ if (HAVE_extendsfdf2)
++ sext_optab->handlers[DFmode][SFmode].insn_code = CODE_FOR_extendsfdf2;
++ if (HAVE_truncdfsf2)
++ trunc_optab->handlers[SFmode][DFmode].insn_code = CODE_FOR_truncdfsf2;
++ if (HAVE_cmpsf)
++ cmp_optab->handlers[SFmode].insn_code = CODE_FOR_cmpsf;
++ if (HAVE_cmpdf)
++ cmp_optab->handlers[DFmode].insn_code = CODE_FOR_cmpdf;
++ }
++
++ /* Check for duplicate values of N */
++ for (i = 0; i < 256; i++)
++ {
++ ns[i] = 0;
++ ps[i] = 0;
++ }
++
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ int N = nios2_fpu_insns[i].N;
++ if (N >= 0)
++ {
++ if (ns[N])
++ {
++ error ("%s%s' conflicts with %s%s'",
++ is_pragma ? "`#pragma custom_" : "switch `-mcustom-",
++ nios2_fpu_insns[i].option,
++ ps[N] ? "`#pragma custom_" : "switch `-mcustom-",
++ ns[N]);
++ errors = 1;
++ }
++ else if (builtin_custom_seen[N])
++ {
++ error ("call to `%s' conflicts with %s%s'",
++ builtin_custom_seen[N],
++ (nios2_fpu_insns[i].pragma_seen
++ ? "`#pragma custom_" : "switch `-mcustom-"),
++ nios2_fpu_insns[i].option);
++ errors = 1;
++ }
++ else
++ {
++ ns[N] = nios2_fpu_insns[i].option;
++ ps[N] = nios2_fpu_insns[i].pragma_seen;
++ }
++ }
++ }
++
++ if (errors)
++ {
++ fatal_error ("conflicting use of -mcustom switches, #pragmas, and/or __builtin_custom_ functions");
++ }
++}
++
++static void
++nios2_handle_custom_fpu_cfg (const char *cfg, int is_pragma)
++{
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ int opt = nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)].N;
++NIOS2_FOR_ALL_FPU_INSNS
++
++ /*
++ * ??? These are just some sample possibilities. We'll change these
++ * at the last minute to match the capabilities of the actual fpu.
++ */
++ if (!strcasecmp (cfg, "60-1"))
++ {
++ fmuls = 252;
++ fadds = 253;
++ fsubs = 254;
++ flag_single_precision_constant = 1;
++ }
++ else if (!strcasecmp (cfg, "60-2"))
++ {
++ fmuls = 252;
++ fadds = 253;
++ fsubs = 254;
++ fdivs = 255;
++ flag_single_precision_constant = 1;
++ }
++ else if (!strcasecmp (cfg, "72-3"))
++ {
++ floatus = 243;
++ fixsi = 244;
++ floatis = 245;
++ fcmpgts = 246;
++ fcmples = 249;
++ fcmpeqs = 250;
++ fcmpnes = 251;
++ fmuls = 252;
++ fadds = 253;
++ fsubs = 254;
++ fdivs = 255;
++ flag_single_precision_constant = 1;
++ }
++ else
++ {
++ warning ("ignoring unrecognized %sfpu-cfg' value `%s'",
++ is_pragma ? "`#pragma custom_" : "switch -mcustom-", cfg);
++ }
++
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)].N = opt;
++NIOS2_FOR_ALL_FPU_INSNS
++
++ /* Guard against errors in the standard configurations. */
++ nios2_custom_check_insns (is_pragma);
++}
++
+void
+override_options ()
+{
++ int i;
++
+ /* Function to allocate machine-dependent function status. */
+ init_machine_status = &nios2_init_machine_status;
+
@@ -4617,6 +5329,69 @@
+ target_flags &= ~HAS_MULX_FLAG;
+ }
+
++ /* Set up for stack limit checking */
++ if (TARGET_STACK_CHECK)
++ {
++ stack_limit_rtx = gen_rtx_REG(SImode, ET_REGNO);
++ }
++
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ nios2_fpu_insns[i].is_double = (nios2_fpu_insns[i].args[0] == 'd'
++ || nios2_fpu_insns[i].args[0] == 'd'
++ || nios2_fpu_insns[i].args[0] == 'd');
++ nios2_fpu_insns[i].needed_by_double = (i == nios2_fpu_nios2_fwrx
++ || i == nios2_fpu_nios2_fwry
++ || i == nios2_fpu_nios2_frdxlo
++ || i == nios2_fpu_nios2_frdxhi
++ || i == nios2_fpu_nios2_frdy);
++ nios2_fpu_insns[i].needs_unsafe = (i == nios2_fpu_cossf2
++ || i == nios2_fpu_cosdf2
++ || i == nios2_fpu_sinsf2
++ || i == nios2_fpu_sindf2
++ || i == nios2_fpu_tansf2
++ || i == nios2_fpu_tandf2
++ || i == nios2_fpu_atansf2
++ || i == nios2_fpu_atandf2
++ || i == nios2_fpu_expsf2
++ || i == nios2_fpu_expdf2
++ || i == nios2_fpu_logsf2
++ || i == nios2_fpu_logdf2);
++ nios2_fpu_insns[i].needs_finite = (i == nios2_fpu_minsf3
++ || i == nios2_fpu_maxsf3
++ || i == nios2_fpu_mindf3
++ || i == nios2_fpu_maxdf3);
++ }
++
++ /*
++ * We haven't seen any __builtin_custom functions yet.
++ */
++ for (i = 0; i < 256; i++)
++ {
++ builtin_custom_seen[i] = 0;
++ }
++
++ /*
++ * Set up default handling for floating point custom instructions.
++ *
++ * Putting things in this order means that the -mcustom-fpu-cfg=
++ * switch will always be overridden by individual -mcustom-fadds=
++ * switches, regardless of the order in which they were specified
++ * on the command line. ??? Remember to document this.
++ */
++ if (nios2_custom_fpu_cfg_string && *nios2_custom_fpu_cfg_string)
++ {
++ nios2_handle_custom_fpu_cfg (nios2_custom_fpu_cfg_string, 0);
++ }
++
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ nios2_custom_switch (nios2_fpu_insns[i].value,
++ &nios2_fpu_insns[i].N,
++ nios2_fpu_insns[i].option);
++ }
++
++ nios2_custom_check_insns (0);
+}
+
+void
@@ -4926,6 +5701,78 @@
+ return test;
+}
+
++bool have_nios2_fpu_cmp_insn( enum rtx_code cond_t, enum cmp_type cmp_t );
++enum rtx_code get_reverse_cond(enum rtx_code cond_t);
++
++bool
++have_nios2_fpu_cmp_insn( enum rtx_code cond_t, enum cmp_type cmp_t )
++{
++ if (cmp_t == CMP_SF)
++ {
++ switch (cond_t) {
++ case EQ:
++ return (nios2_fpu_insns[nios2_fpu_nios2_seqsf].N >= 0);
++ case NE:
++ return (nios2_fpu_insns[nios2_fpu_nios2_snesf].N >= 0);
++ case GT:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sgtsf].N >= 0);
++ case GE:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sgesf].N >= 0);
++ case LT:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sltsf].N >= 0);
++ case LE:
++ return (nios2_fpu_insns[nios2_fpu_nios2_slesf].N >= 0);
++ default:
++ break;
++ }
++ }
++ else if (cmp_t == CMP_DF)
++ {
++ switch (cond_t) {
++ case EQ:
++ return (nios2_fpu_insns[nios2_fpu_nios2_seqdf].N >= 0);
++ case NE:
++ return (nios2_fpu_insns[nios2_fpu_nios2_snedf].N >= 0);
++ case GT:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sgtdf].N >= 0);
++ case GE:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sgedf].N >= 0);
++ case LT:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sltdf].N >= 0);
++ case LE:
++ return (nios2_fpu_insns[nios2_fpu_nios2_sledf].N >= 0);
++ default:
++ break;
++ }
++ }
++
++ return false;
++}
++
++/* Note that get_reverse_cond() is not the same as get_inverse_cond()
++ get_reverse_cond() means that if the operand order is reversed,
++ what is the operand that is needed to generate the same condition?
++*/
++enum rtx_code
++get_reverse_cond(enum rtx_code cond_t)
++{
++ switch (cond_t)
++ {
++ case GT: return LT;
++ case GE: return LE;
++ case LT: return GT;
++ case LE: return GE;
++ case GTU: return LTU;
++ case GEU: return LEU;
++ case LTU: return GTU;
++ case LEU: return GEU;
++ default: break;
++ }
++
++ return cond_t;
++}
++
++
+/* Generate the code to compare (and possibly branch) two integer values
+ TEST_CODE is the comparison code we are trying to emulate
+ (or implement directly)
@@ -4981,8 +5828,6 @@
+ int branch_p;
+
+
-+
-+
+ test = map_test_to_internal_test (test_code);
+ if (test == ITEST_MAX)
+ abort ();
@@ -4995,6 +5840,56 @@
+
+ branch_p = (destination != 0);
+
++ /* Handle floating point comparison directly. */
++ if (branch_type == CMP_SF || branch_type == CMP_DF)
++ {
++
++ bool reverse_operands = false;
++
++ enum machine_mode float_mode = (branch_type == CMP_SF) ? SFmode : DFmode;
++
++ if (!register_operand (cmp0, float_mode)
++ || !register_operand (cmp1, float_mode))
++ {
++ abort ();
++ }
++
++ if (branch_p)
++ {
++ test_code = p_info->test_code_reg;
++ reverse_operands = (p_info->reverse_regs);
++ }
++
++ if ( !have_nios2_fpu_cmp_insn(test_code, branch_type) &&
++ have_nios2_fpu_cmp_insn(get_reverse_cond(test_code), branch_type) )
++ {
++ test_code = get_reverse_cond(test_code);
++ reverse_operands = !reverse_operands;
++ }
++
++ if (reverse_operands)
++ {
++ rtx temp = cmp0;
++ cmp0 = cmp1;
++ cmp1 = temp;
++ }
++
++ if (branch_p)
++ {
++ rtx cond = gen_rtx (test_code, SImode, cmp0, cmp1);
++ rtx label = gen_rtx_LABEL_REF (VOIDmode, destination);
++ rtx insn = gen_rtx_SET (VOIDmode, pc_rtx,
++ gen_rtx_IF_THEN_ELSE (VOIDmode,
++ cond, label, pc_rtx));
++ emit_jump_insn (insn);
++ }
++ else
++ {
++ emit_move_insn (result, gen_rtx (test_code, SImode, cmp0, cmp1));
++ }
++ return;
++ }
++
+ /* We can't, under any circumstances, have const_ints in cmp0
+ ??? Actually we could have const0 */
+ if (GET_CODE (cmp0) == CONST_INT)
@@ -5172,10 +6067,10 @@
+
+ if (REG_P (op0) && REG_P (op1))
+ ret_val = 0;
-+ else if (REG_P (op0) && CONSTANT_P (op1))
++ else if (REG_P (op0) && GET_CODE (op1) == CONST_INT)
+ ret_val = REG_OK_FOR_BASE_P2 (op0, strict)
+ && SMALL_INT (INTVAL (op1));
-+ else if (REG_P (op1) && CONSTANT_P (op0))
++ else if (REG_P (op1) && GET_CODE (op0) == CONST_INT)
+ ret_val = REG_OK_FOR_BASE_P2 (op1, strict)
+ && SMALL_INT (INTVAL (op0));
+ else
@@ -5218,7 +6113,7 @@
+
+ /* If this is an incomplete type with size 0, then we can't put it
+ in sdata because it might be too big when completed. */
-+ if (size > 0 && size <= nios2_section_threshold)
++ if (size > 0 && (unsigned HOST_WIDE_INT)size <= nios2_section_threshold)
+ return true;
+ }
+
@@ -5269,7 +6164,221 @@
+ return flags;
+}
+
++/* Handle a #pragma reverse_bitfields */
++static void
++nios2_pragma_reverse_bitfields (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
++{
++ nios2_pragma_reverse_bitfields_flag = 1; /* Reverse */
++}
++
++/* Handle a #pragma no_reverse_bitfields */
++static void
++nios2_pragma_no_reverse_bitfields (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
++{
++ nios2_pragma_reverse_bitfields_flag = -1; /* Forward */
++}
++
++/* Handle the various #pragma custom_<switch>s */
++static void
++nios2_pragma_fpu (int *value, const char *opt, int *seen)
++{
++ tree t;
++ if (c_lex (&t) != CPP_NUMBER)
++ {
++ error ("`#pragma custom_%s' value must be a number between 0 and 255",
++ opt);
++ return;
++ }
++
++ if (TREE_INT_CST_HIGH (t) == 0
++ && TREE_INT_CST_LOW (t) <= 255)
++ {
++ *value = (int)TREE_INT_CST_LOW (t);
++ *seen = 1;
++ }
++ else
++ {
++ error ("`#pragma custom_%s' value must be between 0 and 255", opt);
++ }
++ nios2_custom_check_insns (1);
++}
++
++/* Handle the various #pragma no_custom_<switch>s */
++static void
++nios2_pragma_no_fpu (int *value, const char *opt ATTRIBUTE_UNUSED)
++{
++ *value = -1;
++ nios2_custom_check_insns (1);
++}
++
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++static void \
++NIOS2_CONCAT (nios2_pragma_, insn) \
++ (struct cpp_reader *pfile ATTRIBUTE_UNUSED) \
++{ \
++ nios2_fpu_info *inf = &(nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)]); \
++ nios2_pragma_fpu (&(inf->N), inf->option, &(inf->pragma_seen)); \
++} \
++static void \
++NIOS2_CONCAT (nios2_pragma_no_, insn) \
++ (struct cpp_reader *pfile ATTRIBUTE_UNUSED) \
++{ \
++ nios2_fpu_info *inf = &(nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)]); \
++ nios2_pragma_no_fpu (&(inf->N), inf->option); \
++}
++NIOS2_FOR_ALL_FPU_INSNS
++
++static void
++nios2_pragma_handle_custom_fpu_cfg (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
++{
++ tree t;
++ if (c_lex (&t) != CPP_STRING)
++ {
++ error ("`#pragma custom_fpu_cfg' value must be a string");
++ return;
++ }
++
++ if (TREE_STRING_LENGTH (t) > 0)
++ {
++ nios2_handle_custom_fpu_cfg (TREE_STRING_POINTER (t), 1);
++ }
++}
++
++void
++nios2_register_target_pragmas ()
++{
++ int i;
++
++ c_register_pragma (0, "reverse_bitfields",
++ nios2_pragma_reverse_bitfields);
++ c_register_pragma (0, "no_reverse_bitfields",
++ nios2_pragma_no_reverse_bitfields);
++
++ for (i = 0; i < nios2_fpu_max_insn; i++)
++ {
++ nios2_fpu_info *inf = &(nios2_fpu_insns[i]);
++ c_register_pragma (0, inf->pname, inf->pragma);
++ c_register_pragma (0, inf->nopname, inf->nopragma);
++ }
++
++ c_register_pragma (0, "custom_fpu_cfg",
++ nios2_pragma_handle_custom_fpu_cfg);
++}
++
++/* Handle a "reverse_bitfields" or "no_reverse_bitfields" attribute.
++ ??? What do these attributes mean on a union? */
++static tree
++nios2_handle_struct_attribute (tree *node, tree name,
++ tree args ATTRIBUTE_UNUSED,
++ int flags ATTRIBUTE_UNUSED,
++ bool *no_add_attrs)
++{
++ tree *type = NULL;
++ if (DECL_P (*node))
++ {
++ if (TREE_CODE (*node) == TYPE_DECL)
++ {
++ type = &TREE_TYPE (*node);
++ }
++ }
++ else
++ {
++ type = node;
++ }
++
++ if (!(type && (TREE_CODE (*type) == RECORD_TYPE
++ || TREE_CODE (*type) == UNION_TYPE)))
++ {
++ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
++ *no_add_attrs = true;
++ }
++
++ else if ((is_attribute_p ("reverse_bitfields", name)
++ && lookup_attribute ("no_reverse_bitfields",
++ TYPE_ATTRIBUTES (*type)))
++ || ((is_attribute_p ("no_reverse_bitfields", name)
++ && lookup_attribute ("reverse_bitfields",
++ TYPE_ATTRIBUTES (*type)))))
++ {
++ warning ("`%s' incompatible attribute ignored",
++ IDENTIFIER_POINTER (name));
++ *no_add_attrs = true;
++ }
++
++ return NULL_TREE;
++}
++
++/*
++ Add __attribute__ ((pragma_reverse_bitfields)) when in the scope of a
++ #pragma reverse_bitfields, or __attribute__
++ ((pragma_no_reverse_bitfields)) when in the scope of a #pragma
++ no_reverse_bitfields. This gets called before
++ nios2_handle_struct_attribute above, so we can't just reuse the same
++ attributes.
++*/
++static void
++nios2_insert_attributes (tree node, tree *attr_ptr)
++{
++ tree type = NULL;
++ if (DECL_P (node))
++ {
++ if (TREE_CODE (node) == TYPE_DECL)
++ {
++ type = TREE_TYPE (node);
++ }
++ }
++ else
++ {
++ type = node;
++ }
++
++ if (!type
++ || (TREE_CODE (type) != RECORD_TYPE
++ && TREE_CODE (type) != UNION_TYPE))
++ {
++ /* We can ignore things other than structs & unions */
++ return;
++ }
++
++ if (lookup_attribute ("reverse_bitfields", TYPE_ATTRIBUTES (type))
++ || lookup_attribute ("no_reverse_bitfields", TYPE_ATTRIBUTES (type)))
++ {
++ /* If an attribute is already set, it silently overrides the
++ current #pragma, if any */
++ return;
++ }
+
++ if (nios2_pragma_reverse_bitfields_flag)
++ {
++ const char *id = (nios2_pragma_reverse_bitfields_flag == 1 ?
++ "pragma_reverse_bitfields" :
++ "pragma_no_reverse_bitfields");
++ /* No attribute set, and we are in the scope of a #pragma */
++ *attr_ptr = tree_cons (get_identifier (id), NULL, *attr_ptr);
++ }
++}
++
++
++/*
++ * The attributes take precedence over the pragmas, which in turn take
++ * precedence over the compile-time switches.
++ */
++static bool
++nios2_reverse_bitfield_layout_p (tree record_type)
++{
++ return ((TARGET_REVERSE_BITFIELDS
++ && !lookup_attribute ("pragma_no_reverse_bitfields",
++ TYPE_ATTRIBUTES (record_type))
++ && !lookup_attribute ("no_reverse_bitfields",
++ TYPE_ATTRIBUTES (record_type)))
++ || (lookup_attribute ("pragma_reverse_bitfields",
++ TYPE_ATTRIBUTES (record_type))
++ && !lookup_attribute ("no_reverse_bitfields",
++ TYPE_ATTRIBUTES (record_type)))
++ || lookup_attribute ("reverse_bitfields",
++ TYPE_ATTRIBUTES (record_type)));
++}
+
+
+/*****************************************
@@ -5296,6 +6405,7 @@
+ H: for %hiadj
+ L: for %lo
+ U: for upper half of 32 bit value
++ D: for the upper 32-bits of a 64-bit double value
+ */
+
+void
@@ -5338,6 +6448,12 @@
+ fprintf (file, "%s", reg_names[REGNO (op)]);
+ return;
+ }
++ else if (letter == 'D')
++ {
++ fprintf (file, "%s", reg_names[REGNO (op)+1]);
++ return;
++ }
++ break;
+
+ case CONST_INT:
+ if (INTVAL (op) == 0 && letter == 'z')
@@ -5379,6 +6495,7 @@
+ fprintf (file, ")");
+ return;
+ }
++ break;
+
+
+ case SUBREG:
@@ -5388,6 +6505,7 @@
+ output_address (op);
+ return;
+ }
++ break;
+
+ case CODE_LABEL:
+ if (letter == 0)
@@ -5395,6 +6513,7 @@
+ output_addr_const (file, op);
+ return;
+ }
++ break;
+
+ default:
+ break;
@@ -5575,6 +6694,431 @@
+
+
+
++/*****************************************************************************
++**
++** custom fpu instruction output
++**
++*****************************************************************************/
++
++static const char *nios2_custom_fpu_insn_zdz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_zsz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_szz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_sss (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_ssz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_iss (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_ddd (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_ddz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_idd (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_siz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_suz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_diz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_duz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_isz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_usz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_idz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_udz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_dsz (rtx, int, const char *);
++static const char *nios2_custom_fpu_insn_sdz (rtx, int, const char *);
++
++static const char *
++nios2_custom_fpu_insn_zdz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, zero, %%0, %%D0 # %s %%0",
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_zsz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, zero, %%0, zero # %s %%0",
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_szz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, %%0, zero, zero # %s %%0",
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_sss (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, %%0, %%1, %%2 # %s %%0, %%1, %%2",
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_ssz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, %%0, %%1, zero # %s %%0, %%1",
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_iss (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_sss (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_ddd (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0
++ || nios2_fpu_insns[nios2_fpu_nios2_frdy].N < 0
++ || nios2_fpu_insns[nios2_fpu_nios2_fwrx].N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, zero, %%1, %%D1 # fwrx %%1\n\t"
++ "custom\t%d, %%D0, %%2, %%D2 # %s %%0, %%1, %%2\n\t"
++ "custom\t%d, %%0, zero, zero # frdy %%0",
++ nios2_fpu_insns[nios2_fpu_nios2_fwrx].N,
++ N, opt,
++ nios2_fpu_insns[nios2_fpu_nios2_frdy].N) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_ddz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0 || nios2_fpu_insns[nios2_fpu_nios2_frdy].N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, %%D0, %%1, %%D1 # %s %%0, %%1\n\t"
++ "custom\t%d, %%0, zero, zero # frdy %%0",
++ N, opt,
++ nios2_fpu_insns[nios2_fpu_nios2_frdy].N) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_idd (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0 || nios2_fpu_insns[nios2_fpu_nios2_fwrx].N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, zero, %%1, %%D1 # fwrx %%1\n\t"
++ "custom\t%d, %%0, %%2, %%D2 # %s %%0, %%1, %%2",
++ nios2_fpu_insns[nios2_fpu_nios2_fwrx].N,
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_siz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_ssz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_suz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_ssz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_diz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_dsz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_duz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_dsz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_isz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_ssz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_usz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_ssz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_idz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_sdz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_udz (rtx insn, int N, const char *opt)
++{
++ return nios2_custom_fpu_insn_sdz (insn, N, opt);
++}
++
++static const char *
++nios2_custom_fpu_insn_dsz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0 || nios2_fpu_insns[nios2_fpu_nios2_frdy].N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, %%D0, %%1, zero # %s %%0, %%1\n\t"
++ "custom\t%d, %%0, zero, zero # frdy %%0",
++ N, opt,
++ nios2_fpu_insns[nios2_fpu_nios2_frdy].N) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++static const char *
++nios2_custom_fpu_insn_sdz (rtx insn, int N, const char *opt)
++{
++ static char buf[1024];
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ "custom\t%d, %%0, %%1, %%D1 # %s %%0, %%1",
++ N, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++static const char * \
++NIOS2_CONCAT (nios2_output_fpu_insn_, insn) (rtx i) \
++{ \
++ return NIOS2_CONCAT (nios2_custom_fpu_insn_, args) \
++ (i, \
++ nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)].N, \
++ nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)].option); \
++}
++NIOS2_FOR_ALL_FPU_INSNS
++
++
++
++const char *
++nios2_output_fpu_insn_cmps (rtx insn, enum rtx_code cond)
++{
++ static char buf[1024];
++ int N;
++ const char *opt;
++
++ int operandL = 2;
++ int operandR = 3;
++
++ if ( !have_nios2_fpu_cmp_insn(cond, CMP_SF) &&
++ have_nios2_fpu_cmp_insn(get_reverse_cond(cond), CMP_SF) ) {
++
++ int temp = operandL;
++ operandL = operandR;
++ operandR = temp;
++
++ cond = get_reverse_cond(cond);
++ }
++
++ switch (cond)
++ {
++ case EQ:
++ N = nios2_fpu_insns[nios2_fpu_nios2_seqsf].N;
++ opt = "fcmpeqs";
++ break;
++ case NE:
++ N = nios2_fpu_insns[nios2_fpu_nios2_snesf].N;
++ opt = "fcmpnes";
++ break;
++ case GT:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sgtsf].N;
++ opt = "fcmpgts";
++ break;
++ case GE:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sgesf].N;
++ opt = "fcmpges";
++ break;
++ case LT:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sltsf].N;
++ opt = "fcmplts";
++ break;
++ case LE:
++ N = nios2_fpu_insns[nios2_fpu_nios2_slesf].N;
++ opt = "fcmples"; break;
++ default:
++ fatal_insn ("bad single compare", insn);
++ }
++
++ if (N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++
++ /*
++ * ??? This raises the whole vexing issue of how to handle
++ * out-of-range branches. Punt for now, seeing as how nios2-elf-as
++ * doesn't even _try_ to handle out-of-range branches yet!
++ */
++ if (snprintf (buf, sizeof (buf),
++ ".set\tnoat\n\t"
++ "custom\t%d, at, %%%d, %%%d # %s at, %%%d, %%%d\n\t"
++ "bne\tat, zero, %%l1\n\t"
++ ".set\tat",
++ N, operandL, operandR, opt, operandL, operandR) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
++const char *
++nios2_output_fpu_insn_cmpd (rtx insn, enum rtx_code cond)
++{
++ static char buf[1024];
++ int N;
++ const char *opt;
++
++ int operandL = 2;
++ int operandR = 3;
++
++ if ( !have_nios2_fpu_cmp_insn(cond, CMP_DF) &&
++ have_nios2_fpu_cmp_insn(get_reverse_cond(cond), CMP_DF) ) {
++
++ int temp = operandL;
++ operandL = operandR;
++ operandR = temp;
++
++ cond = get_reverse_cond(cond);
++ }
++
++ switch (cond)
++ {
++ case EQ:
++ N = nios2_fpu_insns[nios2_fpu_nios2_seqdf].N;
++ opt = "fcmpeqd";
++ break;
++ case NE:
++ N = nios2_fpu_insns[nios2_fpu_nios2_snedf].N;
++ opt = "fcmpned";
++ break;
++ case GT:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sgtdf].N;
++ opt = "fcmpgtd";
++ break;
++ case GE:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sgedf].N;
++ opt = "fcmpged";
++ break;
++ case LT:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sltdf].N;
++ opt = "fcmpltd";
++ break;
++ case LE:
++ N = nios2_fpu_insns[nios2_fpu_nios2_sledf].N;
++ opt = "fcmpled";
++ break;
++ default:
++ fatal_insn ("bad double compare", insn);
++ }
++
++ if (N < 0 || nios2_fpu_insns[nios2_fpu_nios2_fwrx].N < 0)
++ {
++ fatal_insn ("attempt to use disabled fpu instruction", insn);
++ }
++ if (snprintf (buf, sizeof (buf),
++ ".set\tnoat\n\t"
++ "custom\t%d, zero, %%%d, %%D%d # fwrx %%%d\n\t"
++ "custom\t%d, at, %%%d, %%D%d # %s at, %%%d, %%%d\n\t"
++ "bne\tat, zero, %%l1\n\t"
++ ".set\tat",
++ nios2_fpu_insns[nios2_fpu_nios2_fwrx].N, operandL, operandL, operandL,
++ N, operandR, operandR, operandL, operandR, opt) >= (int)sizeof (buf))
++ {
++ fatal_insn ("buffer overflow", insn);
++ }
++ return buf;
++}
++
+
+
+
@@ -5630,43 +7174,6 @@
+}
+
+
-+/* Update the data in CUM to advance over an argument
-+ of mode MODE and data type TYPE.
-+ (TYPE is null for libcalls where that information may not be available.) */
-+
-+void
-+function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
-+ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED)
-+{
-+ HOST_WIDE_INT param_size;
-+
-+ if (mode == BLKmode)
-+ {
-+ param_size = int_size_in_bytes (type);
-+ if (param_size < 0)
-+ internal_error
-+ ("Do not know how to handle large structs or variable length types");
-+ }
-+ else
-+ {
-+ param_size = GET_MODE_SIZE (mode);
-+ }
-+
-+ /* convert to words (round up) */
-+ param_size = (3 + param_size) / 4;
-+
-+ if (cum->regs_used + param_size > NUM_ARG_REGS)
-+ {
-+ cum->regs_used = NUM_ARG_REGS;
-+ }
-+ else
-+ {
-+ cum->regs_used += param_size;
-+ }
-+
-+ return;
-+}
-+
+/* Define where to put the arguments to a function. Value is zero to
+ push the argument on the stack, or a hard register in which to
+ store the argument.
@@ -5693,6 +7200,29 @@
+ return return_rtx;
+}
+
++/*
++ * This is just default_must_pass_in_stack from calls.c sans the final
++ * test for padding which isn't needed: we define BLOCK_REG_PADDING
++ * instead.
++ */
++int
++nios2_must_pass_in_stack (enum machine_mode mode, tree type)
++{
++ if (!type)
++ return false;
++
++ /* If the type has variable size... */
++ if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
++ return true;
++
++ /* If the type is marked as addressable (it is required
++ to be constructed into the stack)... */
++ if (TREE_ADDRESSABLE (type))
++ return true;
++
++ return false;
++}
++
+int
+function_arg_partial_nregs (const CUMULATIVE_ARGS *cum,
+ enum machine_mode mode, tree type,
@@ -5727,6 +7257,74 @@
+}
+
+
++/* Update the data in CUM to advance over an argument
++ of mode MODE and data type TYPE.
++ (TYPE is null for libcalls where that information may not be available.) */
++
++void
++function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
++ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED)
++{
++ HOST_WIDE_INT param_size;
++
++ if (mode == BLKmode)
++ {
++ param_size = int_size_in_bytes (type);
++ if (param_size < 0)
++ internal_error
++ ("Do not know how to handle large structs or variable length types");
++ }
++ else
++ {
++ param_size = GET_MODE_SIZE (mode);
++ }
++
++ /* convert to words (round up) */
++ param_size = (3 + param_size) / 4;
++
++ if (cum->regs_used + param_size > NUM_ARG_REGS)
++ {
++ cum->regs_used = NUM_ARG_REGS;
++ }
++ else
++ {
++ cum->regs_used += param_size;
++ }
++
++ return;
++}
++
++int
++nios2_function_arg_padding_upward (enum machine_mode mode, tree type)
++{
++ /* On little-endian targets, the first byte of every stack argument
++ is passed in the first byte of the stack slot. */
++ if (!BYTES_BIG_ENDIAN)
++ return 1;
++
++ /* Otherwise, integral types are padded downward: the last byte of a
++ stack argument is passed in the last byte of the stack slot. */
++ if (type != 0
++ ? INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)
++ : GET_MODE_CLASS (mode) == MODE_INT)
++ return 0;
++
++ /* Arguments smaller than a stack slot are padded downward. */
++ if (mode != BLKmode)
++ return (GET_MODE_BITSIZE (mode) >= PARM_BOUNDARY) ? 1 : 0;
++ else
++ return ((int_size_in_bytes (type) >= (PARM_BOUNDARY / BITS_PER_UNIT))
++ ? 1 : 0);
++}
++
++int
++nios2_block_reg_padding_upward (enum machine_mode mode, tree type,
++ int first ATTRIBUTE_UNUSED)
++{
++ /* ??? Do we need to treat floating point specially, ala MIPS? */
++ return nios2_function_arg_padding_upward (mode, type);
++}
++
+int
+nios2_return_in_memory (tree type)
+{
@@ -5803,59 +7401,19 @@
+ NIOS2_BUILTIN_RDCTL,
+ NIOS2_BUILTIN_WRCTL,
+
-+ NIOS2_BUILTIN_CUSTOM_N,
-+ NIOS2_BUILTIN_CUSTOM_NI,
-+ NIOS2_BUILTIN_CUSTOM_NF,
-+ NIOS2_BUILTIN_CUSTOM_NP,
-+ NIOS2_BUILTIN_CUSTOM_NII,
-+ NIOS2_BUILTIN_CUSTOM_NIF,
-+ NIOS2_BUILTIN_CUSTOM_NIP,
-+ NIOS2_BUILTIN_CUSTOM_NFI,
-+ NIOS2_BUILTIN_CUSTOM_NFF,
-+ NIOS2_BUILTIN_CUSTOM_NFP,
-+ NIOS2_BUILTIN_CUSTOM_NPI,
-+ NIOS2_BUILTIN_CUSTOM_NPF,
-+ NIOS2_BUILTIN_CUSTOM_NPP,
-+ NIOS2_BUILTIN_CUSTOM_IN,
-+ NIOS2_BUILTIN_CUSTOM_INI,
-+ NIOS2_BUILTIN_CUSTOM_INF,
-+ NIOS2_BUILTIN_CUSTOM_INP,
-+ NIOS2_BUILTIN_CUSTOM_INII,
-+ NIOS2_BUILTIN_CUSTOM_INIF,
-+ NIOS2_BUILTIN_CUSTOM_INIP,
-+ NIOS2_BUILTIN_CUSTOM_INFI,
-+ NIOS2_BUILTIN_CUSTOM_INFF,
-+ NIOS2_BUILTIN_CUSTOM_INFP,
-+ NIOS2_BUILTIN_CUSTOM_INPI,
-+ NIOS2_BUILTIN_CUSTOM_INPF,
-+ NIOS2_BUILTIN_CUSTOM_INPP,
-+ NIOS2_BUILTIN_CUSTOM_FN,
-+ NIOS2_BUILTIN_CUSTOM_FNI,
-+ NIOS2_BUILTIN_CUSTOM_FNF,
-+ NIOS2_BUILTIN_CUSTOM_FNP,
-+ NIOS2_BUILTIN_CUSTOM_FNII,
-+ NIOS2_BUILTIN_CUSTOM_FNIF,
-+ NIOS2_BUILTIN_CUSTOM_FNIP,
-+ NIOS2_BUILTIN_CUSTOM_FNFI,
-+ NIOS2_BUILTIN_CUSTOM_FNFF,
-+ NIOS2_BUILTIN_CUSTOM_FNFP,
-+ NIOS2_BUILTIN_CUSTOM_FNPI,
-+ NIOS2_BUILTIN_CUSTOM_FNPF,
-+ NIOS2_BUILTIN_CUSTOM_FNPP,
-+ NIOS2_BUILTIN_CUSTOM_PN,
-+ NIOS2_BUILTIN_CUSTOM_PNI,
-+ NIOS2_BUILTIN_CUSTOM_PNF,
-+ NIOS2_BUILTIN_CUSTOM_PNP,
-+ NIOS2_BUILTIN_CUSTOM_PNII,
-+ NIOS2_BUILTIN_CUSTOM_PNIF,
-+ NIOS2_BUILTIN_CUSTOM_PNIP,
-+ NIOS2_BUILTIN_CUSTOM_PNFI,
-+ NIOS2_BUILTIN_CUSTOM_PNFF,
-+ NIOS2_BUILTIN_CUSTOM_PNFP,
-+ NIOS2_BUILTIN_CUSTOM_PNPI,
-+ NIOS2_BUILTIN_CUSTOM_PNPF,
-+ NIOS2_BUILTIN_CUSTOM_PNPP,
++#undef NIOS2_DO_BUILTIN
++#define NIOS2_DO_BUILTIN(upper, lower, handler) \
++ NIOS2_CONCAT (NIOS2_BUILTIN_CUSTOM_, upper),
++NIOS2_FOR_ALL_CUSTOM_BUILTINS
++
++ NIOS2_FIRST_FPU_INSN,
+
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ NIOS2_CONCAT (NIOS2_BUILTIN_FPU_, opt),
++NIOS2_FOR_ALL_FPU_INSNS
++
++ NIOS2_LAST_FPU_INSN,
+
+ LIM_NIOS2_BUILTINS
+};
@@ -5866,8 +7424,8 @@
+ const char *const name;
+ const enum nios2_builtins code;
+ const tree *type;
-+ rtx (* expander) PARAMS ((const struct builtin_description *,
-+ tree, rtx, rtx, enum machine_mode, int));
++ rtx (* expander) (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
+};
+
+static rtx nios2_expand_STXIO (const struct builtin_description *,
@@ -5894,6 +7452,45 @@
+static rtx nios2_expand_custom_XnXX (const struct builtin_description *,
+ tree, rtx, rtx, enum machine_mode, int);
+
++static rtx nios2_expand_custom_zdz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_zsz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_szz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_sss (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_ssz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_iss (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_ddd (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_ddz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_idd (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_siz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_suz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_diz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_duz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_isz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_usz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_idz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_udz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_dsz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++static rtx nios2_expand_custom_sdz (const struct builtin_description *,
++ tree, rtx, rtx, enum machine_mode, int);
++
+static tree endlink;
+
+/* int fn (volatile const void *)
@@ -5916,59 +7513,30 @@
+ */
+static tree void_ftype_void;
+
-+static tree custom_n;
-+static tree custom_ni;
-+static tree custom_nf;
-+static tree custom_np;
-+static tree custom_nii;
-+static tree custom_nif;
-+static tree custom_nip;
-+static tree custom_nfi;
-+static tree custom_nff;
-+static tree custom_nfp;
-+static tree custom_npi;
-+static tree custom_npf;
-+static tree custom_npp;
-+static tree custom_in;
-+static tree custom_ini;
-+static tree custom_inf;
-+static tree custom_inp;
-+static tree custom_inii;
-+static tree custom_inif;
-+static tree custom_inip;
-+static tree custom_infi;
-+static tree custom_inff;
-+static tree custom_infp;
-+static tree custom_inpi;
-+static tree custom_inpf;
-+static tree custom_inpp;
-+static tree custom_fn;
-+static tree custom_fni;
-+static tree custom_fnf;
-+static tree custom_fnp;
-+static tree custom_fnii;
-+static tree custom_fnif;
-+static tree custom_fnip;
-+static tree custom_fnfi;
-+static tree custom_fnff;
-+static tree custom_fnfp;
-+static tree custom_fnpi;
-+static tree custom_fnpf;
-+static tree custom_fnpp;
-+static tree custom_pn;
-+static tree custom_pni;
-+static tree custom_pnf;
-+static tree custom_pnp;
-+static tree custom_pnii;
-+static tree custom_pnif;
-+static tree custom_pnip;
-+static tree custom_pnfi;
-+static tree custom_pnff;
-+static tree custom_pnfp;
-+static tree custom_pnpi;
-+static tree custom_pnpf;
-+static tree custom_pnpp;
-+
++#undef NIOS2_DO_BUILTIN
++#define NIOS2_DO_BUILTIN(upper, lower, handler) \
++ static tree NIOS2_CONCAT (custom_, lower);
++NIOS2_FOR_ALL_CUSTOM_BUILTINS
++
++static tree custom_zdz;
++static tree custom_zsz;
++static tree custom_szz;
++static tree custom_sss;
++static tree custom_ssz;
++static tree custom_iss;
++static tree custom_ddd;
++static tree custom_ddz;
++static tree custom_idd;
++static tree custom_siz;
++static tree custom_suz;
++static tree custom_diz;
++static tree custom_duz;
++static tree custom_isz;
++static tree custom_usz;
++static tree custom_idz;
++static tree custom_udz;
++static tree custom_dsz;
++static tree custom_sdz;
+
+static const struct builtin_description bdesc[] = {
+ {CODE_FOR_ldbio, "__builtin_ldbio", NIOS2_BUILTIN_LDBIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO},
@@ -5985,59 +7553,23 @@
+ {CODE_FOR_rdctl, "__builtin_rdctl", NIOS2_BUILTIN_RDCTL, &int_ftype_int, nios2_expand_rdctl},
+ {CODE_FOR_wrctl, "__builtin_wrctl", NIOS2_BUILTIN_WRCTL, &void_ftype_int_int, nios2_expand_wrctl},
+
-+ {CODE_FOR_custom_n, "__builtin_custom_n", NIOS2_BUILTIN_CUSTOM_N, &custom_n, nios2_expand_custom_n},
-+ {CODE_FOR_custom_ni, "__builtin_custom_ni", NIOS2_BUILTIN_CUSTOM_NI, &custom_ni, nios2_expand_custom_nX},
-+ {CODE_FOR_custom_nf, "__builtin_custom_nf", NIOS2_BUILTIN_CUSTOM_NF, &custom_nf, nios2_expand_custom_nX},
-+ {CODE_FOR_custom_np, "__builtin_custom_np", NIOS2_BUILTIN_CUSTOM_NP, &custom_np, nios2_expand_custom_nX},
-+ {CODE_FOR_custom_nii, "__builtin_custom_nii", NIOS2_BUILTIN_CUSTOM_NII, &custom_nii, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_nif, "__builtin_custom_nif", NIOS2_BUILTIN_CUSTOM_NIF, &custom_nif, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_nip, "__builtin_custom_nip", NIOS2_BUILTIN_CUSTOM_NIP, &custom_nip, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_nfi, "__builtin_custom_nfi", NIOS2_BUILTIN_CUSTOM_NFI, &custom_nfi, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_nff, "__builtin_custom_nff", NIOS2_BUILTIN_CUSTOM_NFF, &custom_nff, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_nfp, "__builtin_custom_nfp", NIOS2_BUILTIN_CUSTOM_NFP, &custom_nfp, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_npi, "__builtin_custom_npi", NIOS2_BUILTIN_CUSTOM_NPI, &custom_npi, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_npf, "__builtin_custom_npf", NIOS2_BUILTIN_CUSTOM_NPF, &custom_npf, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_npp, "__builtin_custom_npp", NIOS2_BUILTIN_CUSTOM_NPP, &custom_npp, nios2_expand_custom_nXX},
-+ {CODE_FOR_custom_in, "__builtin_custom_in", NIOS2_BUILTIN_CUSTOM_IN, &custom_in, nios2_expand_custom_Xn},
-+ {CODE_FOR_custom_ini, "__builtin_custom_ini", NIOS2_BUILTIN_CUSTOM_INI, &custom_ini, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_inf, "__builtin_custom_inf", NIOS2_BUILTIN_CUSTOM_INF, &custom_inf, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_inp, "__builtin_custom_inp", NIOS2_BUILTIN_CUSTOM_INP, &custom_inp, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_inii, "__builtin_custom_inii", NIOS2_BUILTIN_CUSTOM_INII, &custom_inii, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_inif, "__builtin_custom_inif", NIOS2_BUILTIN_CUSTOM_INIF, &custom_inif, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_inip, "__builtin_custom_inip", NIOS2_BUILTIN_CUSTOM_INIP, &custom_inip, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_infi, "__builtin_custom_infi", NIOS2_BUILTIN_CUSTOM_INFI, &custom_infi, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_inff, "__builtin_custom_inff", NIOS2_BUILTIN_CUSTOM_INFF, &custom_inff, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_infp, "__builtin_custom_infp", NIOS2_BUILTIN_CUSTOM_INFP, &custom_infp, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_inpi, "__builtin_custom_inpi", NIOS2_BUILTIN_CUSTOM_INPI, &custom_inpi, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_inpf, "__builtin_custom_inpf", NIOS2_BUILTIN_CUSTOM_INPF, &custom_inpf, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_inpp, "__builtin_custom_inpp", NIOS2_BUILTIN_CUSTOM_INPP, &custom_inpp, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fn, "__builtin_custom_fn", NIOS2_BUILTIN_CUSTOM_FN, &custom_fn, nios2_expand_custom_Xn},
-+ {CODE_FOR_custom_fni, "__builtin_custom_fni", NIOS2_BUILTIN_CUSTOM_FNI, &custom_fni, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_fnf, "__builtin_custom_fnf", NIOS2_BUILTIN_CUSTOM_FNF, &custom_fnf, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_fnp, "__builtin_custom_fnp", NIOS2_BUILTIN_CUSTOM_FNP, &custom_fnp, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_fnii, "__builtin_custom_fnii", NIOS2_BUILTIN_CUSTOM_FNII, &custom_fnii, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnif, "__builtin_custom_fnif", NIOS2_BUILTIN_CUSTOM_FNIF, &custom_fnif, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnip, "__builtin_custom_fnip", NIOS2_BUILTIN_CUSTOM_FNIP, &custom_fnip, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnfi, "__builtin_custom_fnfi", NIOS2_BUILTIN_CUSTOM_FNFI, &custom_fnfi, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnff, "__builtin_custom_fnff", NIOS2_BUILTIN_CUSTOM_FNFF, &custom_fnff, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnfp, "__builtin_custom_fnfp", NIOS2_BUILTIN_CUSTOM_FNFP, &custom_fnfp, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnpi, "__builtin_custom_fnpi", NIOS2_BUILTIN_CUSTOM_FNPI, &custom_fnpi, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnpf, "__builtin_custom_fnpf", NIOS2_BUILTIN_CUSTOM_FNPF, &custom_fnpf, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_fnpp, "__builtin_custom_fnpp", NIOS2_BUILTIN_CUSTOM_FNPP, &custom_fnpp, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pn, "__builtin_custom_pn", NIOS2_BUILTIN_CUSTOM_PN, &custom_pn, nios2_expand_custom_Xn},
-+ {CODE_FOR_custom_pni, "__builtin_custom_pni", NIOS2_BUILTIN_CUSTOM_PNI, &custom_pni, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_pnf, "__builtin_custom_pnf", NIOS2_BUILTIN_CUSTOM_PNF, &custom_pnf, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_pnp, "__builtin_custom_pnp", NIOS2_BUILTIN_CUSTOM_PNP, &custom_pnp, nios2_expand_custom_XnX},
-+ {CODE_FOR_custom_pnii, "__builtin_custom_pnii", NIOS2_BUILTIN_CUSTOM_PNII, &custom_pnii, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnif, "__builtin_custom_pnif", NIOS2_BUILTIN_CUSTOM_PNIF, &custom_pnif, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnip, "__builtin_custom_pnip", NIOS2_BUILTIN_CUSTOM_PNIP, &custom_pnip, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnfi, "__builtin_custom_pnfi", NIOS2_BUILTIN_CUSTOM_PNFI, &custom_pnfi, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnff, "__builtin_custom_pnff", NIOS2_BUILTIN_CUSTOM_PNFF, &custom_pnff, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnfp, "__builtin_custom_pnfp", NIOS2_BUILTIN_CUSTOM_PNFP, &custom_pnfp, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnpi, "__builtin_custom_pnpi", NIOS2_BUILTIN_CUSTOM_PNPI, &custom_pnpi, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnpf, "__builtin_custom_pnpf", NIOS2_BUILTIN_CUSTOM_PNPF, &custom_pnpf, nios2_expand_custom_XnXX},
-+ {CODE_FOR_custom_pnpp, "__builtin_custom_pnpp", NIOS2_BUILTIN_CUSTOM_PNPP, &custom_pnpp, nios2_expand_custom_XnXX},
-+
++#undef NIOS2_DO_BUILTIN
++#define NIOS2_DO_BUILTIN(upper, lower, handler) \
++ {NIOS2_CONCAT (CODE_FOR_custom_, lower), \
++ "__builtin_custom_" NIOS2_STRINGIFY (lower), \
++ NIOS2_CONCAT (NIOS2_BUILTIN_CUSTOM_, upper), \
++ &NIOS2_CONCAT (custom_, lower), \
++ NIOS2_CONCAT (nios2_expand_custom_, handler)},
++NIOS2_FOR_ALL_CUSTOM_BUILTINS
++
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ {NIOS2_CONCAT (CODE_FOR_, insn), \
++ "__builtin_custom_" NIOS2_STRINGIFY (opt), \
++ NIOS2_CONCAT (NIOS2_BUILTIN_FPU_, opt), \
++ &NIOS2_CONCAT (custom_, args), \
++ NIOS2_CONCAT (nios2_expand_custom_, args)},
++NIOS2_FOR_ALL_FPU_INSNS
+
+ {0, 0, 0, 0, 0},
+};
@@ -6396,7 +7928,104 @@
+ def_param (ptr_type_node)
+ endlink))));
+
++ custom_zdz
++ = build_function_type (void_type_node,
++ def_param (double_type_node)
++ endlink));
++
++ custom_zsz
++ = build_function_type (void_type_node,
++ def_param (float_type_node)
++ endlink));
++
++ custom_szz
++ = build_function_type (float_type_node,
++ def_param (void_type_node)
++ endlink));
+
++ custom_sss
++ = build_function_type (float_type_node,
++ def_param (float_type_node)
++ def_param (float_type_node)
++ endlink)));
++
++ custom_ssz
++ = build_function_type (float_type_node,
++ def_param (float_type_node)
++ endlink));
++
++ custom_iss
++ = build_function_type (integer_type_node,
++ def_param (float_type_node)
++ def_param (float_type_node)
++ endlink)));
++
++ custom_ddd
++ = build_function_type (double_type_node,
++ def_param (double_type_node)
++ def_param (double_type_node)
++ endlink)));
++
++ custom_ddz
++ = build_function_type (double_type_node,
++ def_param (double_type_node)
++ endlink));
++
++ custom_idd
++ = build_function_type (integer_type_node,
++ def_param (double_type_node)
++ def_param (double_type_node)
++ endlink)));
++
++ custom_siz
++ = build_function_type (float_type_node,
++ def_param (integer_type_node)
++ endlink));
++
++ custom_suz
++ = build_function_type (float_type_node,
++ def_param (unsigned_type_node)
++ endlink));
++
++ custom_diz
++ = build_function_type (double_type_node,
++ def_param (integer_type_node)
++ endlink));
++
++ custom_duz
++ = build_function_type (double_type_node,
++ def_param (unsigned_type_node)
++ endlink));
++
++ custom_isz
++ = build_function_type (integer_type_node,
++ def_param (float_type_node)
++ endlink));
++
++ custom_usz
++ = build_function_type (unsigned_type_node,
++ def_param (float_type_node)
++ endlink));
++
++ custom_idz
++ = build_function_type (integer_type_node,
++ def_param (double_type_node)
++ endlink));
++
++ custom_udz
++ = build_function_type (unsigned_type_node,
++ def_param (double_type_node)
++ endlink));
++
++ custom_dsz
++ = build_function_type (double_type_node,
++ def_param (float_type_node)
++ endlink));
++
++ custom_sdz
++ = build_function_type (float_type_node,
++ def_param (double_type_node)
++ endlink));
+
+ /* *INDENT-ON* */
+
@@ -6424,7 +8053,25 @@
+
+ for (d = bdesc; d->name; d++)
+ if (d->code == fcode)
++ {
++ if (d->code > NIOS2_FIRST_FPU_INSN && d->code < NIOS2_LAST_FPU_INSN)
++ {
++ nios2_fpu_info *inf = &nios2_fpu_insns[d->code - (NIOS2_FIRST_FPU_INSN + 1)];
++ const struct insn_data *idata = &insn_data[d->icode];
++ if (inf->N < 0)
++ {
++ fatal_error ("Cannot call `%s' without specifying switch `-mcustom-%s'",
++ d->name,
++ inf->option);
++ }
++ if (inf->args[0] != 'z'
++ && (!target
++ || !(idata->operand[0].predicate) (target,
++ idata->operand[0].mode)))
++ target = gen_reg_rtx (idata->operand[0].mode);
++ }
+ return (d->expander) (d, exp, target, subtarget, mode, ignore);
++ }
+
+ /* we should have seen one of the functins we registered */
+ abort ();
@@ -6461,6 +8108,8 @@
+ if (!(*insn_data[d->icode].operand[op].predicate) (opcode, mode))
+ error ("Custom instruction opcode must be compile time constant in the range 0-255 for %s", d->name);
+
++ builtin_custom_seen[INTVAL (opcode)] = d->name;
++ nios2_custom_check_insns (0);
+ return opcode;
+}
+
@@ -6844,15 +8493,397 @@
+ return 0;
+}
+
++static rtx
++nios2_extract_double (const struct insn_data *idata, tree arglist, int index)
++{
++ rtx arg;
++
++ while (index--)
++ {
++ arglist = TREE_CHAIN (arglist);
++ }
++ arg = expand_expr (TREE_VALUE (arglist), NULL_RTX, DFmode, 0);
++ arg = protect_from_queue (arg, 0);
++ if (!(*(idata->operand[index+1].predicate)) (arg, DFmode))
++ {
++ arg = copy_to_mode_reg (DFmode, arg);
++ }
++ return arg;
++}
++
++static rtx
++nios2_extract_float (const struct insn_data *idata, tree arglist, int index)
++{
++ rtx arg;
++
++ while (index--)
++ {
++ arglist = TREE_CHAIN (arglist);
++ }
++ arg = expand_expr (TREE_VALUE (arglist), NULL_RTX, SFmode, 0);
++ arg = protect_from_queue (arg, 0);
++ if (!(*(idata->operand[index+1].predicate)) (arg, SFmode))
++ {
++ arg = copy_to_mode_reg (SFmode, arg);
++ }
++ return arg;
++}
++
++static rtx
++nios2_extract_integer (const struct insn_data *idata, tree arglist, int index)
++{
++ rtx arg;
++
++ while (index--)
++ {
++ arglist = TREE_CHAIN (arglist);
++ }
++ arg = expand_expr (TREE_VALUE (arglist), NULL_RTX, SImode, 0);
++ arg = protect_from_queue (arg, 0);
++ if (!(*(idata->operand[index+1].predicate)) (arg, SImode))
++ {
++ arg = copy_to_mode_reg (SImode, arg);
++ }
++ return protect_from_queue (arg, 0);
++}
++
++static rtx
++nios2_expand_custom_zdz (const struct builtin_description *d,
++ tree exp,
++ rtx target ATTRIBUTE_UNUSED,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (nios2_extract_double (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return 0;
++}
++
++static rtx
++nios2_expand_custom_zsz (const struct builtin_description *d,
++ tree exp,
++ rtx target ATTRIBUTE_UNUSED,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (nios2_extract_float (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return 0;
++}
++
++static rtx
++nios2_expand_custom_szz (const struct builtin_description *d,
++ tree exp ATTRIBUTE_UNUSED,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ rtx pat = GEN_FCN (d->icode) (target);
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_sss (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 0),
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 1));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_ssz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_iss (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 0),
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 1));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_ddd (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 0),
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 1));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_ddz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_idd (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 0),
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 1));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_siz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_integer (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_suz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_integer (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_diz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_integer (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_duz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_integer (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_isz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_usz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_idz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_udz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_dsz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_float (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
++
++static rtx
++nios2_expand_custom_sdz (const struct builtin_description *d,
++ tree exp,
++ rtx target,
++ rtx subtarget ATTRIBUTE_UNUSED,
++ enum machine_mode mode ATTRIBUTE_UNUSED,
++ int ignore ATTRIBUTE_UNUSED)
++{
++ tree arglist = TREE_OPERAND (exp, 1);
++ rtx pat = GEN_FCN (d->icode) (target,
++ nios2_extract_double (&insn_data[d->icode],
++ arglist, 0));
++ if (pat)
++ emit_insn (pat);
++ return target;
++}
+
+#include "gt-nios2.h"
+
---- gcc-3.4.3/gcc/config/nios2/nios2.h
-+++ gcc-3.4.3-nios2/gcc/config/nios2/nios2.h
-@@ -0,0 +1,824 @@
+diff --git a/gcc/config/nios2/nios2.h b/gcc/config/nios2/nios2.h
+new file mode 100644
+index 0000000..500ccf0
+--- /dev/null
++++ b/gcc/config/nios2/nios2.h
+@@ -0,0 +1,1130 @@
+/* Definitions of target machine for Altera NIOS 2G NIOS2 version.
-+ Copyright (C) 2003 Altera
-+ Contributed by Jonah Graham (jgraham@altera.com).
++ Copyright (C) 2005 Altera
++ Contributed by Jonah Graham (jgraham@altera.com) and Will Reece (wreece@altera.com).
+
+This file is part of GNU CC.
+
@@ -6878,7 +8909,10 @@
+ { \
+ builtin_define_std ("NIOS2"); \
+ builtin_define_std ("nios2"); \
-+ builtin_define ("_GNU_SOURCE"); \
++ if (TARGET_BIG_ENDIAN) \
++ builtin_define_std ("nios2_big_endian"); \
++ else \
++ builtin_define_std ("nios2_little_endian"); \
+ } \
+ while (0)
+#define TARGET_VERSION fprintf (stderr, " (Altera Nios II)")
@@ -6898,6 +8932,10 @@
+#define INLINE_MEMCPY_FLAG 0x00010
+#define CACHE_VOLATILE_FLAG 0x0020
+#define BYPASS_CACHE_FLAG 0x0040
++#define STACK_CHECK_FLAG 0x0080
++#define REVERSE_BITFIELDS_FLAG 0x0100
++/* Reserve 0x0200 for REVERSE_ENDIAN_FLAG */
++#define BIG_ENDIAN_FLAG 0x0400
+
+extern int target_flags;
+#define TARGET_HAS_DIV (target_flags & HAS_DIV_FLAG)
@@ -6907,6 +8945,9 @@
+#define TARGET_INLINE_MEMCPY (target_flags & INLINE_MEMCPY_FLAG)
+#define TARGET_CACHE_VOLATILE (target_flags & CACHE_VOLATILE_FLAG)
+#define TARGET_BYPASS_CACHE (target_flags & BYPASS_CACHE_FLAG)
++#define TARGET_STACK_CHECK (target_flags & STACK_CHECK_FLAG)
++#define TARGET_REVERSE_BITFIELDS (target_flags & REVERSE_BITFIELDS_FLAG)
++#define TARGET_BIG_ENDIAN (target_flags & BIG_ENDIAN_FLAG)
+
+#define TARGET_SWITCHES \
+{ \
@@ -6942,14 +8983,148 @@
+ N_("Link with a limited version of the C library") }, \
+ { "ctors-in-init", 0, \
+ "" /* undocumented: N_("Link with static constructors and destructors in init") */ }, \
++ { "stack-check", STACK_CHECK_FLAG, \
++ N_("Enable stack limit checking.") }, \
++ { "no-stack-check", -STACK_CHECK_FLAG, \
++ N_("Disable stack limit checking (default).") }, \
++ { "reverse-bitfields", REVERSE_BITFIELDS_FLAG, \
++ N_("Reverse the order of bitfields in a struct.") }, \
++ { "no-reverse-bitfields", -REVERSE_BITFIELDS_FLAG, \
++ N_("Use the normal order of bitfields in a struct (default).") }, \
++ { "eb", BIG_ENDIAN_FLAG, \
++ N_("Use big-endian byte order") }, \
++ { "el", -BIG_ENDIAN_FLAG, \
++ N_("Use little-endian byte order") }, \
+ { "", TARGET_DEFAULT, 0 } \
+}
+
-+
+extern const char *nios2_sys_nosys_string; /* for -msys=nosys */
+extern const char *nios2_sys_lib_string; /* for -msys-lib= */
+extern const char *nios2_sys_crt0_string; /* for -msys-crt0= */
+
++/*
++ * There's a lot of error-prone tedium with all the different
++ * custom floating point instructions. Try to automate it a bit
++ * to make it easier to deal with.
++ */
++#define NIOS2_STRINGIFY_INNER(x) #x
++#define NIOS2_STRINGIFY(x) NIOS2_STRINGIFY_INNER(x)
++#define NIOS2_CONCAT_INNER(x, y) x ## y
++#define NIOS2_CONCAT(x, y) NIOS2_CONCAT_INNER (x, y)
++
++#define NIOS2_FOR_ALL_FPU_INSNS \
++ NIOS2_FPU_INSN (fwrx, nios2_fwrx, zdz) \
++ NIOS2_FPU_INSN (fwry, nios2_fwry, zsz) \
++ NIOS2_FPU_INSN (frdxlo, nios2_frdxlo, szz) \
++ NIOS2_FPU_INSN (frdxhi, nios2_frdxhi, szz) \
++ NIOS2_FPU_INSN (frdy, nios2_frdy, szz) \
++\
++ NIOS2_FPU_INSN (fadds, addsf3, sss) \
++ NIOS2_FPU_INSN (fsubs, subsf3, sss) \
++ NIOS2_FPU_INSN (fmuls, mulsf3, sss) \
++ NIOS2_FPU_INSN (fdivs, divsf3, sss) \
++ NIOS2_FPU_INSN (fmins, minsf3, sss) \
++ NIOS2_FPU_INSN (fmaxs, maxsf3, sss) \
++ NIOS2_FPU_INSN (fnegs, negsf2, ssz) \
++ NIOS2_FPU_INSN (fabss, abssf2, ssz) \
++ NIOS2_FPU_INSN (fsqrts, sqrtsf2, ssz) \
++ NIOS2_FPU_INSN (fcoss, cossf2, ssz) \
++ NIOS2_FPU_INSN (fsins, sinsf2, ssz) \
++ NIOS2_FPU_INSN (ftans, tansf2, ssz) \
++ NIOS2_FPU_INSN (fatans, atansf2, ssz) \
++ NIOS2_FPU_INSN (fexps, expsf2, ssz) \
++ NIOS2_FPU_INSN (flogs, logsf2, ssz) \
++ NIOS2_FPU_INSN (fcmplts, nios2_sltsf, iss) \
++ NIOS2_FPU_INSN (fcmples, nios2_slesf, iss) \
++ NIOS2_FPU_INSN (fcmpgts, nios2_sgtsf, iss) \
++ NIOS2_FPU_INSN (fcmpges, nios2_sgesf, iss) \
++ NIOS2_FPU_INSN (fcmpeqs, nios2_seqsf, iss) \
++ NIOS2_FPU_INSN (fcmpnes, nios2_snesf, iss) \
++\
++ NIOS2_FPU_INSN (faddd, adddf3, ddd) \
++ NIOS2_FPU_INSN (fsubd, subdf3, ddd) \
++ NIOS2_FPU_INSN (fmuld, muldf3, ddd) \
++ NIOS2_FPU_INSN (fdivd, divdf3, ddd) \
++ NIOS2_FPU_INSN (fmind, mindf3, ddd) \
++ NIOS2_FPU_INSN (fmaxd, maxdf3, ddd) \
++ NIOS2_FPU_INSN (fnegd, negdf2, ddz) \
++ NIOS2_FPU_INSN (fabsd, absdf2, ddz) \
++ NIOS2_FPU_INSN (fsqrtd, sqrtdf2, ddz) \
++ NIOS2_FPU_INSN (fcosd, cosdf2, ddz) \
++ NIOS2_FPU_INSN (fsind, sindf2, ddz) \
++ NIOS2_FPU_INSN (ftand, tandf2, ddz) \
++ NIOS2_FPU_INSN (fatand, atandf2, ddz) \
++ NIOS2_FPU_INSN (fexpd, expdf2, ddz) \
++ NIOS2_FPU_INSN (flogd, logdf2, ddz) \
++ NIOS2_FPU_INSN (fcmpltd, nios2_sltdf, idd) \
++ NIOS2_FPU_INSN (fcmpled, nios2_sledf, idd) \
++ NIOS2_FPU_INSN (fcmpgtd, nios2_sgtdf, idd) \
++ NIOS2_FPU_INSN (fcmpged, nios2_sgedf, idd) \
++ NIOS2_FPU_INSN (fcmpeqd, nios2_seqdf, idd) \
++ NIOS2_FPU_INSN (fcmpned, nios2_snedf, idd) \
++\
++ NIOS2_FPU_INSN (floatis, floatsisf2, siz) \
++ NIOS2_FPU_INSN (floatus, floatunssisf2, suz) \
++ NIOS2_FPU_INSN (floatid, floatsidf2, diz) \
++ NIOS2_FPU_INSN (floatud, floatunssidf2, duz) \
++ NIOS2_FPU_INSN (fixsi, fixsfsi2, isz) \
++ NIOS2_FPU_INSN (fixsu, fixunssfsi2, usz) \
++ NIOS2_FPU_INSN (fixdi, fixdfsi2, idz) \
++ NIOS2_FPU_INSN (fixdu, fixunsdfsi2, udz) \
++ NIOS2_FPU_INSN (fextsd, extendsfdf2, dsz) \
++ NIOS2_FPU_INSN (ftruncds, truncdfsf2, sdz)
++
++enum
++{
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ NIOS2_CONCAT (nios2_fpu_, insn),
++NIOS2_FOR_ALL_FPU_INSNS
++ nios2_fpu_max_insn
++};
++
++struct cpp_reader;
++typedef const char * (*nios2_outputfn) (rtx);
++typedef void (*nios2_pragmafn) (struct cpp_reader *);
++
++typedef struct
++{
++ const char *option; /* name of switch, e.g. fadds */
++ const char *insnnm; /* name of gcc insn, e.g. addsf3 */
++ const char *args; /* args to gcc insn, e.g. sss */
++ const char *value; /* value of switch as a string */
++ int N; /* value of switch as an integer, -1 = not used */
++ nios2_outputfn output; /* output function for use in .md file */
++ const char *pname; /* name of corresponding #pragma custom- */
++ nios2_pragmafn pragma; /* pragma function for register_target_pragmas */
++ const char *nopname; /* name of corresponding #pragma no-custom- */
++ nios2_pragmafn nopragma; /* pragma function for register_target_pragmas */
++ int is_double; /* does this insn have any double operands */
++ int needed_by_double; /* is this insn needed if doubles are used? */
++ int needs_unsafe; /* does this insn require
++ -funsafe-math-optimizations to work? */
++ int needs_finite; /* does this insn require
++ -ffinite-math-only to work? */
++ int pragma_seen; /* have we seen the corresponding #pragma? */
++} nios2_fpu_info;
++
++extern nios2_fpu_info nios2_fpu_insns[nios2_fpu_max_insn];
++extern const char *nios2_custom_fpu_cfg_string;
++
++#undef NIOS2_FPU_INSN
++#define NIOS2_FPU_INSN(opt, insn, args) \
++ { \
++ "custom-" NIOS2_STRINGIFY (opt) "=", \
++ &(nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)].value), \
++ N_("Integer id (N) of " NIOS2_STRINGIFY (opt) " custom instruction"), \
++ 0 \
++ }, \
++ { \
++ "no-custom-" NIOS2_STRINGIFY (opt), \
++ &(nios2_fpu_insns[NIOS2_CONCAT (nios2_fpu_, insn)].value), \
++ N_("Do not use the " NIOS2_STRINGIFY (opt) " custom instruction"), \
++ "-1" \
++ },
++
+#define TARGET_OPTIONS \
+{ \
+ { "sys=nosys", &nios2_sys_nosys_string, \
@@ -6958,12 +9133,19 @@
+ N_("Name of System Library to link against. (Converted to a -l option)"), 0}, \
+ { "sys-crt0=", &nios2_sys_crt0_string, \
+ N_("Name of the startfile. (default is a crt0 for the ISS only)"), 0}, \
++ NIOS2_FOR_ALL_FPU_INSNS \
++ { "custom-fpu-cfg=", &nios2_custom_fpu_cfg_string, \
++ N_("Floating point custom instruction configuration name"), 0 }, \
+}
+
++/* We're little endian, unless otherwise specified by including big.h */
++#ifndef TARGET_ENDIAN_DEFAULT
++# define TARGET_ENDIAN_DEFAULT 0
++#endif
+
+/* Default target_flags if no switches specified. */
+#ifndef TARGET_DEFAULT
-+# define TARGET_DEFAULT (HAS_MUL_FLAG | CACHE_VOLATILE_FLAG)
++# define TARGET_DEFAULT (HAS_MUL_FLAG | CACHE_VOLATILE_FLAG | TARGET_ENDIAN_DEFAULT)
+#endif
+
+/* Switch Recognition by gcc.c. Add -G xx support */
@@ -6976,13 +9158,27 @@
+#define CAN_DEBUG_WITHOUT_FP
+
+#define CC1_SPEC "\
-+%{G*}"
++%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}}"
++
++#if TARGET_ENDIAN_DEFAULT == 0
++# define ASM_SPEC "\
++%{!EB:%{!meb:-EL}} %{EB|meb:-EB}"
++# define LINK_SPEC "\
++%{!EB:%{!meb:-EL}} %{EB|meb:-EB}"
++# define MULTILIB_DEFAULTS { "EL" }
++#else
++# define ASM_SPEC "\
++%{!EL:%{!mel:-EB}} %{EL|mel:-EL}"
++# define LINK_SPEC "\
++%{!EL:%{!mel:-EB}} %{EL|mel:-EL}"
++# define MULTILIB_DEFAULTS { "EB" }
++#endif
+
+#undef LIB_SPEC
+#define LIB_SPEC \
+"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \
+ %{msys-lib=*: -l%*} \
-+ %{!msys-lib=*: -lc } \
++ %{!msys-lib=*: -lnosys -lstack} \
+ --end-group \
+ %{msys-lib=: %eYou need a library name for -msys-lib=} \
+"
@@ -6990,7 +9186,7 @@
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
-+"%{msys-crt0=*: %*} %{!msys-crt0=*: crt1%O%s} \
++"%{msys-crt0=*: %*} %{!msys-crt0=*: crt0%O%s} \
+ %{msys-crt0=: %eYou need a C startup file for -msys-crt0=} \
+ %{mctors-in-init: crti%O%s crtbegin%O%s} \
+"
@@ -7006,8 +9202,13 @@
+
+#define DEFAULT_SIGNED_CHAR 1
+#define BITS_BIG_ENDIAN 0
-+#define BYTES_BIG_ENDIAN 0
-+#define WORDS_BIG_ENDIAN 0
++#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
++#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
++#if defined(__nios2_big_endian__)
++#define LIBGCC2_WORDS_BIG_ENDIAN 1
++#else
++#define LIBGCC2_WORDS_BIG_ENDIAN 0
++#endif
+#define BITS_PER_UNIT 8
+#define BITS_PER_WORD 32
+#define UNITS_PER_WORD 4
@@ -7043,7 +9244,8 @@
+ ************************/
+
+/* comparison type */
-+/* ??? currently only CMP_SI is used */
++/* ??? Currently CMP_DI is unused. CMP_SF and CMP_DF are only used if
++ the corresponding -mcustom-<opcode> switches are present. */
+enum cmp_type {
+ CMP_SI, /* compare four byte integers */
+ CMP_DI, /* compare eight byte integers */
@@ -7077,8 +9279,8 @@
+23 r23 sc Static Chain (Callee Saved)
+ ??? Does $sc want to be caller or callee
+ saved. If caller, 15, else 23.
-+24 r24 Exception Temporary
-+25 r25 Breakpoint Temporary
++24 r24 et Exception Temporary
++25 r25 bt Breakpoint Temporary
+26 r26 gp Global Pointer
+27 r27 sp Stack Pointer
+28 r28 fp Frame Pointer
@@ -7120,7 +9322,7 @@
+/* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \
+/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \
-+/* 40 */ 1, \
++/* 40 */ 1 \
+ }
+
+/* call used is the same as caller saved
@@ -7132,7 +9334,7 @@
+/* 10 */ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \
+/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \
+/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \
-+/* 40 */ 1, \
++/* 40 */ 1 \
+ }
+
+#define HARD_REGNO_NREGS(REGNO, MODE) \
@@ -7155,6 +9357,39 @@
+enum reg_class
+{
+ NO_REGS,
++ D00_REG,
++ D01_REG,
++ D02_REG,
++ D03_REG,
++ D04_REG,
++ D05_REG,
++ D06_REG,
++ D07_REG,
++ D08_REG,
++ D09_REG,
++ D10_REG,
++ D11_REG,
++ D12_REG,
++ D13_REG,
++ D14_REG,
++ D15_REG,
++ D16_REG,
++ D17_REG,
++ D18_REG,
++ D19_REG,
++ D20_REG,
++ D21_REG,
++ D22_REG,
++ D23_REG,
++ D24_REG,
++ D25_REG,
++ D26_REG,
++ D27_REG,
++ D28_REG,
++ D29_REG,
++ D30_REG,
++ D31_REG,
++ GP_REGS,
+ ALL_REGS,
+ LIM_REG_CLASSES
+};
@@ -7163,21 +9398,89 @@
+
+#define REG_CLASS_NAMES \
+ {"NO_REGS", \
++ "D00_REG", \
++ "D01_REG", \
++ "D02_REG", \
++ "D03_REG", \
++ "D04_REG", \
++ "D05_REG", \
++ "D06_REG", \
++ "D07_REG", \
++ "D08_REG", \
++ "D09_REG", \
++ "D10_REG", \
++ "D11_REG", \
++ "D12_REG", \
++ "D13_REG", \
++ "D14_REG", \
++ "D15_REG", \
++ "D16_REG", \
++ "D17_REG", \
++ "D18_REG", \
++ "D19_REG", \
++ "D20_REG", \
++ "D21_REG", \
++ "D22_REG", \
++ "D23_REG", \
++ "D24_REG", \
++ "D25_REG", \
++ "D26_REG", \
++ "D27_REG", \
++ "D28_REG", \
++ "D29_REG", \
++ "D30_REG", \
++ "D31_REG", \
++ "GP_REGS", \
+ "ALL_REGS"}
+
+#define GENERAL_REGS ALL_REGS
+
+#define REG_CLASS_CONTENTS \
+/* NO_REGS */ {{ 0, 0}, \
++/* D00_REG */ { 1 << 0, 0}, \
++/* D01_REG */ { 1 << 1, 0}, \
++/* D02_REG */ { 1 << 2, 0}, \
++/* D03_REG */ { 1 << 3, 0}, \
++/* D04_REG */ { 1 << 4, 0}, \
++/* D05_REG */ { 1 << 5, 0}, \
++/* D06_REG */ { 1 << 6, 0}, \
++/* D07_REG */ { 1 << 7, 0}, \
++/* D08_REG */ { 1 << 8, 0}, \
++/* D09_REG */ { 1 << 9, 0}, \
++/* D10_REG */ { 1 << 10, 0}, \
++/* D11_REG */ { 1 << 11, 0}, \
++/* D12_REG */ { 1 << 12, 0}, \
++/* D13_REG */ { 1 << 13, 0}, \
++/* D14_REG */ { 1 << 14, 0}, \
++/* D15_REG */ { 1 << 15, 0}, \
++/* D16_REG */ { 1 << 16, 0}, \
++/* D17_REG */ { 1 << 17, 0}, \
++/* D18_REG */ { 1 << 18, 0}, \
++/* D19_REG */ { 1 << 19, 0}, \
++/* D20_REG */ { 1 << 20, 0}, \
++/* D21_REG */ { 1 << 21, 0}, \
++/* D22_REG */ { 1 << 22, 0}, \
++/* D23_REG */ { 1 << 23, 0}, \
++/* D24_REG */ { 1 << 24, 0}, \
++/* D25_REG */ { 1 << 25, 0}, \
++/* D26_REG */ { 1 << 26, 0}, \
++/* D27_REG */ { 1 << 27, 0}, \
++/* D28_REG */ { 1 << 28, 0}, \
++/* D29_REG */ { 1 << 29, 0}, \
++/* D30_REG */ { 1 << 30, 0}, \
++/* D31_REG */ { 1 << 31, 0}, \
++/* GP_REGS */ {~0, 0}, \
+/* ALL_REGS */ {~0,~0}} \
+
-+#define REGNO_REG_CLASS(REGNO) ALL_REGS
++#define REGNO_REG_CLASS(REGNO) ((REGNO) <= 31 ? GP_REGS : ALL_REGS)
+
+#define BASE_REG_CLASS ALL_REGS
+#define INDEX_REG_CLASS ALL_REGS
+
-+/* only one reg class, 'r', is handled automatically */
-+#define REG_CLASS_FROM_LETTER(CHAR) NO_REGS
++/* 'r', is handled automatically */
++#define REG_CLASS_FROM_CONSTRAINT(CHAR, STR) \
++ reg_class_from_constraint ((CHAR), (STR))
++
+
+#define REGNO_OK_FOR_BASE_P2(REGNO, STRICT) \
+ ((STRICT) \
@@ -7231,6 +9534,9 @@
+#define PREFERRED_RELOAD_CLASS(X, CLASS) \
+ ((CLASS) == NO_REGS ? GENERAL_REGS : (CLASS))
+
++#define CONSTRAINT_LEN(C, STR) \
++ ((C) == 'D' ? 3 : DEFAULT_CONSTRAINT_LEN ((C), (STR)))
++
+/* 'S' matches immediates which are in small data
+ and therefore can be added to gp to create a
+ 32-bit value. */
@@ -7338,6 +9644,9 @@
+#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
+ (function_arg (&CUM, MODE, TYPE, NAMED))
+
++#define MUST_PASS_IN_STACK(MODE, TYPE) \
++ nios2_must_pass_in_stack ((MODE), (TYPE))
++
+#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
+ (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED))
+
@@ -7357,6 +9666,15 @@
+#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
+ (function_arg_advance (&CUM, MODE, TYPE, NAMED))
+
++#define FUNCTION_ARG_PADDING(MODE, TYPE) \
++ (nios2_function_arg_padding_upward ((MODE), (TYPE)) ? upward : downward)
++
++#define PAD_VARARGS_DOWN \
++ (FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward)
++
++#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
++ (nios2_block_reg_padding_upward ((MODE), (TYPE), (FIRST)) ? upward : downward)
++
+#define FUNCTION_ARG_REGNO_P(REGNO) \
+ ((REGNO) >= FIRST_ARG_REGNO && (REGNO) <= LAST_ARG_REGNO)
+
@@ -7372,8 +9690,9 @@
+ * Generating Code for Profiling
+ * ----------------------------- */
+
-+#define PROFILE_BEFORE_PROLOGUE
+
++#define PROFILE_BEFORE_PROLOGUE
++#define NO_PROFILE_COUNTERS 1
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ function_profiler ((FILE), (LABELNO))
+
@@ -7546,8 +9865,8 @@
+ "r21", \
+ "r22", \
+ "r23", \
-+ "r24", \
-+ "r25", \
++ "et", \
++ "bt", \
+ "gp", \
+ "sp", \
+ "fp", \
@@ -7565,6 +9884,21 @@
+ "fake_ap", \
+}
+
++#define ADDITIONAL_REGISTER_NAMES \
++{ \
++ {"r0", 0}, \
++ {"r1", 1}, \
++ {"r24", 24}, \
++ {"r25", 25}, \
++ {"r26", 26}, \
++ {"r27", 27}, \
++ {"r28", 28}, \
++ {"r29", 29}, \
++ {"r30", 30}, \
++ {"r31", 31} \
++}
++
++
+#define ASM_OUTPUT_OPCODE(STREAM, PTR)\
+ (PTR) = asm_output_opcode (STREAM, PTR)
+
@@ -7664,9 +9998,12 @@
+
+#define MOVE_MAX 4
+
++#define STORE_FLAG_VALUE 1
+#define Pmode SImode
+#define FUNCTION_MODE QImode
+
++#define REGISTER_TARGET_PRAGMAS() nios2_register_target_pragmas ();
++
+#define CASE_VECTOR_MODE Pmode
+
+#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
@@ -7674,12 +10011,15 @@
+#define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND)
+
+#define WORD_REGISTER_OPERATIONS
---- gcc-3.4.3/gcc/config/nios2/nios2.md
-+++ gcc-3.4.3-nios2/gcc/config/nios2/nios2.md
-@@ -0,0 +1,2078 @@
+diff --git a/gcc/config/nios2/nios2.md b/gcc/config/nios2/nios2.md
+new file mode 100644
+index 0000000..6183247
+--- /dev/null
++++ b/gcc/config/nios2/nios2.md
+@@ -0,0 +1,2867 @@
+;; Machine Description for Altera NIOS 2G NIOS2 version.
-+;; Copyright (C) 2003 Altera
-+;; Contributed by Jonah Graham (jgraham@altera.com).
++;; Copyright (C) 2005 Altera
++;; Contributed by Jonah Graham (jgraham@altera.com) and Will Reece (wreece@altera.com).
+;;
+;; This file is part of GNU CC.
+;;
@@ -7700,12 +10040,43 @@
+
+
+
++
++;*****************************************************************************
++;*
++;* constraint strings
++;*
++;*****************************************************************************
++;
++; We use the following constraint letters for constants
++;
++; I: -32768 to -32767
++; J: 0 to 65535
++; K: $nnnn0000 for some nnnn
++; L: 0 to 31 (for shift counts)
++; M: 0
++; N: 0 to 255 (for custom instruction numbers)
++; O: 0 to 31 (for control register numbers)
++;
++; We use the following built-in register classes:
++;
++; r: general purpose register (r0..r31)
++; m: memory operand
++;
++; Plus, we define the following constraint strings:
++;
++; S: symbol that is in the "small data" area
++; Dnn: Dnn_REG (just rnn)
++;
++
++
++
+;*****************************************************************************
+;*
+;* constants
+;*
+;*****************************************************************************
+(define_constants [
++ (ET_REGNO 24)
+ (GP_REGNO 26)
+ (SP_REGNO 27)
+ (FP_REGNO 28)
@@ -7733,7 +10104,26 @@
+ (UNSPEC_SYNC 9)
+ (UNSPEC_WRCTL 10)
+ (UNSPEC_RDCTL 11)
-+
++ (UNSPEC_TRAP 12)
++ (UNSPEC_STACK_OVERFLOW_DETECT_AND_TRAP 13)
++ (UNSPEC_FCOSS 14)
++ (UNSPEC_FCOSD 15)
++ (UNSPEC_FSINS 16)
++ (UNSPEC_FSIND 17)
++ (UNSPEC_FTANS 18)
++ (UNSPEC_FTAND 19)
++ (UNSPEC_FATANS 20)
++ (UNSPEC_FATAND 21)
++ (UNSPEC_FEXPS 22)
++ (UNSPEC_FEXPD 23)
++ (UNSPEC_FLOGS 24)
++ (UNSPEC_FLOGD 25)
++ (UNSPEC_FWRX 26)
++ (UNSPEC_FWRY 27)
++ (UNSPEC_FRDXLO 28)
++ (UNSPEC_FRDXHI 29)
++ (UNSPEC_FRDY 30)
++ ;; Note that values 100..151 are used by custom instructions, see below.
+])
+
+
@@ -7829,8 +10219,7 @@
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=m, r,r, r")
+ (match_operand:QI 1 "general_operand" "rM,m,rM,I"))]
+ "(register_operand (operands[0], QImode)
-+ || register_operand (operands[1], QImode)
-+ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
++ || reg_or_0_operand (operands[1], QImode))"
+ "@
+ stb%o0\\t%z1, %0
+ ldbu%o1\\t%0, %1
@@ -7856,7 +10245,7 @@
+
+(define_insn "stbio"
+ [(set (match_operand:SI 0 "memory_operand" "=m")
-+ (match_operand:SI 1 "register_operand" "r"))
++ (match_operand:SI 1 "reg_or_0_operand" "rM"))
+ (unspec_volatile:SI [(const_int 0)] UNSPEC_STBIO)]
+ ""
+ "stbio\\t%z1, %0"
@@ -7876,8 +10265,7 @@
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=m, r,r, r,r")
+ (match_operand:HI 1 "general_operand" "rM,m,rM,I,J"))]
+ "(register_operand (operands[0], HImode)
-+ || register_operand (operands[1], HImode)
-+ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
++ || reg_or_0_operand (operands[1], HImode))"
+ "@
+ sth%o0\\t%z1, %0
+ ldhu%o1\\t%0, %1
@@ -7904,7 +10292,7 @@
+
+(define_insn "sthio"
+ [(set (match_operand:SI 0 "memory_operand" "=m")
-+ (match_operand:SI 1 "register_operand" "r"))
++ (match_operand:SI 1 "reg_or_0_operand" "rM"))
+ (unspec_volatile:SI [(const_int 0)] UNSPEC_STHIO)]
+ ""
+ "sthio\\t%z1, %0"
@@ -7923,8 +10311,7 @@
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=m, r,r, r,r,r,r")
+ (match_operand:SI 1 "general_operand" "rM,m,rM,I,J,S,i"))]
+ "(register_operand (operands[0], SImode)
-+ || register_operand (operands[1], SImode)
-+ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
++ || reg_or_0_operand (operands[1], SImode))"
+ "@
+ stw%o0\\t%z1, %0
+ ldw%o1\\t%0, %1
@@ -7945,7 +10332,7 @@
+
+(define_insn "stwio"
+ [(set (match_operand:SI 0 "memory_operand" "=m")
-+ (match_operand:SI 1 "register_operand" "r"))
++ (match_operand:SI 1 "reg_or_0_operand" "rM"))
+ (unspec_volatile:SI [(const_int 0)] UNSPEC_STWIO)]
+ ""
+ "stwio\\t%z1, %0"
@@ -7994,26 +10381,30 @@
+;* sign extension
+;*
+;*****************************************************************************
-+
+(define_expand "extendhisi2"
+ [(set (match_operand:SI 0 "register_operand" "")
+ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
+ ""
+{
-+ if (optimize && GET_CODE (operands[1]) == MEM)
-+ operands[1] = force_not_mem (operands[1]);
++})
+
-+ if (GET_CODE (operands[1]) != MEM)
-+ {
-+ rtx op1 = gen_lowpart (SImode, operands[1]);
-+ rtx temp = gen_reg_rtx (SImode);
-+ rtx shift = GEN_INT (16);
++(define_insn "*extendhisi2"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
++ ""
++ "#")
+
-+ emit_insn (gen_ashlsi3 (temp, op1, shift));
-+ emit_insn (gen_ashrsi3 (operands[0], temp, shift));
-+ DONE;
-+ }
-+})
++(define_split
++ [(set (match_operand:SI 0 "register_operand" "")
++ (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
++ "reload_completed"
++ [(set (match_dup 0)
++ (and:SI (match_dup 1) (const_int 65535)))
++ (set (match_dup 0)
++ (xor:SI (match_dup 0) (const_int 32768)))
++ (set (match_dup 0)
++ (plus:SI (match_dup 0) (const_int -32768)))]
++ "operands[1] = gen_lowpart (SImode, operands[1]);")
+
+(define_insn "extendhisi2_internal"
+ [(set (match_operand:SI 0 "register_operand" "=r")
@@ -8022,26 +10413,34 @@
+ "ldh%o1\\t%0, %1"
+ [(set_attr "type" "ld")])
+
++
+(define_expand "extendqihi2"
+ [(set (match_operand:HI 0 "register_operand" "")
+ (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
+ ""
+{
-+ if (optimize && GET_CODE (operands[1]) == MEM)
-+ operands[1] = force_not_mem (operands[1]);
++})
++
++(define_insn "*extendqihi2"
++ [(set (match_operand:HI 0 "register_operand" "=r")
++ (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
++ ""
++ "#")
++
++(define_split
++ [(set (match_operand:HI 0 "register_operand" "")
++ (sign_extend:HI (match_operand:QI 1 "register_operand" "")))]
++ "reload_completed"
++ [(set (match_dup 0)
++ (and:SI (match_dup 1) (const_int 255)))
++ (set (match_dup 0)
++ (xor:SI (match_dup 0) (const_int 128)))
++ (set (match_dup 0)
++ (plus:SI (match_dup 0) (const_int -128)))]
++ "operands[0] = gen_lowpart (SImode, operands[0]);
++ operands[1] = gen_lowpart (SImode, operands[1]);")
+
-+ if (GET_CODE (operands[1]) != MEM)
-+ {
-+ rtx op0 = gen_lowpart (SImode, operands[0]);
-+ rtx op1 = gen_lowpart (SImode, operands[1]);
-+ rtx temp = gen_reg_rtx (SImode);
-+ rtx shift = GEN_INT (24);
+
-+ emit_insn (gen_ashlsi3 (temp, op1, shift));
-+ emit_insn (gen_ashrsi3 (op0, temp, shift));
-+ DONE;
-+ }
-+})
+
+(define_insn "extendqihi2_internal"
+ [(set (match_operand:HI 0 "register_operand" "=r")
@@ -8056,20 +10455,25 @@
+ (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
+ ""
+{
-+ if (optimize && GET_CODE (operands[1]) == MEM)
-+ operands[1] = force_not_mem (operands[1]);
++})
+
-+ if (GET_CODE (operands[1]) != MEM)
-+ {
-+ rtx op1 = gen_lowpart (SImode, operands[1]);
-+ rtx temp = gen_reg_rtx (SImode);
-+ rtx shift = GEN_INT (24);
++(define_insn "*extendqisi2"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
++ ""
++ "#")
+
-+ emit_insn (gen_ashlsi3 (temp, op1, shift));
-+ emit_insn (gen_ashrsi3 (operands[0], temp, shift));
-+ DONE;
-+ }
-+})
++(define_split
++ [(set (match_operand:SI 0 "register_operand" "")
++ (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
++ "reload_completed"
++ [(set (match_dup 0)
++ (and:SI (match_dup 1) (const_int 255)))
++ (set (match_dup 0)
++ (xor:SI (match_dup 0) (const_int 128)))
++ (set (match_dup 0)
++ (plus:SI (match_dup 0) (const_int -128)))]
++ "operands[1] = gen_lowpart (SImode, operands[1]);")
+
+(define_insn "extendqisi2_insn"
+ [(set (match_operand:SI 0 "register_operand" "=r")
@@ -8080,6 +10484,7 @@
+
+
+
++
+;*****************************************************************************
+;*
+;* Arithmetic Operations
@@ -8094,6 +10499,26 @@
+ "add%i2\\t%0, %1, %z2"
+ [(set_attr "type" "alu")])
+
++(define_insn "addsf3"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (plus:SF (match_operand:SF 1 "register_operand" "%r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_addsf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_addsf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "adddf3"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (plus:DF (match_operand:DF 1 "register_operand" "%r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_adddf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_adddf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
+(define_insn "subsi3"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rM")
@@ -8102,6 +10527,26 @@
+ "sub\\t%0, %z1, %2"
+ [(set_attr "type" "alu")])
+
++(define_insn "subsf3"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (minus:SF (match_operand:SF 1 "register_operand" "r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_subsf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_subsf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "subdf3"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (minus:DF (match_operand:DF 1 "register_operand" "r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_subdf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_subdf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
+(define_insn "mulsi3"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (mult:SI (match_operand:SI 1 "register_operand" "r,r")
@@ -8110,6 +10555,26 @@
+ "mul%i2\\t%0, %1, %z2"
+ [(set_attr "type" "mul")])
+
++(define_insn "mulsf3"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (mult:SF (match_operand:SF 1 "register_operand" "%r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_mulsf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_mulsf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "muldf3"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (mult:DF (match_operand:DF 1 "register_operand" "%r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_muldf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_muldf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
+(define_expand "divsi3"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (div:SI (match_operand:SI 1 "register_operand" "r")
@@ -8136,6 +10601,26 @@
+ "div\\t%0, %1, %2"
+ [(set_attr "type" "div")])
+
++(define_insn "divsf3"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (div:SF (match_operand:SF 1 "register_operand" "r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_divsf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_divsf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "divdf3"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (div:DF (match_operand:DF 1 "register_operand" "r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_divdf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_divdf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
+(define_insn "udivsi3"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (udiv:SI (match_operand:SI 1 "register_operand" "r")
@@ -8167,7 +10652,7 @@
+ [(set_attr "type" "mul")])
+
+
-+(define_expand "mulsidi3"
++(define_expand "mulsidi3_little_endian"
+ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0)
+ (mult:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "register_operand" "")))
@@ -8175,10 +10660,42 @@
+ (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
+ (sign_extend:DI (match_dup 2)))
+ (const_int 32))))]
-+ "TARGET_HAS_MULX"
++ "TARGET_HAS_MULX && !WORDS_BIG_ENDIAN"
+ "")
+
-+(define_expand "umulsidi3"
++(define_expand "mulsidi3_big_endian"
++ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
++ (mult:SI (match_operand:SI 1 "register_operand" "")
++ (match_operand:SI 2 "register_operand" "")))
++ (set (subreg:SI (match_dup 0) 0)
++ (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
++ (sign_extend:DI (match_dup 2)))
++ (const_int 32))))]
++ "TARGET_HAS_MULX && WORDS_BIG_ENDIAN"
++ "")
++
++(define_expand "mulsidi3"
++ [(match_operand:DI 0 "register_operand" "")
++ (match_operand:SI 1 "register_operand" "")
++ (match_operand:SI 2 "register_operand" "")]
++ "TARGET_HAS_MULX"
++ {
++ if (WORDS_BIG_ENDIAN)
++ {
++ emit_insn (gen_mulsidi3_big_endian (operands[0],
++ operands[1],
++ operands[2]));
++ }
++ else
++ {
++ emit_insn (gen_mulsidi3_little_endian (operands[0],
++ operands[1],
++ operands[2]));
++ }
++ DONE;
++ })
++
++(define_expand "umulsidi3_little_endian"
+ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0)
+ (mult:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "register_operand" "")))
@@ -8186,9 +10703,40 @@
+ (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
+ (zero_extend:DI (match_dup 2)))
+ (const_int 32))))]
-+ "TARGET_HAS_MULX"
++ "TARGET_HAS_MULX && !WORDS_BIG_ENDIAN"
++ "")
++
++(define_expand "umulsidi3_big_endian"
++ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
++ (mult:SI (match_operand:SI 1 "register_operand" "")
++ (match_operand:SI 2 "register_operand" "")))
++ (set (subreg:SI (match_dup 0) 0)
++ (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
++ (zero_extend:DI (match_dup 2)))
++ (const_int 32))))]
++ "TARGET_HAS_MULX && WORDS_BIG_ENDIAN"
+ "")
+
++(define_expand "umulsidi3"
++ [(match_operand:DI 0 "register_operand" "")
++ (match_operand:SI 1 "register_operand" "")
++ (match_operand:SI 2 "register_operand" "")]
++ "TARGET_HAS_MULX"
++ {
++ if (WORDS_BIG_ENDIAN)
++ {
++ emit_insn (gen_umulsidi3_big_endian (operands[0],
++ operands[1],
++ operands[2]));
++ }
++ else
++ {
++ emit_insn (gen_umulsidi3_little_endian (operands[0],
++ operands[1],
++ operands[2]));
++ }
++ DONE;
++ })
+
+
+;*****************************************************************************
@@ -8207,6 +10755,24 @@
+}
+ [(set_attr "type" "alu")])
+
++(define_insn "negsf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (neg:SF (match_operand:SF 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_negsf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_negsf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "negdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (neg:DF (match_operand:DF 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_negdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_negdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
+(define_insn "one_cmplsi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (not:SI (match_operand:SI 1 "register_operand" "r")))]
@@ -8218,8 +10784,252 @@
+ [(set_attr "type" "alu")])
+
+
++;*****************************************************************************
++;*
++;* Miscellaneous floating point
++;*
++;*****************************************************************************
++(define_insn "nios2_fwrx"
++ [(unspec_volatile [(match_operand:DF 0 "register_operand" "r")] UNSPEC_FWRX)]
++ "nios2_fpu_insns[nios2_fpu_nios2_fwrx].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_fwrx].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "nios2_fwry"
++ [(unspec_volatile [(match_operand:SF 0 "register_operand" "r")] UNSPEC_FWRY)]
++ "nios2_fpu_insns[nios2_fpu_nios2_fwry].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_fwry].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "nios2_frdxlo"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec_volatile:SF [(const_int 0)] UNSPEC_FRDXLO))]
++ "nios2_fpu_insns[nios2_fpu_nios2_frdxlo].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_frdxlo].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "nios2_frdxhi"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec_volatile:SF [(const_int 0)] UNSPEC_FRDXHI))]
++ "nios2_fpu_insns[nios2_fpu_nios2_frdxhi].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_frdxhi].output) (insn);
++ }
++ [(set_attr "type" "custom")])
+
-+; Logical Operantions
++(define_insn "nios2_frdy"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec_volatile:SF [(const_int 0)] UNSPEC_FRDY))]
++ "nios2_fpu_insns[nios2_fpu_nios2_frdy].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_frdy].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "minsf3"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (if_then_else:SF (lt:SF (match_operand:SF 1 "register_operand" "%r")
++ (match_operand:SF 2 "register_operand" "r"))
++ (match_dup 1)
++ (match_dup 2)))]
++ "nios2_fpu_insns[nios2_fpu_minsf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_minsf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "mindf3"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (if_then_else:DF (lt:DF (match_operand:DF 1 "register_operand" "%r")
++ (match_operand:DF 2 "register_operand" "r"))
++ (match_dup 1)
++ (match_dup 2)))]
++ "nios2_fpu_insns[nios2_fpu_mindf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_mindf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "maxsf3"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (if_then_else:SF (lt:SF (match_operand:SF 1 "register_operand" "%r")
++ (match_operand:SF 2 "register_operand" "r"))
++ (match_dup 2)
++ (match_dup 1)))]
++ "nios2_fpu_insns[nios2_fpu_maxsf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_maxsf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "maxdf3"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (if_then_else:DF (lt:DF (match_operand:DF 1 "register_operand" "%r")
++ (match_operand:DF 2 "register_operand" "r"))
++ (match_dup 2)
++ (match_dup 1)))]
++ "nios2_fpu_insns[nios2_fpu_maxdf3].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_maxdf3].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "abssf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (abs:SF (match_operand:SF 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_abssf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_abssf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "absdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (abs:DF (match_operand:DF 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_absdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_absdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "sqrtsf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (sqrt:SF (match_operand:SF 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_sqrtsf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_sqrtsf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "sqrtdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (sqrt:DF (match_operand:DF 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_sqrtdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_sqrtdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "cossf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] UNSPEC_FCOSS))]
++ "nios2_fpu_insns[nios2_fpu_cossf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_cossf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "cosdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unspec:DF [(match_operand:DF 1 "register_operand" "r")] UNSPEC_FCOSD))]
++ "nios2_fpu_insns[nios2_fpu_cosdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_cosdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "sinsf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] UNSPEC_FSINS))]
++ "nios2_fpu_insns[nios2_fpu_sinsf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_sinsf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "sindf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unspec:DF [(match_operand:DF 1 "register_operand" "r")] UNSPEC_FSIND))]
++ "nios2_fpu_insns[nios2_fpu_sindf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_sindf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "tansf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] UNSPEC_FTANS))]
++ "nios2_fpu_insns[nios2_fpu_tansf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_tansf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "tandf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unspec:DF [(match_operand:DF 1 "register_operand" "r")] UNSPEC_FTAND))]
++ "nios2_fpu_insns[nios2_fpu_tandf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_tandf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "atansf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] UNSPEC_FATANS))]
++ "nios2_fpu_insns[nios2_fpu_atansf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_atansf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "atandf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unspec:DF [(match_operand:DF 1 "register_operand" "r")] UNSPEC_FATAND))]
++ "nios2_fpu_insns[nios2_fpu_atandf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_atandf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "expsf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] UNSPEC_FEXPS))]
++ "nios2_fpu_insns[nios2_fpu_expsf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_expsf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "expdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unspec:DF [(match_operand:DF 1 "register_operand" "r")] UNSPEC_FEXPD))]
++ "nios2_fpu_insns[nios2_fpu_expdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_expdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "logsf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] UNSPEC_FLOGS))]
++ "nios2_fpu_insns[nios2_fpu_logsf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_logsf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "logdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unspec:DF [(match_operand:DF 1 "register_operand" "r")] UNSPEC_FLOGD))]
++ "nios2_fpu_insns[nios2_fpu_logdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_logdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++;*****************************************************************************
++;*
++;* Logical Operantions
++;*
++;*****************************************************************************
+
+(define_insn "andsi3"
+ [(set (match_operand:SI 0 "register_operand" "=r, r,r")
@@ -8275,7 +11085,12 @@
+ (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
+ (match_operand:SI 2 "shift_operand" "r,L")))]
+ ""
-+ "sll%i2\\t%0, %1, %z2"
++
++{
++ if( GET_CODE ( operands[2] ) == CONST_INT && INTVAL( operands[2] ) == 1 )
++ return "add\t%0,%1,%1";
++ return "sll%i2\t%0,%1,%z2";
++}
+ [(set_attr "type" "shift")])
+
+(define_insn "ashrsi3"
@@ -8334,6 +11149,108 @@
+
+;*****************************************************************************
+;*
++;* Converting between floating point and fixed point
++;*
++;*****************************************************************************
++(define_insn "floatsisf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (float:SF (match_operand:SI 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_floatsisf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_floatsisf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "floatsidf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (float:DF (match_operand:SI 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_floatsidf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_floatsidf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "floatunssisf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (unsigned_float:SF (match_operand:SI 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_floatunssisf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_floatunssisf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "floatunssidf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (unsigned_float:DF (match_operand:SI 1 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_floatunssidf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_floatunssidf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "fixsfsi2"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (fix:SI (match_operand:SF 1 "general_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_fixsfsi2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_fixsfsi2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "fixdfsi2"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (fix:SI (match_operand:DF 1 "general_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_fixdfsi2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_fixdfsi2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "fixunssfsi2"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (unsigned_fix:SI (match_operand:SF 1 "general_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_fixunssfsi2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_fixunssfsi2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "fixunsdfsi2"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (unsigned_fix:SI (match_operand:DF 1 "general_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_fixunsdfsi2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_fixunsdfsi2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "extendsfdf2"
++ [(set (match_operand:DF 0 "register_operand" "=r")
++ (float_extend:DF (match_operand:SF 1 "general_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_extendsfdf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_extendsfdf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++(define_insn "truncdfsf2"
++ [(set (match_operand:SF 0 "register_operand" "=r")
++ (float_truncate:SF (match_operand:DF 1 "general_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_truncdfsf2].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_truncdfsf2].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++
++
++
++
++
++
++;*****************************************************************************
++;*
+;* Prologue, Epilogue and Return
+;*
+;*****************************************************************************
@@ -8487,7 +11404,7 @@
+)
+
+(define_insn "sibcall_insn"
-+ [(call (mem:QI (match_operand:SI 0 "register_operand" "r"))
++ [(call (mem:QI (match_operand:SI 0 "register_operand" "D08"))
+ (match_operand 1 "" ""))
+ (return)
+ (use (match_operand 2 "" ""))]
@@ -8497,7 +11414,7 @@
+
+(define_insn "sibcall_value_insn"
+ [(set (match_operand 0 "register_operand" "")
-+ (call (mem:QI (match_operand:SI 1 "register_operand" "r"))
++ (call (mem:QI (match_operand:SI 1 "register_operand" "D08"))
+ (match_operand 2 "" "")))
+ (return)
+ (use (match_operand 3 "" ""))]
@@ -8569,6 +11486,40 @@
+ DONE;
+})
+
++(define_expand "cmpsf"
++ [(set (cc0)
++ (compare:CC (match_operand:SF 0 "register_operand" "")
++ (match_operand:SF 1 "register_operand" "")))]
++ "(nios2_fpu_insns[nios2_fpu_nios2_sltsf].N >= 0
++ || nios2_fpu_insns[nios2_fpu_nios2_sgtsf].N >= 0)
++ && (nios2_fpu_insns[nios2_fpu_nios2_sgesf].N >= 0
++ || nios2_fpu_insns[nios2_fpu_nios2_slesf].N >= 0)
++ && nios2_fpu_insns[nios2_fpu_nios2_seqsf].N >= 0
++ && nios2_fpu_insns[nios2_fpu_nios2_snesf].N >= 0"
++{
++ branch_cmp[0] = operands[0];
++ branch_cmp[1] = operands[1];
++ branch_type = CMP_SF;
++ DONE;
++})
++
++(define_expand "cmpdf"
++ [(set (cc0)
++ (compare:CC (match_operand:DF 0 "register_operand" "")
++ (match_operand:DF 1 "register_operand" "")))]
++ "(nios2_fpu_insns[nios2_fpu_nios2_sltdf].N >= 0
++ || nios2_fpu_insns[nios2_fpu_nios2_sgtdf].N >= 0)
++ && (nios2_fpu_insns[nios2_fpu_nios2_sgedf].N >= 0
++ || nios2_fpu_insns[nios2_fpu_nios2_sledf].N >= 0)
++ && nios2_fpu_insns[nios2_fpu_nios2_seqdf].N >= 0
++ && nios2_fpu_insns[nios2_fpu_nios2_snedf].N >= 0"
++{
++ branch_cmp[0] = operands[0];
++ branch_cmp[1] = operands[1];
++ branch_type = CMP_DF;
++ DONE;
++})
++
+
+;*****************************************************************************
+;*
@@ -8582,7 +11533,7 @@
+ (match_dup 2)))]
+ ""
+{
-+ if (branch_type != CMP_SI)
++ if (branch_type != CMP_SI && branch_type != CMP_SF && branch_type != CMP_DF)
+ FAIL;
+
+ /* set up operands from compare. */
@@ -8603,13 +11554,35 @@
+ [(set_attr "type" "alu")])
+
+
++(define_insn "nios2_seqsf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (eq:SI (match_operand:SF 1 "register_operand" "%r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_seqsf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_seqsf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_seqdf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (eq:SI (match_operand:DF 1 "register_operand" "%r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_seqdf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_seqdf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "sne"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (ne:SI (match_dup 1)
+ (match_dup 2)))]
+ ""
+{
-+ if (branch_type != CMP_SI)
++ if (branch_type != CMP_SI && branch_type != CMP_SF && branch_type != CMP_DF)
+ FAIL;
+
+ /* set up operands from compare. */
@@ -8630,13 +11603,35 @@
+ [(set_attr "type" "alu")])
+
+
++(define_insn "nios2_snesf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (ne:SI (match_operand:SF 1 "register_operand" "%r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_snesf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_snesf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_snedf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (ne:SI (match_operand:DF 1 "register_operand" "%r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_snedf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_snedf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "sgt"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (gt:SI (match_dup 1)
+ (match_dup 2)))]
+ ""
+{
-+ if (branch_type != CMP_SI)
++ if (branch_type != CMP_SI && branch_type != CMP_SF && branch_type != CMP_DF)
+ FAIL;
+
+ /* set up operands from compare. */
@@ -8657,13 +11652,35 @@
+ [(set_attr "type" "alu")])
+
+
++(define_insn "nios2_sgtsf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (gt:SI (match_operand:SF 1 "register_operand" "r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sgtsf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sgtsf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_sgtdf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (gt:SI (match_operand:DF 1 "register_operand" "r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sgtdf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sgtdf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "sge"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (ge:SI (match_dup 1)
+ (match_dup 2)))]
+ ""
+{
-+ if (branch_type != CMP_SI)
++ if (branch_type != CMP_SI && branch_type != CMP_SF && branch_type != CMP_DF)
+ FAIL;
+
+ /* set up operands from compare. */
@@ -8683,13 +11700,36 @@
+ "cmpge%i2\\t%0, %z1, %z2"
+ [(set_attr "type" "alu")])
+
++
++(define_insn "nios2_sgesf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (ge:SI (match_operand:SF 1 "register_operand" "r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sgesf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sgesf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_sgedf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (ge:SI (match_operand:DF 1 "register_operand" "r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sgedf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sgedf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "sle"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (le:SI (match_dup 1)
+ (match_dup 2)))]
+ ""
+{
-+ if (branch_type != CMP_SI)
++ if (branch_type != CMP_SI && branch_type != CMP_SF && branch_type != CMP_DF)
+ FAIL;
+
+ /* set up operands from compare. */
@@ -8710,13 +11750,35 @@
+ [(set_attr "type" "alu")])
+
+
++(define_insn "nios2_slesf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (le:SI (match_operand:SF 1 "register_operand" "r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_slesf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_slesf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_sledf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (le:SI (match_operand:DF 1 "register_operand" "r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sledf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sledf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "slt"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (lt:SI (match_dup 1)
+ (match_dup 2)))]
+ ""
+{
-+ if (branch_type != CMP_SI)
++ if (branch_type != CMP_SI && branch_type != CMP_SF && branch_type != CMP_DF)
+ FAIL;
+
+ /* set up operands from compare. */
@@ -8737,6 +11799,28 @@
+ [(set_attr "type" "alu")])
+
+
++(define_insn "nios2_sltsf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (lt:SI (match_operand:SF 1 "register_operand" "r")
++ (match_operand:SF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sltsf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sltsf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_sltdf"
++ [(set (match_operand:SI 0 "register_operand" "=r")
++ (lt:SI (match_operand:DF 1 "register_operand" "r")
++ (match_operand:DF 2 "register_operand" "r")))]
++ "nios2_fpu_insns[nios2_fpu_nios2_sltdf].N >= 0"
++ {
++ return (*nios2_fpu_insns[nios2_fpu_nios2_sltdf].output) (insn);
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "sgtu"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (gtu:SI (match_dup 1)
@@ -8865,6 +11949,36 @@
+ [(set_attr "type" "control")])
+
+
++(define_insn "nios2_cbranch_sf"
++ [(set (pc)
++ (if_then_else
++ (match_operator:SI 0 "comparison_operator"
++ [(match_operand:SF 2 "register_operand" "r")
++ (match_operand:SF 3 "register_operand" "r")])
++ (label_ref (match_operand 1 "" ""))
++ (pc)))]
++ ""
++ {
++ return nios2_output_fpu_insn_cmps (insn, GET_CODE (operands[0]));
++ }
++ [(set_attr "type" "custom")])
++
++
++(define_insn "nios2_cbranch_df"
++ [(set (pc)
++ (if_then_else
++ (match_operator:SI 0 "comparison_operator"
++ [(match_operand:DF 2 "register_operand" "r")
++ (match_operand:DF 3 "register_operand" "r")])
++ (label_ref (match_operand 1 "" ""))
++ (pc)))]
++ ""
++ {
++ return nios2_output_fpu_insn_cmpd (insn, GET_CODE (operands[0]));
++ }
++ [(set_attr "type" "custom")])
++
++
+(define_expand "beq"
+ [(set (pc)
+ (if_then_else (eq:CC (cc0)
@@ -9741,11 +12855,23 @@
+
+(define_insn "wrctl"
+ [(unspec_volatile:SI [(match_operand:SI 0 "rdwrctl_operand" "O")
-+ (match_operand:SI 1 "register_operand" "r")] UNSPEC_WRCTL)]
++ (match_operand:SI 1 "reg_or_0_operand" "rM")] UNSPEC_WRCTL)]
+ ""
-+ "wrctl\\tctl%0, %1"
++ "wrctl\\tctl%0, %z1"
+ [(set_attr "type" "control")])
+
++;Used to signal a stack overflow
++(define_insn "trap"
++ [(unspec_volatile [(const_int 0)] UNSPEC_TRAP)]
++ ""
++ "break\\t3"
++ [(set_attr "type" "control")])
++
++(define_insn "stack_overflow_detect_and_trap"
++ [(unspec_volatile [(const_int 0)] UNSPEC_STACK_OVERFLOW_DETECT_AND_TRAP)]
++ ""
++ "bgeu\\tsp, et, 1f\;break\\t3\;1:"
++ [(set_attr "type" "control")])
+
+
+;*****************************************************************************
@@ -9755,9 +12881,15 @@
+;*****************************************************************************
+
+
---- gcc-3.4.3/gcc/config/nios2/t-nios2
-+++ gcc-3.4.3-nios2/gcc/config/nios2/t-nios2
-@@ -0,0 +1,123 @@
++;; Local Variables:
++;; mode: lisp
++;; End:
+diff --git a/gcc/config/nios2/t-nios2 b/gcc/config/nios2/t-nios2
+new file mode 100644
+index 0000000..b92f80a
+--- /dev/null
++++ b/gcc/config/nios2/t-nios2
+@@ -0,0 +1,175 @@
+##
+## Compiler flags to use when compiling libgcc2.c.
+##
@@ -9790,10 +12922,16 @@
+
+$(FPBIT): $(srcdir)/config/fp-bit.c Makefile
+ echo '#define FLOAT' > ${FPBIT}
++ echo '#ifndef __nios2_big_endian__' >> ${FPBIT}
++ echo '#define FLOAT_BIT_ORDER_MISMATCH' >> ${FPBIT}
++ echo '#endif' >> ${FPBIT}
+ cat $(srcdir)/config/fp-bit.c >> ${FPBIT}
+
+$(DPBIT): $(srcdir)/config/fp-bit.c Makefile
+ echo '' > ${DPBIT}
++ echo '#ifndef __nios2_big_endian__' >> ${DPBIT}
++ echo '#define FLOAT_BIT_ORDER_MISMATCH' >> ${DPBIT}
++ echo '#endif' >> ${DPBIT}
+ cat $(srcdir)/config/fp-bit.c >> ${DPBIT}
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
@@ -9837,7 +12975,44 @@
+## sets of options: -m68000, -m68020, -msoft-float, -m68000 -msoft-float,
+## and -m68020 -msoft-float.
+
-+MULTILIB_OPTIONS = mno-hw-mul mhw-mulx
++
++## The BUILD_BE_MULTILIB and BUILD_PG_MULTILIB variables allow the
++## makefile user to enable/disable the generation of the precompiled
++## big endian and profiling libraries. By default, the big endian
++## libraries are not created on a windows build and the profiling
++## libraries are not created on a Solaris build. All other library
++## combinations are created by default.
++
++# Uncomment to temporarily avoid building big endian and profiling libraries during a Windows build.
++#ifeq ($(DEV_HOST_OS), win32)
++#BUILD_BE_MULTILIB ?= 0
++#BUILD_PG_MULTILIB ?= 0
++#endif
++
++#By default, avoid building the profiling libraries during a Solaris build.
++ifeq ($(DEV_HOST_OS), solaris)
++BUILD_PG_MULTILIB ?= 0
++endif
++
++BUILD_BE_MULTILIB ?= 1
++BUILD_PG_MULTILIB ?= 1
++BUILD_MULTILIB ?= 1
++
++ifeq ($(BUILD_MULTILIB), 1)
++
++MULTILIB_OPTIONS = mno-hw-mul mhw-mulx mstack-check mcustom-fpu-cfg=60-1 mcustom-fpu-cfg=60-2
++
++#Add the profiling flag to the multilib variable if required
++ifeq ($(BUILD_PG_MULTILIB), 1)
++MULTILIB_OPTIONS += pg
++endif
++
++#Add the big endian flag to the multilib variable if required
++ifeq ($(BUILD_BE_MULTILIB), 1)
++MULTILIB_OPTIONS += EB/EL
++endif
++
++endif
+
+## MULTILIB_DIRNAMES
+## If MULTILIB_OPTIONS is used, this variable specifies the directory names
@@ -9858,6 +13033,13 @@
+## synonyms. In that case, set MULTILIB_MATCHES to a list of items of the
+## form option=option to describe all relevant synonyms. For example,
+## m68000=mc68000 m68020=mc68020.
++
++ifeq ($(BUILD_MULTILIB), 1)
++ifeq ($(BUILD_BE_MULTILIB), 1)
++MULTILIB_MATCHES = EL=mel EB=meb
++endif
++endif
++
+##
+## MULTILIB_EXCEPTIONS
+## Sometimes when there are multiple sets of MULTILIB_OPTIONS being
@@ -9872,7 +13054,9 @@
+## *mcall-aix/*fleading-underscore* *mlittle/*mcall-aix*
+##
+
-+MULTILIB_EXCEPTIONS = *mno-hw-mul/*mhw-mulx*
++ifeq ($(BUILD_MULTILIB), 1)
++MULTILIB_EXCEPTIONS = *mno-hw-mul/*mhw-mulx* *mcustom-fpu-cfg=60-1/*mcustom-fpu-cfg=60-2*
++endif
+
+##
+## MULTILIB_EXTRA_OPTS Sometimes it is desirable that when building
@@ -9881,22 +13065,169 @@
+## of options to be used for all builds.
+##
+
---- gcc-3.4.3/gcc/config.gcc
-+++ gcc-3.4.3-nios2/gcc/config.gcc
-@@ -1321,6 +1321,10 @@ m32rle-*-linux*)
- thread_file='posix'
- fi
- ;;
-+# JBG
-+nios2-*-* | nios2-*-*)
-+ tm_file="elfos.h ${tm_file}"
-+ ;;
- # m68hc11 and m68hc12 share the same machine description.
- m68hc11-*-*|m6811-*-*)
- tm_file="dbxelf.h elfos.h m68hc11/m68hc11.h"
---- gcc-3.4.3/gcc/cse.c
-+++ gcc-3.4.3-nios2/gcc/cse.c
-@@ -3134,6 +3134,10 @@ find_comparison_args (enum rtx_code code
+diff --git a/gcc/config/nios2/t-nios2-uclibc b/gcc/config/nios2/t-nios2-uclibc
+new file mode 100644
+index 0000000..9a303db
+--- /dev/null
++++ b/gcc/config/nios2/t-nios2-uclibc
+@@ -0,0 +1,152 @@
++##
++## Compiler flags to use when compiling libgcc2.c.
++##
++## LIB2FUNCS_EXTRA
++## A list of source file names to be compiled or assembled and inserted into libgcc.a.
++
++LIB2FUNCS_EXTRA=$(srcdir)/config/nios2/lib2-divmod.c \
++ $(srcdir)/config/nios2/lib2-divmod-hi.c \
++ $(srcdir)/config/nios2/lib2-divtable.c \
++ $(srcdir)/config/nios2/lib2-mul.c
++
++##
++## Floating Point Emulation
++## To have GCC include software floating point libraries in libgcc.a define FPBIT
++## and DPBIT along with a few rules as follows:
++##
++## # We want fine grained libraries, so use the new code
++## # to build the floating point emulation libraries.
++FPBIT=$(srcdir)/config/nios2/nios2-fp-bit.c
++DPBIT=$(srcdir)/config/nios2/nios2-dp-bit.c
++
++TARGET_LIBGCC2_CFLAGS = -O2
++
++# FLOAT_ONLY - no doubles
++# SMALL_MACHINE - QI/HI is faster than SI
++# Actually SMALL_MACHINE uses chars and shorts instead of ints
++# since ints (16-bit ones as they are today) are at least as fast
++# as chars and shorts, don't define SMALL_MACHINE
++# CMPtype - type returned by FP compare, i.e. INT (hard coded in fp-bit - see code )
++
++$(FPBIT): $(srcdir)/config/fp-bit.c Makefile
++ echo '#define FLOAT' > ${FPBIT}
++ echo '#ifndef __nios2_big_endian__' >> ${FPBIT}
++ echo '#define FLOAT_BIT_ORDER_MISMATCH' >> ${FPBIT}
++ echo '#endif' >> ${FPBIT}
++ cat $(srcdir)/config/fp-bit.c >> ${FPBIT}
++
++$(DPBIT): $(srcdir)/config/fp-bit.c Makefile
++ echo '' > ${DPBIT}
++ echo '#ifndef __nios2_big_endian__' >> ${DPBIT}
++ echo '#define FLOAT_BIT_ORDER_MISMATCH' >> ${DPBIT}
++ echo '#endif' >> ${DPBIT}
++ cat $(srcdir)/config/fp-bit.c >> ${DPBIT}
++
++EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
++
++## You may need to provide additional #defines at the beginning of
++## fp-bit.c and dp-bit.c to control target endianness and other options
++##
++## CRTSTUFF_T_CFLAGS
++## Special flags used when compiling crtstuff.c. See Initialization.
++##
++## CRTSTUFF_T_CFLAGS_S
++## Special flags used when compiling crtstuff.c for shared linking. Used
++## if you use crtbeginS.o and crtendS.o in EXTRA-PARTS. See Initialization.
++##
++## MULTILIB_OPTIONS
++## For some targets, invoking GCC in different ways produces objects that
++## can not be linked together. For example, for some targets GCC produces
++## both big and little endian code. For these targets, you must arrange
++## for multiple versions of libgcc.a to be compiled, one for each set of
++## incompatible options. When GCC invokes the linker, it arranges to link
++## in the right version of libgcc.a, based on the command line options
++## used.
++## The MULTILIB_OPTIONS macro lists the set of options for which special
++## versions of libgcc.a must be built. Write options that are mutually
++## incompatible side by side, separated by a slash. Write options that may
++## be used together separated by a space. The build procedure will build
++## all combinations of compatible options.
++##
++## For example, if you set MULTILIB_OPTIONS to m68000/m68020 msoft-float,
++## Makefile will build special versions of libgcc.a using the following
++## sets of options: -m68000, -m68020, -msoft-float, -m68000 -msoft-float,
++## and -m68020 -msoft-float.
++
++
++## The BUILD_BE_MULTILIB and BUILD_PG_MULTILIB variables allow the
++## makefile user to enable/disable the generation of the precompiled
++## big endian and profiling libraries.
++
++# By default, avoid building big endian and profiling libraries
++BUILD_BE_MULTILIB ?= 0
++BUILD_PG_MULTILIB ?= 0
++BUILD_MULTILIB ?= 1
++
++ifeq ($(BUILD_MULTILIB), 1)
++
++MULTILIB_OPTIONS = mno-hw-mul mhw-mulx mstack-check mcustom-fpu-cfg=60-1 mcustom-fpu-cfg=60-2
++
++#Add the profiling flag to the multilib variable if required
++ifeq ($(BUILD_PG_MULTILIB), 1)
++MULTILIB_OPTIONS += pg
++endif
++
++#Add the big endian flag to the multilib variable if required
++ifeq ($(BUILD_BE_MULTILIB), 1)
++MULTILIB_OPTIONS += EB/EL
++endif
++
++endif
++
++## MULTILIB_DIRNAMES
++## If MULTILIB_OPTIONS is used, this variable specifies the directory names
++## that should be used to hold the various libraries. Write one element in
++## MULTILIB_DIRNAMES for each element in MULTILIB_OPTIONS. If
++## MULTILIB_DIRNAMES is not used, the default value will be
++## MULTILIB_OPTIONS, with all slashes treated as spaces.
++## For example, if MULTILIB_OPTIONS is set to m68000/m68020 msoft-float,
++## then the default value of MULTILIB_DIRNAMES is m68000 m68020
++## msoft-float. You may specify a different value if you desire a
++## different set of directory names.
++
++# MULTILIB_DIRNAMES =
++
++## MULTILIB_MATCHES
++## Sometimes the same option may be written in two different ways. If an
++## option is listed in MULTILIB_OPTIONS, GCC needs to know about any
++## synonyms. In that case, set MULTILIB_MATCHES to a list of items of the
++## form option=option to describe all relevant synonyms. For example,
++## m68000=mc68000 m68020=mc68020.
++
++ifeq ($(BUILD_MULTILIB), 1)
++ifeq ($(BUILD_BE_MULTILIB), 1)
++MULTILIB_MATCHES = EL=mel EB=meb
++endif
++endif
++
++##
++## MULTILIB_EXCEPTIONS
++## Sometimes when there are multiple sets of MULTILIB_OPTIONS being
++## specified, there are combinations that should not be built. In that
++## case, set MULTILIB_EXCEPTIONS to be all of the switch exceptions in
++## shell case syntax that should not be built.
++## For example, in the PowerPC embedded ABI support, it is not desirable to
++## build libraries compiled with the -mcall-aix option and either of the
++## -fleading-underscore or -mlittle options at the same time. Therefore
++## MULTILIB_EXCEPTIONS is set to
++##
++## *mcall-aix/*fleading-underscore* *mlittle/*mcall-aix*
++##
++
++ifeq ($(BUILD_MULTILIB), 1)
++MULTILIB_EXCEPTIONS = *mno-hw-mul/*mhw-mulx* *mcustom-fpu-cfg=60-1/*mcustom-fpu-cfg=60-2*
++endif
++
++##
++## MULTILIB_EXTRA_OPTS Sometimes it is desirable that when building
++## multiple versions of libgcc.a certain options should always be passed on
++## to the compiler. In that case, set MULTILIB_EXTRA_OPTS to be the list
++## of options to be used for all builds.
++##
++
+diff --git a/gcc/cse.c b/gcc/cse.c
+index 72af39a..b36310c 100644
+--- a/gcc/cse.c
++++ b/gcc/cse.c
+@@ -3134,6 +3134,10 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2,
#ifdef FLOAT_STORE_FLAG_VALUE
REAL_VALUE_TYPE fsfv;
#endif
@@ -9907,9 +13238,45 @@
/* If the entry isn't valid, skip it. */
if (! exp_equiv_p (p->exp, p->exp, 1, 0))
---- gcc-3.4.3/gcc/doc/extend.texi
-+++ gcc-3.4.3-nios2/gcc/doc/extend.texi
-@@ -5636,12 +5636,118 @@ to those machines. Generally these gene
+diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
+index 4638645..cdb248d 100644
+--- a/gcc/doc/extend.texi
++++ b/gcc/doc/extend.texi
+@@ -2488,6 +2488,33 @@ contents of that register. The @code{short_call} attribute always places
+ the offset to the function from the call site into the @samp{BL}
+ instruction directly.
+
++@item reverse_bitfields/no_reverse_bitfields
++@cindex reverse_bitfields on Altera Nios II
++This attribute specifies the order of bitfield allocation within a
++particular struct on Altera's Nios II processor. This overrides both
++the @option{-mno-reverse-bitfields} and @option{-mreverse-bitfields}
++switches, as well as any @code{#pragma} that might be present. It is
++ignored except when present on a struct.
++
++@smallexample
++struct inner
++@{
++ unsigned int a:1;
++ unsigned int b:31;
++@} __attribute__ ((reverse_bitfields));
++
++union outer
++@{
++ struct inner inner;
++ unsigned int val;
++@};
++
++@end smallexample
++
++will cause a to be allocated overlapping the most significant bit of
++val, regardless of any @code{#pragma} or compiler switch. See the
++@option{-mreverse-bitfields} switch for more examples.
++
+ @item function_vector
+ @cindex calling functions through the function vector on the H8/300 processors
+ Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
+@@ -5638,12 +5665,118 @@ to those machines. Generally these generate calls to specific machine
instructions, but allow the compiler to schedule those calls.
@menu
@@ -10028,9 +13395,49 @@
@node Alpha Built-in Functions
@subsection Alpha Built-in Functions
---- gcc-3.4.3/gcc/doc/invoke.texi
-+++ gcc-3.4.3-nios2/gcc/doc/invoke.texi
-@@ -337,6 +337,14 @@ in the following sections.
+@@ -8022,6 +8155,7 @@ we do not recommend the use of pragmas; @xref{Function Attributes},
+ for further explanation.
+
+ @menu
++* Altera Nios II Pragmas::
+ * ARM Pragmas::
+ * RS/6000 and PowerPC Pragmas::
+ * Darwin Pragmas::
+@@ -8029,6 +8163,29 @@ for further explanation.
+ * Tru64 Pragmas::
+ @end menu
+
++@node Altera Nios II Pragmas
++@subsection Altera Nios II Pragmas
++
++The Altera Nios II target defines two pragmas to control the placement
++of bitfields within a struct.
++
++@table @code
++@item reverse_bitfields
++@cindex pragma, reverse_bitfields
++Cause all subsequent structs to behave as though the -mreverse-bitfields
++compiler switch had been given. Can be overridden by the
++@code{no_reverse_bitfields} attribute or a subsequent
++@code{#pragma no_reverse_bitfields}.
++
++@item no_reverse_bitfields
++@cindex pragma, no_reverse_bitfields
++Cause all subsequent structs to behave as though the -mno-reverse-bitfields
++compiler switch had been given. Can be overridden by the
++@code{reverse_bitfields} attribute or a subsequent
++@code{#pragma reverse_bitfields}.
++
++@end table
++
+ @node ARM Pragmas
+ @subsection ARM Pragmas
+
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index e683d0c..b34200f 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -337,6 +337,16 @@ in the following sections.
@item Machine Dependent Options
@xref{Submodel Options,,Hardware Models and Configurations}.
@@ -10040,12 +13447,14 @@
+-minline-memcpy -mno-fast-sw-div -mfast-sw-div @gol
+-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx @gol
+-mno-hw-div -mhw-div @gol
-+-msys-crt0= -msys-lib= -msys=nosys }
++-mno-stack-check -mstack-check @gol
++-msys-crt0= -msys-lib= -msys=nosys @gol
++-mreverse-bitfields -mno-reverse-bitfields}
+
@emph{M680x0 Options}
@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol
-@@ -5836,6 +5844,7 @@ machine description. The default for th
+@@ -5839,6 +5849,7 @@ machine description. The default for the options is also defined by
that macro, which enables you to change the defaults.
@menu
@@ -10053,7 +13462,7 @@
* M680x0 Options::
* M68hc1x Options::
* VAX Options::
-@@ -5871,6 +5880,103 @@ that macro, which enables you to change
+@@ -5874,6 +5885,290 @@ that macro, which enables you to change the defaults.
* FRV Options::
@end menu
@@ -10069,7 +13478,6 @@
+
+@item -msmallc
+@opindex msmallc
-+
+Link with a limited version of the C library, -lsmallc. For more
+information see the C Library Documentation.
+
@@ -10078,7 +13486,6 @@
+@itemx -mno-bypass-cache
+@opindex mno-bypass-cache
+@opindex mbypass-cache
-+
+Force all load and store instructions to always bypass cache by
+using io variants of the instructions. The default is to not
+bypass the cache.
@@ -10087,7 +13494,6 @@
+@itemx -mcache-volatile
+@opindex mcache-volatile
+@opindex mno-cache-volatile
-+
+Volatile memory access bypass the cache using the io variants of
+the ld and st instructions. The default is to cache volatile
+accesses.
@@ -10100,7 +13506,6 @@
+@itemx -minline-memcpy
+@opindex mno-inline-memcpy
+@opindex minline-memcpy
-+
+Do not inline memcpy. The default is to inline when -O is on.
+
+
@@ -10108,7 +13513,6 @@
+@itemx -mfast-sw-div
+@opindex mno-fast-sw-div
+@opindex mfast-sw-div
-+
+Do no use table based fast divide for small numbers. The default
+is to use the fast divide at -O3 and above.
+
@@ -10125,7 +13529,6 @@
+@opindex mhw-mulx
+@opindex mno-hw-div
+@opindex mhw-div
-+
+Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
+instructions by the compiler. The default is to emit @code{mul}
+and not emit @code{div} and @code{mulx}.
@@ -10133,10 +13536,16 @@
+The different combinations of @code{mul} and @code{mulx} instructions
+generate a different multilib options.
+
++@item -mno-stack-check
++@itemx -mstack-check
++@opindex no-stack-check
++@opindex stack-check
++Enables or disables the checking for sufficient memory when
++items are pushed onto the stack. A checked and non-checked
++version of each of the multilibs is provided.
+
+@item -msys-crt0=@var{startfile}
+@opindex msys-crt0
-+
+@var{startfile} is the file name of the startfile (crt0) to use
+when linking. The default is crt0.o that comes with libgloss
+and is only suitable for use with the instruction set
@@ -10145,21 +13554,210 @@
+@item -msys-lib=@var{systemlib}
+@itemx -msys-lib=nosys
+@opindex msys-lib
-+
+@var{systemlib} is the library name of the library which provides
+the system calls required by the C library, e.g. @code{read}, @code{write}
+etc. The default is to use nosys, this library provides
+stub implementations of the calls and is part of libgloss.
+
++@item -mno-reverse-bitfields
++@itemx -mreverse-bitfields
++@opindex mno-reverse-bitfields
++@opindex mreverse-bitfields
++When enabled, bitfields within a struct are allocated in reverse order.
++This is useful with legacy code that depends on the (inherently
++non-portable) ordering of bitfields via a union. Given:
++
++@smallexample
++struct inner
++@{
++ unsigned int a:1;
++ unsigned int b:31;
++@};
++
++union outer
++@{
++ struct inner inner;
++ unsigned int val;
++@};
++
++unsigned int f()
++@{
++ union outer o;
++ o.inner.a = 1;
++ o.inner.b = 0;
++ return o.val;
++@}
++@end smallexample
++
++a call to @code{f} will return 1 when compiled with
++@option{-mno-reverse-bitfields} (the default), or 2147483648 when
++compiled with @option{-mreverse-bitfields}.
++
++For structures that are a multiple of 32 bits wide, the reversal is
++done 32 bits at a time. For structures that are an odd multiple of 16
++bits wide, the reversal is done 16 bits at a time. For structures
++that are an odd multiple of 8 bits wide, the reversal is done 8 bits
++at a time. The size of a structure (as measured by the @code{sizeof}
++operator) never changes between @option{-mno-reverse-bitfields} and
++@option{-mreverse-bitfields}. Nonetheless, there can be some
++confusing corner cases with structs where the compiler has to add
++additional padding to meet alignment restrictions. Consider:
++
++@smallexample
++struct inner
++@{
++ unsigned int a:1;
++ unsigned int b:15;
++@};
++
++union outer
++@{
++ struct inner inner;
++ unsigned int val;
++@};
++
++unsigned int f()
++@{
++ union outer o;
++ o.val = 0;
++ o.inner.b = 1;
++ return o.val;
++@}
++@end smallexample
++
++a call to @code{f} will return 2 when compiled with
++@option{-mno-reverse-bitfields} (the default), or 65536 when compiled
++with @option{-mreverse-bitfields}. This is because @code{sizeof
++(inner)} is 4 in both cases. In the @option{-mno-reverse-bitfields}
++case, the compiler pads the struct at the end to be 4 bytes long,
++effectively doing:
++
++@smallexample
++struct inner
++@{
++ unsigned int a:1;
++ unsigned int b:15;
++ unsigned int padding:16;
++@};
++@end smallexample
++
++In the @option{-mreverse-bitfields} case, the hidden padding is
++reversed along with everything else, yielding the equivalent of:
++
++@smallexample
++struct inner
++@{
++ unsigned int padding:16;
++ unsigned int b:15;
++ unsigned int a:1;
++@};
++@end smallexample
++
++Of course, if we would rather that @code{sizeof (inner)} was 2, we could
++write the struct as:
++
++@smallexample
++struct inner
++@{
++ unsigned short a:1;
++ unsigned short b:15;
++@};
++@end smallexample
++
++and the padding would go away.
++
++In some cases, especially when using the @code{__packed__} attribute,
++there is no well-defined bit reversal that is possible: the compiler
++will issue an error message in this case. Consider:
++
++@smallexample
++struct invalid
++@{
++ unsigned int f1:1;
++ unsigned int f2:15;
++ unsigned int f3:4;
++ unsigned int f4:4;
++@} __attribute__ ((__packed__));
++@end smallexample
++
++Since @code{sizeof (invalid)} is 3, we are forced to try reversing
++individual bytes in the struct. But f2 is more than a byte wide, so
++we can't reverse it and still have it be contiguous. Similar cases
++occur when dealing with arrays or other large contiguous objects:
++
++@smallexample
++struct invalid2
++@{
++ unsigned char f1[5];
++ unsigned char f2[3];
++@};
++@end smallexample
++
++You'll have to rewrite the affected structs to say exactly what you
++mean in odd cases like that.
++
++Finally, note that individual fields are sized as a whole. The structs
++
++@smallexample
++struct array1
++@{
++ unsigned char f1[3];
++ unsigned char f2;
++@}
++@end smallexample
++
++and:
++
++@smallexample
++struct array2
++@{
++ unsigned char f1a;
++ unsigned char f1b;
++ unsigned char f1c;
++ unsigned char f2;
++@}
++@end smallexample
++
++are not equivalent. When compiled with @option{-mreverse-bitfields},
++they behave the same as:
++
++@smallexample
++struct array1r
++@{
++ unsigned char f2;
++ unsigned char f1[3];
++@}
++@end smallexample
++
++and:
++
++@smallexample
++struct array2r
++@{
++ unsigned char f2;
++ unsigned char f1c;
++ unsigned char f1b;
++ unsigned char f1a;
++@}
++@end smallexample
++
++would, respectively, when compiled with
++@option{-mno-reverse-bitfields}. In particular, f1 is treated as a
++single contiguous 24-bit object for purposes of reversal, while f1a,
++f1b, and f1c are treated as individual 8-bit objects that need not
++(and do not) remain contiguous. Use caution.
++
+@end table
+
+
@node M680x0 Options
@subsection M680x0 Options
@cindex M680x0 options
---- gcc-3.4.3/gcc/doc/md.texi
-+++ gcc-3.4.3-nios2/gcc/doc/md.texi
-@@ -1335,6 +1335,49 @@ However, here is a summary of the machin
+diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
+index b73f325..4a134b2 100644
+--- a/gcc/doc/md.texi
++++ b/gcc/doc/md.texi
+@@ -1337,6 +1337,58 @@ However, here is a summary of the machine-dependent constraints
available on some particular machines.
@table @emph
@@ -10203,9 +13801,577 @@
+data section and therefore can be added to @code{gp}
+as a 16-bit immediate to re-create their 32-bit value.
+
++@item D@var{nn}
++For a given two digit @var{nn} constrains the operand
++to the corresponding register. Example: D02 forces the
++operand into register r2. The side effect of using this
++operand constraint is that reload may not be able to
++meet the constraint. If reload fails, an error message
++about failing to find any register to spill in the
++D@var{nn}_REG register class will be emitted.
++
+@end table
+
+
@item ARM family---@file{arm.h}
@table @code
@item f
+diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
+index 4527fe4..e7cc581 100644
+--- a/gcc/stor-layout.c
++++ b/gcc/stor-layout.c
+@@ -1435,6 +1435,355 @@ finalize_type_size (tree type)
+ }
+ }
+
++static void
++reverse_bitfield_layout (record_layout_info rli)
++{
++ tree field;
++ tree rev_size;
++ unsigned int rev_size_int;
++
++ /*
++ * The size of the words we'll be reversing. Normally, we reverse
++ * entire SImode words. However, if the entire struct's size isn't an
++ * exact multiple of the size of SImode, we can reverse HImode or even
++ * QImode pieces. In the examples below, assume SImode/int is 32
++ * bits, HImode/short is 16 bits, and QImode/char is 8 bits.
++ * Consider:
++ *
++ * struct s1
++ * {
++ * int f1:1;
++ * int f2:31;
++ * };
++ *
++ * struct s2
++ * {
++ * int f1:1;
++ * int f2:15;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s3
++ * {
++ * short f1:1;
++ * short f2:15;
++ * };
++ *
++ * struct s4
++ * {
++ * int f1:1;
++ * int f2:15;
++ * };
++ *
++ * struct s5
++ * {
++ * int f1:8;
++ * int f2:8;
++ * int f3:4;
++ * int f4:4;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s6
++ * {
++ * int f1:1;
++ * int f2:15;
++ * int f3:4;
++ * int f4:4;
++ * int f5:8;
++ * };
++ *
++ * struct s7
++ * {
++ * int f1:1;
++ * int f2:15;
++ * int f3:4;
++ * int f4:4;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s8
++ * {
++ * char f1;
++ * short f2;
++ * char f3;
++ * };
++ *
++ * struct s9
++ * {
++ * char f1;
++ * short f2;
++ * char f3;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s10
++ * {
++ * char f1;
++ * short f2;
++ * char f3;
++ * short f4;
++ * };
++ *
++ * struct s11
++ * {
++ * char f1[5];
++ * int f2;
++ * };
++ *
++ * struct s12
++ * {
++ * char f1[5];
++ * char f2[3];
++ * int f3;
++ * };
++ *
++ * struct s13
++ * {
++ * char f1[3];
++ * int f2;
++ * };
++ *
++ * struct s14
++ * {
++ * char f1a;
++ * char f1b;
++ * char f1c;
++ * int f2;
++ * };
++ *
++ * Then we have:
++ *
++ * sizeof (struct s1) == 4
++ * sizeof (struct s2) == 2
++ * sizeof (struct s3) == 2
++ * sizeof (struct s4) == 4
++ * sizeof (struct s5) == 3
++ * sizeof (struct s6) == 4
++ * sizeof (struct s7) == 3
++ * sizeof (struct s8) == 6
++ * sizeof (struct s9) == 4
++ * sizeof (struct s10) == 8
++ * sizeof (struct s11) == 12
++ * sizeof (struct s12) == 12
++ *
++ * We want the equivalent reversed bitfield structs to be:
++ *
++ * struct s1r
++ * {
++ * int f2:31;
++ * int f1:1;
++ * };
++ *
++ * struct s2r
++ * {
++ * int f2:15;
++ * int f1:1;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s3r
++ * {
++ * short f2:15;
++ * short f1:1;
++ * };
++ *
++ * struct s4r
++ * {
++ * int unnamed:16;
++ * int f2:15;
++ * int f1:1;
++ * };
++ *
++ * struct s5r
++ * {
++ * int f1:8;
++ * int f2:8;
++ * int f4:4;
++ * int f3:4;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s6r
++ * {
++ * int f5:8;
++ * int f4:4;
++ * int f3:4;
++ * int f2:15;
++ * int f1:1;
++ * };
++ *
++ * struct s7r
++ * {
++ * #error cannot reverse bitfield
++ * } __attribute__ ((__packed__));
++ *
++ * struct s8r
++ * {
++ * char unnamed1;
++ * char f1;
++ * short f2;
++ * char unnamed2;
++ * char f3;
++ * };
++ *
++ * struct s9r
++ * {
++ * char f3;
++ * short f2;
++ * char f1;
++ * } __attribute__ ((__packed__));
++ *
++ * struct s10r
++ * {
++ * short f2;
++ * char unnamed1;
++ * char f1;
++ * short f4;
++ * char unnamed2;
++ * char f3;
++ * };
++ *
++ * struct s11r
++ * {
++ * char f1[5];
++ * int f2;
++ * };
++ *
++ * struct s12r
++ * {
++ * #error cannot reverse bitfield
++ * };
++ *
++ * struct s13r
++ * {
++ * char unnamed;
++ * char f1[3];
++ * int f2;
++ * };
++ *
++ * struct s14r
++ * {
++ * char unnamed;
++ * char f1c;
++ * char f1b;
++ * char f1a;
++ * int f2;
++ * };
++ *
++ * Note that the s4, s8, s10, s13, and s14 cases produce somewhat
++ * suprising results: the normally hidden padding bytes the compiler
++ * adds are also reversed. Further note that s13 and s14 are not
++ * equivalent: the f1 field in s13 is 24-bits wide, and is reversed
++ * accordingly, while the three fields f1a, f1b, and f1c in s14 are
++ * reversed as individual bytes.
++ *
++ * The s7 and s12 cases produce an error: we can't reverse a bitfield
++ * that is larger than word size we're reversing. The error is
++ * suppressed in the s11 case since the field in question and the
++ * field that follows are both word aligned.
++ */
++
++ /*
++ * First, figure out what size words to reverse. We look at the total
++ * number of bits currently in use by the struct, rounded up to the
++ * next multiple of rli->record_align, to decide.
++ */
++ {
++ int bits_in_use = TREE_INT_CST_LOW (round_up (rli_size_so_far (rli),
++ rli->record_align));
++ unsigned int size;
++ for (size = GET_MODE_BITSIZE (SImode);
++ size >= GET_MODE_BITSIZE (QImode);
++ size /= 2)
++ {
++ if (bits_in_use % size == 0)
++ {
++ break;
++ }
++ }
++ if (size < GET_MODE_BITSIZE (QImode))
++ {
++ /*
++ * rli->record_align should never be less than QImode, even
++ * for packed structs.
++ */
++ abort ();
++ }
++ rev_size = size_int_type (size, bitsizetype);
++ rev_size_int = size;
++ }
++
++ /*
++ * Then, iterate over the fields, reversing them as we go.
++ */
++ for (field = TYPE_FIELDS (rli->t); field; field = TREE_CHAIN (field))
++ {
++ tree type = TREE_TYPE (field);
++ if (TREE_CODE (field) != FIELD_DECL)
++ {
++ continue;
++ }
++ if (TREE_CODE (field) == ERROR_MARK || TREE_CODE (type) == ERROR_MARK)
++ {
++ return;
++ }
++ {
++ tree offset = DECL_FIELD_OFFSET (field);
++ tree offset_type = TREE_TYPE (offset);
++ tree bit_offset = DECL_FIELD_BIT_OFFSET (field);
++ tree bit_offset_type = TREE_TYPE (bit_offset);
++ tree bit = bit_from_pos (offset, bit_offset);
++ tree true_size = DECL_SIZE (field);
++ pos_from_bit (&offset, &bit_offset, rev_size_int, bit);
++ bit_offset = size_binop (MINUS_EXPR,
++ size_binop (MINUS_EXPR, rev_size, true_size),
++ bit_offset);
++ if (TREE_INT_CST_HIGH (bit_offset) != 0)
++ {
++ /*
++ * This happens when a field spans a rev_size boundary (see
++ * example s7 above): rather than try to come up with some
++ * well-defined, but non-intuitive definition for this case,
++ * just issue an error. It can also happen for large fields,
++ * e.g. arrays or other structs: if these large fields were
++ * already aligned, leave them be; otherwise issue the error
++ * in this case as well.
++ */
++ if ((TREE_INT_CST_HIGH (true_size) != 0
++ || TREE_INT_CST_LOW (true_size) > rev_size_int)
++ && TREE_INT_CST_HIGH (DECL_FIELD_BIT_OFFSET (field)) == 0
++ && TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)) == 0)
++ {
++ tree next_field = TREE_CHAIN (field);
++ if (!next_field)
++ {
++ /* No following field, so we're ok. */
++ continue;
++ }
++ else
++ {
++ tree next_offset = DECL_FIELD_OFFSET (next_field);
++ tree next_bit_offset = DECL_FIELD_BIT_OFFSET (next_field);
++ tree next_bit = bit_from_pos (next_offset, next_bit_offset);
++ pos_from_bit (&next_offset, &next_bit_offset, rev_size_int,
++ next_bit);
++ if (TREE_INT_CST_HIGH (next_bit_offset) == 0
++ && TREE_INT_CST_LOW (next_bit_offset) == 0)
++ {
++ /* Following field is aligned wrt rev_size_int boundary,
++ so we're ok. */
++ continue;
++ }
++ }
++ }
++ error ("unable to reverse bitfields in structure");
++ return;
++ }
++ bit = bit_from_pos (offset, bit_offset);
++ pos_from_bit (&offset, &bit_offset, rli->offset_align, bit);
++ TREE_TYPE (offset) = offset_type;
++ DECL_FIELD_OFFSET (field) = offset;
++ TREE_TYPE (bit_offset) = bit_offset_type;
++ DECL_FIELD_BIT_OFFSET (field) = bit_offset;
++ }
++ }
++}
++
+ /* Do all of the work required to layout the type indicated by RLI,
+ once the fields have been laid out. This function will call `free'
+ for RLI, unless FREE_P is false. Passing a value other than false
+@@ -1444,6 +1793,12 @@ finalize_type_size (tree type)
+ void
+ finish_record_layout (record_layout_info rli, int free_p)
+ {
++ /* Optionally reverse the placement of bitfields within the record */
++ if ((* targetm.reverse_bitfield_layout_p) (rli->t))
++ {
++ reverse_bitfield_layout (rli);
++ }
++
+ /* Compute the final size. */
+ finalize_record_size (rli);
+
+diff --git a/gcc/target-def.h b/gcc/target-def.h
+index 32d00ae..bdea4d4 100644
+--- a/gcc/target-def.h
++++ b/gcc/target-def.h
+@@ -300,6 +300,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
+ #define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
+ #define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
++#define TARGET_REVERSE_BITFIELD_LAYOUT_P hook_bool_tree_false
+ #define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false
+ #define TARGET_MANGLE_FUNDAMENTAL_TYPE hook_constcharptr_tree_null
+
+@@ -368,6 +369,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ TARGET_INSERT_ATTRIBUTES, \
+ TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P, \
+ TARGET_MS_BITFIELD_LAYOUT_P, \
++ TARGET_REVERSE_BITFIELD_LAYOUT_P, \
+ TARGET_INIT_BUILTINS, \
+ TARGET_EXPAND_BUILTIN, \
+ TARGET_MANGLE_FUNDAMENTAL_TYPE, \
+diff --git a/gcc/target.h b/gcc/target.h
+index 59788f9..97bde5f 100644
+--- a/gcc/target.h
++++ b/gcc/target.h
+@@ -295,6 +295,10 @@ struct gcc_target
+ Microsoft Visual C++ bitfield layout rules. */
+ bool (* ms_bitfield_layout_p) (tree record_type);
+
++ /* Return true if bitfields in RECORD_TYPE should be allocated
++ within their base type's bytes starting at the opposite end. */
++ bool (* reverse_bitfield_layout_p) (tree record_type);
++
+ /* Set up target-specific built-in functions. */
+ void (* init_builtins) (void);
+
+diff --git a/gcc/varasm.c b/gcc/varasm.c
+index 33307e5..d4ed0fc 100644
+--- a/gcc/varasm.c
++++ b/gcc/varasm.c
+@@ -3912,6 +3912,107 @@ array_size_for_constructor (tree val)
+ return tree_low_cst (i, 1);
+ }
+
++struct reorder_bitfields_key
++{
++ tree field;
++ tree value;
++};
++
++static int
++reorder_bitfields_compare (const void *x1, const void *x2)
++{
++ const struct reorder_bitfields_key *key1 = x1;
++ const struct reorder_bitfields_key *key2 = x2;
++ int pos1 = int_bit_position (key1->field);
++ int pos2 = int_bit_position (key2->field);
++
++ if (pos1 < pos2)
++ {
++ return -1;
++ }
++ else if (pos1 > pos2)
++ {
++ return 1;
++ }
++ else
++ {
++ /*
++ * No two fields should ever have the same bit_position, so
++ * something is horribly wrong.
++ */
++ abort ();
++ }
++}
++
++static void
++reorder_bitfields (tree *first_field, tree *first_value)
++{
++ struct reorder_bitfields_key *keys;
++ size_t field_count;
++ tree field;
++ tree value;
++ size_t i;
++
++ /*
++ * Find out how many fields are in this record, and allocate an array
++ * of keys to hold them all.
++ */
++ field_count = 0;
++ for (field = *first_field; field; field = TREE_CHAIN (field))
++ {
++ field_count++;
++ }
++ if (field_count < 2)
++ {
++ return;
++ }
++ keys = xmalloc (sizeof (struct reorder_bitfields_key) * field_count);
++
++ /*
++ * Make copies of the existing fields and values (using signed integer
++ * zeros for missing values) in the array of keys.
++ */
++ field = *first_field;
++ value = *first_value;
++ for (i = 0; i < field_count; i++)
++ {
++ keys[i].field = copy_node (field);
++ field = TREE_CHAIN (field);
++ if (value)
++ {
++ keys[i].value = copy_node (value);
++ TREE_PURPOSE (keys[i].value) = keys[i].field;
++ value = TREE_CHAIN (value);
++ }
++ else
++ {
++ keys[i].value = tree_cons (keys[i].field, ssize_int (0), 0);
++ }
++ }
++
++ /*
++ * Sort the array based on position of the fields in the record.
++ */
++ qsort (keys, field_count, sizeof (struct reorder_bitfields_key),
++ reorder_bitfields_compare);
++
++ /*
++ * Build new lists out of the sorted array.
++ */
++ for (i = 0; i < field_count - 1; i++)
++ {
++ TREE_CHAIN (keys[i].field) = keys[i+1].field;
++ TREE_CHAIN (keys[i].value) = keys[i+1].value;
++ }
++ *first_field = keys[0].field;
++ *first_value = keys[0].value;
++
++ /*
++ * Get rid of our array of keys and we're done.
++ */
++ free (keys);
++}
++
+ /* Subroutine of output_constant, used for CONSTRUCTORs (aggregate constants).
+ Generate at least SIZE bytes, padding if necessary. */
+
+@@ -3928,12 +4029,29 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size,
+ /* Nonzero means BYTE contains part of a byte, to be output. */
+ int byte_buffer_in_use = 0;
+ int byte = 0;
++ tree first_link = CONSTRUCTOR_ELTS (exp);
+
+ if (HOST_BITS_PER_WIDE_INT < BITS_PER_UNIT)
+ abort ();
+
+ if (TREE_CODE (type) == RECORD_TYPE)
++ {
++ if ((*targetm.reverse_bitfield_layout_p) (type))
++ {
++ /*
++ * If we're reversing bitfields, we have to reverse the order in
++ * which constructors containing bitfields are output. The
++ * easiest way to do that is to reorder the constructor elements
++ * and fields to be in memory-order.
++ */
+ field = TYPE_FIELDS (type);
++ reorder_bitfields (&field, &first_link);
++ }
++ else
++ {
++ field = TYPE_FIELDS (type);
++ }
++ }
+
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_DOMAIN (type) != 0)
+@@ -3948,7 +4066,7 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size,
+ There is always a maximum of one element in the chain LINK for unions
+ (even if the initializer in a source program incorrectly contains
+ more one). */
+- for (link = CONSTRUCTOR_ELTS (exp);
++ for (link = first_link;
+ link;
+ link = TREE_CHAIN (link),
+ field = field ? TREE_CHAIN (field) : 0)
diff --git a/toolchain/gcc/3.4.6/901-nios2-ctor_dtor.patch b/toolchain/gcc/3.4.6/901-nios2-ctor_dtor.patch
index 87145ad5e..e69de29bb 100644
--- a/toolchain/gcc/3.4.6/901-nios2-ctor_dtor.patch
+++ b/toolchain/gcc/3.4.6/901-nios2-ctor_dtor.patch
@@ -1,52 +0,0 @@
-Index: gcc/gcc/config/nios2/nios2.h
-===================================================================
---- gcc/gcc/config/nios2/nios2.h (revision 195)
-+++ gcc/gcc/config/nios2/nios2.h (revision 196)
-@@ -88,8 +88,6 @@
- N_("All ld/st instructins do not use io variants (default)") }, \
- { "smallc", 0, \
- N_("Link with a limited version of the C library") }, \
-- { "ctors-in-init", 0, \
-- "" /* undocumented: N_("Link with static constructors and destructors in init") */ }, \
- { "", TARGET_DEFAULT, 0 } \
- }
-
-@@ -140,12 +138,12 @@
- #define STARTFILE_SPEC \
- "%{msys-crt0=*: %*} %{!msys-crt0=*: crt1%O%s} \
- %{msys-crt0=: %eYou need a C startup file for -msys-crt0=} \
-- %{mctors-in-init: crti%O%s crtbegin%O%s} \
-+ crti%O%s crtbegin%O%s \
- "
-
- #undef ENDFILE_SPEC
- #define ENDFILE_SPEC \
-- "%{mctors-in-init: crtend%O%s crtn%O%s}"
-+ " crtend%O%s crtn%O%s"
-
-
- /***********************
-Index: gcc/gcc/config/nios2/t-nios2
-===================================================================
---- gcc/gcc/config/nios2/t-nios2 (revision 195)
-+++ gcc/gcc/config/nios2/t-nios2 (revision 196)
-@@ -36,18 +36,8 @@
- echo '' > ${DPBIT}
- cat $(srcdir)/config/fp-bit.c >> ${DPBIT}
-
--EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
-
--# Assemble startup files.
--$(T)crti.o: $(srcdir)/config/nios2/crti.asm $(GCC_PASSES)
-- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/nios2/crti.asm
--
--$(T)crtn.o: $(srcdir)/config/nios2/crtn.asm $(GCC_PASSES)
-- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/nios2/crtn.asm
--
--
- ## You may need to provide additional #defines at the beginning of
- ## fp-bit.c and dp-bit.c to control target endianness and other options
- ##
diff --git a/toolchain/gcc/3.4.6/nios2-config-fix.patch.conditional b/toolchain/gcc/3.4.6/nios2-config-fix.patch.conditional
index 9f1c37868..e69de29bb 100644
--- a/toolchain/gcc/3.4.6/nios2-config-fix.patch.conditional
+++ b/toolchain/gcc/3.4.6/nios2-config-fix.patch.conditional
@@ -1,19 +0,0 @@
---- gcc-3.4.6/gcc/config/t-linux-uclibc 2007-11-07 14:50:34.000000000 +0100
-+++ /dev/null 2007-11-02 12:35:37.750656579 +0100
-@@ -1,5 +0,0 @@
--# Remove glibc specific files added in t-linux
--SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
--
--# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
--LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
---- gcc-3.4.6/gcc/config.gcc.orig 2007-11-07 14:50:34.000000000 +0100
-+++ gcc-3.4.6/gcc/config.gcc 2007-11-07 15:32:31.000000000 +0100
-@@ -2334,7 +2334,7 @@
- # Rather than hook into each target, just do it after all the linux
- # targets have been processed
- case ${target} in
--*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
-+*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC"
- esac
-
- # Support for --with-cpu and related options (and a few unrelated options,
diff --git a/toolchain/gcc/gcc-uclibc-3.x.mk b/toolchain/gcc/gcc-uclibc-3.x.mk
index c6c622a0c..e2210d06c 100644
--- a/toolchain/gcc/gcc-uclibc-3.x.mk
+++ b/toolchain/gcc/gcc-uclibc-3.x.mk
@@ -168,9 +168,6 @@ endif
#toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc i386-gcc-soft-float.patch
#endif
endif
-ifeq ("$(strip $(ARCH))","nios2")
- toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) nios2-config-fix.patch.conditional
-endif
touch $@
# The --without-headers option stopped working with gcc 3.0 and has never been