Commit of nios2 port to trunk:
contrib/ 2013-12-31 Chung-Lin Tang <cltang@codesourcery.com> * config-list.mk: Add nios2-elf, nios2-linux-gnu. Corrected ordering of some configs. gcc/ 2013-12-31 Chung-Lin Tang <cltang@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com> Based on patches from Altera Corporation * config.gcc (nios2-*-*): Add nios2 config targets. * configure.ac (TLS_SECTION_ASM_FLAG): Add nios2 case. ("$cpu_type"): Add nios2 as new cpu type. * configure: Regenerate. * config/nios2/nios2.c: New file. * config/nios2/nios2.h: New file. * config/nios2/nios2-opts.h: New file. * config/nios2/nios2-protos.h: New file. * config/nios2/elf.h: New file. * config/nios2/elf.opt: New file. * config/nios2/linux.h: New file. * config/nios2/nios2.opt: New file. * config/nios2/nios2.md: New file. * config/nios2/predicates.md: New file. * config/nios2/constraints.md: New file. * config/nios2/t-nios2: New file. * common/config/nios2/nios2-common.c: New file. * doc/invoke.texi (Nios II options): Document Nios II specific options. * doc/md.texi (Nios II family): Document Nios II specific constraints. * doc/extend.texi (Function Specific Option Pragmas): Document Nios II supported target pragma functionality. gcc/testsuite/ 2013-12-31 Sandra Loosemore <sandra@codesourcery.com> Chung-Lin Tang <cltang@codesourcery.com> Based on patches from Altera Corporation * gcc.dg/stack-usage-1.c (SIZE): Define case for __nios2__. * gcc.dg/20040813-1.c: Skip for nios2-*-*. * gcc.dg/20020312-2.c: Add __nios2__ case. * g++.dg/other/PR23205.C: Skip for nios2-*-*. * g++.dg/other/pr23205-2.C: Skip for nios2-*-*. * g++.dg/cpp0x/constexpr-rom.C: Skip for nios2-*-*. * g++.dg/cpp0x/alias-decl-debug-0.C: Skip for nios2-*-*. * g++.old-deja/g++.jason/thunk3.C: Skip for nios2-*-*. * lib/target-supports.exp (check_profiling_available): Check for nios2-*-elf. * gcc.c-torture/execute/pr47237.x:: Skip for nios2-*-*. * gcc.c-torture/execute/20101011-1.c: Skip for nios2-*-*. * gcc.c-torture/execute/builtins/lib/chk.c (memset): Place char-based memset loop before inline check, to prevent problems when called to initialize .bss. Update comments. * gcc.target/nios2/nios2.exp: New DejaGNU file. * gcc.target/nios2/nios2-custom-1.c: New test. * gcc.target/nios2/nios2-trap-insn.c: New test. * gcc.target/nios2/nios2-builtin-custom.c: New test. * gcc.target/nios2/nios2-builtin-io.c: New test. * gcc.target/nios2/nios2-stack-check-1.c: New test. * gcc.target/nios2/nios2-stack-check-2.c: New test. * gcc.target/nios2/nios2-rdctl.c: New test. * gcc.target/nios2/nios2-wrctl.c: New test. * gcc.target/nios2/nios2-wrctl-zero.c: New test. * gcc.target/nios2/nios2-wrctl-not-zero.c: New test. * gcc.target/nios2/nios2-rdwrctl-1.c: New test. * gcc.target/nios2/nios2-reg-constraints.c: New test. * gcc.target/nios2/nios2-ashlsi3-one_shift.c: New test. * gcc.target/nios2/nios2-mul-options-1.c: New test. * gcc.target/nios2/nios2-mul-options-2.c: New test. * gcc.target/nios2/nios2-mul-options-3.c: New test. * gcc.target/nios2/nios2-mul-options-4.c: New test. * gcc.target/nios2/nios2-nor.c: New test. * gcc.target/nios2/nios2-stxio.c: New test. * gcc.target/nios2/custom-fp-1.c: New test. * gcc.target/nios2/custom-fp-2.c: New test. * gcc.target/nios2/custom-fp-3.c: New test. * gcc.target/nios2/custom-fp-4.c: New test. * gcc.target/nios2/custom-fp-5.c: New test. * gcc.target/nios2/custom-fp-6.c: New test. * gcc.target/nios2/custom-fp-7.c: New test. * gcc.target/nios2/custom-fp-8.c: New test. * gcc.target/nios2/custom-fp-cmp-1.c: New test. * gcc.target/nios2/custom-fp-conversion.c: New test. * gcc.target/nios2/custom-fp-double.c: New test. * gcc.target/nios2/custom-fp-float.c: New test. * gcc.target/nios2/nios2-int-types.c: New test. * gcc.target/nios2/nios2-cache-1.c: New test. * gcc.target/nios2/nios2-cache-2.c: New test. libgcc/ 2013-12-31 Sandra Loosemore <sandra@codesourcery.com> Chung-Lin Tang <cltang@codesourcery.com> Based on patches from Altera Corporation * config.host (nios2-*-*,nios2-*-linux*): Add nios2 host cases. * config/nios2/lib2-nios2.h: New file. * config/nios2/lib2-divmod-hi.c: New file. * config/nios2/linux-unwind.h: New file. * config/nios2/lib2-divmod.c: New file. * config/nios2/linux-atomic.c: New file. * config/nios2/t-nios2: New file. * config/nios2/crti.asm: New file. * config/nios2/t-linux: New file. * config/nios2/lib2-divtable.c: New file. * config/nios2/lib2-mul.c: New file. * config/nios2/tramp.c: New file. * config/nios2/crtn.asm: New file. From-SVN: r206256
This commit is contained in:
parent
fd5b8c6572
commit
e430824f28
85 changed files with 8397 additions and 25 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-12-31 Chung-Lin Tang <cltang@codesourcery.com>
|
||||
|
||||
* config-list.mk: Add nios2-elf, nios2-linux-gnu. Corrected
|
||||
ordering of some configs.
|
||||
|
||||
2013-12-23 Yury Gribov <y.gribov@samsung.com>
|
||||
|
||||
* mklog: Automatically insert comments in trivial cases.
|
||||
|
|
|
@ -45,9 +45,11 @@ LIST = aarch64-elf aarch64-linux-gnu \
|
|||
mipsisa64-elfoabi mipsisa64r2el-elf mipsisa64sr71k-elf mipsisa64sb1-elf \
|
||||
mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \
|
||||
mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \
|
||||
moxie-uclinux moxie-rtems pdp11-aout picochip-elfOPT-enable-obsolete \
|
||||
moxie-uclinux moxie-rtems \
|
||||
msp430-elf \
|
||||
nds32le-elf nds32be-elf \
|
||||
nios2-elf nios2-linux-gnu \
|
||||
pdp11-aout picochip-elfOPT-enable-obsolete \
|
||||
powerpc-darwin8 \
|
||||
powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \
|
||||
powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \
|
||||
|
|
|
@ -1,3 +1,31 @@
|
|||
2013-12-31 Chung-Lin Tang <cltang@codesourcery.com>
|
||||
Sandra Loosemore <sandra@codesourcery.com>
|
||||
Based on patches from Altera Corporation
|
||||
|
||||
* config.gcc (nios2-*-*): Add nios2 config targets.
|
||||
* configure.ac (TLS_SECTION_ASM_FLAG): Add nios2 case.
|
||||
("$cpu_type"): Add nios2 as new cpu type.
|
||||
* configure: Regenerate.
|
||||
* config/nios2/nios2.c: New file.
|
||||
* config/nios2/nios2.h: New file.
|
||||
* config/nios2/nios2-opts.h: New file.
|
||||
* config/nios2/nios2-protos.h: New file.
|
||||
* config/nios2/elf.h: New file.
|
||||
* config/nios2/elf.opt: New file.
|
||||
* config/nios2/linux.h: New file.
|
||||
* config/nios2/nios2.opt: New file.
|
||||
* config/nios2/nios2.md: New file.
|
||||
* config/nios2/predicates.md: New file.
|
||||
* config/nios2/constraints.md: New file.
|
||||
* config/nios2/t-nios2: New file.
|
||||
* common/config/nios2/nios2-common.c: New file.
|
||||
* doc/invoke.texi (Nios II options): Document Nios II specific
|
||||
options.
|
||||
* doc/md.texi (Nios II family): Document Nios II specific
|
||||
constraints.
|
||||
* doc/extend.texi (Function Specific Option Pragmas): Document
|
||||
Nios II supported target pragma functionality.
|
||||
|
||||
2013-12-30 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/59591
|
||||
|
|
44
gcc/common/config/nios2/nios2-common.c
Normal file
44
gcc/common/config/nios2/nios2-common.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* Common hooks for Altera Nios II.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "diagnostic-core.h"
|
||||
#include "tm.h"
|
||||
#include "common/common-target.h"
|
||||
#include "common/common-target-def.h"
|
||||
#include "opts.h"
|
||||
#include "flags.h"
|
||||
|
||||
/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */
|
||||
static const struct default_options nios2_option_optimization_table[] =
|
||||
{
|
||||
{ OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
|
||||
{ OPT_LEVELS_3_PLUS, OPT_mfast_sw_div, NULL, 1 },
|
||||
{ OPT_LEVELS_NONE, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
#undef TARGET_DEFAULT_TARGET_FLAGS
|
||||
#define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
|
||||
|
||||
#undef TARGET_OPTION_OPTIMIZATION_TABLE
|
||||
#define TARGET_OPTION_OPTIMIZATION_TABLE nios2_option_optimization_table
|
||||
|
||||
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
|
|
@ -425,6 +425,10 @@ nds32*)
|
|||
cpu_type=nds32
|
||||
extra_headers="nds32_intrinsic.h"
|
||||
;;
|
||||
nios2-*-*)
|
||||
cpu_type=nios2
|
||||
extra_options="${extra_options} g.opt"
|
||||
;;
|
||||
picochip-*-*)
|
||||
cpu_type=picochip
|
||||
;;
|
||||
|
@ -2114,6 +2118,19 @@ nds32be-*-*)
|
|||
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
|
||||
tmake_file="nds32/t-mlibs"
|
||||
;;
|
||||
nios2-*-*)
|
||||
tm_file="elfos.h ${tm_file}"
|
||||
tmake_file="${tmake_file} nios2/t-nios2"
|
||||
case ${target} in
|
||||
nios2-*-linux*)
|
||||
tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h nios2/linux.h "
|
||||
;;
|
||||
nios2-*-elf*)
|
||||
tm_file="${tm_file} newlib-stdint.h nios2/elf.h"
|
||||
extra_options="${extra_options} nios2/elf.opt"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
pdp11-*-*)
|
||||
tm_file="${tm_file} newlib-stdint.h"
|
||||
use_gcc_stdint=wrap
|
||||
|
|
89
gcc/config/nios2/constraints.md
Normal file
89
gcc/config/nios2/constraints.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
;; Constraint definitions for Altera Nios II.
|
||||
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
;; Contributed by Chung-Lin Tang <cltang@codesourcery.com>
|
||||
;;
|
||||
;; This file is part of GCC.
|
||||
;;
|
||||
;; GCC 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 3, or (at your option)
|
||||
;; any later version.
|
||||
;;
|
||||
;; GCC 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 GCC; see the file COPYING3. If not see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;; 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
|
||||
|
||||
;; Register constraints
|
||||
|
||||
(define_register_constraint "j" "SIB_REGS"
|
||||
"A register suitable for an indirect sibcall.")
|
||||
|
||||
;; Integer constraints
|
||||
|
||||
(define_constraint "I"
|
||||
"A signed 16-bit constant (for arithmetic instructions)."
|
||||
(and (match_code "const_int")
|
||||
(match_test "SMALL_INT (ival)")))
|
||||
|
||||
(define_constraint "J"
|
||||
"An unsigned 16-bit constant (for logical instructions)."
|
||||
(and (match_code "const_int")
|
||||
(match_test "SMALL_INT_UNSIGNED (ival)")))
|
||||
|
||||
(define_constraint "K"
|
||||
"An unsigned 16-bit high constant (for logical instructions)."
|
||||
(and (match_code "const_int")
|
||||
(match_test "UPPER16_INT (ival)")))
|
||||
|
||||
(define_constraint "L"
|
||||
"An unsigned 5-bit constant (for shift counts)."
|
||||
(and (match_code "const_int")
|
||||
(match_test "ival >= 0 && ival <= 31")))
|
||||
|
||||
(define_constraint "M"
|
||||
"Integer zero."
|
||||
(and (match_code "const_int")
|
||||
(match_test "ival == 0")))
|
||||
|
||||
(define_constraint "N"
|
||||
"An unsigned 8-bit constant (for custom instruction codes)."
|
||||
(and (match_code "const_int")
|
||||
(match_test "ival >= 0 && ival <= 255")))
|
||||
|
||||
(define_constraint "O"
|
||||
"An unsigned 5-bit constant (for control register numbers)."
|
||||
(and (match_code "const_int")
|
||||
(match_test "ival >= 0 && ival <= 31")))
|
||||
|
||||
(define_constraint "S"
|
||||
"An immediate stored in small data, accessible by GP."
|
||||
(and (match_code "symbol_ref")
|
||||
(match_test "nios2_symbol_ref_in_small_data_p (op)")))
|
||||
|
||||
(define_constraint "T"
|
||||
"A constant unspec offset representing a relocation."
|
||||
(match_test "nios2_unspec_reloc_p (op)"))
|
52
gcc/config/nios2/elf.h
Normal file
52
gcc/config/nios2/elf.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* Definitions of ELF target support for Altera Nios II.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Jonah Graham (jgraham@altera.com),
|
||||
Will Reece (wreece@altera.com), and Jeff DaSilva (jdasilva@altera.com).
|
||||
Contributed by Mentor Graphics, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* Specs to support the additional command-line options for Nios II ELF
|
||||
toolchains. */
|
||||
|
||||
/* -msmallc chooses an alternate C library.
|
||||
-msys-lib= specifies an additional low-level system/hosting library and
|
||||
is typically used to suck in a library provided by a HAL BSP. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC \
|
||||
"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \
|
||||
%{msys-lib=*: -l%*} \
|
||||
--end-group \
|
||||
"
|
||||
|
||||
/* Linking with -mhal suppresses inclusion of the GCC-provided crt* begin/end
|
||||
code. Normally in this case you also link with -msys-crt0= to specify
|
||||
the startup code provided by the HAL BSP instead. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{mhal:" \
|
||||
"%{msys-crt0=*:%*} %{!msys-crt0=*:crt0%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 "%{!mhal:crtend%O%s crtn%O%s}"
|
||||
|
||||
/* The ELF target doesn't support the Nios II Linux ABI. */
|
||||
#define TARGET_LINUX_ABI 0
|
||||
|
38
gcc/config/nios2/elf.opt
Normal file
38
gcc/config/nios2/elf.opt
Normal file
|
@ -0,0 +1,38 @@
|
|||
; Options for the Altera Nios II port of the compiler.
|
||||
; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
; Contributed by Altera and Mentor Graphics, Inc.
|
||||
;
|
||||
; This file is part of GCC.
|
||||
;
|
||||
; GCC 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 3, or (at your option)
|
||||
; any later version.
|
||||
;
|
||||
; GCC 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 GCC; see the file COPYING3. If not see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
; These additional options are supported for ELF (bare-metal) Nios II
|
||||
; toolchains.
|
||||
|
||||
msmallc
|
||||
Target Report RejectNegative
|
||||
Link with a limited version of the C library
|
||||
|
||||
msys-lib=
|
||||
Target RejectNegative Joined Var(nios2_sys_lib_string)
|
||||
Name of system library to link against
|
||||
|
||||
msys-crt0=
|
||||
Target RejectNegative Joined Var(nios2_sys_crt0_string)
|
||||
Name of the startfile
|
||||
|
||||
mhal
|
||||
Target Report RejectNegative
|
||||
Link with HAL BSP
|
38
gcc/config/nios2/linux.h
Normal file
38
gcc/config/nios2/linux.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* Definitions of target support for Altera Nios II systems
|
||||
running GNU/Linux with ELF format.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Mentor Graphics, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
GNU_USER_TARGET_OS_CPP_BUILTINS(); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC LINK_SPEC_ENDIAN \
|
||||
" %{shared:-shared} \
|
||||
%{static:-Bstatic} \
|
||||
%{rdynamic:-export-dynamic}"
|
||||
|
||||
/* This toolchain implements the ABI for Linux Systems documented in the
|
||||
Nios II Processor Reference Handbook. */
|
||||
#define TARGET_LINUX_ABI 1
|
||||
|
69
gcc/config/nios2/nios2-opts.h
Normal file
69
gcc/config/nios2/nios2-opts.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* Definitions for option handling for Nios II.
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef NIOS2_OPTS_H
|
||||
#define NIOS2_OPTS_H
|
||||
|
||||
/* Enumeration of all FPU insn codes. */
|
||||
#define N2FPU_ALL_CODES \
|
||||
N2FPU_CODE(fadds) N2FPU_CODE(fsubs) N2FPU_CODE(fmuls) N2FPU_CODE(fdivs) \
|
||||
N2FPU_CODE(fmins) N2FPU_CODE(fmaxs) \
|
||||
N2FPU_CODE(fnegs) N2FPU_CODE(fabss) N2FPU_CODE(fsqrts) \
|
||||
N2FPU_CODE(fsins) N2FPU_CODE(fcoss) N2FPU_CODE(ftans) N2FPU_CODE(fatans) \
|
||||
N2FPU_CODE(fexps) N2FPU_CODE(flogs) \
|
||||
N2FPU_CODE(fcmpeqs) N2FPU_CODE(fcmpnes) \
|
||||
N2FPU_CODE(fcmplts) N2FPU_CODE(fcmples) \
|
||||
N2FPU_CODE(fcmpgts) N2FPU_CODE(fcmpges) \
|
||||
\
|
||||
N2FPU_CODE(faddd) N2FPU_CODE(fsubd) N2FPU_CODE(fmuld) N2FPU_CODE(fdivd) \
|
||||
N2FPU_CODE(fmind) N2FPU_CODE(fmaxd) \
|
||||
N2FPU_CODE(fnegd) N2FPU_CODE(fabsd) N2FPU_CODE(fsqrtd) \
|
||||
N2FPU_CODE(fsind) N2FPU_CODE(fcosd) N2FPU_CODE(ftand) N2FPU_CODE(fatand) \
|
||||
N2FPU_CODE(fexpd) N2FPU_CODE(flogd) \
|
||||
N2FPU_CODE(fcmpeqd) N2FPU_CODE(fcmpned) \
|
||||
N2FPU_CODE(fcmpltd) N2FPU_CODE(fcmpled) \
|
||||
N2FPU_CODE(fcmpgtd) N2FPU_CODE(fcmpged) \
|
||||
\
|
||||
N2FPU_CODE(floatis) N2FPU_CODE(floatus) \
|
||||
N2FPU_CODE(floatid) N2FPU_CODE(floatud) \
|
||||
N2FPU_CODE(fixsi) N2FPU_CODE(fixsu) \
|
||||
N2FPU_CODE(fixdi) N2FPU_CODE(fixdu) \
|
||||
N2FPU_CODE(fextsd) N2FPU_CODE(ftruncds) \
|
||||
\
|
||||
N2FPU_CODE(fwrx) N2FPU_CODE(fwry) \
|
||||
N2FPU_CODE(frdxlo) N2FPU_CODE(frdxhi) N2FPU_CODE(frdy)
|
||||
|
||||
enum n2fpu_code {
|
||||
#define N2FPU_CODE(name) n2fpu_ ## name,
|
||||
N2FPU_ALL_CODES
|
||||
#undef N2FPU_CODE
|
||||
n2fpu_code_num
|
||||
};
|
||||
|
||||
/* An enumeration to indicate the custom code status; if values within 0--255
|
||||
are registered to an FPU insn, or custom insn. */
|
||||
enum nios2_ccs_code
|
||||
{
|
||||
CCS_UNUSED,
|
||||
CCS_FPU,
|
||||
CCS_BUILTIN_CALL
|
||||
};
|
||||
|
||||
#endif
|
||||
|
61
gcc/config/nios2/nios2-protos.h
Normal file
61
gcc/config/nios2/nios2-protos.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* Subroutine declarations for Altera Nios II target support.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Jonah Graham (jgraham@altera.com).
|
||||
Contributed by Mentor Graphics, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_NIOS2_PROTOS_H
|
||||
#define GCC_NIOS2_PROTOS_H
|
||||
|
||||
extern int nios2_initial_elimination_offset (int, int);
|
||||
extern int nios2_can_use_return_insn (void);
|
||||
extern void nios2_expand_prologue (void);
|
||||
extern void nios2_expand_epilogue (bool);
|
||||
extern void nios2_function_profiler (FILE *, int);
|
||||
|
||||
#ifdef RTX_CODE
|
||||
extern int nios2_emit_move_sequence (rtx *, enum machine_mode);
|
||||
extern void nios2_emit_expensive_div (rtx *, enum machine_mode);
|
||||
extern void nios2_adjust_call_address (rtx *);
|
||||
|
||||
extern rtx nios2_get_return_address (int);
|
||||
extern void nios2_set_return_address (rtx, rtx);
|
||||
|
||||
extern bool nios2_validate_compare (enum machine_mode, rtx *, rtx *, rtx *);
|
||||
extern bool nios2_validate_fpu_compare (enum machine_mode, rtx *, rtx *, rtx *,
|
||||
bool);
|
||||
|
||||
extern bool nios2_fpu_insn_enabled (enum n2fpu_code);
|
||||
extern const char * nios2_fpu_insn_asm (enum n2fpu_code);
|
||||
|
||||
extern bool nios2_legitimate_pic_operand_p (rtx);
|
||||
extern bool nios2_symbol_ref_in_small_data_p (rtx);
|
||||
extern bool nios2_regno_ok_for_base_p (int, bool);
|
||||
extern bool nios2_unspec_reloc_p (rtx);
|
||||
|
||||
#ifdef TREE_CODE
|
||||
#ifdef ARGS_SIZE_RTX
|
||||
/* expr.h defines both ARGS_SIZE_RTX and `enum direction' */
|
||||
extern enum direction nios2_function_arg_padding (enum machine_mode, const_tree);
|
||||
extern enum direction nios2_block_reg_padding (enum machine_mode, tree, int);
|
||||
#endif /* ARGS_SIZE_RTX */
|
||||
|
||||
#endif /* TREE_CODE */
|
||||
#endif /* RTX_CODE */
|
||||
|
||||
#endif /* GCC_NIOS2_PROTOS_H */
|
3224
gcc/config/nios2/nios2.c
Normal file
3224
gcc/config/nios2/nios2.c
Normal file
File diff suppressed because it is too large
Load diff
500
gcc/config/nios2/nios2.h
Normal file
500
gcc/config/nios2/nios2.h
Normal file
|
@ -0,0 +1,500 @@
|
|||
/* Definitions of target machine for Altera Nios II.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Jonah Graham (jgraham@altera.com),
|
||||
Will Reece (wreece@altera.com), and Jeff DaSilva (jdasilva@altera.com).
|
||||
Contributed by Mentor Graphics, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_NIOS2_H
|
||||
#define GCC_NIOS2_H
|
||||
|
||||
/* FPU insn codes declared here. */
|
||||
#include "config/nios2/nios2-opts.h"
|
||||
|
||||
/* Define built-in preprocessor macros. */
|
||||
#define TARGET_CPU_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define_std ("NIOS2"); \
|
||||
builtin_define_std ("nios2"); \
|
||||
if (TARGET_BIG_ENDIAN) \
|
||||
builtin_define_std ("nios2_big_endian"); \
|
||||
else \
|
||||
builtin_define_std ("nios2_little_endian"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* We're little endian, unless otherwise specified by defining
|
||||
BIG_ENDIAN_FLAG. */
|
||||
#ifndef TARGET_ENDIAN_DEFAULT
|
||||
# define TARGET_ENDIAN_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/* Default target_flags if no switches specified. */
|
||||
#ifndef TARGET_DEFAULT
|
||||
# define TARGET_DEFAULT (MASK_HAS_MUL | TARGET_ENDIAN_DEFAULT)
|
||||
#endif
|
||||
|
||||
#define CC1_SPEC "%{G*}"
|
||||
|
||||
#if TARGET_ENDIAN_DEFAULT == 0
|
||||
# define ASM_SPEC "%{!meb:-EL} %{meb:-EB}"
|
||||
# define LINK_SPEC_ENDIAN "%{!meb:-EL} %{meb:-EB}"
|
||||
# define MULTILIB_DEFAULTS { "EL" }
|
||||
#else
|
||||
# define ASM_SPEC "%{!mel:-EB} %{mel:-EL}"
|
||||
# define LINK_SPEC_ENDIAN "%{!mel:-EB} %{mel:-EL}"
|
||||
# define MULTILIB_DEFAULTS { "EB" }
|
||||
#endif
|
||||
|
||||
#define LINK_SPEC LINK_SPEC_ENDIAN \
|
||||
" %{shared:-shared} \
|
||||
%{static:-Bstatic}"
|
||||
|
||||
|
||||
/* Storage layout. */
|
||||
|
||||
#define DEFAULT_SIGNED_CHAR 1
|
||||
#define BITS_BIG_ENDIAN 0
|
||||
#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
|
||||
#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
|
||||
#define BITS_PER_UNIT 8
|
||||
#define BITS_PER_WORD 32
|
||||
#define UNITS_PER_WORD 4
|
||||
#define POINTER_SIZE 32
|
||||
#define BIGGEST_ALIGNMENT 32
|
||||
#define STRICT_ALIGNMENT 1
|
||||
#define FUNCTION_BOUNDARY 32
|
||||
#define PARM_BOUNDARY 32
|
||||
#define STACK_BOUNDARY 32
|
||||
#define PREFERRED_STACK_BOUNDARY 32
|
||||
#define MAX_FIXED_MODE_SIZE 64
|
||||
|
||||
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
|
||||
((TREE_CODE (EXP) == STRING_CST) \
|
||||
&& (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
|
||||
|
||||
/* Layout of source language data types. */
|
||||
|
||||
#define INT_TYPE_SIZE 32
|
||||
#define SHORT_TYPE_SIZE 16
|
||||
#define LONG_TYPE_SIZE 32
|
||||
#define LONG_LONG_TYPE_SIZE 64
|
||||
#define FLOAT_TYPE_SIZE 32
|
||||
#define DOUBLE_TYPE_SIZE 64
|
||||
#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
|
||||
/* Basic characteristics of Nios II registers:
|
||||
|
||||
Regno Name
|
||||
0 r0 zero always zero
|
||||
1 r1 at Assembler Temporary
|
||||
2-3 r2-r3 Return Location
|
||||
4-7 r4-r7 Register Arguments
|
||||
8-15 r8-r15 Caller Saved Registers
|
||||
16-22 r16-r22 Callee Saved Registers
|
||||
22 r22 Global Offset Table pointer (Linux ABI only)
|
||||
23 r23 Thread pointer (Linux ABI only)
|
||||
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
|
||||
29 r29 ea Exception Return Address
|
||||
30 r30 ba Breakpoint Return Address
|
||||
31 r31 ra Return Address
|
||||
|
||||
32 ctl0 status
|
||||
33 ctl1 estatus STATUS saved by exception
|
||||
34 ctl2 bstatus STATUS saved by break
|
||||
35 ctl3 ipri Interrupt Priority Mask
|
||||
36 ctl4 ecause Exception Cause
|
||||
|
||||
37 pc Not an actual register
|
||||
|
||||
38 fake_fp Fake Frame Pointer (always eliminated)
|
||||
39 fake_ap Fake Argument Pointer (always eliminated)
|
||||
40 First Pseudo Register
|
||||
|
||||
In addition, r12 is used as the static chain register and r13, r14, and r15
|
||||
are clobbered by PLT code sequences.
|
||||
|
||||
The definitions for all the hard register numbers are located in nios2.md.
|
||||
*/
|
||||
|
||||
#define FIXED_REGISTERS \
|
||||
{ \
|
||||
/* +0 1 2 3 4 5 6 7 8 9 */ \
|
||||
/* 0 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
/* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
/* 20 */ 0, 0, TARGET_LINUX_ABI, TARGET_LINUX_ABI, 1, 1, 1, 1, 0, 1, \
|
||||
/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \
|
||||
}
|
||||
|
||||
/* Call used == caller saved + fixed regs + args + ret vals. */
|
||||
#define CALL_USED_REGISTERS \
|
||||
{ \
|
||||
/* +0 1 2 3 4 5 6 7 8 9 */ \
|
||||
/* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
||||
/* 10 */ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \
|
||||
/* 20 */ 0, 0, TARGET_LINUX_ABI, TARGET_LINUX_ABI, 1, 1, 1, 1, 0, 1, \
|
||||
/* 30 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
||||
}
|
||||
|
||||
#define MODES_TIEABLE_P(MODE1, MODE2) 1
|
||||
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
|
||||
#define HARD_REGNO_NREGS(REGNO, MODE) \
|
||||
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
||||
|
||||
/* Register Classes. */
|
||||
|
||||
enum reg_class
|
||||
{
|
||||
NO_REGS,
|
||||
SIB_REGS,
|
||||
GP_REGS,
|
||||
ALL_REGS,
|
||||
LIM_REG_CLASSES
|
||||
};
|
||||
|
||||
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
||||
|
||||
#define REG_CLASS_NAMES \
|
||||
{ "NO_REGS", \
|
||||
"SIB_REGS", \
|
||||
"GP_REGS", \
|
||||
"ALL_REGS" }
|
||||
|
||||
#define GENERAL_REGS ALL_REGS
|
||||
|
||||
#define REG_CLASS_CONTENTS \
|
||||
{ \
|
||||
/* NO_REGS */ { 0, 0}, \
|
||||
/* SIB_REGS */ { 0xfe0c, 0}, \
|
||||
/* GP_REGS */ {~0, 0}, \
|
||||
/* ALL_REGS */ {~0,~0} \
|
||||
}
|
||||
|
||||
|
||||
#define GP_REG_P(REGNO) ((unsigned)(REGNO) <= LAST_GP_REG)
|
||||
#define REGNO_REG_CLASS(REGNO) (GP_REG_P (REGNO) ? GP_REGS : ALL_REGS)
|
||||
#define CLASS_MAX_NREGS(CLASS, MODE) \
|
||||
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
||||
|
||||
/* Tests for various kinds of constants used in the Nios II port. */
|
||||
|
||||
#define SMALL_INT(X) ((unsigned HOST_WIDE_INT)(X) + 0x8000 < 0x10000)
|
||||
#define SMALL_INT_UNSIGNED(X) ((X) >= 0 && (X) < 0x10000)
|
||||
#define UPPER16_INT(X) (((X) & 0xffff) == 0)
|
||||
#define SHIFT_INT(X) ((X) >= 0 && (X) <= 31)
|
||||
#define RDWRCTL_INT(X) ((X) >= 0 && (X) <= 31)
|
||||
#define CUSTOM_INSN_OPCODE(X) ((X) >= 0 && (X) <= 255)
|
||||
|
||||
/* Say that the epilogue uses the return address register. Note that
|
||||
in the case of sibcalls, the values "used by the epilogue" are
|
||||
considered live at the start of the called function. */
|
||||
#define EPILOGUE_USES(REGNO) (epilogue_completed && (REGNO) == RA_REGNO)
|
||||
|
||||
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
|
||||
the stack pointer does not matter. The value is tested only in
|
||||
functions that have frame pointers.
|
||||
No definition is equivalent to always zero. */
|
||||
|
||||
#define EXIT_IGNORE_STACK 1
|
||||
|
||||
/* Trampolines use a 5-instruction sequence. */
|
||||
#define TRAMPOLINE_SIZE 20
|
||||
|
||||
/* Stack layout. */
|
||||
#define STACK_GROWS_DOWNWARD
|
||||
#define STARTING_FRAME_OFFSET 0
|
||||
#define FIRST_PARM_OFFSET(FUNDECL) 0
|
||||
|
||||
/* Before the prologue, RA lives in r31. */
|
||||
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (VOIDmode, RA_REGNO)
|
||||
#define RETURN_ADDR_RTX(C,F) nios2_get_return_address (C)
|
||||
|
||||
#define DWARF_FRAME_RETURN_COLUMN RA_REGNO
|
||||
|
||||
/* The CFA includes the pretend args. */
|
||||
#define ARG_POINTER_CFA_OFFSET(FNDECL) \
|
||||
(gcc_assert ((FNDECL) == current_function_decl), \
|
||||
FIRST_PARM_OFFSET (FNDECL) + crtl->args.pretend_args_size)
|
||||
|
||||
/* Frame/arg pointer elimination settings. */
|
||||
#define ELIMINABLE_REGS \
|
||||
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
|
||||
{ ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
|
||||
{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
|
||||
{ FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
|
||||
|
||||
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
||||
(OFFSET) = nios2_initial_elimination_offset ((FROM), (TO))
|
||||
|
||||
/* Calling convention definitions. */
|
||||
typedef struct nios2_args
|
||||
{
|
||||
int regs_used;
|
||||
} CUMULATIVE_ARGS;
|
||||
|
||||
#define NUM_ARG_REGS (LAST_ARG_REGNO - FIRST_ARG_REGNO + 1)
|
||||
|
||||
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
|
||||
do { (CUM).regs_used = 0; } while (0)
|
||||
|
||||
#define FUNCTION_ARG_PADDING(MODE, TYPE) \
|
||||
(nios2_function_arg_padding ((MODE), (TYPE)))
|
||||
|
||||
#define PAD_VARARGS_DOWN \
|
||||
(FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward)
|
||||
|
||||
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
|
||||
(nios2_block_reg_padding ((MODE), (TYPE), (FIRST)))
|
||||
|
||||
#define FUNCTION_ARG_REGNO_P(REGNO) \
|
||||
((REGNO) >= FIRST_ARG_REGNO && (REGNO) <= LAST_ARG_REGNO)
|
||||
|
||||
/* Passing function arguments on stack. */
|
||||
#define PUSH_ARGS 0
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* We define TARGET_RETURN_IN_MEMORY, so set to zero. */
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* Profiling. */
|
||||
#define PROFILE_BEFORE_PROLOGUE
|
||||
#define NO_PROFILE_COUNTERS 1
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
nios2_function_profiler ((FILE), (LABELNO))
|
||||
|
||||
/* Addressing modes. */
|
||||
|
||||
#define CONSTANT_ADDRESS_P(X) \
|
||||
(CONSTANT_P (X) && memory_address_p (SImode, X))
|
||||
|
||||
#define MAX_REGS_PER_ADDRESS 1
|
||||
#define BASE_REG_CLASS ALL_REGS
|
||||
#define INDEX_REG_CLASS NO_REGS
|
||||
|
||||
#define REGNO_OK_FOR_BASE_P(REGNO) nios2_regno_ok_for_base_p ((REGNO), true)
|
||||
#define REGNO_OK_FOR_INDEX_P(REGNO) 0
|
||||
|
||||
/* Describing Relative Costs of Operations. */
|
||||
#define MOVE_MAX 4
|
||||
#define SLOW_BYTE_ACCESS 1
|
||||
|
||||
/* It is as good to call a constant function address as to call an address
|
||||
kept in a register. */
|
||||
#define NO_FUNCTION_CSE
|
||||
|
||||
/* Position independent code. */
|
||||
|
||||
#define PIC_OFFSET_TABLE_REGNUM 22
|
||||
#define LEGITIMATE_PIC_OPERAND_P(X) nios2_legitimate_pic_operand_p (X)
|
||||
|
||||
/* Define output assembler language. */
|
||||
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#define ASM_COMMENT_START "# "
|
||||
|
||||
#define GLOBAL_ASM_OP "\t.global\t"
|
||||
|
||||
#define REGISTER_NAMES \
|
||||
{ \
|
||||
"zero", \
|
||||
"at", \
|
||||
"r2", \
|
||||
"r3", \
|
||||
"r4", \
|
||||
"r5", \
|
||||
"r6", \
|
||||
"r7", \
|
||||
"r8", \
|
||||
"r9", \
|
||||
"r10", \
|
||||
"r11", \
|
||||
"r12", \
|
||||
"r13", \
|
||||
"r14", \
|
||||
"r15", \
|
||||
"r16", \
|
||||
"r17", \
|
||||
"r18", \
|
||||
"r19", \
|
||||
"r20", \
|
||||
"r21", \
|
||||
"r22", \
|
||||
"r23", \
|
||||
"et", \
|
||||
"bt", \
|
||||
"gp", \
|
||||
"sp", \
|
||||
"fp", \
|
||||
"ta", \
|
||||
"ba", \
|
||||
"ra", \
|
||||
"status", \
|
||||
"estatus", \
|
||||
"bstatus", \
|
||||
"ipri", \
|
||||
"ecause", \
|
||||
"pc", \
|
||||
"fake_fp", \
|
||||
"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_ADDR_VEC_ELT(FILE, VALUE) \
|
||||
do \
|
||||
{ \
|
||||
fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
|
||||
fprintf (FILE, ".L%u\n", (unsigned) (VALUE)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL)\
|
||||
do \
|
||||
{ \
|
||||
fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), STREAM); \
|
||||
fprintf (STREAM, ".L%u-.L%u\n", (unsigned) (VALUE), (unsigned) (REL)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Section directives. */
|
||||
|
||||
/* Output before read-only data. */
|
||||
#define TEXT_SECTION_ASM_OP "\t.section\t.text"
|
||||
|
||||
/* Output before writable data. */
|
||||
#define DATA_SECTION_ASM_OP "\t.section\t.data"
|
||||
|
||||
/* Output before uninitialized data. */
|
||||
#define BSS_SECTION_ASM_OP "\t.section\t.bss"
|
||||
|
||||
/* Output before 'small' uninitialized data. */
|
||||
#define SBSS_SECTION_ASM_OP "\t.section\t.sbss"
|
||||
|
||||
#ifndef IN_LIBGCC2
|
||||
/* Default the definition of "small data" to 8 bytes. */
|
||||
extern unsigned HOST_WIDE_INT nios2_section_threshold;
|
||||
#endif
|
||||
|
||||
#define NIOS2_DEFAULT_GVALUE 8
|
||||
|
||||
/* This says how to output assembler code to declare an
|
||||
uninitialized external linkage data object. Under SVR4,
|
||||
the linker seems to want the alignment of data objects
|
||||
to depend on their types. We do exactly that here. */
|
||||
#undef COMMON_ASM_OP
|
||||
#define COMMON_ASM_OP "\t.comm\t"
|
||||
|
||||
#define ASM_OUTPUT_ALIGN(FILE, LOG) \
|
||||
do { \
|
||||
fprintf ((FILE), "%s%d\n", ALIGN_ASM_OP, (LOG)); \
|
||||
} while (0)
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_COMMON
|
||||
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
||||
do \
|
||||
{ \
|
||||
fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), \
|
||||
(ALIGN) / BITS_PER_UNIT); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
||||
/* This says how to output assembler code to declare an
|
||||
uninitialized internal linkage data object. Under SVR4,
|
||||
the linker seems to want the alignment of data objects
|
||||
to depend on their types. We do exactly that here. */
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
||||
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
||||
do { \
|
||||
if ((SIZE) <= nios2_section_threshold) \
|
||||
switch_to_section (sbss_section); \
|
||||
else \
|
||||
switch_to_section (bss_section); \
|
||||
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
||||
if (!flag_inhibit_size_directive) \
|
||||
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
|
||||
ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \
|
||||
ASM_OUTPUT_LABEL(FILE, NAME); \
|
||||
ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \
|
||||
} while (0)
|
||||
|
||||
/* Put the jump tables in .text because when using position-independent code,
|
||||
Nios II elf has no relocation that can represent arbitrary differences
|
||||
between symbols in different sections. */
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION 1
|
||||
|
||||
/* Exception handling. */
|
||||
|
||||
/* Describe __builtin_eh_return. */
|
||||
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, LAST_RETVAL_REGNO)
|
||||
#define EH_RETURN_DATA_REGNO(N) ((N) <= (LAST_ARG_REGNO - FIRST_ARG_REGNO) \
|
||||
? (N) + FIRST_ARG_REGNO : INVALID_REGNUM)
|
||||
|
||||
/* Nios II has no appropriate relocations for a 32-bit PC-relative or
|
||||
section-relative pointer encoding. This therefore always chooses an
|
||||
absolute representation for pointers. An unfortunate consequence of
|
||||
this is that ld complains about the absolute fde encoding when linking
|
||||
with -shared or -fpie, but the warning is harmless and there seems to
|
||||
be no good way to suppress it. */
|
||||
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
|
||||
(flag_pic ? DW_EH_PE_aligned : DW_EH_PE_sdata4)
|
||||
|
||||
/* Misc. parameters. */
|
||||
|
||||
#define STORE_FLAG_VALUE 1
|
||||
#define Pmode SImode
|
||||
#define FUNCTION_MODE QImode
|
||||
|
||||
#define CASE_VECTOR_MODE Pmode
|
||||
|
||||
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
||||
|
||||
#define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND)
|
||||
|
||||
#define WORD_REGISTER_OPERATIONS
|
||||
|
||||
#endif /* GCC_NIOS2_H */
|
1029
gcc/config/nios2/nios2.md
Normal file
1029
gcc/config/nios2/nios2.md
Normal file
File diff suppressed because it is too large
Load diff
531
gcc/config/nios2/nios2.opt
Normal file
531
gcc/config/nios2/nios2.opt
Normal file
|
@ -0,0 +1,531 @@
|
|||
; Options for the Altera Nios II port of the compiler.
|
||||
; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
; Contributed by Altera and Mentor Graphics, Inc.
|
||||
;
|
||||
; This file is part of GCC.
|
||||
;
|
||||
; GCC 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 3, or (at your option)
|
||||
; any later version.
|
||||
;
|
||||
; GCC 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 GCC; see the file COPYING3. If not see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
HeaderInclude
|
||||
config/nios2/nios2-opts.h
|
||||
|
||||
TargetSave
|
||||
int saved_fpu_custom_code[n2fpu_code_num]
|
||||
|
||||
TargetSave
|
||||
enum nios2_ccs_code saved_custom_code_status[256]
|
||||
|
||||
TargetSave
|
||||
int saved_custom_code_index[256]
|
||||
|
||||
mhw-div
|
||||
Target Report Mask(HAS_DIV)
|
||||
Enable DIV, DIVU
|
||||
|
||||
mhw-mul
|
||||
Target Report Mask(HAS_MUL)
|
||||
Enable MUL instructions
|
||||
|
||||
mhw-mulx
|
||||
Target Report Mask(HAS_MULX)
|
||||
Enable MULX instructions, assume fast shifter
|
||||
|
||||
mfast-sw-div
|
||||
Target Report Mask(FAST_SW_DIV)
|
||||
Use table based fast divide (default at -O3)
|
||||
|
||||
mbypass-cache
|
||||
Target Report Mask(BYPASS_CACHE)
|
||||
All memory accesses use I/O load/store instructions
|
||||
|
||||
mno-cache-volatile
|
||||
Target Report RejectNegative Mask(BYPASS_CACHE_VOLATILE)
|
||||
Volatile memory accesses use I/O load/store instructions
|
||||
|
||||
mcache-volatile
|
||||
Target Report RejectNegative Undocumented InverseMask(BYPASS_CACHE_VOLATILE)
|
||||
Volatile memory accesses do not use I/O load/store instructions
|
||||
|
||||
mgpopt
|
||||
Target Report Var(TARGET_GPOPT) Init(-1)
|
||||
Use GP-relative addressing to access small data
|
||||
|
||||
meb
|
||||
Target Report RejectNegative Mask(BIG_ENDIAN)
|
||||
Use big-endian byte order
|
||||
|
||||
mel
|
||||
Target Report RejectNegative InverseMask(BIG_ENDIAN)
|
||||
Use little-endian byte order
|
||||
|
||||
mcustom-fpu-cfg=
|
||||
Target RejectNegative Joined Var(nios2_custom_fpu_cfg_string)
|
||||
Floating point custom instruction configuration name
|
||||
|
||||
mno-custom-ftruncds
|
||||
Target Report RejectNegative Var(nios2_custom_ftruncds, -1)
|
||||
Do not use the ftruncds custom instruction
|
||||
|
||||
mcustom-ftruncds=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_ftruncds) Init(-1)
|
||||
Integer id (N) of ftruncds custom instruction
|
||||
|
||||
mno-custom-fextsd
|
||||
Target Report RejectNegative Var(nios2_custom_fextsd, -1)
|
||||
Do not use the fextsd custom instruction
|
||||
|
||||
mcustom-fextsd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fextsd) Init(-1)
|
||||
Integer id (N) of fextsd custom instruction
|
||||
|
||||
mno-custom-fixdu
|
||||
Target Report RejectNegative Var(nios2_custom_fixdu, -1)
|
||||
Do not use the fixdu custom instruction
|
||||
|
||||
mcustom-fixdu=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fixdu) Init(-1)
|
||||
Integer id (N) of fixdu custom instruction
|
||||
|
||||
mno-custom-fixdi
|
||||
Target Report RejectNegative Var(nios2_custom_fixdi, -1)
|
||||
Do not use the fixdi custom instruction
|
||||
|
||||
mcustom-fixdi=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fixdi) Init(-1)
|
||||
Integer id (N) of fixdi custom instruction
|
||||
|
||||
mno-custom-fixsu
|
||||
Target Report RejectNegative Var(nios2_custom_fixsu, -1)
|
||||
Do not use the fixsu custom instruction
|
||||
|
||||
mcustom-fixsu=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fixsu) Init(-1)
|
||||
Integer id (N) of fixsu custom instruction
|
||||
|
||||
mno-custom-fixsi
|
||||
Target Report RejectNegative Var(nios2_custom_fixsi, -1)
|
||||
Do not use the fixsi custom instruction
|
||||
|
||||
mcustom-fixsi=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fixsi) Init(-1)
|
||||
Integer id (N) of fixsi custom instruction
|
||||
|
||||
mno-custom-floatud
|
||||
Target Report RejectNegative Var(nios2_custom_floatud, -1)
|
||||
Do not use the floatud custom instruction
|
||||
|
||||
mcustom-floatud=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_floatud) Init(-1)
|
||||
Integer id (N) of floatud custom instruction
|
||||
|
||||
mno-custom-floatid
|
||||
Target Report RejectNegative Var(nios2_custom_floatid, -1)
|
||||
Do not use the floatid custom instruction
|
||||
|
||||
mcustom-floatid=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_floatid) Init(-1)
|
||||
Integer id (N) of floatid custom instruction
|
||||
|
||||
mno-custom-floatus
|
||||
Target Report RejectNegative Var(nios2_custom_floatus, -1)
|
||||
Do not use the floatus custom instruction
|
||||
|
||||
mcustom-floatus=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_floatus) Init(-1)
|
||||
Integer id (N) of floatus custom instruction
|
||||
|
||||
mno-custom-floatis
|
||||
Target Report RejectNegative Var(nios2_custom_floatis, -1)
|
||||
Do not use the floatis custom instruction
|
||||
|
||||
mcustom-floatis=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_floatis) Init(-1)
|
||||
Integer id (N) of floatis custom instruction
|
||||
|
||||
mno-custom-fcmpned
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpned, -1)
|
||||
Do not use the fcmpned custom instruction
|
||||
|
||||
mcustom-fcmpned=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpned) Init(-1)
|
||||
Integer id (N) of fcmpned custom instruction
|
||||
|
||||
mno-custom-fcmpeqd
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpeqd, -1)
|
||||
Do not use the fcmpeqd custom instruction
|
||||
|
||||
mcustom-fcmpeqd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpeqd) Init(-1)
|
||||
Integer id (N) of fcmpeqd custom instruction
|
||||
|
||||
mno-custom-fcmpged
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpged, -1)
|
||||
Do not use the fcmpged custom instruction
|
||||
|
||||
mcustom-fcmpged=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpged) Init(-1)
|
||||
Integer id (N) of fcmpged custom instruction
|
||||
|
||||
mno-custom-fcmpgtd
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpgtd, -1)
|
||||
Do not use the fcmpgtd custom instruction
|
||||
|
||||
mcustom-fcmpgtd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpgtd) Init(-1)
|
||||
Integer id (N) of fcmpgtd custom instruction
|
||||
|
||||
mno-custom-fcmpled
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpled, -1)
|
||||
Do not use the fcmpled custom instruction
|
||||
|
||||
mcustom-fcmpled=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpled) Init(-1)
|
||||
Integer id (N) of fcmpled custom instruction
|
||||
|
||||
mno-custom-fcmpltd
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpltd, -1)
|
||||
Do not use the fcmpltd custom instruction
|
||||
|
||||
mcustom-fcmpltd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpltd) Init(-1)
|
||||
Integer id (N) of fcmpltd custom instruction
|
||||
|
||||
mno-custom-flogd
|
||||
Target Report RejectNegative Var(nios2_custom_flogd, -1)
|
||||
Do not use the flogd custom instruction
|
||||
|
||||
mcustom-flogd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_flogd) Init(-1)
|
||||
Integer id (N) of flogd custom instruction
|
||||
|
||||
mno-custom-fexpd
|
||||
Target Report RejectNegative Var(nios2_custom_fexpd, -1)
|
||||
Do not use the fexpd custom instruction
|
||||
|
||||
mcustom-fexpd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fexpd) Init(-1)
|
||||
Integer id (N) of fexpd custom instruction
|
||||
|
||||
mno-custom-fatand
|
||||
Target Report RejectNegative Var(nios2_custom_fatand, -1)
|
||||
Do not use the fatand custom instruction
|
||||
|
||||
mcustom-fatand=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fatand) Init(-1)
|
||||
Integer id (N) of fatand custom instruction
|
||||
|
||||
mno-custom-ftand
|
||||
Target Report RejectNegative Var(nios2_custom_ftand, -1)
|
||||
Do not use the ftand custom instruction
|
||||
|
||||
mcustom-ftand=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_ftand) Init(-1)
|
||||
Integer id (N) of ftand custom instruction
|
||||
|
||||
mno-custom-fsind
|
||||
Target Report RejectNegative Var(nios2_custom_fsind, -1)
|
||||
Do not use the fsind custom instruction
|
||||
|
||||
mcustom-fsind=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fsind) Init(-1)
|
||||
Integer id (N) of fsind custom instruction
|
||||
|
||||
mno-custom-fcosd
|
||||
Target Report RejectNegative Var(nios2_custom_fcosd, -1)
|
||||
Do not use the fcosd custom instruction
|
||||
|
||||
mcustom-fcosd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcosd) Init(-1)
|
||||
Integer id (N) of fcosd custom instruction
|
||||
|
||||
mno-custom-fsqrtd
|
||||
Target Report RejectNegative Var(nios2_custom_fsqrtd, -1)
|
||||
Do not use the fsqrtd custom instruction
|
||||
|
||||
mcustom-fsqrtd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fsqrtd) Init(-1)
|
||||
Integer id (N) of fsqrtd custom instruction
|
||||
|
||||
mno-custom-fabsd
|
||||
Target Report RejectNegative Var(nios2_custom_fabsd, -1)
|
||||
Do not use the fabsd custom instruction
|
||||
|
||||
mcustom-fabsd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fabsd) Init(-1)
|
||||
Integer id (N) of fabsd custom instruction
|
||||
|
||||
mno-custom-fnegd
|
||||
Target Report RejectNegative Var(nios2_custom_fnegd, -1)
|
||||
Do not use the fnegd custom instruction
|
||||
|
||||
mcustom-fnegd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fnegd) Init(-1)
|
||||
Integer id (N) of fnegd custom instruction
|
||||
|
||||
mno-custom-fmaxd
|
||||
Target Report RejectNegative Var(nios2_custom_fmaxd, -1)
|
||||
Do not use the fmaxd custom instruction
|
||||
|
||||
mcustom-fmaxd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fmaxd) Init(-1)
|
||||
Integer id (N) of fmaxd custom instruction
|
||||
|
||||
mno-custom-fmind
|
||||
Target Report RejectNegative Var(nios2_custom_fmind, -1)
|
||||
Do not use the fmind custom instruction
|
||||
|
||||
mcustom-fmind=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fmind) Init(-1)
|
||||
Integer id (N) of fmind custom instruction
|
||||
|
||||
mno-custom-fdivd
|
||||
Target Report RejectNegative Var(nios2_custom_fdivd, -1)
|
||||
Do not use the fdivd custom instruction
|
||||
|
||||
mcustom-fdivd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fdivd) Init(-1)
|
||||
Integer id (N) of fdivd custom instruction
|
||||
|
||||
mno-custom-fmuld
|
||||
Target Report RejectNegative Var(nios2_custom_fmuld, -1)
|
||||
Do not use the fmuld custom instruction
|
||||
|
||||
mcustom-fmuld=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fmuld) Init(-1)
|
||||
Integer id (N) of fmuld custom instruction
|
||||
|
||||
mno-custom-fsubd
|
||||
Target Report RejectNegative Var(nios2_custom_fsubd, -1)
|
||||
Do not use the fsubd custom instruction
|
||||
|
||||
mcustom-fsubd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fsubd) Init(-1)
|
||||
Integer id (N) of fsubd custom instruction
|
||||
|
||||
mno-custom-faddd
|
||||
Target Report RejectNegative Var(nios2_custom_faddd, -1)
|
||||
Do not use the faddd custom instruction
|
||||
|
||||
mcustom-faddd=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_faddd) Init(-1)
|
||||
Integer id (N) of faddd custom instruction
|
||||
|
||||
mno-custom-fcmpnes
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpnes, -1)
|
||||
Do not use the fcmpnes custom instruction
|
||||
|
||||
mcustom-fcmpnes=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpnes) Init(-1)
|
||||
Integer id (N) of fcmpnes custom instruction
|
||||
|
||||
mno-custom-fcmpeqs
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpeqs, -1)
|
||||
Do not use the fcmpeqs custom instruction
|
||||
|
||||
mcustom-fcmpeqs=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpeqs) Init(-1)
|
||||
Integer id (N) of fcmpeqs custom instruction
|
||||
|
||||
mno-custom-fcmpges
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpges, -1)
|
||||
Do not use the fcmpges custom instruction
|
||||
|
||||
mcustom-fcmpges=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpges) Init(-1)
|
||||
Integer id (N) of fcmpges custom instruction
|
||||
|
||||
mno-custom-fcmpgts
|
||||
Target Report RejectNegative Var(nios2_custom_fcmpgts, -1)
|
||||
Do not use the fcmpgts custom instruction
|
||||
|
||||
mcustom-fcmpgts=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmpgts) Init(-1)
|
||||
Integer id (N) of fcmpgts custom instruction
|
||||
|
||||
mno-custom-fcmples
|
||||
Target Report RejectNegative Var(nios2_custom_fcmples, -1)
|
||||
Do not use the fcmples custom instruction
|
||||
|
||||
mcustom-fcmples=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmples) Init(-1)
|
||||
Integer id (N) of fcmples custom instruction
|
||||
|
||||
mno-custom-fcmplts
|
||||
Target Report RejectNegative Var(nios2_custom_fcmplts, -1)
|
||||
Do not use the fcmplts custom instruction
|
||||
|
||||
mcustom-fcmplts=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcmplts) Init(-1)
|
||||
Integer id (N) of fcmplts custom instruction
|
||||
|
||||
mno-custom-flogs
|
||||
Target Report RejectNegative Var(nios2_custom_flogs, -1)
|
||||
Do not use the flogs custom instruction
|
||||
|
||||
mcustom-flogs=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_flogs) Init(-1)
|
||||
Integer id (N) of flogs custom instruction
|
||||
|
||||
mno-custom-fexps
|
||||
Target Report RejectNegative Var(nios2_custom_fexps, -1)
|
||||
Do not use the fexps custom instruction
|
||||
|
||||
mcustom-fexps=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fexps) Init(-1)
|
||||
Integer id (N) of fexps custom instruction
|
||||
|
||||
mno-custom-fatans
|
||||
Target Report RejectNegative Var(nios2_custom_fatans, -1)
|
||||
Do not use the fatans custom instruction
|
||||
|
||||
mcustom-fatans=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fatans) Init(-1)
|
||||
Integer id (N) of fatans custom instruction
|
||||
|
||||
mno-custom-ftans
|
||||
Target Report RejectNegative Var(nios2_custom_ftans, -1)
|
||||
Do not use the ftans custom instruction
|
||||
|
||||
mcustom-ftans=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_ftans) Init(-1)
|
||||
Integer id (N) of ftans custom instruction
|
||||
|
||||
mno-custom-fsins
|
||||
Target Report RejectNegative Var(nios2_custom_fsins, -1)
|
||||
Do not use the fsins custom instruction
|
||||
|
||||
mcustom-fsins=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fsins) Init(-1)
|
||||
Integer id (N) of fsins custom instruction
|
||||
|
||||
mno-custom-fcoss
|
||||
Target Report RejectNegative Var(nios2_custom_fcoss, -1)
|
||||
Do not use the fcoss custom instruction
|
||||
|
||||
mcustom-fcoss=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fcoss) Init(-1)
|
||||
Integer id (N) of fcoss custom instruction
|
||||
|
||||
mno-custom-fsqrts
|
||||
Target Report RejectNegative Var(nios2_custom_fsqrts, -1)
|
||||
Do not use the fsqrts custom instruction
|
||||
|
||||
mcustom-fsqrts=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fsqrts) Init(-1)
|
||||
Integer id (N) of fsqrts custom instruction
|
||||
|
||||
mno-custom-fabss
|
||||
Target Report RejectNegative Var(nios2_custom_fabss, -1)
|
||||
Do not use the fabss custom instr
|
||||
|
||||
mcustom-fabss=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fabss) Init(-1)
|
||||
Integer id (N) of fabss custom instruction
|
||||
|
||||
mno-custom-fnegs
|
||||
Target Report RejectNegative Var(nios2_custom_fnegs, -1)
|
||||
Do not use the fnegs custom instruction
|
||||
|
||||
mcustom-fnegs=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fnegs) Init(-1)
|
||||
Integer id (N) of fnegs custom instruction
|
||||
|
||||
mno-custom-fmaxs
|
||||
Target Report RejectNegative Var(nios2_custom_fmaxs, -1)
|
||||
Do not use the fmaxs custom instruction
|
||||
|
||||
mcustom-fmaxs=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fmaxs) Init(-1)
|
||||
Integer id (N) of fmaxs custom instruction
|
||||
|
||||
mno-custom-fmins
|
||||
Target Report RejectNegative Var(nios2_custom_fmins, -1)
|
||||
Do not use the fmins custom instruction
|
||||
|
||||
mcustom-fmins=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fmins) Init(-1)
|
||||
Integer id (N) of fmins custom instruction
|
||||
|
||||
mno-custom-fdivs
|
||||
Target Report RejectNegative Var(nios2_custom_fdivs, -1)
|
||||
Do not use the fdivs custom instruction
|
||||
|
||||
mcustom-fdivs=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fdivs) Init(-1)
|
||||
Integer id (N) of fdivs custom instruction
|
||||
|
||||
mno-custom-fmuls
|
||||
Target Report RejectNegative Var(nios2_custom_fmuls, -1)
|
||||
Do not use the fmuls custom instruction
|
||||
|
||||
mcustom-fmuls=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fmuls) Init(-1)
|
||||
Integer id (N) of fmuls custom instruction
|
||||
|
||||
mno-custom-fsubs
|
||||
Target Report RejectNegative Var(nios2_custom_fsubs, -1)
|
||||
Do not use the fsubs custom instruction
|
||||
|
||||
mcustom-fsubs=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fsubs) Init(-1)
|
||||
Integer id (N) of fsubs custom instruction
|
||||
|
||||
mno-custom-fadds
|
||||
Target Report RejectNegative Var(nios2_custom_fadds, -1)
|
||||
Do not use the fadds custom instruction
|
||||
|
||||
mcustom-fadds=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fadds) Init(-1)
|
||||
Integer id (N) of fadds custom instruction
|
||||
|
||||
mno-custom-frdy
|
||||
Target Report RejectNegative Var(nios2_custom_frdy, -1)
|
||||
Do not use the frdy custom instruction
|
||||
|
||||
mcustom-frdy=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_frdy) Init(-1)
|
||||
Integer id (N) of frdy custom instruction
|
||||
|
||||
mno-custom-frdxhi
|
||||
Target Report RejectNegative Var(nios2_custom_frdxhi, -1)
|
||||
Do not use the frdxhi custom instruction
|
||||
|
||||
mcustom-frdxhi=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_frdxhi) Init(-1)
|
||||
Integer id (N) of frdxhi custom instruction
|
||||
|
||||
mno-custom-frdxlo
|
||||
Target Report RejectNegative Var(nios2_custom_frdxlo, -1)
|
||||
Do not use the frdxlo custom instruction
|
||||
|
||||
mcustom-frdxlo=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_frdxlo) Init(-1)
|
||||
Integer id (N) of frdxlo custom instruction
|
||||
|
||||
mno-custom-fwry
|
||||
Target Report RejectNegative Var(nios2_custom_fwry, -1)
|
||||
Do not use the fwry custom instruction
|
||||
|
||||
mcustom-fwry=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fwry) Init(-1)
|
||||
Integer id (N) of fwry custom instruction
|
||||
|
||||
mno-custom-fwrx
|
||||
Target Report RejectNegative Var(nios2_custom_fwrx, -1)
|
||||
Do not use the fwrx custom instruction
|
||||
|
||||
mcustom-fwrx=
|
||||
Target Report RejectNegative Joined UInteger Var(nios2_custom_fwrx) Init(-1)
|
||||
Integer id (N) of fwrx custom instruction
|
85
gcc/config/nios2/predicates.md
Normal file
85
gcc/config/nios2/predicates.md
Normal file
|
@ -0,0 +1,85 @@
|
|||
;; Predicate definitions for Altera Nios II.
|
||||
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
;; Contributed by Chung-Lin Tang <cltang@codesourcery.com>
|
||||
;;
|
||||
;; This file is part of GCC.
|
||||
;;
|
||||
;; GCC 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 3, or (at your option)
|
||||
;; any later version.
|
||||
;;
|
||||
;; GCC 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 GCC; see the file COPYING3. If not see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define_predicate "const_0_operand"
|
||||
(and (match_code "const_int,const_double,const_vector")
|
||||
(match_test "op == CONST0_RTX (GET_MODE (op))")))
|
||||
|
||||
(define_predicate "reg_or_0_operand"
|
||||
(ior (match_operand 0 "const_0_operand")
|
||||
(match_operand 0 "register_operand")))
|
||||
|
||||
(define_predicate "const_uns_arith_operand"
|
||||
(and (match_code "const_int")
|
||||
(match_test "SMALL_INT_UNSIGNED (INTVAL (op))")))
|
||||
|
||||
(define_predicate "uns_arith_operand"
|
||||
(ior (match_operand 0 "const_uns_arith_operand")
|
||||
(match_operand 0 "register_operand")))
|
||||
|
||||
(define_predicate "const_arith_operand"
|
||||
(and (match_code "const_int")
|
||||
(match_test "SMALL_INT (INTVAL (op))")))
|
||||
|
||||
(define_predicate "arith_operand"
|
||||
(ior (match_operand 0 "const_arith_operand")
|
||||
(match_operand 0 "register_operand")))
|
||||
|
||||
(define_predicate "add_regimm_operand"
|
||||
(ior (match_operand 0 "arith_operand")
|
||||
(match_test "nios2_unspec_reloc_p (op)")))
|
||||
|
||||
(define_predicate "const_logical_operand"
|
||||
(and (match_code "const_int")
|
||||
(match_test "(INTVAL (op) & 0xffff) == 0
|
||||
|| (INTVAL (op) & 0xffff0000) == 0")))
|
||||
|
||||
(define_predicate "logical_operand"
|
||||
(ior (match_operand 0 "const_logical_operand")
|
||||
(match_operand 0 "register_operand")))
|
||||
|
||||
(define_predicate "const_shift_operand"
|
||||
(and (match_code "const_int")
|
||||
(match_test "SHIFT_INT (INTVAL (op))")))
|
||||
|
||||
(define_predicate "shift_operand"
|
||||
(ior (match_operand 0 "const_shift_operand")
|
||||
(match_operand 0 "register_operand")))
|
||||
|
||||
(define_predicate "call_operand"
|
||||
(ior (match_operand 0 "immediate_operand")
|
||||
(match_operand 0 "register_operand")))
|
||||
|
||||
(define_predicate "rdwrctl_operand"
|
||||
(and (match_code "const_int")
|
||||
(match_test "RDWRCTL_INT (INTVAL (op))")))
|
||||
|
||||
(define_predicate "custom_insn_opcode"
|
||||
(and (match_code "const_int")
|
||||
(match_test "CUSTOM_INSN_OPCODE (INTVAL (op))")))
|
||||
|
||||
(define_special_predicate "expandable_comparison_operator"
|
||||
(match_operand 0 "ordered_comparison_operator")
|
||||
{
|
||||
return (GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) != MODE_FLOAT
|
||||
|| nios2_validate_fpu_compare (GET_MODE (XEXP (op, 0)), &op,
|
||||
&XEXP (op, 0), &XEXP (op, 1),
|
||||
false));
|
||||
})
|
27
gcc/config/nios2/t-nios2
Normal file
27
gcc/config/nios2/t-nios2
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Target Makefile Fragment for Altera Nios II.
|
||||
# Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
# Contributed by Altera and Mentor Graphics, Inc.
|
||||
#
|
||||
# This file is part of GCC.
|
||||
#
|
||||
# GCC 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 3, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# GCC 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 GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# MULTILIB_OPTIONS = mno-hw-mul/mhw-mulx mcustom-fpu-cfg=60-1/mcustom-fpu-cfg=60-2
|
||||
# MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
|
||||
# MULTILIB_EXCEPTIONS =
|
||||
|
||||
# MULTILIB_OPTIONS += EL/EB
|
||||
# MULTILIB_DIRNAMES += le be
|
||||
# MULTILIB_MATCHES += EL=mel EB=meb
|
11
gcc/configure
vendored
11
gcc/configure
vendored
|
@ -23396,6 +23396,13 @@ foo:
|
|||
tls_first_minor=19
|
||||
tls_as_opt='--fatal-warnings'
|
||||
;;
|
||||
nios2-*-*)
|
||||
conftest_s='
|
||||
.section ".tdata","awT",@progbits'
|
||||
tls_first_major=2
|
||||
tls_first_minor=23
|
||||
tls_as_opt="--fatal-warnings"
|
||||
;;
|
||||
aarch64*-*-*)
|
||||
conftest_s='
|
||||
.section ".tdata","awT",%progbits
|
||||
|
@ -26251,8 +26258,8 @@ esac
|
|||
# version to the per-target configury.
|
||||
case "$cpu_type" in
|
||||
aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \
|
||||
| mips | pa | rs6000 | score | sparc | spu | tilegx | tilepro | xstormy16 \
|
||||
| xtensa)
|
||||
| mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \
|
||||
| xstormy16 | xtensa)
|
||||
insn="nop"
|
||||
;;
|
||||
ia64 | s390)
|
||||
|
|
|
@ -3068,6 +3068,13 @@ foo:
|
|||
tls_first_minor=19
|
||||
tls_as_opt='--fatal-warnings'
|
||||
;;
|
||||
nios2-*-*)
|
||||
conftest_s='
|
||||
.section ".tdata","awT",@progbits'
|
||||
tls_first_major=2
|
||||
tls_first_minor=23
|
||||
tls_as_opt="--fatal-warnings"
|
||||
;;
|
||||
aarch64*-*-*)
|
||||
conftest_s='
|
||||
.section ".tdata","awT",%progbits
|
||||
|
@ -4303,8 +4310,8 @@ esac
|
|||
# version to the per-target configury.
|
||||
case "$cpu_type" in
|
||||
aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \
|
||||
| mips | pa | rs6000 | score | sparc | spu | tilegx | tilepro | xstormy16 \
|
||||
| xtensa)
|
||||
| mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \
|
||||
| xstormy16 | xtensa)
|
||||
insn="nop"
|
||||
;;
|
||||
ia64 | s390)
|
||||
|
|
|
@ -3847,6 +3847,14 @@ int core2_func (void) __attribute__ ((__target__ ("arch=core2")));
|
|||
int sse3_func (void) __attribute__ ((__target__ ("sse3")));
|
||||
@end smallexample
|
||||
|
||||
You can either use multiple
|
||||
strings to specify multiple options, or separate the options
|
||||
with a comma (@samp{,}).
|
||||
|
||||
The @code{target} attribute is presently implemented for
|
||||
i386/x86_64, PowerPC, and Nios II targets only.
|
||||
The options supported are specific to each target.
|
||||
|
||||
On the 386, the following options are allowed:
|
||||
|
||||
@table @samp
|
||||
|
@ -4168,9 +4176,29 @@ compilation tunes for the @var{CPU} architecture, and not the
|
|||
default tuning specified on the command line.
|
||||
@end table
|
||||
|
||||
On the 386/x86_64 and PowerPC back ends, you can use either multiple
|
||||
strings to specify multiple options, or you can separate the option
|
||||
with a comma (@code{,}).
|
||||
When compiling for Nios II, the following options are allowed:
|
||||
|
||||
@table @samp
|
||||
@item custom-@var{insn}=@var{N}
|
||||
@itemx no-custom-@var{insn}
|
||||
@cindex @code{target("custom-@var{insn}=@var{N}")} attribute
|
||||
@cindex @code{target("no-custom-@var{insn}")} attribute
|
||||
Each @samp{custom-@var{insn}=@var{N}} attribute locally enables use of a
|
||||
custom instruction with encoding @var{N} when generating code that uses
|
||||
@var{insn}. Similarly, @samp{no-custom-@var{insn}} locally inhibits use of
|
||||
the custom instruction @var{insn}.
|
||||
These target attributes correspond to the
|
||||
@option{-mcustom-@var{insn}=@var{N}} and @option{-mno-custom-@var{insn}}
|
||||
command-line options, and support the same set of @var{insn} keywords.
|
||||
@xref{Nios II Options}, for more information.
|
||||
|
||||
@item custom-fpu-cfg=@var{name}
|
||||
@cindex @code{target("custom-fpu-cfg=@var{name}")} attribute
|
||||
This attribute corresponds to the @option{-mcustom-fpu-cfg=@var{name}}
|
||||
command-line option, to select a predefined set of custom instructions
|
||||
named @var{name}.
|
||||
@xref{Nios II Options}, for more information.
|
||||
@end table
|
||||
|
||||
On the 386/x86_64 and PowerPC back ends, the inliner does not inline a
|
||||
function that has different target options than the caller, unless the
|
||||
|
@ -4178,10 +4206,6 @@ callee has a subset of the target options of the caller. For example
|
|||
a function declared with @code{target("sse3")} can inline a function
|
||||
with @code{target("sse2")}, since @code{-msse3} implies @code{-msse2}.
|
||||
|
||||
The @code{target} attribute is not implemented in GCC versions earlier
|
||||
than 4.4 for the i386/x86_64 and 4.6 for the PowerPC back ends. It is
|
||||
not currently implemented for other back ends.
|
||||
|
||||
@item tiny_data
|
||||
@cindex tiny data section on the H8/300H and H8S
|
||||
Use this attribute on the H8/300H and H8S to indicate that the specified
|
||||
|
@ -9012,6 +9036,7 @@ instructions, but allow the compiler to schedule those calls.
|
|||
|
||||
@menu
|
||||
* Alpha Built-in Functions::
|
||||
* Altera Nios II Built-in Functions::
|
||||
* ARC Built-in Functions::
|
||||
* ARC SIMD Built-in Functions::
|
||||
* ARM iWMMXt Built-in Functions::
|
||||
|
@ -9124,6 +9149,110 @@ void *__builtin_thread_pointer (void)
|
|||
void __builtin_set_thread_pointer (void *)
|
||||
@end smallexample
|
||||
|
||||
@node Altera Nios II Built-in Functions
|
||||
@subsection Altera Nios II Built-in Functions
|
||||
|
||||
These built-in functions are available for the Altera Nios II
|
||||
family of processors.
|
||||
|
||||
The following built-in functions are always available. They
|
||||
all generate the machine instruction that is part of the name.
|
||||
|
||||
@example
|
||||
int __builtin_ldbio (volatile const void *)
|
||||
int __builtin_ldbuio (volatile const void *)
|
||||
int __builtin_ldhio (volatile const void *)
|
||||
int __builtin_ldhuio (volatile const void *)
|
||||
int __builtin_ldwio (volatile const void *)
|
||||
void __builtin_stbio (volatile void *, int)
|
||||
void __builtin_sthio (volatile void *, int)
|
||||
void __builtin_stwio (volatile void *, int)
|
||||
void __builtin_sync (void)
|
||||
int __builtin_rdctl (int)
|
||||
void __builtin_wrctl (int, int)
|
||||
@end example
|
||||
|
||||
The following built-in functions are always available. They
|
||||
all generate a Nios II Custom Instruction. The name of the
|
||||
function represents the types that the function takes and
|
||||
returns. The letter before the @code{n} is the return type
|
||||
or void if absent. The @code{n} represents the first parameter
|
||||
to all the custom instructions, the custom instruction number.
|
||||
The two letters after the @code{n} represent the up to two
|
||||
parameters to the function.
|
||||
|
||||
The letters represent the following data types:
|
||||
@table @code
|
||||
@item <no letter>
|
||||
@code{void} for return type and no parameter for parameter types.
|
||||
|
||||
@item i
|
||||
@code{int} for return type and parameter type
|
||||
|
||||
@item f
|
||||
@code{float} for return type and parameter type
|
||||
|
||||
@item p
|
||||
@code{void *} for return type and parameter type
|
||||
|
||||
@end table
|
||||
|
||||
And the function names are:
|
||||
@example
|
||||
void __builtin_custom_n (void)
|
||||
void __builtin_custom_ni (int)
|
||||
void __builtin_custom_nf (float)
|
||||
void __builtin_custom_np (void *)
|
||||
void __builtin_custom_nii (int, int)
|
||||
void __builtin_custom_nif (int, float)
|
||||
void __builtin_custom_nip (int, void *)
|
||||
void __builtin_custom_nfi (float, int)
|
||||
void __builtin_custom_nff (float, float)
|
||||
void __builtin_custom_nfp (float, void *)
|
||||
void __builtin_custom_npi (void *, int)
|
||||
void __builtin_custom_npf (void *, float)
|
||||
void __builtin_custom_npp (void *, void *)
|
||||
int __builtin_custom_in (void)
|
||||
int __builtin_custom_ini (int)
|
||||
int __builtin_custom_inf (float)
|
||||
int __builtin_custom_inp (void *)
|
||||
int __builtin_custom_inii (int, int)
|
||||
int __builtin_custom_inif (int, float)
|
||||
int __builtin_custom_inip (int, void *)
|
||||
int __builtin_custom_infi (float, int)
|
||||
int __builtin_custom_inff (float, float)
|
||||
int __builtin_custom_infp (float, void *)
|
||||
int __builtin_custom_inpi (void *, int)
|
||||
int __builtin_custom_inpf (void *, float)
|
||||
int __builtin_custom_inpp (void *, void *)
|
||||
float __builtin_custom_fn (void)
|
||||
float __builtin_custom_fni (int)
|
||||
float __builtin_custom_fnf (float)
|
||||
float __builtin_custom_fnp (void *)
|
||||
float __builtin_custom_fnii (int, int)
|
||||
float __builtin_custom_fnif (int, float)
|
||||
float __builtin_custom_fnip (int, void *)
|
||||
float __builtin_custom_fnfi (float, int)
|
||||
float __builtin_custom_fnff (float, float)
|
||||
float __builtin_custom_fnfp (float, void *)
|
||||
float __builtin_custom_fnpi (void *, int)
|
||||
float __builtin_custom_fnpf (void *, float)
|
||||
float __builtin_custom_fnpp (void *, void *)
|
||||
void * __builtin_custom_pn (void)
|
||||
void * __builtin_custom_pni (int)
|
||||
void * __builtin_custom_pnf (float)
|
||||
void * __builtin_custom_pnp (void *)
|
||||
void * __builtin_custom_pnii (int, int)
|
||||
void * __builtin_custom_pnif (int, float)
|
||||
void * __builtin_custom_pnip (int, void *)
|
||||
void * __builtin_custom_pnfi (float, int)
|
||||
void * __builtin_custom_pnff (float, float)
|
||||
void * __builtin_custom_pnfp (float, void *)
|
||||
void * __builtin_custom_pnpi (void *, int)
|
||||
void * __builtin_custom_pnpf (void *, float)
|
||||
void * __builtin_custom_pnpp (void *, void *)
|
||||
@end example
|
||||
|
||||
@node ARC Built-in Functions
|
||||
@subsection ARC Built-in Functions
|
||||
|
||||
|
@ -16290,9 +16419,8 @@ function. The parenthesis around the options is optional.
|
|||
@xref{Function Attributes}, for more information about the
|
||||
@code{target} attribute and the attribute syntax.
|
||||
|
||||
The @code{#pragma GCC target} attribute is not implemented in GCC versions earlier
|
||||
than 4.4 for the i386/x86_64 and 4.6 for the PowerPC back ends. At
|
||||
present, it is not implemented for other back ends.
|
||||
The @code{#pragma GCC target} pragma is presently implemented for
|
||||
i386/x86_64, PowerPC, and Nios II targets only.
|
||||
@end table
|
||||
|
||||
@table @code
|
||||
|
|
|
@ -840,6 +840,16 @@ Objective-C and Objective-C++ Dialects}.
|
|||
-mforce-fp-as-gp -mforbid-fp-as-gp @gol
|
||||
-mex9 -mctor-dtor -mrelax}
|
||||
|
||||
@emph{Nios II Options}
|
||||
@gccoptlist{-G @var{num} -mgpopt -mno-gpopt -mel -meb @gol
|
||||
-mno-bypass-cache -mbypass-cache @gol
|
||||
-mno-cache-volatile -mcache-volatile @gol
|
||||
-mno-fast-sw-div -mfast-sw-div @gol
|
||||
-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
|
||||
-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
|
||||
-mcustom-fpu-cfg=@var{name} @gol
|
||||
-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}}
|
||||
|
||||
@emph{PDP-11 Options}
|
||||
@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
|
||||
-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
|
||||
|
@ -11230,6 +11240,7 @@ platform.
|
|||
* Moxie Options::
|
||||
* MSP430 Options::
|
||||
* NDS32 Options::
|
||||
* Nios II Options::
|
||||
* PDP-11 Options::
|
||||
* picoChip Options::
|
||||
* PowerPC Options::
|
||||
|
@ -18214,6 +18225,285 @@ Guide linker to relax instructions.
|
|||
|
||||
@end table
|
||||
|
||||
@node Nios II Options
|
||||
@subsection Nios II Options
|
||||
@cindex Nios II options
|
||||
@cindex Altera Nios II options
|
||||
|
||||
These are the options defined for the Altera Nios II processor.
|
||||
|
||||
@table @gcctabopt
|
||||
|
||||
@item -G @var{num}
|
||||
@opindex G
|
||||
@cindex smaller data references
|
||||
Put global and static objects less than or equal to @var{num} bytes
|
||||
into the small data or BSS sections instead of the normal data or BSS
|
||||
sections. The default value of @var{num} is 8.
|
||||
|
||||
@item -mgpopt
|
||||
@itemx -mno-gpopt
|
||||
@opindex mgpopt
|
||||
@opindex mno-gpopt
|
||||
Generate (do not generate) GP-relative accesses for objects in the
|
||||
small data or BSS sections. The default is @option{-mgpopt} except
|
||||
when @option{-fpic} or @option{-fPIC} is specified to generate
|
||||
position-independent code. Note that the Nios II ABI does not permit
|
||||
GP-relative accesses from shared libraries.
|
||||
|
||||
You may need to specify @option{-mno-gpopt} explicitly when building
|
||||
programs that include large amounts of small data, including large
|
||||
GOT data sections. In this case, the 16-bit offset for GP-relative
|
||||
addressing may not be large enough to allow access to the entire
|
||||
small data section.
|
||||
|
||||
@item -mel
|
||||
@itemx -meb
|
||||
@opindex mel
|
||||
@opindex meb
|
||||
Generate little-endian (default) or big-endian (experimental) code,
|
||||
respectively.
|
||||
|
||||
@item -mbypass-cache
|
||||
@itemx -mno-bypass-cache
|
||||
@opindex mno-bypass-cache
|
||||
@opindex mbypass-cache
|
||||
Force all load and store instructions to always bypass cache by
|
||||
using I/O variants of the instructions. The default is not to
|
||||
bypass the cache.
|
||||
|
||||
@item -mno-cache-volatile
|
||||
@itemx -mcache-volatile
|
||||
@opindex mcache-volatile
|
||||
@opindex mno-cache-volatile
|
||||
Volatile memory access bypass the cache using the I/O variants of
|
||||
the load and store instructions. The default is not to bypass the cache.
|
||||
|
||||
@item -mno-fast-sw-div
|
||||
@itemx -mfast-sw-div
|
||||
@opindex mno-fast-sw-div
|
||||
@opindex mfast-sw-div
|
||||
Do not use table-based fast divide for small numbers. The default
|
||||
is to use the fast divide at @option{-O3} and above.
|
||||
|
||||
@item -mno-hw-mul
|
||||
@itemx -mhw-mul
|
||||
@itemx -mno-hw-mulx
|
||||
@itemx -mhw-mulx
|
||||
@itemx -mno-hw-div
|
||||
@itemx -mhw-div
|
||||
@opindex mno-hw-mul
|
||||
@opindex mhw-mul
|
||||
@opindex mno-hw-mulx
|
||||
@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}.
|
||||
|
||||
@item -mcustom-@var{insn}=@var{N}
|
||||
@itemx -mno-custom-@var{insn}
|
||||
@opindex mcustom-@var{insn}
|
||||
@opindex mno-custom-@var{insn}
|
||||
Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
|
||||
custom instruction with encoding @var{N} when generating code that uses
|
||||
@var{insn}. For example, @code{-mcustom-fadds=253} generates custom
|
||||
instruction 253 for single-precision floating-point add operations instead
|
||||
of the default behavior of using a library call.
|
||||
|
||||
The following values of @var{insn} are supported. Except as otherwise
|
||||
noted, floating-point operations are expected to be implemented with
|
||||
normal IEEE 754 semantics and correspond directly to the C operators or the
|
||||
equivalent GCC built-in functions (@pxref{Other Builtins}).
|
||||
|
||||
Single-precision floating point:
|
||||
@table @asis
|
||||
|
||||
@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
|
||||
Binary arithmetic operations.
|
||||
|
||||
@item @samp{fnegs}
|
||||
Unary negation.
|
||||
|
||||
@item @samp{fabss}
|
||||
Unary absolute value.
|
||||
|
||||
@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
|
||||
Comparison operations.
|
||||
|
||||
@item @samp{fmins}, @samp{fmaxs}
|
||||
Floating-point minimum and maximum. These instructions are only
|
||||
generated if @option{-ffinite-math-only} is specified.
|
||||
|
||||
@item @samp{fsqrts}
|
||||
Unary square root operation.
|
||||
|
||||
@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
|
||||
Floating-point trigonometric and exponential functions. These instructions
|
||||
are only generated if @option{-funsafe-math-optimizations} is also specified.
|
||||
|
||||
@end table
|
||||
|
||||
Double-precision floating point:
|
||||
@table @asis
|
||||
|
||||
@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
|
||||
Binary arithmetic operations.
|
||||
|
||||
@item @samp{fnegd}
|
||||
Unary negation.
|
||||
|
||||
@item @samp{fabsd}
|
||||
Unary absolute value.
|
||||
|
||||
@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
|
||||
Comparison operations.
|
||||
|
||||
@item @samp{fmind}, @samp{fmaxd}
|
||||
Double-precision minimum and maximum. These instructions are only
|
||||
generated if @option{-ffinite-math-only} is specified.
|
||||
|
||||
@item @samp{fsqrtd}
|
||||
Unary square root operation.
|
||||
|
||||
@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
|
||||
Double-precision trigonometric and exponential functions. These instructions
|
||||
are only generated if @option{-funsafe-math-optimizations} is also specified.
|
||||
|
||||
@end table
|
||||
|
||||
Conversions:
|
||||
@table @asis
|
||||
@item @samp{fextsd}
|
||||
Conversion from single precision to double precision.
|
||||
|
||||
@item @samp{ftruncds}
|
||||
Conversion from double precision to single precision.
|
||||
|
||||
@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
|
||||
Conversion from floating point to signed or unsigned integer types, with
|
||||
truncation towards zero.
|
||||
|
||||
@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
|
||||
Conversion from signed or unsigned integer types to floating-point types.
|
||||
|
||||
@end table
|
||||
|
||||
In addition, all of the following transfer instructions for internal
|
||||
registers X and Y must be provided to use any of the double-precision
|
||||
floating-point instructions. Custom instructions taking two
|
||||
double-precision source operands expect the first operand in the
|
||||
64-bit register X. The other operand (or only operand of a unary
|
||||
operation) is given to the custom arithmetic instruction with the
|
||||
least significant half in source register @var{src1} and the most
|
||||
significant half in @var{src2}. A custom instruction that returns a
|
||||
double-precision result returns the most significant 32 bits in the
|
||||
destination register and the other half in 32-bit register Y.
|
||||
GCC automatically generates the necessary code sequences to write
|
||||
register X and/or read register Y when double-precision floating-point
|
||||
instructions are used.
|
||||
|
||||
@table @asis
|
||||
|
||||
@item @samp{fwrx}
|
||||
Write @var{src1} into the least significant half of X and @var{src2} into
|
||||
the most significant half of X.
|
||||
|
||||
@item @samp{fwry}
|
||||
Write @var{src1} into Y.
|
||||
|
||||
@item @samp{frdxhi}, @samp{frdxlo}
|
||||
Read the most or least (respectively) significant half of X and store it in
|
||||
@var{dest}.
|
||||
|
||||
@item @samp{frdy}
|
||||
Read the value of Y and store it into @var{dest}.
|
||||
@end table
|
||||
|
||||
Note that you can gain more local control over generation of Nios II custom
|
||||
instructions by using the @code{target("custom-@var{insn}=@var{N}")}
|
||||
and @code{target("no-custom-@var{insn}")} function attributes
|
||||
(@pxref{Function Attributes})
|
||||
or pragmas (@pxref{Function Specific Option Pragmas}).
|
||||
|
||||
@item -mcustom-fpu-cfg=@var{name}
|
||||
@opindex mcustom-fpu-cfg
|
||||
|
||||
This option enables a predefined, named set of custom instruction encodings
|
||||
(see @option{-mcustom-@var{insn}} above).
|
||||
Currently, the following sets are defined:
|
||||
|
||||
@option{-mcustom-fpu-cfg=60-1} is equivalent to:
|
||||
@gccoptlist{-mcustom-fmuls=252 @gol
|
||||
-mcustom-fadds=253 @gol
|
||||
-mcustom-fsubs=254 @gol
|
||||
-fsingle-precision-constant}
|
||||
|
||||
@option{-mcustom-fpu-cfg=60-2} is equivalent to:
|
||||
@gccoptlist{-mcustom-fmuls=252 @gol
|
||||
-mcustom-fadds=253 @gol
|
||||
-mcustom-fsubs=254 @gol
|
||||
-mcustom-fdivs=255 @gol
|
||||
-fsingle-precision-constant}
|
||||
|
||||
@option{-mcustom-fpu-cfg=72-3} is equivalent to:
|
||||
@gccoptlist{-mcustom-floatus=243 @gol
|
||||
-mcustom-fixsi=244 @gol
|
||||
-mcustom-floatis=245 @gol
|
||||
-mcustom-fcmpgts=246 @gol
|
||||
-mcustom-fcmples=249 @gol
|
||||
-mcustom-fcmpeqs=250 @gol
|
||||
-mcustom-fcmpnes=251 @gol
|
||||
-mcustom-fmuls=252 @gol
|
||||
-mcustom-fadds=253 @gol
|
||||
-mcustom-fsubs=254 @gol
|
||||
-mcustom-fdivs=255 @gol
|
||||
-fsingle-precision-constant}
|
||||
|
||||
Custom instruction assignments given by individual
|
||||
@option{-mcustom-@var{insn}=} options override those given by
|
||||
@option{-mcustom-fpu-cfg=}, regardless of the
|
||||
order of the options on the command line.
|
||||
|
||||
Note that you can gain more local control over selection of a FPU
|
||||
configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
|
||||
function attribute (@pxref{Function Attributes})
|
||||
or pragma (@pxref{Function Specific Option Pragmas}).
|
||||
|
||||
@end table
|
||||
|
||||
These additional @samp{-m} options are available for the Altera Nios II
|
||||
ELF (bare-metal) target:
|
||||
|
||||
@table @gcctabopt
|
||||
|
||||
@item -mhal
|
||||
@opindex mhal
|
||||
Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
|
||||
startup and termination code, and is typically used in conjunction with
|
||||
@option{-msys-crt0=} to specify the location of the alternate startup code
|
||||
provided by the HAL BSP.
|
||||
|
||||
@item -msmallc
|
||||
@opindex msmallc
|
||||
Link with a limited version of the C library, @option{-lsmallc}, rather than
|
||||
Newlib.
|
||||
|
||||
@item -msys-crt0=@var{startfile}
|
||||
@opindex msys-crt0
|
||||
@var{startfile} is the file name of the startfile (crt0) to use
|
||||
when linking. This option is only useful in conjunction with @option{-mhal}.
|
||||
|
||||
@item -msys-lib=@var{systemlib}
|
||||
@opindex msys-lib
|
||||
@var{systemlib} is the library name of the library that provides
|
||||
low-level system calls required by the C library,
|
||||
e.g. @code{read} and @code{write}.
|
||||
This option is typically used to link with a library provided by a HAL BSP.
|
||||
|
||||
@end table
|
||||
|
||||
@node PDP-11 Options
|
||||
@subsection PDP-11 Options
|
||||
@cindex PDP-11 Options
|
||||
|
|
|
@ -3233,6 +3233,52 @@ Memory constraint for 45 format.
|
|||
Memory constraint for 37 format.
|
||||
@end table
|
||||
|
||||
@item Nios II family---@file{config/nios2/constraints.md}
|
||||
@table @code
|
||||
|
||||
@item I
|
||||
Integer that is valid as an immediate operand in an
|
||||
instruction taking a signed 16-bit number. Range
|
||||
@minus{}32768 to 32767.
|
||||
|
||||
@item J
|
||||
Integer that is valid as an immediate operand in an
|
||||
instruction taking an unsigned 16-bit number. Range
|
||||
0 to 65535.
|
||||
|
||||
@item K
|
||||
Integer that is valid as an immediate operand in an
|
||||
instruction taking only the upper 16-bits of a
|
||||
32-bit number. Range 32-bit numbers with the lower
|
||||
16-bits being 0.
|
||||
|
||||
@item L
|
||||
Integer that is valid as an immediate operand for a
|
||||
shift instruction. Range 0 to 31.
|
||||
|
||||
@item M
|
||||
Integer that is valid as an immediate operand for
|
||||
only the value 0. Can be used in conjunction with
|
||||
the format modifier @code{z} to use @code{r0}
|
||||
instead of @code{0} in the assembly output.
|
||||
|
||||
@item N
|
||||
Integer that is valid as an immediate operand for
|
||||
a custom instruction opcode. Range 0 to 255.
|
||||
|
||||
@item S
|
||||
Matches immediates which are addresses in the small
|
||||
data section and therefore can be added to @code{gp}
|
||||
as a 16-bit immediate to re-create their 32-bit value.
|
||||
|
||||
@ifset INTERNALS
|
||||
@item T
|
||||
A @code{const} wrapped @code{UNSPEC} expression,
|
||||
representing a supported PIC or TLS relocation.
|
||||
@end ifset
|
||||
|
||||
@end table
|
||||
|
||||
@item PDP-11---@file{config/pdp11/constraints.md}
|
||||
@table @code
|
||||
@item a
|
||||
|
|
|
@ -1,3 +1,58 @@
|
|||
2013-12-31 Sandra Loosemore <sandra@codesourcery.com>
|
||||
Chung-Lin Tang <cltang@codesourcery.com>
|
||||
Based on patches from Altera Corporation
|
||||
|
||||
* gcc.dg/stack-usage-1.c (SIZE): Define case for __nios2__.
|
||||
* gcc.dg/20040813-1.c: Skip for nios2-*-*.
|
||||
* gcc.dg/20020312-2.c: Add __nios2__ case.
|
||||
* g++.dg/other/PR23205.C: Skip for nios2-*-*.
|
||||
* g++.dg/other/pr23205-2.C: Skip for nios2-*-*.
|
||||
* g++.dg/cpp0x/constexpr-rom.C: Skip for nios2-*-*.
|
||||
* g++.dg/cpp0x/alias-decl-debug-0.C: Skip for nios2-*-*.
|
||||
* g++.old-deja/g++.jason/thunk3.C: Skip for nios2-*-*.
|
||||
* lib/target-supports.exp (check_profiling_available): Check for
|
||||
nios2-*-elf.
|
||||
* gcc.c-torture/execute/pr47237.x:: Skip for nios2-*-*.
|
||||
* gcc.c-torture/execute/20101011-1.c: Skip for nios2-*-*.
|
||||
* gcc.c-torture/execute/builtins/lib/chk.c (memset): Place
|
||||
char-based memset loop before inline check, to prevent
|
||||
problems when called to initialize .bss. Update comments.
|
||||
* gcc.target/nios2/nios2.exp: New DejaGNU file.
|
||||
* gcc.target/nios2/nios2-custom-1.c: New test.
|
||||
* gcc.target/nios2/nios2-trap-insn.c: New test.
|
||||
* gcc.target/nios2/nios2-builtin-custom.c: New test.
|
||||
* gcc.target/nios2/nios2-builtin-io.c: New test.
|
||||
* gcc.target/nios2/nios2-stack-check-1.c: New test.
|
||||
* gcc.target/nios2/nios2-stack-check-2.c: New test.
|
||||
* gcc.target/nios2/nios2-rdctl.c: New test.
|
||||
* gcc.target/nios2/nios2-wrctl.c: New test.
|
||||
* gcc.target/nios2/nios2-wrctl-zero.c: New test.
|
||||
* gcc.target/nios2/nios2-wrctl-not-zero.c: New test.
|
||||
* gcc.target/nios2/nios2-rdwrctl-1.c: New test.
|
||||
* gcc.target/nios2/nios2-reg-constraints.c: New test.
|
||||
* gcc.target/nios2/nios2-ashlsi3-one_shift.c: New test.
|
||||
* gcc.target/nios2/nios2-mul-options-1.c: New test.
|
||||
* gcc.target/nios2/nios2-mul-options-2.c: New test.
|
||||
* gcc.target/nios2/nios2-mul-options-3.c: New test.
|
||||
* gcc.target/nios2/nios2-mul-options-4.c: New test.
|
||||
* gcc.target/nios2/nios2-nor.c: New test.
|
||||
* gcc.target/nios2/nios2-stxio.c: New test.
|
||||
* gcc.target/nios2/custom-fp-1.c: New test.
|
||||
* gcc.target/nios2/custom-fp-2.c: New test.
|
||||
* gcc.target/nios2/custom-fp-3.c: New test.
|
||||
* gcc.target/nios2/custom-fp-4.c: New test.
|
||||
* gcc.target/nios2/custom-fp-5.c: New test.
|
||||
* gcc.target/nios2/custom-fp-6.c: New test.
|
||||
* gcc.target/nios2/custom-fp-7.c: New test.
|
||||
* gcc.target/nios2/custom-fp-8.c: New test.
|
||||
* gcc.target/nios2/custom-fp-cmp-1.c: New test.
|
||||
* gcc.target/nios2/custom-fp-conversion.c: New test.
|
||||
* gcc.target/nios2/custom-fp-double.c: New test.
|
||||
* gcc.target/nios2/custom-fp-float.c: New test.
|
||||
* gcc.target/nios2/nios2-int-types.c: New test.
|
||||
* gcc.target/nios2/nios2-cache-1.c: New test.
|
||||
* gcc.target/nios2/nios2-cache-2.c: New test.
|
||||
|
||||
2013-12-30 Mike Stump <mikestump@comcast.net>
|
||||
|
||||
PR c++/41090
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Origin: PR c++/51032
|
||||
// { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* } { "*" } { "" } }
|
||||
// { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* nios2-*-* } { "*" } { "" } }
|
||||
// { dg-options "-std=c++11 -gstabs+" }
|
||||
|
||||
template <class C>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// PR c++/49673: check that test_data goes into .rodata
|
||||
// { dg-options -std=c++11 }
|
||||
// { dg-additional-options -G0 { target { { alpha*-*-* frv*-*-* ia64-*-* lm32*-*-* m32r*-*-* microblaze*-*-* mips*-*-* powerpc*-*-* rs6000*-*-* score*-*-* } && { ! { *-*-darwin* *-*-aix* alpha*-*-*vms* } } } } }
|
||||
// { dg-additional-options -G0 { target { { alpha*-*-* frv*-*-* ia64-*-* lm32*-*-* m32r*-*-* microblaze*-*-* mips*-*-* nios2-*-* powerpc*-*-* rs6000*-*-* score*-*-* } && { ! { *-*-darwin* *-*-aix* alpha*-*-*vms* } } } } }
|
||||
// { dg-final { scan-assembler "\\.rdata" { target mips*-*-* } } }
|
||||
// { dg-final { scan-assembler "rodata" { target { { *-*-linux-gnu *-*-gnu* *-*-elf } && { ! mips*-*-* } } } } }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* *-*-vxworks } { "*" } { "" } } */
|
||||
/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* nios2-*-* tile*-*-* *-*-vxworks } { "*" } { "" } } */
|
||||
/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types" } */
|
||||
|
||||
const int foobar = 4;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* } { "*" } { "" } } */
|
||||
/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* } { "*" } { "" } } */
|
||||
/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -ftoplevel-reorder" } */
|
||||
|
||||
const int foobar = 4;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// { dg-do run }
|
||||
// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } { "*" } { "" } }
|
||||
// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* nios2-*-* } { "*" } { "" } }
|
||||
// Test that variadic function calls using thunks work right.
|
||||
// Note that this will break on any target that uses the generic thunk
|
||||
// support, because it doesn't support variadic functions.
|
||||
|
|
|
@ -63,6 +63,10 @@ __aeabi_idiv0 (int return_value)
|
|||
}
|
||||
# define DO_TEST 1
|
||||
# endif
|
||||
#elif defined (__nios2__)
|
||||
/* Nios II requires both hardware support and user configuration to
|
||||
raise an exception on divide by zero. */
|
||||
# define DO_TEST 0
|
||||
#else
|
||||
# define DO_TEST 1
|
||||
#endif
|
||||
|
|
|
@ -124,16 +124,17 @@ __memmove_chk (void *dst, const void *src, __SIZE_TYPE__ n, __SIZE_TYPE__ size)
|
|||
void *
|
||||
memset (void *dst, int c, __SIZE_TYPE__ n)
|
||||
{
|
||||
while (n-- != 0)
|
||||
n[(char *) dst] = c;
|
||||
|
||||
/* Single-byte memsets should be done inline when optimisation
|
||||
is enabled. */
|
||||
is enabled. Do this after the copy in case we're being called to
|
||||
initialize bss. */
|
||||
#ifdef __OPTIMIZE__
|
||||
if (memset_disallowed && inside_main && n < 2)
|
||||
abort ();
|
||||
#endif
|
||||
|
||||
while (n-- != 0)
|
||||
n[(char *) dst] = c;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
|
6
gcc/testsuite/gcc.c-torture/execute/pr47237.x
Normal file
6
gcc/testsuite/gcc.c-torture/execute/pr47237.x
Normal file
|
@ -0,0 +1,6 @@
|
|||
if { [istarget "nios2-*-*"] } {
|
||||
# This test can cause the stack to underflow on Nios II.
|
||||
set torture_execute_xfail [istarget]
|
||||
}
|
||||
|
||||
return 0
|
|
@ -54,6 +54,8 @@ extern void abort (void);
|
|||
/* No pic register. */
|
||||
#elif defined(__nds32__)
|
||||
/* No pic register. */
|
||||
#elif defined(__nios2__)
|
||||
/* No pic register. */
|
||||
#elif defined(__hppa__)
|
||||
/* PIC register is %r27 or %r19, but is used even without -fpic. */
|
||||
#elif defined(__pdp11__)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* Contributed by Devang Patel <dpatel@apple.com> */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* *-*-vxworks* } { "*" } { "" } } */
|
||||
/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* *-*-vxworks* } { "*" } { "" } } */
|
||||
/* { dg-options "-gstabs" } */
|
||||
|
||||
int
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
# define SIZE 248
|
||||
#elif defined (xstormy16)
|
||||
# define SIZE 254
|
||||
#elif defined (__nios2__)
|
||||
# define SIZE 252
|
||||
#else
|
||||
# define SIZE 256
|
||||
#endif
|
||||
|
|
22
gcc/testsuite/gcc.target/nios2/custom-fp-1.c
Normal file
22
gcc/testsuite/gcc.target/nios2/custom-fp-1.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* Test specification of custom instructions via command-line options. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only -mcustom-fmaxs=246 -mcustom-fmins=247 -mcustom-fsqrts=251" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
result[2] = sqrtf (operand_a);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t251, .* # fsqrts .*" } } */
|
26
gcc/testsuite/gcc.target/nios2/custom-fp-2.c
Normal file
26
gcc/testsuite/gcc.target/nios2/custom-fp-2.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* Test specification of custom instructions via pragmas. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#pragma GCC target ("custom-fmaxs=246")
|
||||
#pragma GCC target ("custom-fmins=247")
|
||||
#pragma GCC target ("custom-fsqrts=251")
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
result[2] = sqrtf (operand_a);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t251, .* # fsqrts .*" } } */
|
26
gcc/testsuite/gcc.target/nios2/custom-fp-3.c
Normal file
26
gcc/testsuite/gcc.target/nios2/custom-fp-3.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* Test specification of custom instructions via function attributes. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
__attribute__ ((target ("custom-fmaxs=246,custom-fmins=247,custom-fsqrts=251")));
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
result[2] = sqrtf (operand_a);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t251, .* # fsqrts .*" } } */
|
29
gcc/testsuite/gcc.target/nios2/custom-fp-4.c
Normal file
29
gcc/testsuite/gcc.target/nios2/custom-fp-4.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* Test conflict between pragma and attribute specification of custom
|
||||
instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/* This test case is expected to cause an error because GCC does not know
|
||||
how to merge different custom instruction attribute sets. The extern
|
||||
declaration sees the options specified by both the pragma and the function
|
||||
attribute, but the function definition sees only the pragma options. */
|
||||
|
||||
#pragma GCC target ("custom-fmaxs=246")
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
__attribute__ ((target ("custom-fmins=247")));
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{ /* { dg-error "conflicting" } */
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
}
|
26
gcc/testsuite/gcc.target/nios2/custom-fp-5.c
Normal file
26
gcc/testsuite/gcc.target/nios2/custom-fp-5.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* Test that forward declaration and definition don't conflict when used
|
||||
with pragma specification of custom instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#pragma GCC target ("custom-fmaxs=246,custom-fmins=247")
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result);
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
|
30
gcc/testsuite/gcc.target/nios2/custom-fp-6.c
Normal file
30
gcc/testsuite/gcc.target/nios2/custom-fp-6.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* Test conflict between pragma and attribute specification of custom
|
||||
instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/* This test case is expected to cause an error because GCC does not know
|
||||
how to merge different custom instruction attribute sets, even if they
|
||||
do not overlap. */
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
__attribute__ ((target ("custom-fmaxs=246")));
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
__attribute__ ((target ("custom-fmins=247"))); /* { dg-error "conflicting" } */
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
}
|
33
gcc/testsuite/gcc.target/nios2/custom-fp-7.c
Normal file
33
gcc/testsuite/gcc.target/nios2/custom-fp-7.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* Test that duplicate declarations with the same custom insn attributes
|
||||
don't cause an error. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/* This test case is expected to cause an error because GCC does not know
|
||||
how to merge different custom instruction attribute sets, even if they
|
||||
do not overlap. */
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
__attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
|
||||
|
||||
extern void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
__attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
|
||||
|
||||
void
|
||||
custom_fp (float operand_a, float operand_b, float *result)
|
||||
{
|
||||
result[0] = fmaxf (operand_a, operand_b);
|
||||
result[1] = fminf (operand_a, operand_b);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
|
24
gcc/testsuite/gcc.target/nios2/custom-fp-8.c
Normal file
24
gcc/testsuite/gcc.target/nios2/custom-fp-8.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* Test whitespace skipping in target attributes. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
|
||||
#pragma GCC target ("custom-fdivs=246")
|
||||
#pragma GCC target (" custom-fdivs=246")
|
||||
#pragma GCC target ("custom-fdivs =246")
|
||||
#pragma GCC target ("custom-fdivs= 246")
|
||||
#pragma GCC target ("custom-fdivs=246 ")
|
||||
|
||||
#pragma GCC target ("custom-fdivs=246,custom-fabss=247")
|
||||
#pragma GCC target ("custom-fdivs=246 ,custom-fabss=247")
|
||||
#pragma GCC target ("custom-fdivs=246, custom-fabss=247")
|
||||
#pragma GCC target ("custom-fdivs=246 , custom-fabss=247")
|
||||
|
||||
void foo (void) __attribute__ ((target ("custom-fcmpnes=226,custom-fcmpeqs=227")));
|
||||
void foo (void) __attribute__ ((target ("custom-fcmpnes =226 ,custom-fcmpeqs=227")));
|
||||
void foo (void) __attribute__ ((target ("custom-fcmpnes= 226, custom-fcmpeqs=227")));
|
||||
void foo (void) __attribute__ ((target (" custom-fcmpnes=226 , custom-fcmpeqs = 227")));
|
||||
void foo (void) __attribute__ ((target (" custom-fcmpnes=226 ,custom-fcmpeqs =227 ")));
|
||||
|
||||
#pragma GCC target ("custom-fpu-cfg=60-1")
|
||||
#pragma GCC target ("custom-fpu-cfg =60-1 ")
|
||||
#pragma GCC target (" custom-fpu-cfg= 60-1 ")
|
53
gcc/testsuite/gcc.target/nios2/custom-fp-cmp-1.c
Normal file
53
gcc/testsuite/gcc.target/nios2/custom-fp-cmp-1.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* Test generation of floating-point compare custom instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#pragma GCC target ("custom-frdxhi=40")
|
||||
#pragma GCC target ("custom-frdxlo=41")
|
||||
#pragma GCC target ("custom-frdy=42")
|
||||
#pragma GCC target ("custom-fwrx=43")
|
||||
#pragma GCC target ("custom-fwry=44")
|
||||
|
||||
#pragma GCC target ("custom-fcmpeqs=200")
|
||||
|
||||
int
|
||||
test_fcmpeqs (float a, float b)
|
||||
{
|
||||
return (a == b);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t200, .* # fcmpeqs .*" } } */
|
||||
|
||||
#pragma GCC target ("custom-fcmpgtd=201")
|
||||
|
||||
int
|
||||
test_fcmpgtd (double a, double b)
|
||||
{
|
||||
return (a > b);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t201, .* # fcmpgtd .*" } } */
|
||||
|
||||
#pragma GCC target ("custom-fcmples=202")
|
||||
|
||||
int
|
||||
test_fcmples (float a, float b)
|
||||
{
|
||||
return (a <= b);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t202, .* # fcmples .*" } } */
|
||||
|
||||
#pragma GCC target ("custom-fcmpned=203")
|
||||
|
||||
int
|
||||
test_fcmpned (double a, double b)
|
||||
{
|
||||
return (a != b);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t203, .* # fcmpned .*" } } */
|
66
gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c
Normal file
66
gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* Test generation of conversion custom instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#pragma GCC target ("custom-frdxhi=40")
|
||||
#pragma GCC target ("custom-frdxlo=41")
|
||||
#pragma GCC target ("custom-frdy=42")
|
||||
#pragma GCC target ("custom-fwrx=43")
|
||||
#pragma GCC target ("custom-fwry=44")
|
||||
|
||||
#pragma GCC target ("custom-fextsd=100")
|
||||
#pragma GCC target ("custom-fixdi=101")
|
||||
#pragma GCC target ("custom-fixdu=102")
|
||||
#pragma GCC target ("custom-fixsi=103")
|
||||
#pragma GCC target ("custom-fixsu=104")
|
||||
#pragma GCC target ("custom-floatid=105")
|
||||
#pragma GCC target ("custom-floatis=106")
|
||||
#pragma GCC target ("custom-floatud=107")
|
||||
#pragma GCC target ("custom-floatus=108")
|
||||
#pragma GCC target ("custom-ftruncds=109")
|
||||
|
||||
typedef struct data {
|
||||
double fextsd;
|
||||
int fixdi;
|
||||
unsigned fixdu;
|
||||
int fixsi;
|
||||
unsigned fixsu;
|
||||
double floatid;
|
||||
float floatis;
|
||||
double floatud;
|
||||
float floatus;
|
||||
float ftruncds;
|
||||
} data_t;
|
||||
|
||||
void
|
||||
custom_fp (int i, unsigned u, float f, double d, data_t *out)
|
||||
{
|
||||
out->fextsd = (double) f;
|
||||
out->fixdi = (int) d;
|
||||
out->fixdu = (unsigned) d;
|
||||
out->fixsi = (int) f;
|
||||
out->fixsu = (unsigned) f;
|
||||
out->floatid = (double) i;
|
||||
out->floatis = (float) i;
|
||||
out->floatud = (double) u;
|
||||
out->floatus = (float) u;
|
||||
out->ftruncds = (float) d;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t100, .* # fextsd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t101, .* # fixdi .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t102, .* # fixdu .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t103, .* # fixsi .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t104, .* # fixsu .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t105, .* # floatid .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t106, .* # floatis .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t107, .* # floatud .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t108, .* # floatus .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t109, .* # ftruncds .*" } } */
|
86
gcc/testsuite/gcc.target/nios2/custom-fp-double.c
Normal file
86
gcc/testsuite/gcc.target/nios2/custom-fp-double.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* Test generation of all double-float custom instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#pragma GCC target ("custom-frdxhi=40")
|
||||
#pragma GCC target ("custom-frdxlo=41")
|
||||
#pragma GCC target ("custom-frdy=42")
|
||||
#pragma GCC target ("custom-fwrx=43")
|
||||
#pragma GCC target ("custom-fwry=44")
|
||||
|
||||
#pragma GCC target ("custom-fabsd=100")
|
||||
#pragma GCC target ("custom-faddd=101")
|
||||
#pragma GCC target ("custom-fatand=102")
|
||||
#pragma GCC target ("custom-fcosd=103")
|
||||
#pragma GCC target ("custom-fdivd=104")
|
||||
#pragma GCC target ("custom-fexpd=105")
|
||||
#pragma GCC target ("custom-flogd=106")
|
||||
#pragma GCC target ("custom-fmaxd=107")
|
||||
#pragma GCC target ("custom-fmind=108")
|
||||
#pragma GCC target ("custom-fmuld=109")
|
||||
#pragma GCC target ("custom-fnegd=110")
|
||||
#pragma GCC target ("custom-fsind=111")
|
||||
#pragma GCC target ("custom-fsqrtd=112")
|
||||
#pragma GCC target ("custom-fsubd=113")
|
||||
#pragma GCC target ("custom-ftand=114")
|
||||
#pragma GCC target ("custom-fcmpeqd=200")
|
||||
#pragma GCC target ("custom-fcmpged=201")
|
||||
#pragma GCC target ("custom-fcmpgtd=202")
|
||||
#pragma GCC target ("custom-fcmpled=203")
|
||||
#pragma GCC target ("custom-fcmpltd=204")
|
||||
#pragma GCC target ("custom-fcmpned=205")
|
||||
|
||||
void
|
||||
custom_fp (double a, double b, double *fp, int *ip)
|
||||
{
|
||||
fp[0] = fabs (a);
|
||||
fp[1] = a + b;
|
||||
fp[2] = atan (a);
|
||||
fp[3] = cos (a);
|
||||
fp[4] = a / b;
|
||||
fp[5] = exp (a);
|
||||
fp[6] = log (a);
|
||||
fp[7] = fmax (a, b);
|
||||
fp[8] = fmin (a, b);
|
||||
fp[9] = a * b;
|
||||
fp[10] = -b;
|
||||
fp[11] = sin (b);
|
||||
fp[12] = sqrt (a);
|
||||
fp[13] = a - b;
|
||||
fp[14] = tan (a);
|
||||
ip[0] = (a == fp[0]);
|
||||
ip[1] = (a >= fp[1]);
|
||||
ip[2] = (a > fp[2]);
|
||||
ip[3] = (a <= fp[3]);
|
||||
ip[4] = (a < fp[4]);
|
||||
ip[5] = (a != fp[5]);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t100, .* # fabsd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t101, .* # faddd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t102, .* # fatand .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t103, .* # fcosd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t104, .* # fdivd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t105, .* # fexpd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t106, .* # flogd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t107, .* # fmaxd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t108, .* # fmind .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t109, .* # fmuld .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t110, .* # fnegd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t111, .* # fsind .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t112, .* # fsqrtd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t113, .* # fsubd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t114, .* # ftand .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t200, .* # fcmpeqd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t201, .* # fcmpged .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t202, .* # fcmpgtd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t203, .* # fcmpled .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t204, .* # fcmpltd .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t205, .* # fcmpned .*" } } */
|
80
gcc/testsuite/gcc.target/nios2/custom-fp-float.c
Normal file
80
gcc/testsuite/gcc.target/nios2/custom-fp-float.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
/* Test generation of all single-float custom instructions. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */
|
||||
|
||||
/* -O1 in the options is significant. Without it FP operations may not be
|
||||
optimized to custom instructions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#pragma GCC target ("custom-fabss=100")
|
||||
#pragma GCC target ("custom-fadds=101")
|
||||
#pragma GCC target ("custom-fatans=102")
|
||||
#pragma GCC target ("custom-fcoss=103")
|
||||
#pragma GCC target ("custom-fdivs=104")
|
||||
#pragma GCC target ("custom-fexps=105")
|
||||
#pragma GCC target ("custom-flogs=106")
|
||||
#pragma GCC target ("custom-fmaxs=107")
|
||||
#pragma GCC target ("custom-fmins=108")
|
||||
#pragma GCC target ("custom-fmuls=109")
|
||||
#pragma GCC target ("custom-fnegs=110")
|
||||
#pragma GCC target ("custom-fsins=111")
|
||||
#pragma GCC target ("custom-fsqrts=112")
|
||||
#pragma GCC target ("custom-fsubs=113")
|
||||
#pragma GCC target ("custom-ftans=114")
|
||||
#pragma GCC target ("custom-fcmpeqs=200")
|
||||
#pragma GCC target ("custom-fcmpges=201")
|
||||
#pragma GCC target ("custom-fcmpgts=202")
|
||||
#pragma GCC target ("custom-fcmples=203")
|
||||
#pragma GCC target ("custom-fcmplts=204")
|
||||
#pragma GCC target ("custom-fcmpnes=205")
|
||||
|
||||
void
|
||||
custom_fp (float a, float b, float *fp, int *ip)
|
||||
{
|
||||
fp[0] = fabsf (a);
|
||||
fp[1] = a + b;
|
||||
fp[2] = atanf (a);
|
||||
fp[3] = cosf (a);
|
||||
fp[4] = a / b;
|
||||
fp[5] = expf (a);
|
||||
fp[6] = logf (a);
|
||||
fp[7] = fmaxf (a, b);
|
||||
fp[8] = fminf (a, b);
|
||||
fp[9] = a * b;
|
||||
fp[10] = -b;
|
||||
fp[11] = sinf (b);
|
||||
fp[12] = sqrtf (a);
|
||||
fp[13] = a - b;
|
||||
fp[14] = tanf (a);
|
||||
ip[0] = (a == fp[0]);
|
||||
ip[1] = (a >= fp[1]);
|
||||
ip[2] = (a > fp[2]);
|
||||
ip[3] = (a <= fp[3]);
|
||||
ip[4] = (a < fp[4]);
|
||||
ip[5] = (a != fp[5]);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "custom\\t100, .* # fabss .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t101, .* # fadds .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t102, .* # fatans .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t103, .* # fcoss .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t104, .* # fdivs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t105, .* # fexps .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t106, .* # flogs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t107, .* # fmaxs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t108, .* # fmins .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t109, .* # fmuls .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t110, .* # fnegs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t111, .* # fsins .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t112, .* # fsqrts .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t113, .* # fsubs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t114, .* # ftans .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t200, .* # fcmpeqs .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t201, .* # fcmpges .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t202, .* # fcmpgts .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t203, .* # fcmples .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t204, .* # fcmplts .*" } } */
|
||||
/* { dg-final { scan-assembler "custom\\t205, .* # fcmpnes .*" } } */
|
10
gcc/testsuite/gcc.target/nios2/nios2-ashlsi3-one_shift.c
Normal file
10
gcc/testsuite/gcc.target/nios2/nios2-ashlsi3-one_shift.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options " " } */
|
||||
/* { dg-final { scan-assembler-not "slli" } } */
|
||||
|
||||
int x;
|
||||
|
||||
void foo(void)
|
||||
{
|
||||
x <<= 1;
|
||||
}
|
9
gcc/testsuite/gcc.target/nios2/nios2-builtin-custom.c
Normal file
9
gcc/testsuite/gcc.target/nios2/nios2-builtin-custom.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-final { scan-assembler "custom" } } */
|
||||
|
||||
/* This test case used to cause an unrecognizable insn crash. */
|
||||
|
||||
void foo (void)
|
||||
{
|
||||
int offset = __builtin_custom_in(0x1);
|
||||
}
|
26
gcc/testsuite/gcc.target/nios2/nios2-builtin-io.c
Normal file
26
gcc/testsuite/gcc.target/nios2/nios2-builtin-io.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-final { scan-assembler "ldbio" } } */
|
||||
/* { dg-final { scan-assembler "ldbuio" } } */
|
||||
/* { dg-final { scan-assembler "ldhio" } } */
|
||||
/* { dg-final { scan-assembler "ldhuio" } } */
|
||||
/* { dg-final { scan-assembler "ldwio" } } */
|
||||
/* { dg-final { scan-assembler "stbio" } } */
|
||||
/* { dg-final { scan-assembler "sthio" } } */
|
||||
/* { dg-final { scan-assembler "stwio" } } */
|
||||
|
||||
volatile char b;
|
||||
volatile short h;
|
||||
volatile int w;
|
||||
|
||||
void x ()
|
||||
{
|
||||
__builtin_ldbio (&b);
|
||||
__builtin_ldbuio (&b);
|
||||
__builtin_ldhio (&h);
|
||||
__builtin_ldhuio (&h);
|
||||
__builtin_ldwio (&w);
|
||||
|
||||
__builtin_stbio (&b, 42);
|
||||
__builtin_sthio (&h, 43);
|
||||
__builtin_stwio (&w, 44);
|
||||
}
|
21
gcc/testsuite/gcc.target/nios2/nios2-cache-1.c
Normal file
21
gcc/testsuite/gcc.target/nios2/nios2-cache-1.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
/* { dg-final { scan-assembler-not "ldwio" } } */
|
||||
/* { dg-final { scan-assembler-not "stwio" } } */
|
||||
|
||||
/* Make sure the default behavior is not to generate I/O variants of
|
||||
the load and stores to foo. */
|
||||
|
||||
extern volatile int foo;
|
||||
|
||||
int
|
||||
read_foo (void)
|
||||
{
|
||||
return foo;
|
||||
}
|
||||
|
||||
void
|
||||
write_foo (int x)
|
||||
{
|
||||
foo = x;
|
||||
}
|
21
gcc/testsuite/gcc.target/nios2/nios2-cache-2.c
Normal file
21
gcc/testsuite/gcc.target/nios2/nios2-cache-2.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mno-cache-volatile" } */
|
||||
/* { dg-final { scan-assembler "ldwio" } } */
|
||||
/* { dg-final { scan-assembler "stwio" } } */
|
||||
|
||||
/* Make sure -mno-cache-volatile generates I/O variants of the load and
|
||||
stores to foo. */
|
||||
|
||||
extern volatile int foo;
|
||||
|
||||
int
|
||||
read_foo (void)
|
||||
{
|
||||
return foo;
|
||||
}
|
||||
|
||||
void
|
||||
write_foo (int x)
|
||||
{
|
||||
foo = x;
|
||||
}
|
64
gcc/testsuite/gcc.target/nios2/nios2-custom-1.c
Normal file
64
gcc/testsuite/gcc.target/nios2/nios2-custom-1.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
float fres, f1, f2;
|
||||
int ires, i1, i2;
|
||||
void *pres, *p1, *p2;
|
||||
|
||||
void x ()
|
||||
{
|
||||
__builtin_custom_n (0);
|
||||
__builtin_custom_ni (1, i1);
|
||||
__builtin_custom_nf (2, f1);
|
||||
__builtin_custom_np (3, p1);
|
||||
__builtin_custom_nii (4, i1, i2);
|
||||
__builtin_custom_nif (5, i1, f2);
|
||||
__builtin_custom_nip (6, i1, p2);
|
||||
__builtin_custom_nfi (7, f1, i2);
|
||||
__builtin_custom_nff (8, f1, f2);
|
||||
__builtin_custom_nfp (9, f1, p2);
|
||||
__builtin_custom_npi (10, p1, i2);
|
||||
__builtin_custom_npf (11, p1, f2);
|
||||
__builtin_custom_npp (12, p1, p2);
|
||||
|
||||
ires = __builtin_custom_in (13+0);
|
||||
ires = __builtin_custom_ini (13+1, i1);
|
||||
ires = __builtin_custom_inf (13+2, f1);
|
||||
ires = __builtin_custom_inp (13+3, p1);
|
||||
ires = __builtin_custom_inii (13+4, i1, i2);
|
||||
ires = __builtin_custom_inif (13+5, i1, f2);
|
||||
ires = __builtin_custom_inip (13+6, i1, p2);
|
||||
ires = __builtin_custom_infi (13+7, f1, i2);
|
||||
ires = __builtin_custom_inff (13+8, f1, f2);
|
||||
ires = __builtin_custom_infp (13+9, f1, p2);
|
||||
ires = __builtin_custom_inpi (13+10, p1, i2);
|
||||
ires = __builtin_custom_inpf (13+11, p1, f2);
|
||||
ires = __builtin_custom_inpp (13+12, p1, p2);
|
||||
|
||||
fres = __builtin_custom_fn (26+0);
|
||||
fres = __builtin_custom_fni (26+1, i1);
|
||||
fres = __builtin_custom_fnf (26+2, f1);
|
||||
fres = __builtin_custom_fnp (26+3, p1);
|
||||
fres = __builtin_custom_fnii (26+4, i1, i2);
|
||||
fres = __builtin_custom_fnif (26+5, i1, f2);
|
||||
fres = __builtin_custom_fnip (26+6, i1, p2);
|
||||
fres = __builtin_custom_fnfi (26+7, f1, i2);
|
||||
fres = __builtin_custom_fnff (26+8, f1, f2);
|
||||
fres = __builtin_custom_fnfp (26+9, f1, p2);
|
||||
fres = __builtin_custom_fnpi (26+10, p1, i2);
|
||||
fres = __builtin_custom_fnpf (26+11, p1, f2);
|
||||
fres = __builtin_custom_fnpp (26+12, p1, p2);
|
||||
|
||||
pres = __builtin_custom_pn (39+0);
|
||||
pres = __builtin_custom_pni (39+1, i1);
|
||||
pres = __builtin_custom_pnf (39+2, f1);
|
||||
pres = __builtin_custom_pnp (39+3, p1);
|
||||
pres = __builtin_custom_pnii (39+4, i1, i2);
|
||||
pres = __builtin_custom_pnif (39+5, i1, f2);
|
||||
pres = __builtin_custom_pnip (39+6, i1, p2);
|
||||
pres = __builtin_custom_pnfi (39+7, f1, i2);
|
||||
pres = __builtin_custom_pnff (39+8, f1, f2);
|
||||
pres = __builtin_custom_pnfp (39+9, f1, p2);
|
||||
pres = __builtin_custom_pnpi (39+10, p1, i2);
|
||||
pres = __builtin_custom_pnpf (39+11, p1, f2);
|
||||
pres = __builtin_custom_pnpp (39+12, p1, p2);
|
||||
}
|
7
gcc/testsuite/gcc.target/nios2/nios2-custom-2.c
Normal file
7
gcc/testsuite/gcc.target/nios2/nios2-custom-2.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
float foo (float) __attribute__ ((target ("custom-fsqrts=128")));
|
||||
float foo (float x)
|
||||
{
|
||||
return __builtin_custom_fsqrts (x) + __builtin_custom_fnf (128, x);
|
||||
}
|
34
gcc/testsuite/gcc.target/nios2/nios2-int-types.c
Normal file
34
gcc/testsuite/gcc.target/nios2/nios2-int-types.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* Test that various types are all derived from int. */
|
||||
/* { dg-do compile } */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern size_t a;
|
||||
unsigned int a;
|
||||
extern unsigned int aa;
|
||||
size_t aa;
|
||||
|
||||
extern ssize_t b;
|
||||
int b;
|
||||
extern int bb;
|
||||
ssize_t bb;
|
||||
|
||||
extern ptrdiff_t c;
|
||||
int c;
|
||||
extern int cc;
|
||||
ptrdiff_t cc;
|
||||
|
||||
extern intptr_t d;
|
||||
int d;
|
||||
extern int dd;
|
||||
intptr_t dd;
|
||||
|
||||
extern uintptr_t e;
|
||||
unsigned int e;
|
||||
extern unsigned int ee;
|
||||
uintptr_t ee;
|
||||
|
||||
|
||||
|
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-1.c
Normal file
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-1.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "" } */
|
||||
/* { dg-final { scan-assembler "__muldi3" } } */
|
||||
|
||||
long long x, y, z;
|
||||
|
||||
void test()
|
||||
{
|
||||
x = y * z;
|
||||
}
|
||||
|
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-2.c
Normal file
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-2.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-mhw-mulx" } */
|
||||
/* { dg-final { scan-assembler-not "__muldi3" } } */
|
||||
|
||||
long long x, y, z;
|
||||
|
||||
void test()
|
||||
{
|
||||
x = y * z;
|
||||
}
|
||||
|
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-3.c
Normal file
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-3.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "" } */
|
||||
/* { dg-final { scan-assembler-not "__mulsi3" } } */
|
||||
|
||||
int x, y, z;
|
||||
|
||||
void test()
|
||||
{
|
||||
x = y * z;
|
||||
}
|
||||
|
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-4.c
Normal file
11
gcc/testsuite/gcc.target/nios2/nios2-mul-options-4.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-mno-hw-mul" } */
|
||||
/* { dg-final { scan-assembler "__mulsi3" } } */
|
||||
|
||||
int x, y, z;
|
||||
|
||||
void test()
|
||||
{
|
||||
x = y * z;
|
||||
}
|
||||
|
8
gcc/testsuite/gcc.target/nios2/nios2-nor.c
Normal file
8
gcc/testsuite/gcc.target/nios2/nios2-nor.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O" } */
|
||||
/* { dg-final { scan-assembler "nor" } } */
|
||||
|
||||
int foo (int x, int y)
|
||||
{
|
||||
return ~(x | y);
|
||||
}
|
8
gcc/testsuite/gcc.target/nios2/nios2-rdctl.c
Normal file
8
gcc/testsuite/gcc.target/nios2/nios2-rdctl.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-final { scan-assembler "rdctl" } } */
|
||||
|
||||
int x ()
|
||||
{
|
||||
__builtin_rdctl (0);
|
||||
return 0;
|
||||
}
|
14
gcc/testsuite/gcc.target/nios2/nios2-rdwrctl-1.c
Normal file
14
gcc/testsuite/gcc.target/nios2/nios2-rdwrctl-1.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
volatile int res;
|
||||
|
||||
void x ()
|
||||
{
|
||||
__builtin_wrctl (0, res);
|
||||
__builtin_wrctl (15, res);
|
||||
__builtin_wrctl (31, res);
|
||||
|
||||
res = __builtin_rdctl (0);
|
||||
res = __builtin_rdctl (15);
|
||||
res = __builtin_rdctl (31);
|
||||
}
|
9
gcc/testsuite/gcc.target/nios2/nios2-stack-check-1.c
Normal file
9
gcc/testsuite/gcc.target/nios2/nios2-stack-check-1.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-fstack-limit-register=et" } */
|
||||
/* { dg-final { scan-assembler "bgeu\\tsp, et" } } */
|
||||
/* { dg-final { scan-assembler "break\\t3" } } */
|
||||
/* check stack checking */
|
||||
void test()
|
||||
{
|
||||
int a, b, c;
|
||||
}
|
9
gcc/testsuite/gcc.target/nios2/nios2-stack-check-2.c
Normal file
9
gcc/testsuite/gcc.target/nios2/nios2-stack-check-2.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options " " } */
|
||||
/* { dg-final { scan-assembler-not "bgeu\\tsp, et" } } */
|
||||
/* { dg-final { scan-assembler-not "break\\t3" } } */
|
||||
/* check stack checking */
|
||||
void test()
|
||||
{
|
||||
int a, b, c;
|
||||
}
|
25
gcc/testsuite/gcc.target/nios2/nios2-stxio.c
Normal file
25
gcc/testsuite/gcc.target/nios2/nios2-stxio.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
void test_stbio (unsigned char* p1, unsigned char* p2)
|
||||
{
|
||||
__builtin_stbio (p1, *p2);
|
||||
__builtin_stbio (p2, 0);
|
||||
__builtin_stbio (p2 + 1, 0x80);
|
||||
__builtin_stbio (p2 + 2, 0x7f);
|
||||
}
|
||||
|
||||
void test_sthio (unsigned short* p1, unsigned short* p2)
|
||||
{
|
||||
__builtin_sthio (p1, *p2);
|
||||
__builtin_sthio (p2, 0);
|
||||
__builtin_sthio (p2 + 1, 0x8000);
|
||||
__builtin_sthio (p2 + 2, 0x7fff);
|
||||
}
|
||||
|
||||
void test_stwio (unsigned int* p1, unsigned int* p2)
|
||||
{
|
||||
__builtin_stwio (p1, *p2);
|
||||
__builtin_stwio (p2, 0);
|
||||
__builtin_stwio (p2 + 1, 0x80000000);
|
||||
__builtin_stwio (p2 + 2, 0x7fffffff);
|
||||
}
|
7
gcc/testsuite/gcc.target/nios2/nios2-trap-insn.c
Normal file
7
gcc/testsuite/gcc.target/nios2/nios2-trap-insn.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-final { scan-assembler "break\\t3" } } */
|
||||
|
||||
/* Test the nios2 trap instruction */
|
||||
void foo(void){
|
||||
__builtin_trap();
|
||||
}
|
7
gcc/testsuite/gcc.target/nios2/nios2-wrctl-not-zero.c
Normal file
7
gcc/testsuite/gcc.target/nios2/nios2-wrctl-not-zero.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options " " } */
|
||||
/* { dg-final { scan-assembler-not "wrctl\\tctl6, zero" } } */
|
||||
|
||||
void foo(void){
|
||||
__builtin_wrctl(6,4);
|
||||
}
|
7
gcc/testsuite/gcc.target/nios2/nios2-wrctl-zero.c
Normal file
7
gcc/testsuite/gcc.target/nios2/nios2-wrctl-zero.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1" } */
|
||||
/* { dg-final { scan-assembler "wrctl\\tctl6, zero" } } */
|
||||
|
||||
void foo(void){
|
||||
__builtin_wrctl(6,0);
|
||||
}
|
7
gcc/testsuite/gcc.target/nios2/nios2-wrctl.c
Normal file
7
gcc/testsuite/gcc.target/nios2/nios2-wrctl.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "" } */
|
||||
/* { dg-final { scan-assembler "wrctl" } } */
|
||||
|
||||
void foo(void){
|
||||
__builtin_wrctl(6,4);
|
||||
}
|
41
gcc/testsuite/gcc.target/nios2/nios2.exp
Normal file
41
gcc/testsuite/gcc.target/nios2/nios2.exp
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# GCC testsuite that uses the `dg.exp' driver.
|
||||
|
||||
# Exit immediately if this isn't a Nios II target.
|
||||
if ![istarget nios2*-*-*] then {
|
||||
return
|
||||
}
|
||||
|
||||
# Load support procs.
|
||||
load_lib gcc-dg.exp
|
||||
|
||||
# If a testcase doesn't have special options, use these.
|
||||
global DEFAULT_CFLAGS
|
||||
if ![info exists DEFAULT_CFLAGS] then {
|
||||
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
|
||||
}
|
||||
|
||||
# Initialize `dg'.
|
||||
dg-init
|
||||
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
|
||||
"" $DEFAULT_CFLAGS
|
||||
|
||||
# All done.
|
||||
dg-finish
|
|
@ -531,6 +531,7 @@ proc check_profiling_available { test_what } {
|
|||
|| [istarget moxie-*-elf*]
|
||||
|| [istarget msp430-*-*]
|
||||
|| [istarget nds32*-*-elf]
|
||||
|| [istarget nios2-*-elf]
|
||||
|| [istarget picochip-*-*]
|
||||
|| [istarget powerpc-*-eabi*]
|
||||
|| [istarget powerpc-*-elf]
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
2013-12-31 Sandra Loosemore <sandra@codesourcery.com>
|
||||
Chung-Lin Tang <cltang@codesourcery.com>
|
||||
Based on patches from Altera Corporation
|
||||
|
||||
* config.host (nios2-*-*,nios2-*-linux*): Add nios2 host cases.
|
||||
* config/nios2/lib2-nios2.h: New file.
|
||||
* config/nios2/lib2-divmod-hi.c: New file.
|
||||
* config/nios2/linux-unwind.h: New file.
|
||||
* config/nios2/lib2-divmod.c: New file.
|
||||
* config/nios2/linux-atomic.c: New file.
|
||||
* config/nios2/t-nios2: New file.
|
||||
* config/nios2/crti.asm: New file.
|
||||
* config/nios2/t-linux: New file.
|
||||
* config/nios2/lib2-divtable.c: New file.
|
||||
* config/nios2/lib2-mul.c: New file.
|
||||
* config/nios2/tramp.c: New file.
|
||||
* config/nios2/crtn.asm: New file.
|
||||
|
||||
2013-12-26 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* config/i386/cpuinfo.c (enum vendor_signatures): Remove.
|
||||
|
|
|
@ -146,6 +146,9 @@ mips*-*-*)
|
|||
nds32*-*)
|
||||
cpu_type=nds32
|
||||
;;
|
||||
nios2*-*-*)
|
||||
cpu_type=nios2
|
||||
;;
|
||||
powerpc*-*-*)
|
||||
cpu_type=rs6000
|
||||
;;
|
||||
|
@ -880,6 +883,15 @@ nds32*-elf*)
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
nios2-*-linux*)
|
||||
tmake_file="$tmake_file nios2/t-nios2 nios2/t-linux t-libgcc-pic t-slibgcc-libgcc"
|
||||
extra_parts="$extra_parts crti.o crtn.o"
|
||||
md_unwind_header=nios2/linux-unwind.h
|
||||
;;
|
||||
nios2-*-*)
|
||||
tmake_file="$tmake_file nios2/t-nios2 t-softfp-sfdf t-softfp-excl t-softfp"
|
||||
extra_parts="$extra_parts crti.o crtn.o"
|
||||
;;
|
||||
pdp11-*-*)
|
||||
tmake_file="pdp11/t-pdp11 t-fdpbit"
|
||||
;;
|
||||
|
|
87
libgcc/config/nios2/crti.S
Normal file
87
libgcc/config/nios2/crti.S
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Jonah Graham (jgraham@altera.com).
|
||||
Contributed by Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* This file just make a stack frame for the contents of the .fini and
|
||||
.init sections. Users may put any desired instructions in those
|
||||
sections.
|
||||
|
||||
While technically any code can be put in the init and fini sections
|
||||
most stuff will not work other than stuff which obeys the call frame
|
||||
and ABI. All the call-preserved registers are saved, the call clobbered
|
||||
registers should have been saved by the code calling init and fini.
|
||||
|
||||
See crtstuff.c for an example of code that inserts itself in the init
|
||||
and fini sections.
|
||||
|
||||
See crt0.s for the code that calls init and fini. */
|
||||
|
||||
.file "crti.asm"
|
||||
|
||||
.section ".init"
|
||||
.align 2
|
||||
.global _init
|
||||
_init:
|
||||
addi sp, sp, -48
|
||||
stw ra, 44(sp)
|
||||
stw r23, 40(sp)
|
||||
stw r22, 36(sp)
|
||||
stw r21, 32(sp)
|
||||
stw r20, 28(sp)
|
||||
stw r19, 24(sp)
|
||||
stw r18, 20(sp)
|
||||
stw r17, 16(sp)
|
||||
stw r16, 12(sp)
|
||||
stw fp, 8(sp)
|
||||
addi fp, sp, 8
|
||||
#ifdef linux
|
||||
nextpc r22
|
||||
1: movhi r2, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b)
|
||||
addi r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b)
|
||||
add r22, r22, r2
|
||||
#endif
|
||||
|
||||
|
||||
.section ".fini"
|
||||
.align 2
|
||||
.global _fini
|
||||
_fini:
|
||||
addi sp, sp, -48
|
||||
stw ra, 44(sp)
|
||||
stw r23, 40(sp)
|
||||
stw r22, 36(sp)
|
||||
stw r21, 32(sp)
|
||||
stw r20, 28(sp)
|
||||
stw r19, 24(sp)
|
||||
stw r18, 20(sp)
|
||||
stw r17, 16(sp)
|
||||
stw r16, 12(sp)
|
||||
stw fp, 8(sp)
|
||||
addi fp, sp, 8
|
||||
#ifdef linux
|
||||
nextpc r22
|
||||
1: movhi r2, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b)
|
||||
addi r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b)
|
||||
add r22, r22, r2
|
||||
#endif
|
||||
|
60
libgcc/config/nios2/crtn.S
Normal file
60
libgcc/config/nios2/crtn.S
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Jonah Graham (jgraham@altera.com).
|
||||
Contributed by Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* This file just makes sure that the .fini and .init sections do in
|
||||
fact return. Users may put any desired instructions in those sections.
|
||||
This file is the last thing linked into any executable.
|
||||
*/
|
||||
.file "crtn.asm"
|
||||
|
||||
|
||||
|
||||
.section ".init"
|
||||
ldw ra, 44(sp)
|
||||
ldw r23, 40(sp)
|
||||
ldw r22, 36(sp)
|
||||
ldw r21, 32(sp)
|
||||
ldw r20, 28(sp)
|
||||
ldw r19, 24(sp)
|
||||
ldw r18, 20(sp)
|
||||
ldw r17, 16(sp)
|
||||
ldw r16, 12(sp)
|
||||
ldw fp, 8(sp)
|
||||
addi sp, sp, 48
|
||||
ret
|
||||
|
||||
.section ".fini"
|
||||
ldw ra, 44(sp)
|
||||
ldw r23, 40(sp)
|
||||
ldw r22, 36(sp)
|
||||
ldw r21, 32(sp)
|
||||
ldw r20, 28(sp)
|
||||
ldw r19, 24(sp)
|
||||
ldw r18, 20(sp)
|
||||
ldw r17, 16(sp)
|
||||
ldw r16, 12(sp)
|
||||
ldw fp, 8(sp)
|
||||
addi sp, sp, 48
|
||||
ret
|
||||
|
117
libgcc/config/nios2/lib2-divmod-hi.c
Normal file
117
libgcc/config/nios2/lib2-divmod-hi.c
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Altera and Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "lib2-nios2.h"
|
||||
|
||||
/* 16-bit HI divide and modulo as used in Nios II. */
|
||||
|
||||
static UHItype
|
||||
udivmodhi4 (UHItype num, UHItype den, word_type modwanted)
|
||||
{
|
||||
UHItype bit = 1;
|
||||
UHItype res = 0;
|
||||
|
||||
while (den < num && bit && !(den & (1L<<15)))
|
||||
{
|
||||
den <<=1;
|
||||
bit <<=1;
|
||||
}
|
||||
while (bit)
|
||||
{
|
||||
if (num >= den)
|
||||
{
|
||||
num -= den;
|
||||
res |= bit;
|
||||
}
|
||||
bit >>=1;
|
||||
den >>=1;
|
||||
}
|
||||
if (modwanted)
|
||||
return num;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
HItype
|
||||
__divhi3 (HItype a, HItype b)
|
||||
{
|
||||
word_type neg = 0;
|
||||
HItype res;
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
a = -a;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
{
|
||||
b = -b;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
res = udivmodhi4 (a, b, 0);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
HItype
|
||||
__modhi3 (HItype a, HItype b)
|
||||
{
|
||||
word_type neg = 0;
|
||||
HItype res;
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
a = -a;
|
||||
neg = 1;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
|
||||
res = udivmodhi4 (a, b, 1);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
UHItype
|
||||
__udivhi3 (UHItype a, UHItype b)
|
||||
{
|
||||
return udivmodhi4 (a, b, 0);
|
||||
}
|
||||
|
||||
|
||||
UHItype
|
||||
__umodhi3 (UHItype a, UHItype b)
|
||||
{
|
||||
return udivmodhi4 (a, b, 1);
|
||||
}
|
||||
|
117
libgcc/config/nios2/lib2-divmod.c
Normal file
117
libgcc/config/nios2/lib2-divmod.c
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Altera and Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "lib2-nios2.h"
|
||||
|
||||
/* 32-bit SI divide and modulo as used in Nios II. */
|
||||
|
||||
static USItype
|
||||
udivmodsi4 (USItype num, USItype den, word_type modwanted)
|
||||
{
|
||||
USItype bit = 1;
|
||||
USItype res = 0;
|
||||
|
||||
while (den < num && bit && !(den & (1L<<31)))
|
||||
{
|
||||
den <<=1;
|
||||
bit <<=1;
|
||||
}
|
||||
while (bit)
|
||||
{
|
||||
if (num >= den)
|
||||
{
|
||||
num -= den;
|
||||
res |= bit;
|
||||
}
|
||||
bit >>=1;
|
||||
den >>=1;
|
||||
}
|
||||
if (modwanted)
|
||||
return num;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
SItype
|
||||
__divsi3 (SItype a, SItype b)
|
||||
{
|
||||
word_type neg = 0;
|
||||
SItype res;
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
a = -a;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
{
|
||||
b = -b;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
res = udivmodsi4 (a, b, 0);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
SItype
|
||||
__modsi3 (SItype a, SItype b)
|
||||
{
|
||||
word_type neg = 0;
|
||||
SItype res;
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
a = -a;
|
||||
neg = 1;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
|
||||
res = udivmodsi4 (a, b, 1);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
SItype
|
||||
__udivsi3 (SItype a, SItype b)
|
||||
{
|
||||
return udivmodsi4 (a, b, 0);
|
||||
}
|
||||
|
||||
|
||||
SItype
|
||||
__umodsi3 (SItype a, SItype b)
|
||||
{
|
||||
return udivmodsi4 (a, b, 1);
|
||||
}
|
||||
|
60
libgcc/config/nios2/lib2-divtable.c
Normal file
60
libgcc/config/nios2/lib2-divtable.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Altera and Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "lib2-nios2.h"
|
||||
|
||||
UQItype __divsi3_table[] =
|
||||
{
|
||||
0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7,
|
||||
0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15,
|
||||
0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7,
|
||||
1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15,
|
||||
0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7,
|
||||
2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15,
|
||||
0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7,
|
||||
3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15,
|
||||
0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7,
|
||||
4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15,
|
||||
0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7,
|
||||
5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15,
|
||||
0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7,
|
||||
6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15,
|
||||
0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7,
|
||||
7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15,
|
||||
0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7,
|
||||
8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15,
|
||||
0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7,
|
||||
9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15,
|
||||
0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7,
|
||||
10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15,
|
||||
0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7,
|
||||
11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15,
|
||||
0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7,
|
||||
12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15,
|
||||
0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7,
|
||||
13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15,
|
||||
0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7,
|
||||
14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15,
|
||||
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,
|
||||
};
|
||||
|
42
libgcc/config/nios2/lib2-mul.c
Normal file
42
libgcc/config/nios2/lib2-mul.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Altera and Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "lib2-nios2.h"
|
||||
|
||||
/* 32-bit SI multiply for Nios II. */
|
||||
|
||||
SItype
|
||||
__mulsi3 (SItype a, SItype b)
|
||||
{
|
||||
SItype res = 0;
|
||||
USItype cnt = a;
|
||||
|
||||
while (cnt)
|
||||
{
|
||||
if (cnt & 1)
|
||||
res += b;
|
||||
b <<= 1;
|
||||
cnt >>= 1;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
49
libgcc/config/nios2/lib2-nios2.h
Normal file
49
libgcc/config/nios2/lib2-nios2.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* Integer arithmetic support for Altera Nios II.
|
||||
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Altera and Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef LIB2_NIOS2_H
|
||||
#define LIB2_NIOS2_H
|
||||
|
||||
/* Types. */
|
||||
|
||||
typedef char QItype __attribute__ ((mode (QI)));
|
||||
typedef unsigned char UQItype __attribute__ ((mode (QI)));
|
||||
typedef short HItype __attribute__ ((mode (HI)));
|
||||
typedef unsigned short UHItype __attribute__ ((mode (HI)));
|
||||
typedef int SItype __attribute__ ((mode (SI)));
|
||||
typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
typedef int word_type __attribute__ ((mode (__word__)));
|
||||
|
||||
/* Exported functions. */
|
||||
extern SItype __divsi3 (SItype, SItype);
|
||||
extern SItype __modsi3 (SItype, SItype);
|
||||
extern SItype __udivsi3 (SItype, SItype);
|
||||
extern SItype __umodsi3 (SItype, SItype);
|
||||
extern HItype __divhi3 (HItype, HItype);
|
||||
extern HItype __modhi3 (HItype, HItype);
|
||||
extern UHItype __udivhi3 (UHItype, UHItype);
|
||||
extern UHItype __umodhi3 (UHItype, UHItype);
|
||||
extern SItype __mulsi3 (SItype, SItype);
|
||||
|
||||
#endif /* LIB2_NIOS2_H */
|
286
libgcc/config/nios2/linux-atomic.c
Normal file
286
libgcc/config/nios2/linux-atomic.c
Normal file
|
@ -0,0 +1,286 @@
|
|||
/* Linux-specific atomic operations for Nios II Linux.
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <asm/unistd.h>
|
||||
#define EFAULT 14
|
||||
#define EBUSY 16
|
||||
#define ENOSYS 38
|
||||
|
||||
/* We implement byte, short and int versions of each atomic operation
|
||||
using the kernel helper defined below. There is no support for
|
||||
64-bit operations yet. */
|
||||
|
||||
/* Crash a userspace program with SIGSEV. */
|
||||
#define ABORT_INSTRUCTION asm ("stw zero, 0(zero)")
|
||||
|
||||
/* Kernel helper for compare-and-exchange a 32-bit value. */
|
||||
static inline long
|
||||
__kernel_cmpxchg (int oldval, int newval, int *mem)
|
||||
{
|
||||
register int r2 asm ("r2");
|
||||
register int *r4 asm ("r4") = mem;
|
||||
register int r5 asm ("r5") = oldval;
|
||||
register int r6 asm ("r6") = newval;
|
||||
|
||||
/* Call the kernel provided fixed address cmpxchg helper routine. */
|
||||
asm volatile ("movi %0, %4\n\t"
|
||||
"callr %0\n"
|
||||
: "=r" (r2)
|
||||
: "r" (r4), "r" (r5), "r" (r6), "I" (0x00001004)
|
||||
: "ra", "memory");
|
||||
return r2;
|
||||
}
|
||||
|
||||
#define HIDDEN __attribute__ ((visibility ("hidden")))
|
||||
|
||||
#ifdef __nios2_little_endian__
|
||||
#define INVERT_MASK_1 0
|
||||
#define INVERT_MASK_2 0
|
||||
#else
|
||||
#define INVERT_MASK_1 24
|
||||
#define INVERT_MASK_2 16
|
||||
#endif
|
||||
|
||||
#define MASK_1 0xffu
|
||||
#define MASK_2 0xffffu
|
||||
|
||||
#define FETCH_AND_OP_WORD(OP, PFX_OP, INF_OP) \
|
||||
int HIDDEN \
|
||||
__sync_fetch_and_##OP##_4 (int *ptr, int val) \
|
||||
{ \
|
||||
int failure, tmp; \
|
||||
\
|
||||
do { \
|
||||
tmp = *ptr; \
|
||||
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
return tmp; \
|
||||
}
|
||||
|
||||
FETCH_AND_OP_WORD (add, , +)
|
||||
FETCH_AND_OP_WORD (sub, , -)
|
||||
FETCH_AND_OP_WORD (or, , |)
|
||||
FETCH_AND_OP_WORD (and, , &)
|
||||
FETCH_AND_OP_WORD (xor, , ^)
|
||||
FETCH_AND_OP_WORD (nand, ~, &)
|
||||
|
||||
#define NAME_oldval(OP, WIDTH) __sync_fetch_and_##OP##_##WIDTH
|
||||
#define NAME_newval(OP, WIDTH) __sync_##OP##_and_fetch_##WIDTH
|
||||
|
||||
/* Implement both __sync_<op>_and_fetch and __sync_fetch_and_<op> for
|
||||
subword-sized quantities. */
|
||||
|
||||
#define SUBWORD_SYNC_OP(OP, PFX_OP, INF_OP, TYPE, WIDTH, RETURN) \
|
||||
TYPE HIDDEN \
|
||||
NAME##_##RETURN (OP, WIDTH) (TYPE *ptr, TYPE val) \
|
||||
{ \
|
||||
int *wordptr = (int *) ((unsigned long) ptr & ~3); \
|
||||
unsigned int mask, shift, oldval, newval; \
|
||||
int failure; \
|
||||
\
|
||||
shift = (((unsigned long) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
|
||||
mask = MASK_##WIDTH << shift; \
|
||||
\
|
||||
do { \
|
||||
oldval = *wordptr; \
|
||||
newval = ((PFX_OP (((oldval & mask) >> shift) \
|
||||
INF_OP (unsigned int) val)) << shift) & mask; \
|
||||
newval |= oldval & ~mask; \
|
||||
failure = __kernel_cmpxchg (oldval, newval, wordptr); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
return (RETURN & mask) >> shift; \
|
||||
}
|
||||
|
||||
SUBWORD_SYNC_OP (add, , +, unsigned short, 2, oldval)
|
||||
SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, oldval)
|
||||
SUBWORD_SYNC_OP (or, , |, unsigned short, 2, oldval)
|
||||
SUBWORD_SYNC_OP (and, , &, unsigned short, 2, oldval)
|
||||
SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, oldval)
|
||||
SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, oldval)
|
||||
|
||||
SUBWORD_SYNC_OP (add, , +, unsigned char, 1, oldval)
|
||||
SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, oldval)
|
||||
SUBWORD_SYNC_OP (or, , |, unsigned char, 1, oldval)
|
||||
SUBWORD_SYNC_OP (and, , &, unsigned char, 1, oldval)
|
||||
SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, oldval)
|
||||
SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, oldval)
|
||||
|
||||
#define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP) \
|
||||
int HIDDEN \
|
||||
__sync_##OP##_and_fetch_4 (int *ptr, int val) \
|
||||
{ \
|
||||
int tmp, failure; \
|
||||
\
|
||||
do { \
|
||||
tmp = *ptr; \
|
||||
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
return PFX_OP (tmp INF_OP val); \
|
||||
}
|
||||
|
||||
OP_AND_FETCH_WORD (add, , +)
|
||||
OP_AND_FETCH_WORD (sub, , -)
|
||||
OP_AND_FETCH_WORD (or, , |)
|
||||
OP_AND_FETCH_WORD (and, , &)
|
||||
OP_AND_FETCH_WORD (xor, , ^)
|
||||
OP_AND_FETCH_WORD (nand, ~, &)
|
||||
|
||||
SUBWORD_SYNC_OP (add, , +, unsigned short, 2, newval)
|
||||
SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, newval)
|
||||
SUBWORD_SYNC_OP (or, , |, unsigned short, 2, newval)
|
||||
SUBWORD_SYNC_OP (and, , &, unsigned short, 2, newval)
|
||||
SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, newval)
|
||||
SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, newval)
|
||||
|
||||
SUBWORD_SYNC_OP (add, , +, unsigned char, 1, newval)
|
||||
SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, newval)
|
||||
SUBWORD_SYNC_OP (or, , |, unsigned char, 1, newval)
|
||||
SUBWORD_SYNC_OP (and, , &, unsigned char, 1, newval)
|
||||
SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, newval)
|
||||
SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, newval)
|
||||
|
||||
int HIDDEN
|
||||
__sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
|
||||
{
|
||||
int actual_oldval, fail;
|
||||
|
||||
while (1)
|
||||
{
|
||||
actual_oldval = *ptr;
|
||||
|
||||
if (oldval != actual_oldval)
|
||||
return actual_oldval;
|
||||
|
||||
fail = __kernel_cmpxchg (actual_oldval, newval, ptr);
|
||||
|
||||
if (!fail)
|
||||
return oldval;
|
||||
}
|
||||
}
|
||||
|
||||
#define SUBWORD_VAL_CAS(TYPE, WIDTH) \
|
||||
TYPE HIDDEN \
|
||||
__sync_val_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval, \
|
||||
TYPE newval) \
|
||||
{ \
|
||||
int *wordptr = (int *)((unsigned long) ptr & ~3), fail; \
|
||||
unsigned int mask, shift, actual_oldval, actual_newval; \
|
||||
\
|
||||
shift = (((unsigned long) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
|
||||
mask = MASK_##WIDTH << shift; \
|
||||
\
|
||||
while (1) \
|
||||
{ \
|
||||
actual_oldval = *wordptr; \
|
||||
\
|
||||
if (((actual_oldval & mask) >> shift) != (unsigned int) oldval) \
|
||||
return (actual_oldval & mask) >> shift; \
|
||||
\
|
||||
actual_newval = (actual_oldval & ~mask) \
|
||||
| (((unsigned int) newval << shift) & mask); \
|
||||
\
|
||||
fail = __kernel_cmpxchg (actual_oldval, actual_newval, \
|
||||
wordptr); \
|
||||
\
|
||||
if (!fail) \
|
||||
return oldval; \
|
||||
} \
|
||||
}
|
||||
|
||||
SUBWORD_VAL_CAS (unsigned short, 2)
|
||||
SUBWORD_VAL_CAS (unsigned char, 1)
|
||||
|
||||
typedef unsigned char bool;
|
||||
|
||||
bool HIDDEN
|
||||
__sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
|
||||
{
|
||||
int failure = __kernel_cmpxchg (oldval, newval, ptr);
|
||||
return (failure == 0);
|
||||
}
|
||||
|
||||
#define SUBWORD_BOOL_CAS(TYPE, WIDTH) \
|
||||
bool HIDDEN \
|
||||
__sync_bool_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval, \
|
||||
TYPE newval) \
|
||||
{ \
|
||||
TYPE actual_oldval \
|
||||
= __sync_val_compare_and_swap_##WIDTH (ptr, oldval, newval); \
|
||||
return (oldval == actual_oldval); \
|
||||
}
|
||||
|
||||
SUBWORD_BOOL_CAS (unsigned short, 2)
|
||||
SUBWORD_BOOL_CAS (unsigned char, 1)
|
||||
|
||||
int HIDDEN
|
||||
__sync_lock_test_and_set_4 (int *ptr, int val)
|
||||
{
|
||||
int failure, oldval;
|
||||
|
||||
do {
|
||||
oldval = *ptr;
|
||||
failure = __kernel_cmpxchg (oldval, val, ptr);
|
||||
} while (failure != 0);
|
||||
|
||||
return oldval;
|
||||
}
|
||||
|
||||
#define SUBWORD_TEST_AND_SET(TYPE, WIDTH) \
|
||||
TYPE HIDDEN \
|
||||
__sync_lock_test_and_set_##WIDTH (TYPE *ptr, TYPE val) \
|
||||
{ \
|
||||
int failure; \
|
||||
unsigned int oldval, newval, shift, mask; \
|
||||
int *wordptr = (int *) ((unsigned long) ptr & ~3); \
|
||||
\
|
||||
shift = (((unsigned long) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
|
||||
mask = MASK_##WIDTH << shift; \
|
||||
\
|
||||
do { \
|
||||
oldval = *wordptr; \
|
||||
newval = (oldval & ~mask) \
|
||||
| (((unsigned int) val << shift) & mask); \
|
||||
failure = __kernel_cmpxchg (oldval, newval, wordptr); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
return (oldval & mask) >> shift; \
|
||||
}
|
||||
|
||||
SUBWORD_TEST_AND_SET (unsigned short, 2)
|
||||
SUBWORD_TEST_AND_SET (unsigned char, 1)
|
||||
|
||||
#define SYNC_LOCK_RELEASE(TYPE, WIDTH) \
|
||||
void HIDDEN \
|
||||
__sync_lock_release_##WIDTH (TYPE *ptr) \
|
||||
{ \
|
||||
/* All writes before this point must be seen before we release \
|
||||
the lock itself. */ \
|
||||
__builtin_sync (); \
|
||||
*ptr = 0; \
|
||||
}
|
||||
|
||||
SYNC_LOCK_RELEASE (int, 4)
|
||||
SYNC_LOCK_RELEASE (short, 2)
|
||||
SYNC_LOCK_RELEASE (char, 1)
|
106
libgcc/config/nios2/linux-unwind.h
Normal file
106
libgcc/config/nios2/linux-unwind.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* DWARF2 EH unwinding support for Nios II Linux.
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef inhibit_libc
|
||||
|
||||
/* Do code reading to identify a signal frame, and set the frame
|
||||
state data appropriately. See unwind-dw2.c for the structs.
|
||||
The corresponding bits in the Linux kernel are in
|
||||
arch/nios2/kernel/signal.c. */
|
||||
|
||||
#include <signal.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
/* Exactly the same layout as the kernel structures, unique names. */
|
||||
struct nios2_mcontext {
|
||||
int version;
|
||||
int gregs[32];
|
||||
};
|
||||
|
||||
struct nios2_ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct ucontext *uc_link;
|
||||
stack_t uc_stack;
|
||||
struct nios2_mcontext uc_mcontext;
|
||||
sigset_t uc_sigmask; /* mask last for extensibility */
|
||||
};
|
||||
|
||||
#define MD_FALLBACK_FRAME_STATE_FOR nios2_fallback_frame_state
|
||||
|
||||
static _Unwind_Reason_Code
|
||||
nios2_fallback_frame_state (struct _Unwind_Context *context,
|
||||
_Unwind_FrameState *fs)
|
||||
{
|
||||
u_int32_t *pc = (u_int32_t *) context->ra;
|
||||
_Unwind_Ptr new_cfa;
|
||||
|
||||
/* The expected sequence of instructions is:
|
||||
movi r2,(rt_sigreturn)
|
||||
trap
|
||||
Check for the trap first. */
|
||||
if (pc[1] != 0x003b683a)
|
||||
return _URC_END_OF_STACK;
|
||||
|
||||
#define NIOS2_REG(NUM,NAME) \
|
||||
(fs->regs.reg[NUM].how = REG_SAVED_OFFSET, \
|
||||
fs->regs.reg[NUM].loc.offset = (_Unwind_Ptr)&(regs->NAME) - new_cfa)
|
||||
|
||||
if (pc[0] == (0x00800004 | (__NR_rt_sigreturn << 6)))
|
||||
{
|
||||
struct rt_sigframe {
|
||||
char retcode[12];
|
||||
siginfo_t info;
|
||||
struct nios2_ucontext uc;
|
||||
} *rt_ = context->ra;
|
||||
struct nios2_mcontext *regs = &rt_->uc.uc_mcontext;
|
||||
int i;
|
||||
|
||||
/* MCONTEXT_VERSION is defined to 2 in the kernel. */
|
||||
if (regs->version != 2)
|
||||
return _URC_END_OF_STACK;
|
||||
|
||||
/* The CFA is the user's incoming stack pointer value. */
|
||||
new_cfa = (_Unwind_Ptr)regs->gregs[28];
|
||||
fs->regs.cfa_how = CFA_REG_OFFSET;
|
||||
fs->regs.cfa_reg = STACK_POINTER_REGNUM;
|
||||
fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
|
||||
|
||||
/* The sequential registers. */
|
||||
for (i = 1; i < 24; i++)
|
||||
NIOS2_REG (i, gregs[i-1]);
|
||||
|
||||
/* The random registers. The kernel stores these in a funny order
|
||||
in the gregs array. */
|
||||
NIOS2_REG (RA_REGNO, gregs[23]);
|
||||
NIOS2_REG (FP_REGNO, gregs[24]);
|
||||
NIOS2_REG (GP_REGNO, gregs[25]);
|
||||
NIOS2_REG (EA_REGNO, gregs[27]);
|
||||
|
||||
fs->retaddr_column = EA_REGNO;
|
||||
fs->signal_frame = 1;
|
||||
|
||||
return _URC_NO_REASON;
|
||||
}
|
||||
#undef NIOS2_REG
|
||||
return _URC_END_OF_STACK;
|
||||
}
|
||||
#endif
|
78
libgcc/config/nios2/sfp-machine.h
Normal file
78
libgcc/config/nios2/sfp-machine.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/* Soft-FP definitions for Altera Nios II.
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define _FP_W_TYPE_SIZE 32
|
||||
#define _FP_W_TYPE unsigned long
|
||||
#define _FP_WS_TYPE signed long
|
||||
#define _FP_I_TYPE long
|
||||
|
||||
#define _FP_MUL_MEAT_S(R,X,Y) \
|
||||
_FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
|
||||
#define _FP_MUL_MEAT_D(R,X,Y) \
|
||||
_FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
|
||||
#define _FP_MUL_MEAT_Q(R,X,Y) \
|
||||
_FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
|
||||
|
||||
#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
|
||||
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
|
||||
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
|
||||
|
||||
#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
|
||||
#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
|
||||
#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
|
||||
#define _FP_NANSIGN_S 0
|
||||
#define _FP_NANSIGN_D 0
|
||||
#define _FP_NANSIGN_Q 0
|
||||
|
||||
#define _FP_KEEPNANFRACP 1
|
||||
#define _FP_QNANNEGATEDP 0
|
||||
|
||||
/* Someone please check this. */
|
||||
#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
|
||||
do { \
|
||||
if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
|
||||
&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
|
||||
{ \
|
||||
R##_s = Y##_s; \
|
||||
_FP_FRAC_COPY_##wc(R,Y); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
R##_s = X##_s; \
|
||||
_FP_FRAC_COPY_##wc(R,X); \
|
||||
} \
|
||||
R##_c = FP_CLS_NAN; \
|
||||
} while (0)
|
||||
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BIG_ENDIAN 4321
|
||||
|
||||
#ifdef __nios2_little_endian__
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#else
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
/* Define ALIASNAME as a strong alias for NAME. */
|
||||
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
|
||||
# define _strong_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
7
libgcc/config/nios2/t-linux
Normal file
7
libgcc/config/nios2/t-linux
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Soft-float functions go in glibc only, to facilitate the possible
|
||||
# future addition of exception and rounding mode support integrated
|
||||
# with <fenv.h>.
|
||||
|
||||
LIB2FUNCS_EXCLUDE = _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
|
||||
_fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _floatundidf _floatundisf
|
||||
LIB2ADD += $(srcdir)/config/nios2/linux-atomic.c
|
5
libgcc/config/nios2/t-nios2
Normal file
5
libgcc/config/nios2/t-nios2
Normal file
|
@ -0,0 +1,5 @@
|
|||
LIB2ADD += $(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 \
|
||||
$(srcdir)/config/nios2/tramp.c
|
61
libgcc/config/nios2/tramp.c
Normal file
61
libgcc/config/nios2/tramp.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
Contributed by Altera and Mentor Graphics, Inc.
|
||||
|
||||
This file 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This file 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Set up trampolines.
|
||||
R12 is the static chain register.
|
||||
R2 is AT, the assembler temporary.
|
||||
The trampoline code looks like:
|
||||
movhi r12,%hi(chain)
|
||||
ori r12,%lo(chain)
|
||||
movhi r2,%hi(fn)
|
||||
ori r2,%lo(fn)
|
||||
jmp r2
|
||||
*/
|
||||
|
||||
#define SC_REGNO 12
|
||||
|
||||
#define MOVHI(reg,imm16) \
|
||||
(((reg) << 22) | ((imm16) << 6) | 0x34)
|
||||
#define ORI(reg,imm16) \
|
||||
(((reg) << 27) | ((reg) << 22) | ((imm16) << 6) | 0x14)
|
||||
#define JMP(reg) \
|
||||
(((reg) << 27) | (0x0d << 11) | 0x3a)
|
||||
|
||||
void
|
||||
__trampoline_setup (unsigned int *addr, void *fnptr, void *chainptr)
|
||||
{
|
||||
unsigned int fn = (unsigned int) fnptr;
|
||||
unsigned int chain = (unsigned int) chainptr;
|
||||
int i;
|
||||
|
||||
addr[0] = MOVHI (SC_REGNO, ((chain >> 16) & 0xffff));
|
||||
addr[1] = ORI (SC_REGNO, (chain & 0xffff));
|
||||
addr[2] = MOVHI (2, ((fn >> 16) & 0xffff));
|
||||
addr[3] = ORI (2, (fn & 0xffff));
|
||||
addr[4] = JMP (2);
|
||||
|
||||
/* Flush the caches.
|
||||
See Example 9-4 in the Nios II Software Developer's Handbook. */
|
||||
for (i = 0; i < 5; i++)
|
||||
asm volatile ("flushd 0(%0); flushi %0" :: "r"(addr + i) : "memory");
|
||||
asm volatile ("flushp" ::: "memory");
|
||||
}
|
Loading…
Add table
Reference in a new issue