1 /* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
2 Copyright (C) 1987, 1988, 1993, 1995, 1996, 1998, 1999
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* This comment is here to see if it will keep Sun's cpp from dying. */
24 /* If you do not need to generate floating point code for the optional
25 Sun FPA board, you can safely comment out the SUPPORT_SUN_FPA define
26 to gain a little speed and code size. */
28 #define SUPPORT_SUN_FPA
30 #include "m68k/m68k.h"
32 /* See m68k.h. 7 means 68020 with 68881. */
34 #ifndef TARGET_DEFAULT
35 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
38 /* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
39 according to the -m flags.
40 This will control the use of inline 68881 insns in certain macros.
41 Also inform the program which CPU this is for. */
43 #if TARGET_DEFAULT & MASK_68881
45 /* -m68881 is the default */
47 "%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
48 %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
49 %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
53 /* -msoft-float is the default */
55 "%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
56 %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
57 %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
61 /* Prevent error on `-sun3' and `-target sun3' options. */
63 #define CC1_SPEC "%{sun3:} %{target:}"
65 #define PTRDIFF_TYPE "int"
67 /* We must override m68k.h. */
69 #undef WCHAR_TYPE_SIZE
70 #define WCHAR_TYPE "short unsigned int"
71 #define WCHAR_TYPE_SIZE 16
73 /* These compiler options take an argument. We ignore -target for now. */
75 #define WORD_SWITCH_TAKES_ARG(STR) \
76 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
77 || !strcmp (STR, "target") || !strcmp (STR, "assert"))
79 /* -m68000 requires special flags to the assembler. */
82 "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
83 %{fpic:-k} %{fPIC:-k} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
85 /* Names to predefine in the preprocessor for this target machine. */
86 /* For a while, -D_CROSS_TARGET_ARCH=SUN3 was included here,
87 but it doesn't work, partly because SUN3 etc. aren't defined
88 (and shouldn't be). It seems that on a native compiler _CROSS_TARGET_ARCH
89 should not be defined. For cross compilers, let's do things as we
90 normally do in GCC. -- rms. */
92 #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
94 /* STARTFILE_SPEC to include sun floating point initialization
95 This is necessary (tr: Sun does it) for both the m68881 and the fpa
97 Note that includes knowledge of the default specs for gcc, ie. no
98 args translates to the same effect as -m68881
99 I'm not sure what would happen below if people gave contradictory
100 arguments (eg. -msoft-float -mfpa) */
102 #if TARGET_DEFAULT & MASK_FPA
103 /* -mfpa is the default */
104 #define STARTFILE_SPEC \
105 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
106 %{m68881:Mcrt1.o%s} \
107 %{msoft-float:Fcrt1.o%s} \
108 %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
110 #if TARGET_DEFAULT & MASK_68881
111 /* -m68881 is the default */
112 #define STARTFILE_SPEC \
113 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
115 %{msoft-float:Fcrt1.o%s} \
116 %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
118 /* -msoft-float is the default */
119 #define STARTFILE_SPEC \
120 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
121 %{m68881:Mcrt1.o%s} \
123 %{!m68881:%{!mfpa:Fcrt1.o%s}}"
127 /* Specify library to handle `-a' basic block profiling.
128 Control choice of libm.a (if user says -lm)
129 based on fp arith default and options. */
131 #if TARGET_DEFAULT & MASK_FPA
132 /* -mfpa is the default */
133 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
135 %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
136 %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
138 #if TARGET_DEFAULT & MASK_68881
139 /* -m68881 is the default */
140 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
142 %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
143 %{mfpa:-L/usr/lib/ffpa}"
145 /* -msoft-float is the default */
146 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
148 %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
149 %{mfpa:-L/usr/lib/ffpa}"
153 /* Provide required defaults for linker -e and -d switches. */
156 "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
158 /* Every structure or union's size must be a multiple of 2 bytes. */
160 #define STRUCTURE_SIZE_BOUNDARY 16
162 /* This is BSD, so it wants DBX format. */
164 #define DBX_DEBUGGING_INFO
166 /* Generate calls to memcpy, memcmp and memset. */
167 #define TARGET_MEM_FUNCTIONS
169 /* This is not a good idea. It prevents interoperation between
170 files compiled with -m68881 and those compiled with -msoft-float. */
172 #define FUNCTION_VALUEX(MODE) \
173 gen_rtx_REG ((MODE), \
175 && ((MODE) == SFmode || (MODE) == DFmode \
176 || (MODE) == XFmode)) \
179 #undef FUNCTION_VALUE
180 #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
183 /* This is how to output an assembler lines defining floating operands.
184 There's no way to output a NaN's fraction, so we lose it. */
186 #undef ASM_OUTPUT_FLOAT_OPERAND
187 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
192 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
193 if (sizeof (int) == sizeof (long)) \
194 asm_fprintf ((FILE), "%I0x%x", (int) l); \
196 asm_fprintf ((FILE), "%I0x%lx", l); \
198 else if (REAL_VALUE_ISINF (VALUE)) \
200 if (REAL_VALUE_NEGATIVE (VALUE)) \
201 asm_fprintf (FILE, "%I0r-99e999"); \
203 asm_fprintf (FILE, "%I0r99e999"); \
205 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
207 asm_fprintf (FILE, "%I0r-0.0"); \
211 REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
212 asm_fprintf (FILE, "%I0r%s", dstr); \
216 #undef ASM_OUTPUT_DOUBLE_OPERAND
217 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
218 do { if (REAL_VALUE_ISINF (VALUE)) \
220 if (REAL_VALUE_NEGATIVE (VALUE)) \
221 asm_fprintf (FILE, "%I0r-99e999"); \
223 asm_fprintf (FILE, "%I0r99e999"); \
225 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
227 asm_fprintf (FILE, "%I0r-0.0"); \
231 REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
232 asm_fprintf (FILE, "%I0r%s", dstr); \