1 /* Definitions of target machine for GNU compiler. SONY NEWS-OS 4 version.
2 Copyright (C) 1987, 1989, 1993, 1994, 1996, 1997, 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. */
23 /* This controls conditionals in m68k.h. */
24 #define MOTOROLA /* Use Motorola syntax rather than "MIT" */
25 #define SGS_NO_LI /* Suppress jump table label usage */
29 #define NO_DOLLAR_IN_LABEL
30 #define NO_DOT_IN_LABEL
32 #include "m68k/m68k.h"
34 /* See m68k.h. 7 means 68020 with 68881. */
36 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
38 /* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
39 This will control the use of inline 68881 insns in certain macros. */
41 #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
43 /* Names to predefine in the preprocessor for this target machine. */
44 /* These are the ones defined by Sony, plus mc68000 for uniformity with
45 GCC on other 68000 systems. */
48 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews700 -D__motorola__ -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
50 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews700 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
53 /* These conditionals tested for different submodels,
54 but they were incorrect since they tested the host rather than the target.
55 The choice of model shouldn't actually matter. */
59 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews800 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
62 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews900 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
65 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1500 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
68 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1700 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
71 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1800 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
74 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1900 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
78 /* Link with libg.a when debugging, for dbx's sake. */
80 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
82 /* This is BSD, so it wants DBX format. */
84 #define DBX_DEBUGGING_INFO
87 /* This is to be compatible with types.h.
88 It was found to be necessary with Newsos 3. */
90 #define SIZE_TYPE "long int"
93 /* Override parts of m68k.h to fit Sony's assembler syntax. */
95 #undef BIGGEST_ALIGNMENT
96 #undef CALL_USED_REGISTERS
99 #undef FUNCTION_PROFILER
102 #undef REGISTER_NAMES
103 #undef ASM_OUTPUT_REG_PUSH
104 #undef ASM_OUTPUT_REG_POP
105 #undef ASM_OUTPUT_SKIP
106 #undef ASM_FORMAT_PRIVATE_NAME
109 #undef ASM_OUTPUT_ALIGN
111 /* There is no point aligning anything to a rounder boundary than this. */
112 #define BIGGEST_ALIGNMENT 32
114 /* A bitfield declared as `int' forces `int' alignment for the struct. */
115 #define PCC_BITFIELD_TYPE_MATTERS 1
117 /* NEWS makes d2, d3, fp2 and fp3 unsaved registers, unlike the Sun system. */
119 #define CALL_USED_REGISTERS \
120 {1, 1, 1, 1, 0, 0, 0, 0, \
121 1, 1, 0, 0, 0, 0, 0, 1, \
122 1, 1, 1, 1, 0, 0, 0, 0}
124 /* NEWS returns floats and doubles in fp0, not d0/d1. */
126 #define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
128 #define LIBCALL_VALUE(MODE) \
129 gen_rtx_REG ((MODE), \
131 && ((MODE) == SFmode || (MODE) == DFmode \
132 || (MODE) == XFmode)) \
135 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
136 fprintf (FILE, "\t.align %d\n", (LOG))
140 #define FUNCTION_PROFILER(FILE, LABEL_NO) \
141 fprintf (FILE, "\tmove.l #LP%d,d0\n\tjsr mcount\n", (LABEL_NO));
143 /* Difference from m68k.h is in `fp' instead of `a6'. */
145 #define REGISTER_NAMES \
146 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
147 "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp", \
148 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7"}
150 /* This is how to output an insn to push a register on the stack.
151 It need not be very fast code. */
153 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
154 fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
156 /* This is how to output an insn to pop a register from the stack.
157 It need not be very fast code. */
159 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
160 fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
162 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
163 fprintf (FILE, "\t.space %u\n", (SIZE))
166 /* The NEWS assembler in version 3.4 complains about fmove.d, but this
167 macro proved not to work right. 3.4 is old, so forget about it. */
168 #define ASM_OUTPUT_OPCODE(FILE, STRING) \
170 if (!strncmp (STRING, "fmove.d", 7) \
171 && CONSTANT_P (operands[1])) \
173 fprintf (FILE, "fmove.x"); \
179 /* Store in OUTPUT a string (made with alloca) containing
180 an assembler-name for a local static variable named NAME.
181 LABELNO is an integer which is different for each call. */
183 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
184 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 13), \
185 sprintf ((OUTPUT), "%s$$$%d", (NAME), (LABELNO)))
187 /* Output a float value (represented as a C double) as an immediate operand.
188 This macro is a 68k-specific macro. */
190 #undef ASM_OUTPUT_FLOAT_OPERAND
191 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
196 REAL_VALUE_TO_DECIMAL (VALUE, "%.9e", dstr); \
197 if (REAL_VALUE_ISINF (VALUE) || REAL_VALUE_ISNAN (VALUE)) \
199 if (REAL_VALUE_NEGATIVE (VALUE)) \
200 fprintf (FILE, "#0f-99e999"); \
202 fprintf (FILE, "#0f99e999"); \
204 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
205 fprintf (FILE, "#0f-0.0"); \
207 fprintf (FILE, "#0f%s", dstr); \
212 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
213 fprintf (FILE, "#0x%lx", l); \
217 /* Output a double value (represented as a C double) as an immediate operand.
218 This macro is a 68k-specific macro. */
219 #undef ASM_OUTPUT_DOUBLE_OPERAND
220 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
221 do { char dstr[30]; \
222 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr ); \
223 if (REAL_VALUE_ISINF (VALUE) || REAL_VALUE_ISNAN (VALUE)) \
225 if (REAL_VALUE_NEGATIVE (VALUE)) \
226 fprintf (FILE, "#0d-99e999"); \
228 fprintf (FILE, "#0d99e999"); \
230 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
231 fprintf (FILE, "#0d-0.0"); \
233 fprintf (FILE, "#0d%s", dstr); \
236 /* Note, long double immediate operands are not actually
237 generated by m68k.md. */
238 #undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
239 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
240 do { char dstr[30]; \
241 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
242 asm_fprintf (FILE, "%I0r%s", dstr); \
247 #define PRINT_OPERAND(FILE, X, CODE) \
248 { if (CODE == '.') fprintf (FILE, "."); \
249 else if (CODE == '#') fprintf (FILE, "#"); \
250 else if (CODE == '-') fprintf (FILE, "-(sp)"); \
251 else if (CODE == '+') fprintf (FILE, "(sp)+"); \
252 else if (CODE == '@') fprintf (FILE, "(sp)"); \
253 else if (CODE == '!') fprintf (FILE, "fpcr"); \
254 else if (CODE == '$') {if (TARGET_68040_ONLY) fprintf (FILE, "s");} \
255 else if (CODE == '&') {if (TARGET_68040_ONLY) fprintf (FILE, "d");} \
256 else if (CODE == '/') \
258 else if (GET_CODE (X) == REG) \
259 fprintf (FILE, "%s", reg_names[REGNO (X)]); \
260 else if (GET_CODE (X) == MEM) \
261 output_address (XEXP (X, 0)); \
262 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
263 { REAL_VALUE_TYPE r; \
264 REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
267 REAL_VALUE_TO_DECIMAL (r, "%.9e", dstr); \
268 if (REAL_VALUE_ISINF (r) || REAL_VALUE_ISNAN (r)) { \
269 if (REAL_VALUE_NEGATIVE (r)) \
270 fprintf (FILE, "#0f-99e999"); \
272 fprintf (FILE, "#0f99e999"); } \
273 else if (REAL_VALUE_MINUS_ZERO (r)) \
274 fprintf (FILE, "#0f-0.0"); \
276 fprintf (FILE, "#0f%s", dstr); \
280 REAL_VALUE_TO_TARGET_SINGLE (r, l); \
281 fprintf (FILE, "#0x%lx", l); \
283 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
284 { REAL_VALUE_TYPE r; \
285 REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
286 ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \
287 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
288 { REAL_VALUE_TYPE r; char dstr[30]; \
289 REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
290 REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr ); \
291 if (REAL_VALUE_ISINF (r) || REAL_VALUE_ISNAN (r)) { \
292 if (REAL_VALUE_NEGATIVE (r)) \
293 fprintf (FILE, "#0d-99e999"); \
295 fprintf (FILE, "#0d99e999"); } \
296 else if (REAL_VALUE_MINUS_ZERO (r)) \
297 fprintf (FILE, "#0d-0.0"); \
299 fprintf (FILE, "#0d%s", dstr); } \
300 else if (CODE == 'b') output_addr_const (FILE, X); \
301 else { putc ('#', FILE); output_addr_const (FILE, X); }}
304 #undef PRINT_OPERAND_ADDRESS
305 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
306 { register rtx reg1, reg2, breg, ireg; \
307 register rtx addr = ADDR; \
309 switch (GET_CODE (addr)) \
312 fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
315 fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
318 fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
321 reg1 = 0; reg2 = 0; \
322 ireg = 0; breg = 0; \
324 if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
326 offset = XEXP (addr, 0); \
327 addr = XEXP (addr, 1); \
329 else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
331 offset = XEXP (addr, 1); \
332 addr = XEXP (addr, 0); \
334 if (GET_CODE (addr) != PLUS) ; \
335 else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
337 reg1 = XEXP (addr, 0); \
338 addr = XEXP (addr, 1); \
340 else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
342 reg1 = XEXP (addr, 1); \
343 addr = XEXP (addr, 0); \
345 else if (GET_CODE (XEXP (addr, 0)) == MULT) \
347 reg1 = XEXP (addr, 0); \
348 addr = XEXP (addr, 1); \
350 else if (GET_CODE (XEXP (addr, 1)) == MULT) \
352 reg1 = XEXP (addr, 1); \
353 addr = XEXP (addr, 0); \
355 else if (GET_CODE (XEXP (addr, 0)) == REG) \
357 reg1 = XEXP (addr, 0); \
358 addr = XEXP (addr, 1); \
360 else if (GET_CODE (XEXP (addr, 1)) == REG) \
362 reg1 = XEXP (addr, 1); \
363 addr = XEXP (addr, 0); \
365 if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
366 || GET_CODE (addr) == SIGN_EXTEND) \
367 { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
368 if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
369 if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
370 || GET_CODE (reg1) == MULT)) \
371 || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
372 { breg = reg2; ireg = reg1; } \
373 else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
374 { breg = reg1; ireg = reg2; } \
375 if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
377 if (GET_CODE (ireg) == MULT) \
378 { scale = INTVAL (XEXP (ireg, 1)); \
379 ireg = XEXP (ireg, 0); } \
380 if (GET_CODE (ireg) == SIGN_EXTEND) \
381 fprintf (FILE, "(L%d.b,pc,%s.w", \
382 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
383 reg_names[REGNO (XEXP (ireg, 0))]); \
385 fprintf (FILE, "(L%d.b,pc,%s.l", \
386 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
387 reg_names[REGNO (ireg)]); \
388 if (scale != 1) fprintf (FILE, "*%d", scale); \
391 if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
392 { fprintf (FILE, "(L%d.b,pc,%s.l", \
393 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
394 reg_names[REGNO (breg)]); \
397 if (ireg != 0 || breg != 0) \
401 if (addr && GET_CODE (addr) == LABEL_REF) abort (); \
402 fprintf (FILE, "("); \
404 output_addr_const (FILE, addr); \
405 putc (',', FILE); } \
406 fprintf (FILE, "%s", reg_names[REGNO (breg)]); \
409 if (ireg != 0 && GET_CODE (ireg) == MULT) \
410 { scale = INTVAL (XEXP (ireg, 1)); \
411 ireg = XEXP (ireg, 0); } \
412 if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
413 fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
414 else if (ireg != 0) \
415 fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
416 if (scale != 1) fprintf (FILE, "*%d", scale); \
420 else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
421 { fprintf (FILE, "(L%d.b,pc,%s.l)", \
422 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
423 reg_names[REGNO (reg1)]); \
426 if (GET_CODE (addr) == CONST_INT \
427 && INTVAL (addr) < 0x8000 \
428 && INTVAL (addr) >= -0x8000) \
429 fprintf (FILE, "%d.w", INTVAL (addr)); \
431 output_addr_const (FILE, addr); \
434 #else /* Using GAS, which uses the MIT assembler syntax, like a Sun. */
436 #define FUNCTION_PROFILER(FILE, LABEL_NO) \
437 fprintf (FILE, "\tmovl #LP%d,d0\n\tjsr mcount\n", (LABEL_NO));
439 #endif /* MOTOROLA */