Commit cc7232b9 by Jojo Committed by Sandra Loosemore

C-SKY port: Backend implementation

2018-08-17  Jojo  <jijie_rong@c-sky.com>
	    Huibin Wang  <huibin_wang@c-sky.com>
	    Sandra Loosemore  <sandra@codesourcery.com>
	    Chung-Lin Tang  <cltang@codesourcery.com>

	C-SKY port: Backend implementation

	gcc/
	* config/csky/*: New.
	* common/config/csky/*: New.

Co-Authored-By: Chung-Lin Tang <cltang@codesourcery.com>
Co-Authored-By: Huibin Wang <huibin_wang@c-sky.com>
Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com>

From-SVN: r263628
parent 56856b58
......@@ -2,6 +2,16 @@
Huibin Wang <huibin_wang@c-sky.com>
Sandra Loosemore <sandra@codesourcery.com>
Chung-Lin Tang <cltang@codesourcery.com>
C-SKY port: Backend implementation
* config/csky/*: New.
* common/config/csky/*: New.
2018-08-17 Jojo <jijie_rong@c-sky.com>
Huibin Wang <huibin_wang@c-sky.com>
Sandra Loosemore <sandra@codesourcery.com>
Chung-Lin Tang <cltang@codesourcery.com>
Andrew Jenner <andrew@codesourcery.com>
C-SKY port: Configury
......
/* Common hooks for CSKY.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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 "tm.h"
#include "common/common-target.h"
#include "common/common-target-def.h"
/* Set default optimization options. */
static const struct default_options csky_option_optimization_table[] =
{
/* Enable section anchors by default at -O1 or higher. */
{ OPT_LEVELS_1_PLUS, OPT_fsection_anchors, 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 csky_option_optimization_table
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
;; Constraints for C-SKY.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/>. */
;; Register constraints.
(define_register_constraint "a" "MINI_REGS" "r0 - r7")
(define_register_constraint "b" "LOW_REGS" "r0 - r15")
(define_register_constraint "c" "C_REGS" "C register")
(define_register_constraint "y" "HILO_REGS" "HI and LO registers")
(define_register_constraint "l" "LO_REGS" "LO register")
(define_register_constraint "h" "HI_REGS" "HI register")
(define_register_constraint "v" "V_REGS" "vector registers")
(define_register_constraint "z" "SP_REGS" "SP register")
;; Memory and misc constraints.
(define_memory_constraint "Q"
"Memory operands with base register, index register and short displacement for FPUV2"
(match_test "csky_valid_fpuv2_mem_operand (op)"))
(define_constraint "R"
"Memory operands whose address is a label_ref"
(and (match_code "mem")
(match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")))
(define_constraint "S"
"Symbol reference with optional offset"
(match_test "csky_symbolic_address_p (op)"))
;; Constant integer constraints.
(define_constraint "I"
"Constant in range [0, 65535]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_I (ival)")))
(define_constraint "J"
"Constant in range [1, 32]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_J (ival)")))
(define_constraint "K"
"Constant in range [0, 31]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_K (ival)")))
(define_constraint "L"
"Constant in range [1, 8]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_L (ival)")))
(define_constraint "M"
"Constant in range [1, 4096]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_M (ival)")))
(define_constraint "N"
"Constant in range [1, 256]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_N (ival)")))
(define_constraint "O"
"Constant in range [0, 4095]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_O (ival)")))
(define_constraint "P"
"Constant in range [4, 508] that is divisible by 4"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_P (ival)")))
(define_constraint "T"
"Constant in range [-256, -1]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_T (ival)")))
(define_constraint "Ua"
"Constant 0"
(and (match_code "const_int")
(match_test "ival == 0")))
(define_constraint "Ub"
"Unsigned int that is an exact power of 2"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Ub (ival)")))
(define_constraint "Uc"
"Unsigned int X such that X+1 is an exact power of 2"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Uc (ival)")))
(define_constraint "Ud"
"64-bit int whose high/low words separately satisfy I, Ub, or Uc"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Ud (ival)")))
(define_constraint "Ug"
"Constant in range [-508, -4] that is divisible by 4"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Ug (ival)")))
(define_constraint "Uh"
"Constant in range [-31, 0]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Uh (ival)")))
(define_constraint "Uj"
"Constant in range [4, 1024] that is divisible by 4"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Uj (ival)")))
(define_constraint "Uk"
"Constant in range [1, 65536]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Uk (ival)")))
(define_constraint "Ul"
"Constant in range [-1024, -4] that is divisible by 4"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Ul (ival)")))
(define_constraint "Um"
"Constant in range [-4096, -1]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Um (ival)")))
(define_constraint "Un"
"Constant whose low 16 bits are all zeros"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_MOVIH (ival)")))
(define_constraint "Uo"
"Constant that can be synthesized with an extra instruction"
(and (match_code "const_int")
(match_test "csky_inlinable_constant (ival)")))
(define_constraint "Up"
"Constant in range [0, 255]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_N (ival + 1)")))
(define_constraint "Uq"
"Constant in range [0, 1020] that is divisible by 4"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Uj (ival + 4)")))
(define_constraint "Ur"
"Constant in range [-1020, -4] that is divisible by 4"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_Uj (-ival + 4)")))
(define_constraint "Us"
"Constant in range [-8, -1]"
(and (match_code "const_int")
(match_test "CSKY_CONST_OK_FOR_US (ival)")))
/* Declarations for bare-metal C-SKY targets.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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/>. */
/******************************************************************
* Run-time Target Specification *
******************************************************************/
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"crt0.o%s crti.o%s crtbegin.o%s"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
#undef CC1_SPEC
#define CC1_SPEC \
"%{EB:-EB} \
%{EL:-EL} \
%{fpic|fPIC:-DPIC} \
%{march=ck803s:-march=ck803} \
"
#undef ASM_SPEC
#define ASM_SPEC \
"%{mbig-endian:-mbig-endian} \
%{EB:-EB} \
%{EL:-EL} \
%{fpic|fPIC:-pic} \
%{mcpu=*:-mcpu=%*} \
%{march=*:-march=%*} \
%{mhard-float:-mhard-float} \
%{melrw:-melrw} \
%{mno-elrw:-mno-elrw} \
%{mistack:-mistack} \
%{mno-istack:-mno-istack} \
%{mmp:-mmp} \
%{mcp:-mcp} \
%{mcache:-mcache} \
%{msecurity|mmac:-msecurity} \
%{mtrust:-mtrust} \
%{mdsp:-mdsp} \
%{medsp:-medsp} \
%{mvdsp:-mvdsp} \
"
#undef LINK_SPEC
#define LINK_SPEC \
"%{mbig-endian:-EB} \
%{EB:-EB} \
%{EL:-EL} -X"
#undef LIB_SPEC
#define LIB_SPEC \
"%{pthread:-lpthread} -lc %{mccrt:-lcc-rt}"
/* FIXME add this to LIB_SPEC when need */
/* %{!shared:%{profile:-lc_p}%{!profile:-lc}}" */
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
/* Disable features only for Linux toolchains. */
#undef TARGET_POSIX_IO
#define TARGET_CSKY_LINUX 0
/* Declarations for C-SKY targets running Linux.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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/>. */
/******************************************************************
* Run-time Target Specification *
******************************************************************/
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{!shared: %{pie:Scrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
#undef CC1_SPEC
#define CC1_SPEC \
"%{EB:-EB} \
%{EL:-EL} \
"
#undef ASM_SPEC
#define ASM_SPEC \
"%{mbig-endian:-mbig-endian} \
%{EB:-EB} \
%{EL:-EL} \
%{fpic|fPIC:-pic} \
%{mcpu=*:-mcpu=%*} \
%{march=*:-march=%*} \
%{mhard-float:-mhard-float} \
%{melrw:-melrw} \
%{mno-elrw:-mno-elrw} \
%{mistack:-mistack} \
%{mno-istack:-mno-istack} \
%{mmp:-mmp} \
%{mcp:-mcp} \
%{mcache:-mcache} \
%{msecurity|mmac:-msecurity} \
%{mtrust:-mtrust} \
%{mdsp:-mdsp} \
%{medsp:-medsp} \
%{mvdsp:-mvdsp} \
"
#define LINUX_DYNAMIC_LINKER "/lib/ld.so.1"
#define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \
%{b} \
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!shared:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
-X \
%{mbig-endian:-EB} %{mlittle-endian:-EL} \
%{EB:-EB} %{EL:-EL}"
#undef LINK_SPEC
#define LINK_SPEC LINUX_TARGET_LINK_SPEC
#undef LIB_SPEC
#define LIB_SPEC \
"%{pthread:-lpthread} -lc %{mccrt:-lcc-rt}"
/* FIXME add this to LIB_SPEC when need */
/* %{!shared:%{profile:-lc_p}%{!profile:-lc}}" */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
GNU_USER_TARGET_OS_CPP_BUILTINS (); \
} \
while (0)
/* In crtstuff.c to control section in where code resides.
We have to write it as asm code. */
#ifdef __PIC__
#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
asm (SECTION_OP "\n" \
"\tgrs\tr3, .Lgetpc_"#FUNC"\n\t" \
".Lgetpc_"#FUNC":\n\t" \
"\tlrw\tr2,\t.Lgetpc_"#FUNC"@GOTPC\n\t" \
"\taddu\tr3, r2\n\t" \
"\tlrw\tr2, "#FUNC"@GOTOFF\n\t" \
"\taddu\tr2, r3\n\t" \
"\tjsr\tr2\n\t"); \
FORCE_CODE_SECTION_ALIGN \
asm (TEXT_SECTION_ASM_OP);
#endif
#undef CPP_SPEC
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
#undef FUNCTION_PROFILER
#define SAVE_LR \
"push\tlr"
#define FUNCTION_PROFILER(file, labelno) \
fprintf (file, "\t%s\n\tjbsr\t_mcount\n", SAVE_LR);
#define NO_PROFILE_COUNTERS 1
/* Enable features only for Linux toolchains. */
#define TARGET_CSKY_LINUX 1
/* Clear the instruction cache from `BEG' to `END'. */
#define CLEAR_INSN_CACHE(BEG, END) \
cacheflush (BEG, END-BEG, 3)
/* For __clear_cache in libgcc2.c. The declaration is copied from
<sys/cachectl.h>. */
#ifdef IN_LIBGCC2
extern int cacheflush (void *__addr, const int __nbytes, const int __op);
#endif
/* Prototype declarations for the C-SKY back end.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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_CSKY_PROTOS_H
#define GCC_CSKY_PROTOS_H
extern bool csky_simple_addr_operand_p (rtx);
extern bool csky_symbolic_address_p (rtx);
extern bool csky_legitimate_pic_operand_p (rtx);
extern void csky_cpu_cpp_builtins (cpp_reader *);
extern bool csky_inlinable_constant (HOST_WIDE_INT value);
extern bool csky_shifted_imm8_constant (unsigned HOST_WIDE_INT,
unsigned int *, unsigned int *);
extern bool csky_valid_fpuv2_mem_operand (rtx);
extern bool csky_minipool_load_p (rtx_insn *);
extern const char *csky_output_move (rtx insn, rtx *, machine_mode);
extern const char *csky_output_movedouble (rtx *, machine_mode);
extern const char *csky_output_ck801_move (rtx, rtx *, machine_mode);
extern const char *csky_output_ck801_movedouble (rtx *, machine_mode);
extern char *csky_output_call (rtx *, int);
extern const char *csky_output_casesi (rtx *);
extern bool csky_split_and (rtx *);
extern bool csky_split_ior (rtx *);
extern bool csky_split_xor (rtx *);
#ifdef RTX_CODE
extern bool csky_emit_compare (enum rtx_code, rtx, rtx);
extern bool csky_emit_compare_float (enum rtx_code, rtx, rtx);
#endif /* RTX_CODE */
extern rtx csky_return_addr (int, rtx);
extern void csky_init_expanders (void);
extern HOST_WIDE_INT csky_initial_elimination_offset (int, int);
extern void csky_expand_prologue (void);
extern void csky_expand_epilogue (void);
extern const char *csky_output_return_instruction (void);
extern void csky_set_eh_return_address (rtx, rtx);
extern bool csky_symbol_mentioned_p (rtx);
extern bool csky_label_mentioned_p (rtx);
extern rtx csky_legitimize_pic_address (rtx, rtx, bool);
extern bool csky_tls_referenced_p (rtx);
extern rtx csky_legitimize_tls_address (rtx, rtx);
extern int csky_compute_pushpop_length (rtx *);
extern int csky_default_branch_cost (bool, bool);
extern bool csky_default_logical_op_non_short_circuit (void);
#endif /* GCC_CSKY_PROTOS_H */
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Declarations for the C-SKY back end.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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_CSKY_H
#define GCC_CSKY_H
/* In some places e.g. csky_secondary_reload, we use -1 to indicate an
invalid register. In other places where N is unsigned the comparison
to zero would give an error, so explicitly cast to int here. */
#define CSKY_GENERAL_REGNO_P(N) \
((N) < CSKY_NGPR_REGS && (int)(N) >= 0)
#define CSKY_VREG_P(N) \
((N) >= CSKY_FIRST_VFP_REGNUM && (N) <= CSKY_LAST_VFP_REGNUM)
#define CSKY_HILO_REG_P(N) \
((N) == CSKY_HI_REGNUM || (N) == CSKY_LO_REGNUM)
/* Helper macros for constant constraints and predicates. */
#define CSKY_VALUE_BETWEEN(VALUE, LOW, HIGH) \
((VALUE) >= (LOW) && (VALUE) <= (HIGH))
#define CSKY_CONST_OK_FOR_I(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 0, 65535)
#define CSKY_CONST_OK_FOR_J(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 1, 32)
#define CSKY_CONST_OK_FOR_K(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 0, 31)
#define CSKY_CONST_OK_FOR_L(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 1, 8)
#define CSKY_CONST_OK_FOR_M(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 1, 4096)
#define CSKY_CONST_OK_FOR_N(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 1, 256)
#define CSKY_CONST_OK_FOR_O(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 0, 4095)
#define CSKY_CONST_OK_FOR_P(VALUE) \
(((VALUE) & 0x3) == 0 && CSKY_VALUE_BETWEEN (VALUE, 4, 508))
#define CSKY_CONST_OK_FOR_T(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, -256, -1)
#define CSKY_CONST_OK_FOR_Ub(VALUE) \
(exact_log2 (VALUE & 0xFFFFFFFF) >= 0)
#define CSKY_CONST_OK_FOR_Uc(VALUE) \
((VALUE) == (HOST_WIDE_INT) -1 \
|| (exact_log2 ((VALUE) + 1) >= 0 \
&& exact_log2 ((VALUE) + 1) <= 31))
#define CSKY_CONST_OK_FOR_Ud(VALUE) \
((CSKY_CONST_OK_FOR_I ((VALUE) & 0xffffffff) \
|| CSKY_CONST_OK_FOR_Ub ((VALUE)) \
|| CSKY_CONST_OK_FOR_Uc (((VALUE) << 32) >> 32)) \
&& (CSKY_CONST_OK_FOR_I ((VALUE) >> 32) \
|| CSKY_CONST_OK_FOR_Ub ((VALUE) >> 32) \
|| CSKY_CONST_OK_FOR_Uc ((VALUE) >> 32))) \
#define CSKY_CONST_OK_FOR_Ug(VALUE) \
(((VALUE) & 0x3) == 0 && CSKY_VALUE_BETWEEN (VALUE, -508, -4))
#define CSKY_CONST_OK_FOR_Uh(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, -31, 0)
#define CSKY_CONST_OK_FOR_Uj(VALUE) \
(((VALUE) & 0x3) == 0 && CSKY_VALUE_BETWEEN (VALUE, 1, 1024))
#define CSKY_CONST_OK_FOR_Uk(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, 1, 65536)
#define CSKY_CONST_OK_FOR_Ul(VALUE) \
(((VALUE) & 0x3) == 0 && CSKY_VALUE_BETWEEN (VALUE, -1024, -4))
#define CSKY_CONST_OK_FOR_Um(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, -4096, -1)
#define CSKY_CONST_OK_FOR_US(VALUE) \
CSKY_VALUE_BETWEEN (VALUE, -8, -1)
#define CSKY_CONST_OK_FOR_MOVIH(VALUE) \
(((VALUE) & 0xFFFF) == 0)
#ifndef TARGET_CPU_DEFAULT
#define TARGET_CPU_DEFAULT CSKY_TARGET_CORE_GET(ck810f)
#endif
/* Options that are enabled by default are specified as such in the
.opt file. */
#define TARGET_DEFAULT 0
/* The highest CSKY architecture version supported by the target. */
#define CSKY_TARGET_ARCH(arch) \
(csky_base_arch == CSKY_TARGET_ARCH_GET (arch))
/* Define some macros for target code generation options. */
#define TARGET_SOFT_FPU \
(csky_fpu_index == TARGET_FPU_fpv2_sf)
#define TARGET_CASESI \
(optimize_size && TARGET_CONSTANT_POOL \
&& (CSKY_TARGET_ARCH (CK801) || CSKY_TARGET_ARCH (CK802)))
#define TARGET_TLS \
(CSKY_TARGET_ARCH (CK807) || CSKY_TARGET_ARCH (CK810))
/* Number of loads/stores handled by ldm/stm. */
#define CSKY_MIN_MULTIPLE_STLD 3
#define CSKY_MAX_MULTIPLE_STLD 12
/* Pull in enums and defines for processor/arch variants. This makes
it possible to use CSKY_TARGET_ARCH in macros defined in this file. */
#include "csky_opts.h"
extern enum csky_base_architecture csky_base_arch;
/* Pull in enums and defines for ISA features. Likewise required to
support use of CSKY_ISA_FEATURE in this file.
Note that the CSKY_ISA_FEATURE macro tests properties of the
particular processor we're compiling for, not code generation
options that may have dependencies on those features. The latter
are handled by TARGET_xxxx macros/variables instead. See csky.opt. */
#include "csky_isa.h"
extern int csky_arch_isa_features[];
#define CSKY_ISA_FEATURE(IDENT) \
csky_arch_isa_features[CSKY_ISA_FEATURE_GET (IDENT)]
/******************************************************************
* Storage Layout *
******************************************************************/
/* Define this if most significant bit is lowest numbered
in instructions that operate on numbered bit-fields. */
#define BITS_BIG_ENDIAN 0
/* If the most significant byte of a word is the lowest numbered. */
#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
/* If the most significant word of a multiword number is the lowest. */
#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN)
/* Width of a word, in units (bytes). */
#define UNITS_PER_WORD 4
/* Define this macro if it is advisable to hold scalars in registers
in a wider mode than that declared by the program. In such cases,
the value is constrained to be within the bounds of the declared
type, but kept valid in the wider mode. The signedness of the
extension may differ from that of the type. */
#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
if (GET_MODE_CLASS (MODE) == MODE_INT \
&& GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
(MODE) = SImode;
/* Allocation boundary (in *bits*) for storing arguments in argument list. */
#define PARM_BOUNDARY 32
/* Boundary (in *bits*) on which stack pointer should be aligned.
Per C-SKY, the published V2 ABI document is incorrect and the proper
alignment is on a 4-byte boundary rather than 8 bytes. */
#define STACK_BOUNDARY 32
/* Align definitions of arrays, unions and structures so that
initializations and copies can be made more efficient. This is not
ABI-changing, so it only affects places where we can see the
definition. Increasing the alignment tends to introduce padding,
so don't do this when optimizing for size/conserving stack space. */
#define CSKY_EXPAND_ALIGNMENT(COND, EXP, ALIGN) \
(((COND) && ((ALIGN) < BITS_PER_WORD) \
&& (TREE_CODE (EXP) == ARRAY_TYPE \
|| TREE_CODE (EXP) == UNION_TYPE \
|| TREE_CODE (EXP) == RECORD_TYPE)) \
? BITS_PER_WORD : (ALIGN))
/* Align global data. */
#define DATA_ALIGNMENT(EXP, ALIGN) \
CSKY_EXPAND_ALIGNMENT (!optimize_size, EXP, ALIGN)
/* Similarly, make sure that objects on the stack are sensibly aligned. */
#define LOCAL_ALIGNMENT(EXP, ALIGN) \
CSKY_EXPAND_ALIGNMENT (!flag_conserve_stack, EXP, ALIGN)
/* No data type wants to be aligned rounder than this. */
#define BIGGEST_ALIGNMENT 32
/* Every structures size must be a multiple of 8 bits. */
#define STRUCTURE_SIZE_BOUNDARY 8
/* Look at the fundamental type that is used for a bit-field and use
that to impose alignment on the enclosing structure.
struct s {int a:8}; should have same alignment as "int", not "char". */
#define PCC_BITFIELD_TYPE_MATTERS 1
/* Largest integer machine mode for structures. If undefined, the default
is GET_MODE_SIZE(DImode). */
#define MAX_FIXED_MODE_SIZE 64
/* Allocation boundary (in *bits*) for the code of a function.
Optimize ck801 and ck802 a little harder for size. */
#define FUNCTION_BOUNDARY \
(((CSKY_TARGET_ARCH (CK801) || CSKY_TARGET_ARCH (CK802)) \
&& optimize_size) \
? 16 : 32)
/* C-SKY does not support unaligned access. */
#define STRICT_ALIGNMENT 1
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "long int"
#undef UINT_LEAST32_TYPE
#define UINT_LEAST32_TYPE "unsigned int"
#undef INT_LEAST32_TYPE
#define INT_LEAST32_TYPE "int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD
/******************************************************************
* Layout of Source Language Data Types *
******************************************************************/
/* 'char' is unsigned by default for backward compatibility. */
#define DEFAULT_SIGNED_CHAR 0
/******************************************************************
* Stack Layout and Calling Conventions *
******************************************************************/
/* Basic Stack Layout */
/* Define this if pushing a word on the stack
makes the stack pointer a smaller address. */
#define STACK_GROWS_DOWNWARD 1
/* Define this to nonzero if the nominal address of the stack frame
is at the high-address end of the local variables;
that is, each additional local variable allocated
goes at a more negative offset in the frame. */
#define FRAME_GROWS_DOWNWARD 1
/* Offset of first parameter from the argument pointer register value. */
#define FIRST_PARM_OFFSET(FNDECL) 0
/* A C expression whose value is RTL representing the value of the return
address for the frame COUNT steps up from the current frame. */
#define RETURN_ADDR_RTX(COUNT, FRAME) \
csky_return_addr (COUNT, FRAME)
/* Pick up the return address upon entry to a procedure. Used for
dwarf2 unwind information. This also enables the table driven
mechanism. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, CSKY_LR_REGNUM)
/* Exception Handling Support */
/* The register that holds the return address in exception handlers. */
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CSKY_EH_STACKADJ_REGNUM)
/* Registers That Address the Stack Frame */
/* Register to use for pushing function arguments. */
#define STACK_POINTER_REGNUM CSKY_SP_REGNUM
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM 8
/* Base register for access to arguments of the function. This is a fake
register that is always eliminated. */
#define ARG_POINTER_REGNUM 32
/* Static chain register.
Register use is more restricted on CK801. */
#define STATIC_CHAIN_REGNUM (CSKY_TARGET_ARCH (CK801) ? 13 : 12)
/* Eliminating Frame Pointer and Arg Pointer */
/* Definitions for register eliminations.
This is an array of structures. Each structure initializes one pair
of eliminable registers. The "from" register number is given first,
followed by "to". Eliminations of the same "from" register are listed
in order of preference.
We have two registers that can be eliminated on the CSKY. First, the
arg pointer register can often be eliminated in favor of the stack
pointer register. Secondly, the pseudo frame pointer register can always
be eliminated; it is replaced with the stack pointer. */
#define ELIMINABLE_REGS \
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },\
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },\
{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }}
/* Define the offset between two registers, one to be eliminated, and the
other its replacement, at the start of a routine. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET) = csky_initial_elimination_offset (FROM, TO)
/* Passing Function Arguments on the Stack */
/* Define this if the maximum size of all the outgoing args is to be
accumulated and pushed during the prologue. The amount can be
found in the variable crtl->outgoing_args_size. */
#define ACCUMULATE_OUTGOING_ARGS 1
/* Passing Arguments in Registers */
/* A C type for declaring a variable that is used as the first argument of
TARGET_ FUNCTION_ARG and other related values. */
#define CUMULATIVE_ARGS int
/* Initialize a variable CUM of type CUMULATIVE_ARGS
for a call to a function whose data type is FNTYPE.
For a library call, FNTYPE is 0.
On CSKY, the offset always starts at 0: the first parm reg is always
the same reg. */
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
((CUM) = 0)
/* True if N is a possible register number for function argument passing.
On the CSKY, r0-r3 are used to pass args.
The int cast is to prevent a complaint about unsigned comparison to
zero, since CSKY_FIRST_PARM_REGNUM is zero. */
#define FUNCTION_ARG_REGNO_P(REGNO) \
(((int)(REGNO) >= CSKY_FIRST_PARM_REGNUM) && \
((REGNO) < (CSKY_NPARM_REGS + CSKY_FIRST_PARM_REGNUM)))
/* How Large Values Are Returned */
/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
values must be in memory. On the CSKY, small
structures (eight bytes or fewer) are returned in
the register pair r0/r1. */
#define DEFAULT_PCC_STRUCT_RETURN 0
/* 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.
On the CSKY, the function epilogue recovers the stack pointer from the
frame. */
#define EXIT_IGNORE_STACK 1
/******************************************************************
* Register Usage & Register Classes *
******************************************************************/
#define FIRST_PSEUDO_REGISTER 71
/* 1 for registers that have pervasive standard uses
and are not available for the register allocator.
On C-SKY, r14 is SP, r26 is used by linker,
r27 is used by assembler, r28 is data base address,
r29 is GOT base address, r30 is handler base address,
r31 is TLS register. */
#define FIXED_REGISTERS \
/* r0 r1 r2 r3 r4 r5 r6 r7 */ \
{ 0, 0, 0, 0, 0, 0, 0, 0, \
/* r8 r9 r10 r11 r12 r13 r14 r15 */ \
0, 0, 0, 0, 0, 0, 1, 0, \
/* r16 r17 r18 r19 r20 r21 r22 r23 */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* r24 r25 r26 r27 r28 r29 r30 tls */ \
0, 0, 1, 1, 1, 1, 1, 1, \
/* reserved c hi lo */ \
1, 1, 0, 0, \
/* reserved */ \
1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr0 vr1 vr2 vr3 vr4 vr5 vr6 vr7 */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* vr8 vr9 vr10 vr11 vr12 vr13 vr14 vr15 */ \
0, 0, 0, 0, 0, 0, 0, 0 , \
/* reserved */ \
1, 1, \
/* epc */ \
1 \
}
/* 1 for registers that is clobbered (in general) by function calls.
If a register has 0, the compiler automatically saves it on
function entry and restores it on function exit, if the register
is used within the function. */
#define CALL_USED_REGISTERS \
/* r0 r1 r2 r3 r4 r5 r6 r7 */ \
{ 1, 1, 1, 1, 0, 0, 0, 0, \
/* r8 r9 r10 r11 r12 r13 r14 r15 */ \
0, 0, 0, 0, 1, 1, 1, 0, \
/* r16 r17 r18 r19 r20 r21 r22 r23 */ \
0, 0, 1, 1, 1, 1, 1, 1, \
/* r24 r25 r26 r27 r28 r29 r30 r31 */ \
1, 1, 1, 1, 1, 1, 1, 1, \
/* reserved c hi lo */ \
1, 1, 1, 1, \
/* reserved */ \
1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr0 vr1 vr2 vr3 vr4 vr5 vr6 vr7 */ \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr8 vr9 vr10 vr11 vr12 vr13 vr14 vr15 */ \
1, 1, 1, 1, 1, 1, 1, 1, \
/* reserved */ \
1, 1, \
/* epc */ \
1 \
}
/* Like `CALL_USED_REGISTERS' but used to overcome a historical
problem which makes CALL_USED_REGISTERS *always* include
all the FIXED_REGISTERS. Until this problem has been
resolved this macro can be used to overcome this situation.
In particular, block_propagate() requires this list
be accurate, or we can remove registers which should be live.
This macro is used in get_csky_live_regs(). */
#define CALL_REALLY_USED_REGISTERS \
/* r0 r1 r2 r3 r4 r5 r6 r7 */ \
{ 1, 1, 1, 1, 0, 0, 0, 0, \
/* r8 r9 r10 r11 r12 r13 r14 r15 */ \
0, 0, 0, 0, 1, 1, 1, 0, \
/* r16 r17 r18 r19 r20 r21 r22 r23 */ \
0, 0, 1, 1, 1, 1, 1, 1, \
/* r24 r25 r26 r27 r28 r29 r30 r31 */ \
1, 1, 1, 1, 1, 1, 1, 1, \
/* reserved c hi lo */ \
1, 1, 1, 1, \
/* reserved */ \
1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr0 vr1 vr2 vr3 vr4 vr5 vr6 vr7 */ \
1, 1, 1, 1, 1, 1, 1, 1, \
/* vr8 vr9 vr10 vr11 vr12 vr13 vr14 vr15 */ \
1, 1, 1, 1, 1, 1, 1, 1, \
/* reserved */ \
1, 1, \
/* epc */ \
1 \
}
#define REGISTER_NAMES \
{ \
"a0", "a1", "a2", "a3", "l0", "l1", "l2", "l3", \
"l4", "l5", "l6", "l7", "t0", "t1", "sp", "lr", \
"l8", "l9", "t2", "t3", "t4", "t5", "t6", "t7", \
"t8", "t9", "r26", "r27", "gb", "r29", "svbr", "r31", \
/* reserved */ \
"reserved", \
/* CC register: 33 */ \
"c", \
/* DSP instruction register: 34, 35 */ \
"hi", "lo", \
"reserved", "reserved", "reserved", "reserved", "reserved", \
"reserved", "reserved", "reserved", "reserved", "reserved", \
"reserved", "reserved", "reserved", "reserved", "reserved", \
"reserved", \
/* V registers: 52~67 */ \
"vr0", "vr1", "vr2", "vr3", "vr4", "vr5", "vr6", "vr7", \
"vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14", "vr15", \
"reserved", "reserved", \
"epc" \
}
/* Table of additional register names to use in user input. */
#define ADDITIONAL_REGISTER_NAMES \
{ \
{"r0", 0}, \
{"r1", 1}, \
{"r2", 2}, \
{"r3", 3}, \
{"r4", 4}, \
{"r5", 5}, \
{"r6", 6}, \
{"r7", 7}, \
{"r8", 8}, \
{"r9", 9}, \
{"r10", 10}, \
{"r11", 11}, \
{"r12", 12}, \
{"r13", 13}, \
{"r14", 14}, \
{"r15", 15}, \
{"r16", 16}, \
{"r17", 17}, \
{"r18", 18}, \
{"r19", 19}, \
{"r20", 20}, \
{"r21", 21}, \
{"r22", 22}, \
{"r23", 23}, \
{"r24", 24}, \
{"r25", 25}, \
{"r26", 26}, \
{"r27", 27}, \
{"r28", 28}, \
{"r29", 29}, \
{"r30", 30}, \
{"r31", 31}, \
}
/* The order in which registers should be allocated.
It is better to use the registers the caller need not save.
Allocate r0 through r3 in reverse order since r3 is least likely
to contain a function parameter; in addition results are returned
in r0. It is quite good to use lr since other calls may clobber
it anyway. */
#define REG_ALLOC_ORDER \
/* r3 r2 r1 r0 r12 r13 r18 r19 */ \
{ 3, 2, 1, 0, 12, 13, 18, 19, \
/* r20 r21 r22 r23 r24 r25 */ \
20, 21, 22, 23, 24, 25, \
/* r15 r4 r5 r6 r7 r8 r9 r10 r11 */ \
15, 4, 5, 6, 7, 8, 9, 10, 11, \
/* r16 r17 r26 r27 r28 r29 r30 hi lo */ \
16, 17, 26, 27, 28, 29, 30, 34, 35, \
/* vr0 vr1 vr2 vr3 vr4 vr5 vr6 vr7 */ \
52, 53, 54, 55, 56, 57, 58, 59, \
/* vr8 vr9 vr10 vr11 vr12 vr13 vr14 vr15 */ \
60, 61, 62, 63, 64, 65, 66, 67, \
/* reserved */ \
36, 37, 38, 39, 40, 41, 42, 43, \
44, 45, 46, 47, 48, 49, 50, 51, \
/* sp tls reserved c reserved epc */ \
14, 31, 32, 33, 68, 69, 70 }
/* Register classes. */
enum reg_class
{
NO_REGS,
MINI_REGS,
SP_REGS,
LOW_REGS,
GENERAL_REGS,
C_REGS,
HI_REGS,
LO_REGS,
HILO_REGS,
V_REGS,
OTHER_REGS,
RESERVE_REGS,
ALL_REGS,
LIM_REG_CLASSES
};
#define N_REG_CLASSES (int) LIM_REG_CLASSES
/* Give names of register classes as strings for dump file. */
#define REG_CLASS_NAMES \
{ \
"NO_REGS", \
"MINI_REGS", \
"SP_REGS", \
"LOW_REGS", \
"GENERAL_REGS", \
"C_REGS", \
"HI_REGS", \
"LO_REGS", \
"HILO_REGS", \
"V_REGS", \
"OTHER_REGS", \
"RESERVE_REGS", \
"ALL_REGS", \
}
/* Define which registers fit in which classes. This is an initializer
for a vector of HARD_REG_SET of length N_REG_CLASSES. */
#define REG_CLASS_CONTENTS \
{ \
{0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
{0x000000FF, 0x00000000, 0x00000000 }, /* MINI_REGS */ \
{0x00004000, 0x00000000, 0x00000000 }, /* SP_REGS */ \
{0x0000FFFF, 0x00000000, 0x00000000 }, /* LOW_REGS */ \
{0xFFFFFFFF, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \
{0x00000000, 0x00000002, 0x00000000 }, /* C_REGS */ \
{0x00000000, 0x00000004, 0x00000000 }, /* HI_REG */ \
{0x00000000, 0x00000008, 0x00000000 }, /* LO_REG */ \
{0x00000000, 0x0000000c, 0x00000000 }, /* HILO_REGS */ \
{0x00000000, 0xFFF00000, 0x0000000F }, /* V_REGS */ \
{0x00000000, 0x00000000, 0x00000040 }, /* OTHER_REGS */ \
{0x00000000, 0x0FF00001, 0x00000030 }, /* RESERVE_REGS */ \
{0xFFFFFFFF, 0xFFFFFFFF, 0x0000007F }, /* ALL_REGS */ \
}
/* Return register class from regno. */
extern enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
#define REGNO_REG_CLASS(REGNO) regno_reg_class[REGNO]
/* The class value for index registers, and the one for base regs. */
#define INDEX_REG_CLASS (CSKY_ISA_FEATURE (2E3) ? GENERAL_REGS : NO_REGS)
#define BASE_REG_CLASS GENERAL_REGS
/* TODO is it necessary to set it to MINI_REGS to emit more 16-bit
instructions? */
#define MODE_BASE_REG_CLASS(MODE) GENERAL_REGS
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
and check its validity for a certain class.
We have two alternate definitions for each of them.
The usual definition accepts all pseudo regs; the other rejects
them unless they have been allocated suitable hard regs.
The symbol REG_OK_STRICT causes the latter definition to be used.
Most source files want to accept pseudo regs in the hope that
they will get allocated to the class that the insn wants them to be in.
Source files for reload pass need to be strict.
After reload, it makes no difference, since pseudo regs have
been eliminated by then.
The reg_renumber is used to map pseudo regs into hardware
regs, it is set up as a result of register allocation. */
#ifdef REG_OK_STRICT
#define REGNO_OK_FOR_BASE_P(REGNO) \
(CSKY_GENERAL_REGNO_P (REGNO) \
|| CSKY_GENERAL_REGNO_P (reg_renumber[(REGNO)]) )
#else
#define REGNO_OK_FOR_BASE_P(REGNO) \
(CSKY_GENERAL_REGNO_P (REGNO) \
|| (REGNO) >= FIRST_PSEUDO_REGISTER)
#endif
#ifdef REG_OK_STRICT
#define REGNO_OK_FOR_INDEX_P(REGNO) \
(CSKY_GENERAL_REGNO_P (REGNO) \
|| CSKY_GENERAL_REGNO_P (reg_renumber[(REGNO)]) )
#else
#define REGNO_OK_FOR_INDEX_P(REGNO) \
(CSKY_GENERAL_REGNO_P (REGNO) \
|| (REGNO) >= FIRST_PSEUDO_REGISTER)
#endif
/******************************************************************
* Addressing Modes *
******************************************************************/
/* Recognize any constant value that is a valid address. */
#define CONSTANT_ADDRESS_P(X) \
(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF)
/* Maximum number of registers that can appear in a valid memory address.
Shifts in addresses can't be by a register. */
#define MAX_REGS_PER_ADDRESS 2
/******************************************************************
* Run-time Target *
******************************************************************/
#define TARGET_CPU_CPP_BUILTINS() \
csky_cpu_cpp_builtins (pfile)
/******************************************************************
* Per-function Data *
******************************************************************/
/* Initialize data used by insn expanders. This is called from insn_emit,
once for every function before code is generated. */
#define INIT_EXPANDERS csky_init_expanders ()
/******************************************************************
* Dividing the Output into Sections (Texts, Data, . . . ) *
******************************************************************/
/* Switch to the text or data segment. */
#define TEXT_SECTION_ASM_OP "\t.text"
#define DATA_SECTION_ASM_OP "\t.data"
/* The subroutine calls in the .init and .fini sections create literal
pools which must be jumped around... */
#define FORCE_CODE_SECTION_ALIGN \
asm ("br 1f ; .literals ; .align 2 ; 1:");
/* Define this macro to be an expression with a nonzero value if
jump tables (for tablejump insns) should be output in the text section,
along with the assembler instructions. */
#define JUMP_TABLES_IN_TEXT_SECTION TARGET_CASESI
/******************************************************************
* Assembler Format *
******************************************************************/
/* A C string constant for text to be output before(after) each asm
statement or group of consecutive ones. */
#undef ASM_APP_ON
#define ASM_APP_ON "// inline asm begin\n"
#undef ASM_APP_OFF
#define ASM_APP_OFF "// inline asm end\n"
/* A C string constant describing how to begin a comment in the target
assembler language. */
#define ASM_COMMENT_START "\t//"
/* This says how to output an assembler line
to define a global common symbol, with alignment information. */
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN) \
do \
{ \
fputs ("\t.comm\t", STREAM); \
assemble_name (STREAM, NAME); \
fprintf (STREAM, ",%lu, %u\n", (unsigned long)(SIZE), \
(ALIGN) / BITS_PER_UNIT); \
} \
while (0)
/* Define a local common symbol whose alignment we wish to specify.
ALIGN comes in as bits, we have to turn it into bytes. */
#undef ASM_OUTPUT_ALIGNED_LOCAL
#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
do \
{ \
fputs ("\t.bss\t", (STREAM)); \
assemble_name ((STREAM), (NAME)); \
fprintf ((STREAM), ",%d, %d\n", (int)(SIZE), \
(ALIGN) / BITS_PER_UNIT); \
} \
while (0)
/* Globalizing directive for a label. */
#define GLOBAL_ASM_OP "\t.global\t"
/* Output a reference to a label. */
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
fprintf (STREAM, "%s%s", user_label_prefix, \
(* targetm.strip_name_encoding) (NAME))
/* Make an internal label into a string. */
#undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
sprintf (STRING, "*.%s%ld", PREFIX, (long) NUM)
/* This is how to output an insn to push a register on the stack.
It need not be very fast code. */
#define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \
fprintf (STREAM, "\tsubi\t %s,%d\n\tst.w\t %s,(%s)\n", \
reg_names[STACK_POINTER_REGNUM], \
(STACK_BOUNDARY / BITS_PER_UNIT), \
reg_names[REGNO], \
reg_names[STACK_POINTER_REGNUM])
/* This is how to output an insn to pop a register from the stack. */
#define ASM_OUTPUT_REG_POP(STREAM,REGNO) \
fprintf (STREAM, "\tld.w\t %s,(%s)\n\taddi\t %s,%d\n", \
reg_names[REGNO], \
reg_names[STACK_POINTER_REGNUM], \
reg_names[STACK_POINTER_REGNUM], \
(STACK_BOUNDARY / BITS_PER_UNIT))
/* Output an element of a dispatch table. */
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \
fprintf (STREAM, "\t.long\t.L%d\n", VALUE)
/* This is how to output an assembler line
that says to advance the location counter by SIZE bytes. */
#undef ASM_OUTPUT_SKIP
#define ASM_OUTPUT_SKIP(STREAM,SIZE) \
fprintf (STREAM, "\t.fill %d, 1\n", (int)(SIZE))
/* Align output to a power of two. Note ".align 0" is redundant,
and also GAS will treat it as ".align 2" which we do not want. */
#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
do \
{ \
if ((POWER) > 0) \
fprintf (STREAM, "\t.align\t%d\n", POWER); \
} \
while (0)
/******************************************************************
* Controlling the Compilation Driver *
******************************************************************/
/* Define this macro as a C expression for the initializer of an
array of string to tell the driver program which options are
defaults for this target and thus do not need to be handled
specially when using MULTILIB_OPTIONS. */
#undef MULTILIB_DEFAULTS
#define MULTILIB_DEFAULTS \
{"mlittle-endian", "mcpu=ck810f", "msoft-float"}
/* Support for a compile-time default CPU, et cetera. The rules are:
--with-arch is ignored if -march or -mcpu are specified.
--with-cpu is ignored if -march or -mcpu are specified, and is overridden
by --with-arch. */
#define OPTION_DEFAULT_SPECS \
{"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
{"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
{"endian", "%{!mbig-endian:%{!mlittle-endian:-m%(VALUE)-endian}}" }, \
{"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" },
/******************************************************************
* Position Independent Code *
******************************************************************/
/* Define the global table register. */
#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? CSKY_GB_REGNUM : INVALID_REGNUM)
/* Nonzero if x is a legitimate immediate operand on the target machine
when generating position-independent code. */
#define LEGITIMATE_PIC_OPERAND_P(X) \
csky_legitimate_pic_operand_p (X)
/******************************************************************
* Controlling Debugging Information Format *
******************************************************************/
/* Define this macro if GCC should produce dwarf version 2 format debugging
output in response to the `-g' option. */
#define DWARF2_DEBUGGING_INFO 1
/* Define this macro to 0 if your target supports DWARF 2 frame unwind
information, but it does not yet work with exception handling. */
#define DWARF2_UNWIND_INFO 1
/* Define this if you have arranged for GCC to support
more than one format of debugging output.
The value of this macro only affects the default debugging output. */
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
/* Define this macro if the target’s representation
for dwarf registers used in .eh_frame or .debug_frame
is different from that used in other debug info sections.
Given a GCC hard register number,
this macro should return the .eh_frame register number.*/
#define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
/* If INCOMING_RETURN_ADDR_RTX is defined & the RTL is REG,
define DWARF_FRAME_RETURN_COLUMN to DWARF_FRAME_REGNUM. */
#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (CSKY_LR_REGNUM)
/* Use r0 and r1 to pass exception handling information. */
#define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? N : INVALID_REGNUM)
/* How to renumber registers for dbx and gdb. */
extern const int csky_dbx_regno[];
#define DBX_REGISTER_NUMBER(REGNO) ((unsigned int) csky_dbx_regno[REGNO])
/******************************************************************
* Miscellaneous Parameters *
******************************************************************/
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction. */
#define CASE_VECTOR_MODE SImode
/* Define if operations between registers always perform the operation
on the full register even if a narrower mode is specified. */
#define WORD_REGISTER_OPERATIONS 1
/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
will either zero-extend or sign-extend. The value of this macro should
be the code that says which one of the two operations is implicitly
done, UNKNOWN if none. */
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
/* Max number of bytes we can move from memory to memory
in one reasonably fast instruction. */
#define MOVE_MAX 4
/* Shift counts are truncated to 6-bits (0 to 63) instead of the expected
5-bits, so we can not define SHIFT_COUNT_TRUNCATED to true for this
target. */
#define SHIFT_COUNT_TRUNCATED 0
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
/* The machine modes of pointers and functions. */
#define Pmode SImode
#define FUNCTION_MODE Pmode
/* Define this macro to be a C expression to indicate when jump-tables
should contain relative addresses. */
#define CASE_VECTOR_PC_RELATIVE \
(optimize_size && TARGET_CONSTANT_POOL \
&& (CSKY_TARGET_ARCH (CK802) || CSKY_TARGET_ARCH (CK801)))
/* Return the preferred mode for an addr_diff_vec when the minimum
and maximum offset are known. */
#define CASE_VECTOR_SHORTEN_MODE(min, max, body) \
(min >= 0 && max < 512 \
? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 1, QImode) \
: min >= -256 && max < 256 \
? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 0, QImode) \
: min >= 0 && max < 8192 \
? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 1, HImode) \
: min >= -4096 && max < 4096 \
? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 0, HImode) \
: SImode)
/* This is how to output an element of a case-vector that is relative. */
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
do \
{ \
if (optimize_size && TARGET_CONSTANT_POOL \
&& (CSKY_TARGET_ARCH (CK802) || CSKY_TARGET_ARCH (CK801))) \
{ \
switch (GET_MODE (BODY)) \
{ \
case E_QImode: \
asm_fprintf (STREAM, "\t.byte\t(.L%d-.L%d)/2\n", \
VALUE, REL); \
break; \
case E_HImode: /* TBH */ \
asm_fprintf (STREAM, "\t.short\t(.L%d-.L%d)/2\n", \
VALUE, REL); \
break; \
case E_SImode: \
asm_fprintf (STREAM, "\t.long\t.L%d-.L%d\n", \
VALUE, REL); \
break; \
default: \
gcc_unreachable (); \
} \
} \
else \
asm_fprintf (STREAM, "\t.long\t.L%d@GOTOFF\n", VALUE); \
} while (0)
/* This macro is not documented yet.
But we do need it to make jump table vector aligned. */
#define ADDR_VEC_ALIGN(JUMPTABLE) 0
/* We have to undef this first to override the version from elfos.h. */
#undef ASM_OUTPUT_CASE_LABEL
#define ASM_OUTPUT_CASE_LABEL(stream, prefix, num, table) \
do \
{ \
if (GET_MODE (PATTERN (table)) == SImode) \
ASM_OUTPUT_ALIGN (stream, 2); \
(*targetm.asm_out.internal_label) (stream, prefix, num); \
} while (0)
/* Make sure subsequent insns are aligned after a byte-sized jump offset
table. */
#define ASM_OUTPUT_CASE_END(stream, num, table) \
do \
{ \
if (GET_MODE (PATTERN (table)) == QImode) \
ASM_OUTPUT_ALIGN (stream, 1); \
} while (0)
/******************************************************************
* Trampolines for Nested Functions *
******************************************************************/
/* Length in units of the trampoline for entering a nested function. */
#define TRAMPOLINE_SIZE (CSKY_ISA_FEATURE (2E3) ? 16 : 20)
/* Alignment required for a trampoline in bits. */
#define TRAMPOLINE_ALIGNMENT 32
/******************************************************************
* Describing Relative Costs of Operations *
******************************************************************/
/* Nonzero if access to memory by bytes is slow and undesirable.
For RISC chips, it means that access to memory by bytes is no
better than access by words when possible, so grab a whole word
and maybe make use of that. */
#define SLOW_BYTE_ACCESS 0
/* On C-SKY, function CSE would allow use of 16-bit jsr instructions
instead of normal 32-bit calls. But it also needs a separate constant
pool entry for the function address and an instruction to load it, and
may cause additional spills due to increased register pressure, etc.
It doesn't seem like a good idea overall. */
#define NO_FUNCTION_CSE 1
/* Try to generate sequences that don't involve branches, we can then use
conditional instructions. */
#define BRANCH_COST(speed_p, predictable_p) \
csky_default_branch_cost (speed_p, predictable_p)
/* False if short circuit operation is preferred. */
#define LOGICAL_OP_NON_SHORT_CIRCUIT \
(csky_default_logical_op_non_short_circuit ())
/******************************************************************
* Generating Code for Profiling *
******************************************************************/
#define FUNCTION_PROFILER(FILE, LABELNO)
#endif /* GCC_CSKY_H */
This source diff could not be displayed because it is too large. You can view the blob instead.
;; Command-line options for the C-SKY back end.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/csky/csky_opts.h
;; Architecture/CPU options.
;; Normal CPU and arch enums are loaded from csky_tables.opt.
; For backward compatibility only.
march=ck803s
Target Report Var(flag_arch_ck803s) Undocumented
march=
Target RejectNegative ToLower Joined Enum(csky_arch) Var(csky_arch_option) Save
Specify the target architecture.
mcpu=
Target RejectNegative ToLower Joined Enum(csky_processor_type) Var(csky_cpu_option) Init(TARGET_CPU_csky_none) Save
Specify the target processor.
;; Endianness options.
mbig-endian
Target RejectNegative Report Mask(BIG_ENDIAN)
Generate big-endian code.
EB
Target RejectNegative Report Alias(mbig-endian) Undocumented
mlittle-endian
Target RejectNegative Report InverseMask(BIG_ENDIAN)
Generate little-endian code.
EL
Target RejectNegative Report Alias(mlittle-endian) Undocumented
;; Floating point options. These affect code generation but not
;; assembly.
mhard-float
Target Report RejectNegative Mask(HARD_FLOAT)
Enable hardware floating-point instructions.
msoft-float
Target Report RejectNegative InverseMask(HARD_FLOAT)
Use library calls to perform floating-point operations (default).
mfpu=
Target RejectNegative Joined Enum(csky_fpu) Var(csky_fpu_index) Init(TARGET_FPU_auto) Save
Specify the target floating-point hardware/format.
mdouble-float
Target Report Var(TARGET_DOUBLE_FLOAT) Init(-1)
Generate C-SKY FPU double float instructions (default for hard float).
mfdivdu
Target Report Var(TARGET_FDIVDU) Init(-1)
Generate frecipd/fsqrtd/fdivd instructions (default for hard float).
;; Instruction set extensions. Most of these don't affect code
;; generation, and are passed through to the assembler.
;; There are builtin preprocessor defines for each of these.
melrw
Target Report Var(TARGET_ELRW) Init(-1)
Enable the extended LRW instruction (default for CK801).
mistack
Target Report Mask(ISTACK)
Enable interrupt stack instructions.
mmp
Target Report RejectNegative Mask(MP)
Enable multiprocessor instructions.
mcp
Target Report RejectNegative Mask(CP)
Enable coprocessor instructions.
mcache
Target Report RejectNegative Mask(CACHE)
Enable cache prefetch instructions.
msecurity
Target Report RejectNegative Mask(SECURITY)
Enable C-SKY SECURE instructions.
mmac
Target Report RejectNegative Alias(msecurity) Undocumented
mtrust
Target Report RejectNegative Mask(TRUST)
Enable C-SKY TRUST instructions.
mdsp
Target Report RejectNegative Var(TARGET_DSP)
Enable C-SKY DSP instructions.
medsp
Target Report RejectNegative Mask(EDSP)
Enable C-SKY Enhanced DSP instructions.
mvdsp
Target Report RejectNegative Mask(VDSP)
Enable C-SKY Vector DSP instructions.
;; Code generation options not passed to the assembler.
mdiv
Target Report Var(TARGET_DIV) Init(-1)
Generate divide instructions.
msmart
Target Report Var(TARGET_MINI_REGISTERS) Init(-1)
Generate code for Smart Mode.
mhigh-registers
Target Report Var(TARGET_HIGH_REGISTERS) Init(-1)
Enable use of R16-R31 (default).
manchor
Target Report Var(TARGET_ANCHOR)
Generate code using global anchor symbol addresses.
mpushpop
Target Report Var(TARGET_PUSHPOP) Init(1)
Generate push/pop instructions (default).
mmultiple-stld
Target Report Var(TARGET_MULTIPLE_STLD) Init(-1)
Generate stm/ldm instructions (default).
mstm
Target Report Alias(mmultiple-stld) Undocumented
mconstpool
Target Report Var(TARGET_CONSTANT_POOL) Init(-1)
Generate constant pools in the compiler instead of assembler.
mstack-size
Target Report Var(TARGET_STACK_SIZE) Init(0)
Emit .stack_size directives.
mccrt
Target Report Var(TARGET_LIBCCRT) Init(0)
Generate code for C-SKY compiler runtime instead of libgcc.
mbranch-cost=
Target Report Joined RejectNegative UInteger Var(csky_branch_cost) Init(1)
Set the branch costs to roughly the specified number of instructions.
msched-prolog
Target Report Var(flag_sched_prolog) Init(0)
Permit scheduling of function prologue and epilogue sequences.
/* Architecture and core descriptions for the C-SKY back end.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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/>. */
/* Before using #include to read this file, define a macro:
CSKY_ARCH(NAME, CORE, ARCH, ISA)
The NAME is the name of the architecture, represented as a string
constant. The CORE is the identifier for a core representative of
this architecture. ARCH is the architecture revision. ISA is the
detailed architectural capabilities of the core. */
#ifdef CSKY_ARCH
CSKY_ARCH ("ck801", ck801, CK801,
CSKY_ISA_FEAT (CSKY_ISA_CK801))
CSKY_ARCH ("ck802", ck802, CK802,
CSKY_ISA_FEAT (CSKY_ISA_CK802))
CSKY_ARCH ("ck803", ck803, CK803,
CSKY_ISA_FEAT (CSKY_ISA_CK803))
CSKY_ARCH ("ck807", ck807, CK807,
CSKY_ISA_FEAT (CSKY_ISA_CK807) CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_ARCH ("ck810", ck810, CK810,
CSKY_ISA_FEAT (CSKY_ISA_CK810) CSKY_ISA_FEAT (CSKY_ISA_DSP))
#endif
/* Before using #include to read this file, define a macro:
CSKY_CORE(CORE_NAME, INTERNAL_IDENT, TUNE_IDENT, ARCH, ISA)
The isa features of core will inherit the ARCH.
The CORE_NAME is the name of the core, represented as a string constant.
The INTERNAL_IDENT is the name of the core represented as an identifier.
This must be unique for each entry in this table.
The TUNE_IDENT is the name of the core for which scheduling decisions
should be made, represented as an identifier.
The ARCH is the architecture revision implemented by the chip.
The ISA is the detailed architectural capabilities of the core. */
#ifdef CSKY_CORE
/* ck801 Architecture Processors */
CSKY_CORE ("ck801", ck801, ck801, CK801,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck801t", ck801t, ck801t, CK801,
CSKY_ISA_FEAT_NONE)
/* ck802 Architecture Processors */
CSKY_CORE ("ck802", ck802, ck802, CK802,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck802t", ck802t, ck802t, CK802,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck802j", ck802j, ck802j, CK802,
CSKY_ISA_FEAT (isa_bit_java))
/* ck803 Architecture Processors */
CSKY_CORE ("ck803", ck803, ck803, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803h", ck803h, ck803h, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803t", ck803t, ck803t, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803ht", ck803ht, ck803ht, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803f", ck803f, ck803f, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803fh", ck803fh, ck803fh, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803e", ck803e, ck803e, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803eh", ck803eh, ck803eh, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803et", ck803et, ck803et, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803eht", ck803eht, ck803eht, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803ef", ck803ef, ck803ef, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803efh", ck803efh, ck803efh, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803ft", ck803ft, ck803ft, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803eft", ck803eft, ck803eft, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803efht", ck803efht, ck803efht, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803r1", ck803r1, ck803r1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803hr1", ck803hr1, ck803hr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803tr1", ck803tr1, ck803tr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803htr1", ck803htr1, ck803htr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803fr1", ck803fr1, ck803fr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803fhr1", ck803fhr1, ck803fhr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803er1", ck803er1, ck803er1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803ehr1", ck803ehr1, ck803ehr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803etr1", ck803etr1, ck803etr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803ehtr1", ck803ehtr1, ck803ehtr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803efr1", ck803efr1, ck803efr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803efhr1", ck803efhr1, ck803efhr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803ftr1", ck803ftr1, ck803ftr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803eftr1", ck803eftr1, ck803eftr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
CSKY_CORE ("ck803efhtr1", ck803efhtr1, ck803efhtr1, CK803,
CSKY_ISA_FEAT (isa_bit_3E3r1))
/* ck803s Architecture Processors */
CSKY_CORE ("ck803s", ck803s, ck803s, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803st", ck803st, ck803st, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803se", ck803se, ck803se, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803sf", ck803sf, ck803sf, CK803,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck803sef", ck803sef, ck803sef, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
CSKY_CORE ("ck803seft", ck803seft, ck803seft, CK803,
CSKY_ISA_FEAT (CSKY_ISA_DSP))
/* ck807 Architecture Processors */
CSKY_CORE ("ck807e", ck807e, ck807e, CK807,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck807ef", ck807ef, ck807ef, CK807,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck807", ck807, ck807, CK807,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck807f", ck807f, ck807f, CK807,
CSKY_ISA_FEAT_NONE)
/* ck810 Architecture Processors */
CSKY_CORE ("ck810e", ck810e, ck810e, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810et", ck810et, ck810et, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810ef", ck810ef, ck810ef, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810eft", ck810eft, ck810eft, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810", ck810, ck810, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810v", ck810v, ck810v, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810f", ck810f, ck810f, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810t", ck810t, ck810t, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810fv", ck810fv, ck810fv, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810tv", ck810tv, ck810tv, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810ft", ck810ff, ck810ft, CK810,
CSKY_ISA_FEAT_NONE)
CSKY_CORE ("ck810ftv", ck810ftv, ck810ftv, CK810,
CSKY_ISA_FEAT_NONE)
#endif
/* Before using #include to read this file, define a macro:
CSKY_FPU(NAME, CNAME, ISA)
NAME is the publicly visible option name.
CNAME is a C-compatible variable name substring.
ISA is the list of feature bits that this FPU provides. */
#ifdef CSKY_FPU
CSKY_FPU ("fpv2_sf", fpv2_sf, CSKY_ISA_FEAT (CSKY_ISA_FPv2_SF))
CSKY_FPU ("fpv2", fpv2, CSKY_ISA_FEAT (CSKY_ISA_FPv2))
CSKY_FPU ("fpv2_divd", fpv2_divd, CSKY_ISA_FEAT (CSKY_ISA_FPv2_DIVD))
#endif
#!/bin/sh
# Generate csky_tables.opt from the lists in *.def.
# Copyright (C) 2018 Free Software Foundation, Inc.
# Contributed by C-SKY Microsystems and Mentor Graphics.
#
# 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/>.
cat <<EOF
; -*- buffer-read-only: t -*-
; Generated automatically by csky_genopt.sh from csky_cores.def.
; Copyright (C) 2018 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/>.
Enum
Name(csky_processor_type) Type(enum csky_processor_type)
Known CSKY CPUs (for use with the -mcpu= options):
EOF
awk -F'[(, ]+' '/^CSKY_CORE/ {
name = $2
enum = $3
gsub("\"", "", name)
print "EnumValue"
print "Enum(csky_processor_type) String(" name ") Value( TARGET_CPU_" enum ")"
print ""
}' $1/csky_cores.def
cat <<EOF
Enum
Name(csky_arch) Type(int)
Known CSKY architectures (for use with the -march= option):
EOF
awk -F'[(, ]+' 'BEGIN {
value = 0
}
/^CSKY_ARCH/ {
name = $2
gsub("\"", "", name)
print "EnumValue"
print "Enum(csky_arch) String(" name ") Value(" value ")"
print ""
value++
}' $1/csky_cores.def
cat <<EOF
Enum
Name(csky_fpu) Type(enum csky_fpu_type)
Known CSKY FPUs (for use with the -mfpu= option):
EOF
awk -F'[(, ]+' '
/^CSKY_FPU/ {
name = $2
enum = $3
gsub("\"", "", name)
print "EnumValue"
print "Enum(csky_fpu) String(" name ") Value(TARGET_FPU_" enum ")"
print ""
}
END {
print "EnumValue"
print "Enum(csky_fpu) String(auto) Value(TARGET_FPU_auto)"
}' $1/csky_cores.def
;; C-SKY DSP instruction descriptions.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/>. */
;; ------------------------------------------------------------
;; DSP insns
;; ------------------------------------------------------------
(define_insn "mulsidi3"
[(set (match_operand:DI 0 "register_operand" "=y")
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
(sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
"TARGET_DSP"
"muls\t%1, %2"
)
(define_insn "umulsidi3"
[(set (match_operand:DI 0 "register_operand" "=y")
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
(zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
"TARGET_DSP"
"mulu\t%1, %2"
)
(define_insn "maddsidi4"
[(set (match_operand:DI 0 "register_operand" "=y")
(plus:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
(sign_extend:DI (match_operand:SI 2 "register_operand" "r")))
(match_operand:DI 3 "register_operand" "0")))]
"TARGET_DSP"
"mulsa\t%1, %2"
)
(define_insn "umaddsidi4"
[(set (match_operand:DI 0 "register_operand" "=y")
(plus:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
(zero_extend:DI (match_operand:SI 2 "register_operand" "r")))
(match_operand:DI 3 "register_operand" "0")))]
"TARGET_DSP"
"mulua\t%1, %2"
)
(define_insn "msubsidi4"
[(set (match_operand:DI 0 "register_operand" "=y")
(minus:DI (match_operand:DI 3 "register_operand" "0")
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
(sign_extend:DI (match_operand:SI 2 "register_operand" "r")))))]
"TARGET_DSP"
"mulss\t%1, %2"
)
(define_insn "umsubsidi4"
[(set (match_operand:DI 0 "register_operand" "=y")
(minus:DI (match_operand:DI 3 "register_operand" "0")
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
(zero_extend:DI (match_operand:SI 2 "register_operand" "r")))))]
"TARGET_DSP"
"mulus\t%1, %2"
)
(define_insn "*mulall_s16_0"
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (match_operand:SI 3 "register_operand" " 0")
(mult:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r"))))]
"CSKY_ISA_FEATURE (3E3r1)"
"mula.32.l\t%0, %1, %2"
[(set_attr "type" "alu")
(set_attr "length" "4")])
(define_insn "*mulall_s16_1"
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (mult:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r"))
(match_operand:SI 3 "register_operand" " 0")))]
"CSKY_ISA_FEATURE (3E3r1)"
"mula.32.l\t%0, %1, %2"
[(set_attr "type" "alu")
(set_attr "length" "4")])
;; C-SKY FPU instruction descriptions.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/>. */
;; -------------------------------------------------------------------------
;; Float Abs instructions
;; -------------------------------------------------------------------------
(define_insn "abssf2"
[(set (match_operand:SF 0 "register_operand" "=v,r")
(abs:SF (match_operand:SF 1 "register_operand" "v, r")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"@
fabss\t%0, %1
bclri\t%0, %1, 31")
(define_insn "absdf2"
[(set (match_operand:DF 0 "register_operand" "=v")
(abs:DF (match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fabsd\t%0, %1")
;; -------------------------------------------------------------------------
;; Float Neg instructions
;; -------------------------------------------------------------------------
(define_insn "negsf2"
[(set (match_operand:SF 0 "register_operand" "=v")
(neg:SF (match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fnegs\t%0, %1")
(define_insn "negdf2"
[(set (match_operand:DF 0 "register_operand" "=v")
(neg:DF (match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fnegd\t%0, %1")
;; -------------------------------------------------------------------------
;; Float Sqrt instructions
;; -------------------------------------------------------------------------
(define_insn "sqrtsf2"
[(set (match_operand:SF 0 "register_operand" "=v")
(sqrt:SF (match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fsqrts\t%0, %1")
(define_insn "sqrtdf2"
[(set (match_operand:DF 0 "register_operand" "=v")
(sqrt:DF (match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_divd)"
"fsqrtd\t%0, %1")
;; -------------------------------------------------------------------------
;; Float Add instructions
;; -------------------------------------------------------------------------
(define_insn "addsf3"
[(set (match_operand:SF 0 "register_operand" "=v")
(plus:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fadds\t%0, %1, %2")
(define_insn "adddf3"
[(set (match_operand:DF 0 "register_operand" "=v")
(plus:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"faddd\t%0, %1, %2")
;; -------------------------------------------------------------------------
;; Float Sub instructions
;; -------------------------------------------------------------------------
(define_insn "subsf3"
[(set (match_operand:SF 0 "register_operand" "=v")
(minus:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fsubs\t%0, %1, %2")
(define_insn "subdf3"
[(set (match_operand:DF 0 "register_operand" "=v")
(minus:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fsubd\t%0, %1, %2")
;; -------------------------------------------------------------------------
;; Float Mul instructions
;; -------------------------------------------------------------------------
(define_insn "mulsf3"
[(set (match_operand:SF 0 "register_operand" "=v")
(mult:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fmuls\t%0, %1, %2")
(define_insn "muldf3"
[(set (match_operand:DF 0 "register_operand" "=v")
(mult:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fmuld\t%0, %1, %2")
(define_insn "*fpuv2_nmulsf3_1"
[(set (match_operand:SF 0 "register_operand" "=v")
(mult:SF (neg:SF (match_operand:SF 1 "register_operand" "%v"))
(match_operand:SF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fnmuls\t%0, %1, %2")
(define_insn "*fpuv2_nmulsf3_2"
[(set (match_operand:SF 0 "register_operand" "=v")
(neg:SF (mult:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v"))))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fnmuls\t%0, %1, %2")
(define_insn "*fpuv2_nmuldf3_1"
[(set (match_operand:DF 0 "register_operand" "=v")
(mult:DF (neg:DF (match_operand:DF 1 "register_operand" "%v"))
(match_operand:DF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fnmuld\t%0, %1, %2")
(define_insn "*fpuv2_nmuldf3_2"
[(set (match_operand:DF 0 "register_operand" "=v")
(neg:DF (mult:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v"))))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fnmuld\t%0, %1, %2")
;; -------------------------------------------------------------------------
;; Float Div instructions
;; -------------------------------------------------------------------------
(define_expand "divsf3"
[(set (match_operand:SF 0 "register_operand" "")
(div:SF (match_operand:SF 1 "csky_arith_float1_operand" "")
(match_operand:SF 2 "register_operand" "")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"")
(define_insn "*fpuv2_divsf3"
[(set (match_operand:SF 0 "register_operand" "=v")
(div:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fdivs\t%0, %1, %2")
(define_insn "*fpuv2_1_divsf3"
[(set (match_operand:SF 0 "register_operand" "=v")
(div:SF (match_operand:SF 1 "csky_const_float1_operand" "i")
(match_operand:SF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"frecips\t%0, %2")
(define_expand "divdf3"
[(set (match_operand:DF 0 "register_operand" "")
(div:DF (match_operand:DF 1 "csky_arith_float1_operand" "")
(match_operand:DF 2 "register_operand" "")))]
"CSKY_ISA_FEATURE (fpv2_divd)"
"")
(define_insn "*fpuv2_divdf3"
[(set (match_operand:DF 0 "register_operand" "=v")
(div:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_divd)"
"fdivd\t%0, %1, %2")
(define_insn "*fpuv2_1_divdf3"
[(set (match_operand:DF 0 "register_operand" "=v")
(div:DF (match_operand:DF 1 "csky_const_float1_operand" "i")
(match_operand:DF 2 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_divd)"
"frecipd\t%0, %2")
;; -------------------------------------------------------------------------
;; Float add(sub) with mult instructions
;; -------------------------------------------------------------------------
;; vrz <= vrz + vrx * vry
(define_insn "*fpuv2_fmacs"
[(set (match_operand:SF 0 "register_operand" "=v")
(plus:SF (mult:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v"))
(match_operand:SF 3 "register_operand" "0")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fmacs\t%0, %1, %2")
(define_insn "*fpuv2_fmacd"
[(set (match_operand:DF 0 "register_operand" "=v")
(plus:DF (mult:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v"))
(match_operand:DF 3 "register_operand" "0")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fmacd\t%0, %1, %2")
;; vrz <= vrz - vrx * vry
(define_insn "*fpuv2_fnmacs"
[(set (match_operand:SF 0 "register_operand" "=v")
(minus:SF (match_operand:SF 1 "register_operand" "0")
(mult:SF (match_operand:SF 2 "register_operand" "v")
(match_operand:SF 3 "register_operand" "v"))))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fnmacs\t%0, %2, %3")
(define_insn "*fpuv2_fnmacd"
[(set (match_operand:DF 0 "register_operand" "=v")
(minus:DF (match_operand:DF 1 "register_operand" "0")
(mult:DF (match_operand:DF 2 "register_operand" "v")
(match_operand:DF 3 "register_operand" "v"))))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fnmacd\t%0, %2, %3")
;; vrz <= vrx * vry - vrz
(define_insn "*fpuv2_fmscs"
[(set (match_operand:SF 0 "register_operand" "=v")
(minus:SF (mult:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v"))
(match_operand:SF 3 "register_operand" "0")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fmscs\t%0, %1, %2")
(define_insn "*fpuv2_fmscd"
[(set (match_operand:DF 0 "register_operand" "=v")
(minus:DF (mult:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v"))
(match_operand:DF 3 "register_operand" "0")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fmscd\t%0, %1, %2")
;; vrz = - (vrz + vrx * vry)
(define_insn "*fpuv2_fnmscs_1"
[(set (match_operand:SF 0 "register_operand" "=v")
(minus:SF (mult:SF (neg:SF (match_operand:SF 1 "register_operand" "%v"))
(match_operand:SF 2 "register_operand" "v"))
(match_operand:SF 3 "register_operand" "0")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fnmscs\t%0, %1, %2")
(define_insn "*fpuv2_fnmscs_2"
[(set (match_operand:SF 0 "register_operand" "=v")
(neg:SF (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "v")
(match_operand:SF 2 "register_operand" "v"))
(match_operand:SF 3 "register_operand" "0"))))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fnmscs\t%0, %1, %2")
(define_insn "*fpuv2_fnmscd_1"
[(set (match_operand:DF 0 "register_operand" "=v")
(minus:DF (mult:DF (neg:DF (match_operand:DF 1 "register_operand" "%v"))
(match_operand:DF 2 "register_operand" "v"))
(match_operand:DF 3 "register_operand" "0")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fnmscd\t%0, %1, %2")
(define_insn "*fpuv2_fnmscd_2"
[(set (match_operand:DF 0 "register_operand" "=v")
(neg:DF (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "v")
(match_operand:DF 2 "register_operand" "v"))
(match_operand:DF 3 "register_operand" "0"))))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fnmscd\t%0, %1, %2")
;; -------------------------------------------------------------------------
;; Float compare instructions
;; -------------------------------------------------------------------------
(define_expand "cbranchsf4"
[(set (pc) (if_then_else (match_operator 0 "csky_float_comparison_operator"
[(match_operand:SF 1 "register_operand")
(match_operand:SF 2 "csky_compare_operand_float")])
(label_ref (match_operand 3 ""))
(pc)))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"
{
enum rtx_code code = GET_CODE (operands[0]);
bool invert = csky_emit_compare_float (code, operands[1], operands[2]);
if (invert)
emit_jump_insn (gen_csky_jbf (operands[3]));
else
emit_jump_insn (gen_csky_jbt (operands[3]));
DONE;
}")
(define_insn "*fpuv2_unordered"
[(set (reg:CC 33) (unordered:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmpuos\t%0, %1")
(define_insn "*fpuv2_unordered_zero"
[(set (reg:CC 33) (unordered:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "csky_const_float0_operand" "i")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmpuos\t%0, %0")
(define_insn "*fpuv2_ne"
[(set (reg:CC 33) (ne:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmpnes\t%0, %1")
(define_insn "*fpuv2_gt"
[(set (reg:CC 33) (gt:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmplts\t%1, %0")
(define_insn "*fpuv2_ge"
[(set (reg:CC 33) (ge:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmphss\t%0, %1")
(define_insn "*fpuv2_lt"
[(set (reg:CC 33) (lt:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmplts\t%0, %1")
(define_insn "*fpuv2_le"
[(set (reg:CC 33) (le:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmphss\t%1, %0")
(define_insn "*fpuv2_gez"
[(set (reg:CC 33) (ge:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "csky_const_float0_operand" "i")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmpzhss\t%0")
(define_insn "*fpuv2_nez"
[(set (reg:CC 33) (ne:CC (match_operand:SF 0 "register_operand" "v")
(match_operand:SF 1 "csky_const_float0_operand" "i")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fcmpznes\t%0")
(define_expand "cbranchdf4"
[(set (pc) (if_then_else (match_operator 0 "csky_float_comparison_operator"
[(match_operand:DF 1 "register_operand")
(match_operand:DF 2 "csky_compare_operand_float")])
(label_ref (match_operand 3 ""))
(pc)))]
"CSKY_ISA_FEATURE (fpv2_df)"
"
{
enum rtx_code code = GET_CODE (operands[0]);
bool invert = csky_emit_compare_float (code, operands[1], operands[2]);
if (invert)
emit_jump_insn (gen_csky_jbf (operands[3]));
else
emit_jump_insn (gen_csky_jbt (operands[3]));
DONE;
}")
(define_insn "*fpuv2_dunordered"
[(set (reg:CC 33) (unordered:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpuod\t%0, %1")
(define_insn "*fpuv2_dunordered_zero"
[(set (reg:CC 33) (unordered:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "csky_const_float0_operand" "i")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpuod\t%0, %0")
(define_insn "*fpuv2_dne"
[(set (reg:CC 33) (ne:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpned\t%0, %1")
(define_insn "*fpuv2_dgt"
[(set (reg:CC 33) (gt:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpltd\t%1, %0")
(define_insn "*fpuv2_dge"
[(set (reg:CC 33) (ge:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmphsd\t%0, %1")
(define_insn "*fpuv2_dlt"
[(set (reg:CC 33) (lt:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpltd\t%0, %1")
(define_insn "*fpuv2_dle"
[(set (reg:CC 33) (le:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmphsd\t%1, %0")
(define_insn "*fpuv2_dgez"
[(set (reg:CC 33) (ge:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "csky_const_float0_operand" "i")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpzhsd\t%0")
(define_insn "*fpuv2_dnez"
[(set (reg:CC 33) (ne:CC (match_operand:DF 0 "register_operand" "v")
(match_operand:DF 1 "csky_const_float0_operand" "i")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fcmpzned\t%0")
;; -------------------------------------------------------------------------
;; Float convert instructions
;; -------------------------------------------------------------------------
;; DF <- SF
(define_insn "extendsfdf2"
[(set (match_operand:DF 0 "register_operand" "=v")
(float_extend:DF (match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fstod\t%0, %1")
;; SF <- DF
(define_insn "truncdfsf2"
[(set (match_operand:SF 0 "register_operand" "=v")
(float_truncate:SF (match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fdtos\t%0, %1")
;; SF <- SI
(define_insn "floatsisf2"
[(set (match_operand:SF 0 "register_operand" "=v")
(float:SF (match_operand:SI 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fsitos\t%0, %1")
;; DF <- SI
(define_insn "floatsidf2"
[(set (match_operand:DF 0 "register_operand" "=v")
(float:DF (match_operand:SI 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fsitod\t%0, %1")
;; SF <- unsigned SI
(define_insn "floatunssisf2"
[(set (match_operand:SF 0 "register_operand" "=v")
(unsigned_float:SF (match_operand:SI 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fuitos\t%0, %1")
;; DF <- unsigned SI
(define_insn "floatunssidf2"
[(set (match_operand:DF 0 "register_operand" "=v")
(unsigned_float:DF (match_operand:SI 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fuitod\t%0, %1")
;; SI <- SF
(define_insn "fix_truncsfsi2"
[(set (match_operand:SI 0 "register_operand" "=v")
(fix:SI (match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fstosi.rz\t%0, %1")
;; SI <- DF
(define_insn "fix_truncdfsi2"
[(set (match_operand:SI 0 "register_operand" "=v")
(fix:SI (match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fdtosi.rz\t%0, %1")
;; unsigned SI <- SF
(define_insn "fixuns_truncsfsi2"
[(set (match_operand:SI 0 "register_operand" "=v")
(unsigned_fix:SI (match_operand:SF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"fstoui.rz\t%0, %1")
;; unsigned SI <- DF
(define_insn "fixuns_truncdfsi2"
[(set (match_operand:SI 0 "register_operand" "=v")
(unsigned_fix:SI (match_operand:DF 1 "register_operand" "v")))]
"CSKY_ISA_FEATURE (fpv2_df)"
"fdtoui.rz\t%0, %1")
;; -------------------------------------------------------------------------
;; Float mov instructions
;; -------------------------------------------------------------------------
;; Note: movsf and movdf patterns are in csky.md.
;; cstore SF
(define_expand "cstoresf4"
[(set (match_operand:SI 0 "register_operand" "")
(match_operator 1 "ordered_comparison_operator"
[(match_operand:SF 2 "register_operand" "")
(match_operand:SF 3 "csky_compare_operand_float" "")]))]
"CSKY_ISA_FEATURE (fpv2_sf)"
"
{
bool invert = csky_emit_compare_float (GET_CODE (operands[1]),
operands[2], operands[3]);
if (invert)
emit_insn (gen_mvcv (operands[0]));
else
emit_insn (gen_mvc (operands[0]));
DONE;
}"
)
;; cstore DF
(define_expand "cstoredf4"
[(set (match_operand:SI 0 "register_operand" "")
(match_operator 1 "ordered_comparison_operator"
[(match_operand:DF 2 "register_operand" "")
(match_operand:DF 3 "csky_compare_operand_float" "")]))]
"CSKY_ISA_FEATURE (fpv2_df)"
"
{
bool invert = csky_emit_compare_float (GET_CODE (operands[1]),
operands[2], operands[3]);
if (invert)
emit_insn (gen_mvcv (operands[0]));
else
emit_insn (gen_mvc (operands[0]));
DONE;
}"
)
/* ISA feature descriptions for the C-SKY back end.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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/>. */
/* Before using #include to read this file, define a macro:
CSKY_ISA(CNAME, DESCRIPTION)
*/
/* Common insns */
CSKY_ISA (E1, "Extended insns for arch ck801 from base")
CSKY_ISA (E2, "Extended insns for arch ck802 from base")
CSKY_ISA (2E3, "Extended insns for arch ck803 from ck802")
CSKY_ISA (3E3r1, "Extended insns for cpu ck803n from ck803")
CSKY_ISA (3E7, "Extended insns for arch ck807 from ck803")
CSKY_ISA (7E10, "Extended insns for arch ck810 from ck807")
/* Special insns */
CSKY_ISA (div, "divide insns")
/* Extended insns */
CSKY_ISA (dsp, "Extended insns for DSP")
CSKY_ISA (java, "Extended insns for Java")
CSKY_ISA (fpv2_sf, "Single precision operations supported")
CSKY_ISA (fpv2_df, "Double precision operations supported")
CSKY_ISA (fpv2_divd, "Double precision div operations supported")
/* Specific insns mode */
#ifdef CSKY_ISA_MACRO
#define CSKY_ISA_CK801 CSKY_ISA_FEATURE_GET (E1)
#define CSKY_ISA_CK802 CSKY_ISA_FEATURE_GET (E2)
#define CSKY_ISA_CK803 CSKY_ISA_CK802, CSKY_ISA_FEATURE_GET (2E3), \
CSKY_ISA_FEATURE_GET (div)
#define CSKY_ISA_CK803R1 CSKY_ISA_CK803, CSKY_ISA_FEATURE_GET (3E3r1)
#define CSKY_ISA_CK807 CSKY_ISA_CK803, CSKY_ISA_FEATURE_GET (3E7)
#define CSKY_ISA_CK810 CSKY_ISA_CK807, CSKY_ISA_FEATURE_GET (7E10)
#define CSKY_ISA_DSP CSKY_ISA_FEATURE_GET (dsp)
#define CSKY_ISA_FPv2_SF CSKY_ISA_FEATURE_GET (fpv2_sf)
#define CSKY_ISA_FPv2 CSKY_ISA_FPv2_SF, CSKY_ISA_FEATURE_GET (fpv2_df)
#define CSKY_ISA_FPv2_DIVD CSKY_ISA_FPv2, CSKY_ISA_FEATURE_GET (fpv2_divd)
#endif
/* ISA feature enumerations for C-SKY targets.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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_CSKY_ISA_FEATURE_H
#define GCC_CSKY_ISA_FEATURE_H
#ifndef CSKY_ISA_MACRO
#define CSKY_ISA_MACRO
#endif
#define CSKY_ISA_FEATURE_DEFINE(x) isa_bit_ ## x
#define CSKY_ISA_FEATURE_GET(x) CSKY_ISA_FEATURE_DEFINE (x)
enum csky_isa_feature
{
CSKY_ISA_FEATURE_DEFINE (none),
#undef CSKY_ISA
#define CSKY_ISA(IDENT, DESC) \
CSKY_ISA_FEATURE_DEFINE (IDENT),
#include "csky_isa.def"
#undef CSKY_ISA
CSKY_ISA_FEATURE_DEFINE (max)
};
#define CSKY_ISA_FEAT(x) x,
#define CSKY_ISA_FEAT_NONE CSKY_ISA_FEAT (isa_bit_none)
#endif /* GCC_CSKY_ISA_FEATURE_H */
/* Processor and arch enumerations for C-SKY targets.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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 CSKY_OPTS_H
#define CSKY_OPTS_H
/* The various CSKY cores. */
enum csky_processor_type
{
#undef CSKY_CORE
#define CSKY_CORE(NAME, INTERNAL_IDENT, IDENT, ARCH, ISA) \
TARGET_CPU_##INTERNAL_IDENT,
#include "csky_cores.def"
#undef CSKY_CORE
/* Used to indicate that no processor has been specified. */
TARGET_CPU_csky_none
};
#define CSKY_TARGET_CORE_GET(name) TARGET_CPU_ ## name
/* The various CSKY architectures. */
enum csky_base_architecture
{
#undef CSKY_ARCH
#define CSKY_ARCH(NAME, CORE_IDENT, ARCH, ISA) \
CSKY_BASE_ARCH_##ARCH,
#include "csky_cores.def"
#undef CSKY_ARCH
CSKY_BASE_ARCH_NONE
};
#define CSKY_TARGET_ARCH_GET(name) CSKY_BASE_ARCH_ ## name
/* The various CSKY FPUs. */
enum csky_fpu_type
{
#undef CSKY_FPU
#define CSKY_FPU(NAME, CNAME, ISA) TARGET_FPU_##CNAME,
#include "csky_cores.def"
TARGET_FPU_auto
#undef CSKY_FPU
};
#define CSKY_TARGET_FPU_GET(name) TARGET_FPU_ ## name
#endif /* CSKY_OPTS_H */
;; Scheduler information for C-SKY CK801 processors.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/>. */
;; This is just a placeholder for a more accurate pipeline
;; description for CK801.
(define_automaton "ck801")
(define_cpu_unit "ck801_ex1" "ck801")
(define_cpu_unit "ck801_exit" "ck801")
(define_insn_reservation "ck801_generic" 1
(and (match_test "CSKY_TARGET_ARCH (CK801)")
(eq_attr "type" "alu,cmp,branch,cbranch,addsub,alu_ix,branch_jmp,call_jsr,call"))
"ck801_ex1+ck801_exit")
(define_insn_reservation "ck801_load" 1
(and (match_test "CSKY_TARGET_ARCH (CK801)")
(and (eq_attr "type" "load")
(match_test "!csky_minipool_load_p (insn)")))
"ck801_ex1+ck801_exit")
(define_insn_reservation "ck801_pool" 1
(and (match_test "CSKY_TARGET_ARCH (CK801)")
(and (eq_attr "type" "load")
(match_test "csky_minipool_load_p (insn)")))
"ck801_ex1+ck801_exit")
(define_insn_reservation "ck801_store" 1
(and (match_test "CSKY_TARGET_ARCH (CK801)")
(eq_attr "type" "store"))
"ck801_ex1+ck801_exit")
;; Switching between constant pool loads and loads/stores in the data section
;; carries an extra penalty.
(define_bypass 2 "ck801_load,ck801_store" "ck801_pool")
(define_bypass 2 "ck801_pool" "ck801_load,ck801_store")
;; Instruction scheduling information for C-SKY CK802 processors.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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_automaton "csky_ck802")
(define_cpu_unit "csky_ck802_ex" "csky_ck802")
(define_cpu_unit "csky_ck802_wb" "csky_ck802")
(define_insn_reservation "ck802_alu" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(eq_attr "type" "alu"))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_branch" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(eq_attr "type" "branch, branch_jmp"))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_cmp" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(eq_attr "type" "cmp"))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_cbranch" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(eq_attr "type" "cbranch"))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_call" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(eq_attr "type" "call, call_jsr"))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_load" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(and (eq_attr "type" "load")
(match_test "!csky_minipool_load_p (insn)")))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_pool" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(and (eq_attr "type" "load")
(match_test "csky_minipool_load_p (insn)")))
"csky_ck802_ex, csky_ck802_wb")
(define_insn_reservation "ck802_store" 2
(and (match_test "CSKY_TARGET_ARCH (CK802)")
(eq_attr "type" "store"))
"csky_ck802_ex, csky_ck802_wb")
;; Switching between constant pool loads and loads/stores in the data section
;; carries an extra penalty.
(define_bypass 3 "ck802_load,ck802_store" "ck802_pool")
(define_bypass 3 "ck802_pool" "ck802_load,ck802_store")
(define_bypass 1 "*" "ck802_alu")
(define_bypass 1 "*" "ck802_branch")
(define_bypass 2 "ck802_cmp" "ck802_cbranch")
;; Scheduler information for C-SKY CK803 processors.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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_automaton "ck803")
(define_cpu_unit "ck803_ex1" "ck803")
(define_cpu_unit "ck803_exit" "ck803")
(define_insn_reservation "ck803_3cycle" 1
(and (match_test "CSKY_TARGET_ARCH (CK803)")
(eq_attr "type" "alu,cmp,branch,branch_jmp,call_jsr,call"))
"ck803_ex1+ck803_exit")
(define_insn_reservation "ck803_alu1" 1
(and (match_test "CSKY_TARGET_ARCH (CK803)")
(eq_attr "type" "addsub,alu_ix"))
"ck803_ex1+ck803_exit")
(define_insn_reservation "ck803_cbranch" 1
(and (match_test "CSKY_TARGET_ARCH (CK803)")
(eq_attr "type" "cbranch"))
"ck803_ex1+ck803_exit")
(define_insn_reservation "ck803_load" 1
(and (match_test "CSKY_TARGET_ARCH (CK803)")
(and (eq_attr "type" "load")
(match_test "!csky_minipool_load_p (insn)")))
"ck803_ex1+ck803_exit")
(define_insn_reservation "ck803_pool" 1
(and (match_test "CSKY_TARGET_ARCH (CK803)")
(and (eq_attr "type" "load")
(match_test "csky_minipool_load_p (insn)")))
"ck803_ex1+ck803_exit")
(define_insn_reservation "ck803_store" 1
(and (match_test "CSKY_TARGET_ARCH (CK803)")
(eq_attr "type" "store"))
"ck803_ex1+ck803_exit")
;; Switching between constant pool loads and loads/stores in the data section
;; carries an extra penalty.
(define_bypass 2 "ck803_load,ck803_store" "ck803_pool")
(define_bypass 2 "ck803_pool" "ck803_load,ck803_store")
(define_bypass 2 "ck803_3cycle,ck803_cbranch,ck803_load,ck803_store,ck803_pool"
"ck803_cbranch")
;; Instruction scheduling information for C-SKY CK810 processors.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/>. */
;;-------------------------------------------------------------
;; Pipeline descriptions for ck810
;;-------------------------------------------------------------
(define_attr "cycle" "1,2,not_used_yet"
(const_string "1"))
(define_automaton "cskyv2_ck810")
(define_cpu_unit "pipeline_alu0" "cskyv2_ck810")
(define_insn_reservation "alu_one_cycle" 1
(and (eq_attr "cycle" "1")
(not (ior (match_test "CSKY_TARGET_ARCH (CK803)")
(match_test "CSKY_TARGET_ARCH (CK802)"))))
"pipeline_alu0")
; -*- buffer-read-only: t -*-
; Generated automatically by csky_genopt.sh from csky_cores.def.
; Copyright (C) 2018 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/>.
Enum
Name(csky_processor_type) Type(enum csky_processor_type)
Known CSKY CPUs (for use with the -mcpu= options):
EnumValue
Enum(csky_processor_type) String(ck801) Value( TARGET_CPU_ck801)
EnumValue
Enum(csky_processor_type) String(ck801t) Value( TARGET_CPU_ck801t)
EnumValue
Enum(csky_processor_type) String(ck802) Value( TARGET_CPU_ck802)
EnumValue
Enum(csky_processor_type) String(ck802t) Value( TARGET_CPU_ck802t)
EnumValue
Enum(csky_processor_type) String(ck802j) Value( TARGET_CPU_ck802j)
EnumValue
Enum(csky_processor_type) String(ck803) Value( TARGET_CPU_ck803)
EnumValue
Enum(csky_processor_type) String(ck803h) Value( TARGET_CPU_ck803h)
EnumValue
Enum(csky_processor_type) String(ck803t) Value( TARGET_CPU_ck803t)
EnumValue
Enum(csky_processor_type) String(ck803ht) Value( TARGET_CPU_ck803ht)
EnumValue
Enum(csky_processor_type) String(ck803f) Value( TARGET_CPU_ck803f)
EnumValue
Enum(csky_processor_type) String(ck803fh) Value( TARGET_CPU_ck803fh)
EnumValue
Enum(csky_processor_type) String(ck803e) Value( TARGET_CPU_ck803e)
EnumValue
Enum(csky_processor_type) String(ck803eh) Value( TARGET_CPU_ck803eh)
EnumValue
Enum(csky_processor_type) String(ck803et) Value( TARGET_CPU_ck803et)
EnumValue
Enum(csky_processor_type) String(ck803eht) Value( TARGET_CPU_ck803eht)
EnumValue
Enum(csky_processor_type) String(ck803ef) Value( TARGET_CPU_ck803ef)
EnumValue
Enum(csky_processor_type) String(ck803efh) Value( TARGET_CPU_ck803efh)
EnumValue
Enum(csky_processor_type) String(ck803ft) Value( TARGET_CPU_ck803ft)
EnumValue
Enum(csky_processor_type) String(ck803eft) Value( TARGET_CPU_ck803eft)
EnumValue
Enum(csky_processor_type) String(ck803efht) Value( TARGET_CPU_ck803efht)
EnumValue
Enum(csky_processor_type) String(ck803r1) Value( TARGET_CPU_ck803r1)
EnumValue
Enum(csky_processor_type) String(ck803hr1) Value( TARGET_CPU_ck803hr1)
EnumValue
Enum(csky_processor_type) String(ck803tr1) Value( TARGET_CPU_ck803tr1)
EnumValue
Enum(csky_processor_type) String(ck803htr1) Value( TARGET_CPU_ck803htr1)
EnumValue
Enum(csky_processor_type) String(ck803fr1) Value( TARGET_CPU_ck803fr1)
EnumValue
Enum(csky_processor_type) String(ck803fhr1) Value( TARGET_CPU_ck803fhr1)
EnumValue
Enum(csky_processor_type) String(ck803er1) Value( TARGET_CPU_ck803er1)
EnumValue
Enum(csky_processor_type) String(ck803ehr1) Value( TARGET_CPU_ck803ehr1)
EnumValue
Enum(csky_processor_type) String(ck803etr1) Value( TARGET_CPU_ck803etr1)
EnumValue
Enum(csky_processor_type) String(ck803ehtr1) Value( TARGET_CPU_ck803ehtr1)
EnumValue
Enum(csky_processor_type) String(ck803efr1) Value( TARGET_CPU_ck803efr1)
EnumValue
Enum(csky_processor_type) String(ck803efhr1) Value( TARGET_CPU_ck803efhr1)
EnumValue
Enum(csky_processor_type) String(ck803ftr1) Value( TARGET_CPU_ck803ftr1)
EnumValue
Enum(csky_processor_type) String(ck803eftr1) Value( TARGET_CPU_ck803eftr1)
EnumValue
Enum(csky_processor_type) String(ck803efhtr1) Value( TARGET_CPU_ck803efhtr1)
EnumValue
Enum(csky_processor_type) String(ck803s) Value( TARGET_CPU_ck803s)
EnumValue
Enum(csky_processor_type) String(ck803st) Value( TARGET_CPU_ck803st)
EnumValue
Enum(csky_processor_type) String(ck803se) Value( TARGET_CPU_ck803se)
EnumValue
Enum(csky_processor_type) String(ck803sf) Value( TARGET_CPU_ck803sf)
EnumValue
Enum(csky_processor_type) String(ck803sef) Value( TARGET_CPU_ck803sef)
EnumValue
Enum(csky_processor_type) String(ck803seft) Value( TARGET_CPU_ck803seft)
EnumValue
Enum(csky_processor_type) String(ck807e) Value( TARGET_CPU_ck807e)
EnumValue
Enum(csky_processor_type) String(ck807ef) Value( TARGET_CPU_ck807ef)
EnumValue
Enum(csky_processor_type) String(ck807) Value( TARGET_CPU_ck807)
EnumValue
Enum(csky_processor_type) String(ck807f) Value( TARGET_CPU_ck807f)
EnumValue
Enum(csky_processor_type) String(ck810e) Value( TARGET_CPU_ck810e)
EnumValue
Enum(csky_processor_type) String(ck810et) Value( TARGET_CPU_ck810et)
EnumValue
Enum(csky_processor_type) String(ck810ef) Value( TARGET_CPU_ck810ef)
EnumValue
Enum(csky_processor_type) String(ck810eft) Value( TARGET_CPU_ck810eft)
EnumValue
Enum(csky_processor_type) String(ck810) Value( TARGET_CPU_ck810)
EnumValue
Enum(csky_processor_type) String(ck810v) Value( TARGET_CPU_ck810v)
EnumValue
Enum(csky_processor_type) String(ck810f) Value( TARGET_CPU_ck810f)
EnumValue
Enum(csky_processor_type) String(ck810t) Value( TARGET_CPU_ck810t)
EnumValue
Enum(csky_processor_type) String(ck810fv) Value( TARGET_CPU_ck810fv)
EnumValue
Enum(csky_processor_type) String(ck810tv) Value( TARGET_CPU_ck810tv)
EnumValue
Enum(csky_processor_type) String(ck810ft) Value( TARGET_CPU_ck810ff)
EnumValue
Enum(csky_processor_type) String(ck810ftv) Value( TARGET_CPU_ck810ftv)
Enum
Name(csky_arch) Type(int)
Known CSKY architectures (for use with the -march= option):
EnumValue
Enum(csky_arch) String(ck801) Value(0)
EnumValue
Enum(csky_arch) String(ck802) Value(1)
EnumValue
Enum(csky_arch) String(ck803) Value(2)
EnumValue
Enum(csky_arch) String(ck807) Value(3)
EnumValue
Enum(csky_arch) String(ck810) Value(4)
Enum
Name(csky_fpu) Type(enum csky_fpu_type)
Known CSKY FPUs (for use with the -mfpu= option):
EnumValue
Enum(csky_fpu) String(fpv2_sf) Value(TARGET_FPU_fpv2_sf)
EnumValue
Enum(csky_fpu) String(fpv2) Value(TARGET_FPU_fpv2)
EnumValue
Enum(csky_fpu) String(fpv2_divd) Value(TARGET_FPU_fpv2_divd)
EnumValue
Enum(csky_fpu) String(auto) Value(TARGET_FPU_auto)
;; Predicates for C-SKY.
;; Copyright (C) 2018 Free Software Foundation, Inc.
;; Contributed by C-SKY Microsystems and Mentor Graphics.
;;
;; 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/>. */
;; Return 1 if OP is a load multiple operation.
(define_predicate "csky_load_multiple_operation"
(match_code "parallel")
{
int count = XVECLEN (op, 0);
int dest_regno;
rtx src_addr;
int i;
/* Perform a quick check so we don't blow up below. */
if (count <= 1
|| GET_CODE (XVECEXP (op, 0, 0)) != SET
|| GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != REG
|| GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != MEM
|| GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0)) != REG
|| XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0) != stack_pointer_rtx)
return 0;
dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, 0)));
src_addr = XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0);
for (i = 1; i < count; i++)
{
rtx elt = XVECEXP (op, 0, i);
if (GET_CODE (elt) != SET
|| GET_CODE (SET_DEST (elt)) != REG
|| GET_MODE (SET_DEST (elt)) != SImode
|| REGNO (SET_DEST (elt)) != (unsigned) (dest_regno + i)
|| GET_CODE (SET_SRC (elt)) != MEM
|| GET_MODE (SET_SRC (elt)) != SImode
|| GET_CODE (XEXP (SET_SRC (elt), 0)) != PLUS
|| ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt), 0), 0), src_addr)
|| GET_CODE (XEXP (XEXP (SET_SRC (elt), 0), 1)) != CONST_INT
|| INTVAL (XEXP (XEXP (SET_SRC (elt), 0), 1)) != i * 4)
return 0;
}
return 1;
})
;; Similar, for store multiple.
(define_predicate "csky_store_multiple_operation"
(match_code "parallel")
{
int count = XVECLEN (op, 0);
int src_regno;
rtx dest_addr;
int i;
/* Perform a quick check so we don't blow up below. */
if (count <= 1
|| GET_CODE (XVECEXP (op, 0, 0)) != SET
|| GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != MEM
|| GET_CODE (XEXP (SET_DEST (XVECEXP (op, 0, 0)), 0)) != REG
|| XEXP (SET_DEST (XVECEXP (op, 0, 0)), 0) != stack_pointer_rtx
|| GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != REG)
return 0;
src_regno = REGNO (SET_SRC (XVECEXP (op, 0, 0)));
dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, 0)), 0);
for (i = 1; i < count; i++)
{
rtx elt = XVECEXP (op, 0, i);
if (GET_CODE (elt) != SET
|| GET_CODE (SET_SRC (elt)) != REG
|| GET_MODE (SET_SRC (elt)) != SImode
|| REGNO (SET_SRC (elt)) != (unsigned) (src_regno + i)
|| GET_CODE (SET_DEST (elt)) != MEM
|| GET_MODE (SET_DEST (elt)) != SImode
|| GET_CODE (XEXP (SET_DEST (elt), 0)) != PLUS
|| ! rtx_equal_p (XEXP (XEXP (SET_DEST (elt), 0), 0), dest_addr)
|| GET_CODE (XEXP (XEXP (SET_DEST (elt), 0), 1)) != CONST_INT
|| INTVAL (XEXP (XEXP (SET_DEST (elt), 0), 1)) != i * 4)
return 0;
}
return 1;
})
(define_predicate "csky_arith_K_operand"
(match_code "reg,subreg,const_int")
{
if (register_operand (op, mode))
return 1;
if (CONST_INT_P (op) && CSKY_CONST_OK_FOR_K (INTVAL (op)))
return 1;
return 0;
})
(define_predicate "csky_literal_K_operand"
(match_code "const_int")
{
if (CONST_INT_P (op) && CSKY_CONST_OK_FOR_K (INTVAL (op)))
return 1;
return 0;
})
(define_predicate "csky_literal_I_operand"
(match_code "const_int")
{
if (CONST_INT_P (op) && CSKY_CONST_OK_FOR_I (INTVAL (op)))
return 1;
return 0;
})
(define_predicate "csky_literal_J_operand"
(match_code "const_int")
{
if (CONST_INT_P (op) && CSKY_CONST_OK_FOR_J (INTVAL (op)))
return 1;
return 0;
})
(define_predicate "csky_literal_Uk_operand"
(match_code "const_int")
{
if (CONST_INT_P (op) && CSKY_CONST_OK_FOR_Uk (INTVAL (op)))
return 1;
return 0;
})
;; Nonzero if OP is a register or constant value of 1
(define_predicate "csky_arith_int1_operand"
(match_code "reg,subreg,const_int")
{
if (register_operand (op, mode))
return 1;
if (op == const1_rtx)
return 1;
return 0;
})
;; Nonzero if OP is legal address for function call
(define_predicate "csky_call_address_operand"
(match_code "reg,subreg,symbol_ref")
{
if (!flag_pic && (GET_CODE (op) == SYMBOL_REF))
return 1;
if (register_operand (op, mode))
return 1;
return 0;
})
;; Nonzero if OP is a valid source operand for a compare operation.
(define_predicate "csky_compare_operand"
(match_code "const_int,reg,subreg")
{
if (register_operand (op, mode))
return 1;
if (GET_CODE (op) == CONST_INT && INTVAL (op) == 0)
return 1;
return 0;
})
(define_predicate "csky_literal_K_Uh_operand"
(match_code "const_int")
{
if (CONST_INT_P (op)
&& (CSKY_CONST_OK_FOR_K (INTVAL (op))
|| CSKY_CONST_OK_FOR_Uh (INTVAL (op))))
return 1;
return 0;
})
;; True if OP is a mem with an reg + optional displacement address.
(define_predicate "csky_simple_mem_operand"
(and (match_operand 0 "memory_operand")
(match_test "csky_simple_addr_operand_p (XEXP (op, 0))")))
(define_predicate "csky_arith_any_imm_operand"
(match_code "const_int,reg,subreg")
{
if (register_operand (op, mode))
return 1;
if (CONST_INT_P (op))
return 1;
return 0;
})
(define_predicate "csky_arith_O_operand"
(match_code "reg,subreg,const_int")
{
if (register_operand (op, mode))
return 1;
if (CONST_INT_P (op) && CSKY_CONST_OK_FOR_O (INTVAL (op)))
return 1;
return 0;
})
(define_predicate "csky_unspec_operand"
(match_code "unspec")
{
if (op == NULL || GET_CODE(op) != UNSPEC)
return 0;
return 1;
}
)
(define_predicate "csky_const_float1_operand"
(and (match_code "const_double")
(match_test "(op == CONST1_RTX (mode))")))
(define_predicate "csky_arith_float1_operand"
(ior (match_operand 0 "register_operand")
(match_operand 0 "csky_const_float1_operand")))
(define_predicate "csky_const_float0_operand"
(and (match_code "const_double")
(match_test "(op == CONST0_RTX (mode))")))
(define_predicate "csky_compare_operand_float"
(ior (match_operand 0 "register_operand")
(match_operand 0 "csky_const_float0_operand")))
(define_special_predicate "registers_push"
(match_code "parallel")
{
if ((GET_CODE (XVECEXP (op, 0, 0)) != SET)
|| (GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != UNSPEC)
|| (XINT (SET_SRC (XVECEXP (op, 0, 0)), 1) != UNSPEC_PUSHPOP_MULT))
return false;
return true;
})
(define_special_predicate "registers_pop"
(match_code "parallel")
{
if ((GET_CODE (XVECEXP (op, 0, 1)) != SET)
|| (GET_CODE (SET_SRC (XVECEXP (op, 0, 1))) != UNSPEC)
|| (XINT (SET_SRC (XVECEXP (op, 0, 1)), 1) != UNSPEC_PUSHPOP_MULT))
return false;
return true;
})
(define_predicate "push_memory_operand"
(match_code "mem")
{
rtx x = XEXP (op, 0);
if (GET_CODE (x) != PRE_MODIFY)
return false;
if (XEXP (x, 0) != stack_pointer_rtx)
return false;
x = XEXP (x, 1);
if (GET_CODE (x) != PLUS)
return false;
if (XEXP (x, 0) != stack_pointer_rtx)
return false;
return CONST_INT_P (XEXP (x, 1));
})
(define_predicate "pop_memory_operand"
(match_code "mem")
{
rtx x = XEXP (op, 0);
if (GET_CODE (x) != POST_MODIFY)
return false;
if (XEXP (x, 0) != stack_pointer_rtx)
return false;
x = XEXP (x, 1);
if (GET_CODE (x) != PLUS)
return false;
if (XEXP (x, 0) != stack_pointer_rtx)
return false;
return CONST_INT_P (XEXP (x, 1));
})
(define_special_predicate "csky_float_comparison_operator"
(match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,
unordered,ordered"))
#! /bin/sh
# Script to generate SYSROOT_SUFFIX_SPEC equivalent to MULTILIB_OSDIRNAMES
# Arguments are MULTILIB_OSDIRNAMES, MULTILIB_OPTIONS and MULTILIB_MATCHES.
# Copyright (C) 2018 Free Software Foundation, Inc.
# Contributed by C-SKY Microsystems and Mentor Graphics.
# 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/>.
# This shell script produces a header file fragment that defines
# SYSROOT_SUFFIX_SPEC. It assumes that the sysroots will have the same
# structure and names used by the multilibs.
# Invocation:
# print-sysroot-suffix.sh \
# MULTILIB_OSDIRNAMES \
# MULTILIB_OPTIONS \
# MULTILIB_MATCHES \
# > t-sysroot-suffix.h
# The three options exactly correspond to the variables of the same
# names defined in the tmake_file fragments.
# Example:
# sh ./gcc/config/print-sysroot-suffix.sh "a=A" "a b/c/d" ""
# =>
# #undef SYSROOT_SUFFIX_SPEC
# #define SYSROOT_SUFFIX_SPEC "" \
# "%{a:" \
# "%{b:A/b/;" \
# "c:A/c/;" \
# "d:A/d/;" \
# ":A/};" \
# ":}"
# The script uses temporary subscripts in order to permit a recursive
# algorithm without the use of functions.
set -e
dirnames="$1"
options="$2"
matches="$3"
cat > print-sysroot-suffix3.sh <<\EOF
#! /bin/sh
# Print all the multilib matches for this option
result="$1"
EOF
for x in $matches; do
l=`echo $x | sed -e 's/=.*$//' -e 's/?/=/g'`
r=`echo $x | sed -e 's/^.*=//' -e 's/?/=/g'`
echo "[ \"\$1\" = \"$l\" ] && result=\"\$result|$r\"" >> print-sysroot-suffix3.sh
done
echo 'echo $result' >> print-sysroot-suffix3.sh
chmod +x print-sysroot-suffix3.sh
cat > print-sysroot-suffix2.sh <<\EOF
#! /bin/sh
# Recursive script to enumerate all multilib combinations, match against
# multilib directories and output a spec string of the result.
# Will fold identical trees.
padding="$1"
optstring="$2"
shift 2
n="\" \\
$padding\""
if [ $# = 0 ]; then
EOF
pat=
for x in $dirnames; do
# p=`echo $x | sed -e 's,=!,/$=/,'`
p=`echo $x | sed -e 's/=//g'`
# pat="$pat -e 's=^//$p='"
pat="$pat -e 's/$p/g'"
done
echo ' optstring=`echo "/$optstring" | sed '"$pat\`" >> print-sysroot-suffix2.sh
cat >> print-sysroot-suffix2.sh <<\EOF
case $optstring in
//*)
;;
*)
echo "$optstring"
;;
esac
else
thisopt="$1"
shift
bit=
lastcond=
result=
for x in `echo "$thisopt" | sed -e 's,/, ,g'`; do
case $x in
EOF
for x in `echo "$options" | sed -e 's,/, ,g'`; do
match=`./print-sysroot-suffix3.sh "$x"`
echo "$x) optmatch=\"$match\" ;;" >> print-sysroot-suffix2.sh
done
cat >> print-sysroot-suffix2.sh <<\EOF
esac
bit=`"$0" "$padding " "$optstring$x/" "$@"`
if [ -z "$lastopt" ]; then
lastopt="$optmatch"
else
if [ "$lastbit" = "$bit" ]; then
lastopt="$lastopt|$optmatch"
else
result="$result$lastopt:$lastbit;$n"
lastopt="$optmatch"
fi
fi
lastbit="$bit"
done
bit=`"$0" "$padding " "$optstring" "$@"`
if [ "$bit" = "$lastbit" ]; then
if [ -z "$result" ]; then
echo "$bit"
else
echo "$n%{$result:$bit}"
fi
else
echo "$n%{$result$lastopt:$lastbit;$n:$bit}"
fi
fi
EOF
chmod +x ./print-sysroot-suffix2.sh
result=`./print-sysroot-suffix2.sh \"\" \"\" $options`
echo "#undef SYSROOT_SUFFIX_SPEC"
echo "#define SYSROOT_SUFFIX_SPEC \"$result\""
rm print-sysroot-suffix2.sh
rm print-sysroot-suffix3.sh
# Make rules for all C-SKY targets.
#
# Copyright (C) 2018 Free Software Foundation, Inc.
# Contributed by C-SKY Microsystems and Mentor Graphics.
#
# 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/>.
TM_H += $(srcdir)/config/csky/csky_cores.def
OPTIONS_H_EXTRA += $(srcdir)/config/csky/csky_cores.def
$(srcdir)/config/csky/csky_tables.opt: $(srcdir)/config/csky/csky_genopt.sh \
$(srcdir)/config/csky/csky_cores.def
$(SHELL) $(srcdir)/config/csky/csky_genopt.sh $(srcdir)/config/csky > \
$(srcdir)/config/csky/csky_tables.opt
# Multilib configuration for csky*-elf.
#
# Copyright (C) 2018 Free Software Foundation, Inc.
# Contributed by C-SKY Microsystems and Mentor Graphics.
#
# 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/>.
# Endiannesses.
MULTILIB_OPTIONS = mlittle-endian/mbig-endian
MULTILIB_DIRNAMES = little big
MULTILIB_MATCHES = mlittle-endian=EL
MULTILIB_MATCHES = mbig-endian=EB
MULTILIB_EXCEPTIONS =
# Arch variants.
MULTILIB_OPTIONS += mcpu=ck802/mcpu=ck801/mcpu=ck803f/mcpu=ck807f/mcpu=ck810f
MULTILIB_DIRNAMES += ck802 ck801 ck803 ck807 ck810
# For arch ck802.
MULTILIB_MATCHES += mcpu?ck802=march?ck802
MULTILIB_MATCHES += mcpu?ck802=mcpu?ck802t
MULTILIB_MATCHES += mcpu?ck802=mcpu?ck802j
# For arch ck801.
MULTILIB_MATCHES += mcpu?ck801=march?ck801
MULTILIB_MATCHES += mcpu?ck801=mcpu?ck801t
# For arch ck803.
MULTILIB_MATCHES += mcpu?ck803f=march?ck803
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803fh
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803h
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803t
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803ht
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803e
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803eh
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803et
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803eht
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803ef
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803efh
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803ft
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803eft
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803efht
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803r1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803fr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803fhr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803hr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803tr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803htr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803er1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803ehr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803etr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803ehtr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803efr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803efhr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803ftr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803eftr1
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803efhtr1
# For arch ck803s.
MULTILIB_MATCHES += mcpu?ck803f=march?ck803s
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803s
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803st
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803se
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803sf
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803sef
MULTILIB_MATCHES += mcpu?ck803f=mcpu?ck803seft
# For arch ck810.
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810e
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810et
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810ef
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810eft
MULTILIB_MATCHES += mcpu?ck810f=march?ck810
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810v
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810t
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810vf
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810tv
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810ft
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810ftv
# For arch ck807.
MULTILIB_MATCHES += mcpu?ck807f=march?ck807e
MULTILIB_MATCHES += mcpu?ck807f=march?ck807ef
MULTILIB_MATCHES += mcpu?ck807f=march?ck807
MULTILIB_MATCHES += mcpu?ck807f=mcpu?ck807
# For option -msoft-float/-mhard-float.
MULTILIB_OPTIONS += msoft-float/mhard-float
MULTILIB_DIRNAMES += soft-fp hard-fp
MULTILIB_EXCEPTIONS += *mcpu=ck801/*mhard-float*
MULTILIB_EXCEPTIONS += *mcpu=ck802/*mhard-float*
# Multilib configuration for csky*-linux-*.
#
# Copyright (C) 2018 Free Software Foundation, Inc.
# Contributed by C-SKY Microsystems and Mentor Graphics.
#
# 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/>.
# Endiannesses.
MULTILIB_OPTIONS = mlittle-endian/mbig-endian
MULTILIB_DIRNAMES = little big
MULTILIB_MATCHES = mlittle-endian=EL
MULTILIB_MATCHES = mbig-endian=EB
MULTILIB_EXCEPTIONS =
CSKY_MULTILIB_OSDIRNAMES = mbig-endian=/big mlittle-endian=/. mhard-float=/hard-fp msoft-float=/. mcpu.ck810f=/. mcpu.ck807f=/ck807
# Arch variants.
MULTILIB_OPTIONS += mcpu=ck810f/mcpu=ck807f
MULTILIB_DIRNAMES += ck810 ck807
# For ck807.
MULTILIB_MATCHES += mcpu?ck807f=march?ck807
MULTILIB_MATCHES += mcpu?ck807f=mcpu?ck807
# For arch ck810.
MULTILIB_MATCHES += mcpu?ck810f=march?ck810
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810v
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810t
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810vt
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810vf
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810ft
MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810vft
# For option -msoft-float/-mhard-float.
MULTILIB_OPTIONS += msoft-float/mhard-float
MULTILIB_DIRNAMES += soft-fp hard-fp
# Makefile fragment for C-SKY sysroot suffix.
#
# Copyright (C) 2018 Free Software Foundation, Inc.
# Contributed by C-SKY Microsystems and Mentor Graphics.
#
# 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/>.
# Generate SYSROOT_SUFFIX_SPEC from MULTILIB_OSDIRNAMES.
sysroot-suffix.h: $(srcdir)/config/csky/print-sysroot-suffix.sh
$(SHELL) $(srcdir)/config/csky/print-sysroot-suffix.sh \
"$(CSKY_MULTILIB_OSDIRNAMES)" "$(MULTILIB_OPTIONS)" \
"$(MULTILIB_MATCHES)" > tmp-sysroot-suffix.h
mv tmp-sysroot-suffix.h $@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment