Initial revision
[official-gcc.git] / gcc / config / m68k / dpx2.h
blob14f0606b8aad0c7faea302197b7cb218e7b483cb
1 /* Definitions of target machine for GNU compiler.
2 Bull DPX/2 200 and 300 systems (m68k, SysVr3).
3 Copyright (C) 1987, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
4 Contributed by Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr).
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 #ifndef USE_GAS
25 #define MOTOROLA /* Use Motorola syntax rather than "MIT" */
26 #define SGS_NO_LI /* Suppress jump table label usage */
27 #define VERSADOS /* This is the name of the assembler we have */
28 #endif
30 #include "m68k/m68k.h"
31 #undef SELECT_RTX_SECTION
32 #include "svr3.h"
34 /* See m68k.h. 7 means 68020 with 68881.
35 * We really have 68030 and 68882,
36 * but this will get us going.
38 #ifndef TARGET_DEFAULT
39 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
40 #endif
42 #define OBJECT_FORMAT_COFF
43 #define NO_SYS_SIGLIST
45 #ifdef CPP_PREDEFINES
46 #undef CPP_PREDEFINES
47 #endif
49 * define all the things the compiler should
51 #ifdef ncl_mr
52 # define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -Dncl_mr=1 -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
53 #else
54 # ifdef ncl_el
55 # define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -Dncl_el -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
56 # else
57 # define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
58 # endif
59 #endif
61 #undef CPP_SPEC
63 * you can't get a DPX/2 without a 68882 but allow it
64 * to be ignored...
66 # define __HAVE_68881__ 1
67 # define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ }"
69 #define HAVE_ATEXIT
70 #undef DO_GLOBAL_CTORS_BODY /* don't use svr3.h version */
71 #undef DO_GLOBAL_DTORS_BODY
73 #ifndef USE_GAS
75 * handle the native MOTOROLA VERSAdos assembler.
78 /* See m68k.h. 3 means 68020 with 68881 and no bitfield
79 * bitfield instructions do not seem to work a clean way.
81 #undef TARGET_DEFAULT
82 #define TARGET_DEFAULT (MASK_68881|MASK_68020)
84 /* The native assembler doesn't support fmovecr. */
85 #define NO_ASM_FMOVECR
87 #undef EXTRA_SECTIONS
88 #undef EXTRA_SECTION_FUNCTIONS
89 #undef READONLY_DATA_SECTION
90 #define READONLY_DATA_SECTION data_section
91 #undef SELECT_SECTION
92 #undef SELECT_RTX_SECTION
93 #define fini_section() while (0)
95 #undef CTORS_SECTION_ASM_OP
96 #define CTORS_SECTION_ASM_OP "\tsection 15"
97 #undef DTORS_SECTION_ASM_OP
98 #define DTORS_SECTION_ASM_OP "\tsection 15"
99 #undef INIT_SECTION_ASM_OP
100 #define BSS_SECTION_ASM_OP "\tsection 14"
101 #undef TEXT_SECTION_ASM_OP
102 #define TEXT_SECTION_ASM_OP "\tsection 10"
103 #undef DATA_SECTION_ASM_OP
104 #define DATA_SECTION_ASM_OP "\tsection 15"
107 /* Don't try using XFmode. */
108 #undef LONG_DOUBLE_TYPE_SIZE
109 #define LONG_DOUBLE_TYPE_SIZE 64
111 /* Define if you don't want extended real, but do want to use the
112 software floating point emulator for REAL_ARITHMETIC and
113 decimal <-> binary conversion. */
114 #define REAL_ARITHMETIC
116 #undef ASM_OUTPUT_SOURCE_FILENAME
117 #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NA) \
118 do { fprintf ((FILE), "\t.file\t'%s'\n", (NA)); } while (0)
120 /* Assembler pseudos to introduce constants of various size. */
122 #undef ASM_BYTE_OP
123 #define ASM_BYTE_OP "\tdc.b"
124 #undef ASM_LONG
125 #define ASM_LONG "\tdc.l"
128 * we don't seem to support any of:
129 * .globl
130 * .even
131 * .align
132 * .ascii
134 #undef ASM_OUTPUT_SKIP
135 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
136 fprintf (FILE, "\tdcb.b %u,0\n", (SIZE))
138 #undef GLOBAL_ASM_OP
139 #define GLOBAL_ASM_OP "\txdef"
141 #undef ASM_OUTPUT_ALIGN
142 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
143 if ((LOG) >= 1) \
144 fprintf (FILE, "\tds.w 0\n");
147 #define STRING_LIMIT (0)
148 #undef ASM_APP_ON
149 #define ASM_APP_ON ""
150 #undef ASM_APP_OFF
151 #define ASM_APP_OFF ""
153 * dc.b 'hello, world!'
154 * dc.b 10,0
155 * is how we have to output "hello, world!\n"
157 #undef ASM_OUTPUT_ASCII
158 #define ASM_OUTPUT_ASCII(asm_out_file, p, thissize) \
159 do { register int i, c, f=0, len=0; \
160 for (i = 0; i < thissize; i++) { \
161 c = p[i]; \
162 if (c == '\'' || c < ' ' || c > 127) { \
163 switch(f) { \
164 case 0: /* need to output dc.b etc */ \
165 fprintf(asm_out_file, "\tdc.b %d", c); \
166 f=1; \
167 break; \
168 case 1: \
169 fprintf(asm_out_file, ",%d", c); \
170 break; \
171 default: \
172 /* close a string */ \
173 fprintf(asm_out_file, "'\n\tdc.b %d", c); \
174 f=1; \
175 break; \
177 } else { \
178 switch(f) { \
179 case 0: \
180 fprintf(asm_out_file, "\tdc.b '%c", c); \
181 f=2; \
182 break; \
183 case 2: \
184 if (len >= 79) { \
185 fprintf(asm_out_file, "'\n\tdc.b '%c", c); \
186 len = 0; } \
187 else \
188 fprintf(asm_out_file, "%c", c); \
189 break; \
190 default: \
191 len = 0; \
192 fprintf(asm_out_file, "\n\tdc.b '%c", c); \
193 f=2; \
194 break; \
197 len++; \
199 if (f==2) \
200 putc('\'', asm_out_file); \
201 putc('\n', asm_out_file); } while (0)
203 /* This is how to output an insn to push a register on the stack.
204 It need not be very fast code. */
206 #undef ASM_OUTPUT_REG_PUSH
207 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
208 fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
210 /* This is how to output an insn to pop a register from the stack.
211 It need not be very fast code. */
213 #undef ASM_OUTPUT_REG_POP
214 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
215 fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
218 #define PUT_SDB_FUNCTION_START(LINE) \
219 fprintf (asm_out_file, \
220 "\t.def\t.bf%s\t.val\t*%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
221 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
223 #define PUT_SDB_FUNCTION_END(LINE) \
224 fprintf (asm_out_file, \
225 "\t.def\t.ef%s\t.val\t*%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
226 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
228 #define PUT_SDB_BLOCK_START(LINE) \
229 fprintf (asm_out_file, \
230 "\t.def\t.bb%s\t.val\t*%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
231 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
233 #define PUT_SDB_BLOCK_END(LINE) \
234 fprintf (asm_out_file, \
235 "\t.def\t.eb%s\t.val\t*%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
236 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
238 #define PUT_SDB_EPILOGUE_END(NAME)
240 /* Output type in decimal not in octal as done in sdbout.c */
241 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%d%s", a, SDB_DELIM)
243 #undef FUNCTION_PROLOGUE
244 #define FUNCTION_PROLOGUE(FILE, SIZE) \
246 register int regno; \
247 register int mask = 0; \
248 int num_saved_regs = 0, first = 1; \
249 extern char call_used_regs[]; \
250 int fsize = ((SIZE) + 3) & -4; \
253 if (frame_pointer_needed) \
255 /* Adding negative number is faster on the 68040. */ \
256 if (fsize < 0x8000 && !TARGET_68040) \
258 fprintf (FILE, "\tlink %s,#%d\n", \
259 reg_names[FRAME_POINTER_REGNUM], -fsize); \
261 else if (TARGET_68020) \
263 fprintf (FILE, "\tlink %s,#%d\n", \
264 reg_names[FRAME_POINTER_REGNUM], -fsize); \
266 else \
268 fprintf (FILE, "\tlink %s,#0\n\tadd.l #%d,sp\n", \
269 reg_names[FRAME_POINTER_REGNUM], -fsize); \
272 else if (fsize) \
274 /* Adding negative number is faster on the 68040. */ \
275 if (fsize + 4 < 0x8000) \
277 fprintf (FILE, "\tadd.w #%d,sp\n", - (fsize + 4)); \
279 else \
281 fprintf (FILE, "\tadd.l #%d,sp\n", - (fsize + 4)); \
284 for (regno = 23; regno >= 16; regno--) \
285 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
286 if (first) { \
287 fprintf (FILE, "\tfmovem.x %s", reg_names[regno]); \
288 first = 0; \
290 else fprintf (FILE, "/%s", reg_names[regno]); \
291 if (!first) fprintf (FILE, ",-(sp)\n"); \
293 mask = 0; \
294 for (regno = 0; regno < 16; regno++) \
295 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
297 mask |= 1 << (15 - regno); \
298 num_saved_regs++; \
300 if (frame_pointer_needed) \
302 mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM)); \
303 num_saved_regs--; \
307 if (num_saved_regs <= 2) \
309 /* Store each separately in the same order moveml uses. \
310 Using two movel instructions instead of a single moveml \
311 is about 15% faster for the 68020 and 68030 at no expense \
312 in code size */ \
314 int i; \
316 /* Undo the work from above. */ \
317 for (i = 0; i< 16; i++) \
318 if (mask & (1 << i)) \
319 fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[15 - i]); \
321 else if (mask) \
323 first = 1; \
324 for (regno = 0; regno < 16; regno++) \
325 if (mask & (1 << regno)) \
326 if (first) { \
327 fprintf (FILE, "\tmovem.l %s", reg_names[15 - regno]); \
328 first = 0; \
330 else fprintf (FILE, "/%s", reg_names[15 - regno]); \
331 fprintf (FILE, ",-(sp)\n"); \
333 if (flag_pic && current_function_uses_pic_offset_table) \
335 fprintf (FILE, "\tmove.l #__GLOBAL_OFFSET_TABLE_, %s\n", \
336 reg_names[PIC_OFFSET_TABLE_REGNUM]); \
337 fprintf (FILE, "\tlea.l (pc,%s.l),%s\n", \
338 reg_names[PIC_OFFSET_TABLE_REGNUM], \
339 reg_names[PIC_OFFSET_TABLE_REGNUM]); \
344 #undef FUNCTION_EPILOGUE
345 #define FUNCTION_EPILOGUE(FILE, SIZE) \
347 register int regno; \
348 register int mask, fmask; \
349 register int nregs; \
350 int offset, foffset, fpoffset, first = 1; \
351 extern char call_used_regs[]; \
352 int fsize = ((SIZE) + 3) & -4; \
353 int big = 0; \
354 rtx insn = get_last_insn (); \
356 /* If the last insn was a BARRIER, we don't have to write any code. */ \
357 if (GET_CODE (insn) == NOTE) \
358 insn = prev_nonnote_insn (insn); \
359 if (insn && GET_CODE (insn) == BARRIER) \
361 /* Output just a no-op so that debuggers don't get confused \
362 about which function the pc is in at this address. */ \
363 fprintf (FILE, "\tnop\n"); \
364 return; \
367 nregs = 0; fmask = 0; fpoffset = 0; \
368 for (regno = 16; regno < 24; regno++) \
369 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
371 nregs++; \
372 fmask |= 1 << (23 - regno); \
374 foffset = fpoffset + nregs * 12; \
375 nregs = 0; mask = 0; \
376 if (frame_pointer_needed) \
377 regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
378 for (regno = 0; regno < 16; regno++) \
379 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
381 nregs++; \
382 mask |= 1 << regno; \
384 offset = foffset + nregs * 4; \
385 if (offset + fsize >= 0x8000 \
386 && frame_pointer_needed \
387 && (mask || fmask || fpoffset)) \
389 fprintf (FILE, "\tmove.l #%d,a0\n", -fsize); \
390 fsize = 0, big = 1; \
392 if (nregs <= 2) \
394 /* Restore each separately in the same order moveml does. \
395 Using two movel instructions instead of a single moveml \
396 is about 15% faster for the 68020 and 68030 at no expense \
397 in code size. */ \
399 int i; \
401 /* Undo the work from above. */ \
402 for (i = 0; i< 16; i++) \
403 if (mask & (1 << i)) \
405 if (big) \
407 fprintf (FILE, "\tmove.l -%d(%s,a0.l),%s\n", \
408 offset + fsize, \
409 reg_names[FRAME_POINTER_REGNUM], \
410 reg_names[i]); \
412 else if (! frame_pointer_needed) \
414 fprintf (FILE, "\tmove.l (sp)+,%s\n", \
415 reg_names[i]); \
417 else \
419 fprintf (FILE, "\tmove.l -%d(%s),%s\n", \
420 offset + fsize, \
421 reg_names[FRAME_POINTER_REGNUM], \
422 reg_names[i]); \
424 offset = offset - 4; \
427 else if (mask) \
429 first = 1; \
430 for (regno = 0; regno < 16; regno++) \
431 if (mask & (1 << regno)) \
432 if (first && big) { \
433 fprintf (FILE, "\tmovem.l -%d(%s,a0.l),%s", \
434 offset + fsize, \
435 reg_names[FRAME_POINTER_REGNUM], \
436 reg_names[regno]); \
437 first = 0; \
439 else if (first && ! frame_pointer_needed) { \
440 fprintf (FILE, "\tmovem.l (sp)+,%s", \
441 offset + fsize, \
442 reg_names[FRAME_POINTER_REGNUM], \
443 reg_names[regno]); \
444 first = 0; \
446 else if (first) { \
447 fprintf (FILE, "\tmovem.l -%d(%s),%s", \
448 offset + fsize, \
449 reg_names[FRAME_POINTER_REGNUM], \
450 reg_names[regno]); \
451 first = 0; \
453 else \
454 fprintf (FILE, "/%s", reg_names[regno]); \
455 fprintf (FILE, "\n"); \
457 if (fmask) \
459 first = 1; \
460 for (regno = 16; regno < 24; regno++) \
461 if (fmask & (1 << (23 - regno))) \
462 if (first && big) { \
463 fprintf (FILE, "\tfmovem.x -%d(%s,a0.l),%s", \
464 foffset + fsize, \
465 reg_names[FRAME_POINTER_REGNUM], \
466 reg_names[regno]); \
467 first = 0; \
469 else if (first && ! frame_pointer_needed) { \
470 fprintf (FILE, "\tfmovem.x (sp)+,%s", \
471 foffset + fsize, \
472 reg_names[FRAME_POINTER_REGNUM], \
473 reg_names[regno]); \
474 first = 0; \
476 else if (first) { \
477 fprintf (FILE, "\tfmovem.x -%d(%s),%s", \
478 foffset + fsize, \
479 reg_names[FRAME_POINTER_REGNUM], \
480 reg_names[regno]); \
481 first = 0; \
483 else fprintf (FILE, "/%s", reg_names[regno]); \
484 fprintf (FILE, "\n"); \
486 if (frame_pointer_needed) \
487 fprintf (FILE, "\tunlk %s\n", \
488 reg_names[FRAME_POINTER_REGNUM]); \
489 else if (fsize) \
491 if (fsize + 4 < 0x8000) \
493 fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \
495 else \
497 fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \
500 if (current_function_pops_args) \
501 fprintf (FILE, "\trtd #%d\n", current_function_pops_args); \
502 else \
503 fprintf (FILE, "\trts\n"); \
506 /* Translate Motorola opcodes such as `jbeq'
507 into VERSAdos opcodes such as `beq'.
508 Change `fbeq' to `fbseq', `fbne' to `fbsneq'.
511 #undef ASM_OUTPUT_OPCODE
512 #define ASM_OUTPUT_OPCODE(FILE, PTR) \
513 { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
514 { ++(PTR); \
515 while (*(PTR) != ' ') \
516 { putc (*(PTR), (FILE)); ++(PTR); } \
518 else if ((PTR)[0] == 'f') \
520 if (!strncmp ((PTR), "fbeq", 4)) \
521 { fprintf ((FILE), "fbseq"); (PTR) += 4; } \
522 else if (!strncmp ((PTR), "fbne", 4)) \
523 { fprintf ((FILE), "fbsneq"); (PTR) += 4; } \
525 else if ((PTR)[0] == 'b' && (PTR)[1] == 'f') \
527 char *s; \
528 if ((s = (char*)strchr ((PTR), '{'))) \
529 while (*s != '}') { \
530 if (*s == 'b') \
531 /* hack, I replace it with R ie nothing */ \
532 *s = '0'; \
533 s++; } \
537 /* This is how to output a `long double' extended real constant. */
538 #undef ASM_OUTPUT_LONG_DOUBLE
539 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
540 do { long l[3]; \
541 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
542 if (sizeof (int) == sizeof (long)) \
543 fprintf (FILE, "\tdc.l $%x,$%x,$%x\n", l[0], l[1], l[2]); \
544 else \
545 fprintf (FILE, "\tdc.l $%lx,$%lx,$%lx\n", l[0], l[1], l[2]); \
546 } while (0)
548 #undef ASM_OUTPUT_DOUBLE
549 #if 0
550 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
551 do { char dstr[30]; \
552 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
553 fprintf (FILE, "\tdc.d %s\n", dstr); \
554 } while (0)
555 #endif
556 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
557 do { long l[2]; \
558 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
559 fprintf (FILE, "\tdc.l $%x,$%x\n", l[0], l[1]); \
560 } while (0)
563 /* This is how to output an assembler line defining a `float' constant. */
564 #undef ASM_OUTPUT_FLOAT
565 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
566 do { long l; \
567 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
568 if (sizeof (int) == sizeof (long)) \
569 fprintf (FILE, "\tdc.l $%x\n", l); \
570 else \
571 fprintf (FILE, "\tdc.l $%lx\n", l); \
572 } while (0)
574 /* This is how to output an assembler line defining an `int' constant. */
575 #undef ASM_OUTPUT_INT
576 #define ASM_OUTPUT_INT(FILE,VALUE) \
577 ( fprintf (FILE, "\tdc.l "), \
578 output_addr_const (FILE, (VALUE)), \
579 fprintf (FILE, "\n"))
581 /* Likewise for `char' and `short' constants. */
582 #undef ASM_OUTPUT_SHORT
583 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
584 ( fprintf (FILE, "\tdc.w "), \
585 output_addr_const (FILE, (VALUE)), \
586 fprintf (FILE, "\n"))
588 #undef ASM_OUTPUT_CHAR
589 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
590 ( fprintf (FILE, "\tdc.b "), \
591 output_addr_const (FILE, (VALUE)), \
592 fprintf (FILE, "\n"))
594 /* This is how to output an assembler line for a numeric constant byte. */
595 #undef ASM_OUTPUT_BYTE
596 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
597 fprintf (FILE, "\tdc.b $%x\n", (VALUE))
599 /* This is how to output an element of a case-vector that is absolute.
600 (The 68000 does not use such vectors,
601 but we must define this macro anyway.) */
602 #undef ASM_OUTPUT_ADDR_VEC_ELT
603 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
604 asm_fprintf (FILE, "\tdc.l %LL%d\n", VALUE)
606 /* This is how to output an element of a case-vector that is relative. */
607 #undef ASM_OUTPUT_ADDR_DIFF_ELT
608 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
609 asm_fprintf (FILE, "\tdc.w %LL%d-%LL%d\n", VALUE, REL)
611 /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
612 keep switch tables in the text section. */
613 #define JUMP_TABLES_IN_TEXT_SECTION 1
615 /* Output a float value (represented as a C double) as an immediate operand.
616 This macro is a 68k-specific macro. */
617 #undef ASM_OUTPUT_FLOAT_OPERAND
618 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
619 do { \
620 if (CODE == 'f') \
622 char dstr[30]; \
623 REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
624 asm_fprintf ((FILE), "%I%s", dstr); \
626 else \
628 long l; \
629 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
630 if (sizeof (int) == sizeof (long)) \
631 asm_fprintf ((FILE), "%I$%x", l); \
632 else \
633 asm_fprintf ((FILE), "%I$%lx", l); \
635 } while (0)
637 /* Output a double value (represented as a C double) as an immediate operand.
638 This macro is a 68k-specific macro. */
639 #undef ASM_OUTPUT_DOUBLE_OPERAND
640 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
641 do { char dstr[30]; \
642 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
643 asm_fprintf (FILE, "%I%s", dstr); \
644 } while (0)
646 /* Note, long double immediate operands are not actually
647 generated by m68k.md. */
648 #undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
649 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
650 do { char dstr[30]; \
651 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
652 asm_fprintf (FILE, "%I%s", dstr); \
653 } while (0)
655 #undef ASM_OUTPUT_COMMON
656 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
657 ( fputs ("\t.comm ", (FILE)), \
658 assemble_name ((FILE), (NAME)), \
659 fprintf ((FILE), ",%u\n", (ROUNDED)))
661 #undef ASM_OUTPUT_LOCAL
662 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
663 do { \
664 int align = exact_log2 (ROUNDED); \
665 /*fprintf ((FILE), "\tsection 14\n"); */ \
666 data_section (); \
667 ASM_OUTPUT_ALIGN ((FILE), align) \
668 ASM_OUTPUT_LABEL ((FILE), (NAME)); \
669 fprintf ((FILE), "\tdcb.b %u,0\n", (ROUNDED)); \
670 /* fprintf ((FILE), "\tsection 10\n"); */ \
671 } while (0)
673 #undef PRINT_OPERAND_ADDRESS
674 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
675 { register rtx reg1, reg2, breg, ireg; \
676 register rtx addr = ADDR; \
677 rtx offset; \
678 switch (GET_CODE (addr)) \
680 case REG: \
681 fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
682 break; \
683 case PRE_DEC: \
684 fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
685 break; \
686 case POST_INC: \
687 fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
688 break; \
689 case PLUS: \
690 reg1 = 0; reg2 = 0; \
691 ireg = 0; breg = 0; \
692 offset = 0; \
693 if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
695 offset = XEXP (addr, 0); \
696 addr = XEXP (addr, 1); \
698 else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
700 offset = XEXP (addr, 1); \
701 addr = XEXP (addr, 0); \
703 if (GET_CODE (addr) != PLUS) ; \
704 else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
706 reg1 = XEXP (addr, 0); \
707 addr = XEXP (addr, 1); \
709 else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
711 reg1 = XEXP (addr, 1); \
712 addr = XEXP (addr, 0); \
714 else if (GET_CODE (XEXP (addr, 0)) == MULT) \
716 reg1 = XEXP (addr, 0); \
717 addr = XEXP (addr, 1); \
719 else if (GET_CODE (XEXP (addr, 1)) == MULT) \
721 reg1 = XEXP (addr, 1); \
722 addr = XEXP (addr, 0); \
724 else if (GET_CODE (XEXP (addr, 0)) == REG) \
726 reg1 = XEXP (addr, 0); \
727 addr = XEXP (addr, 1); \
729 else if (GET_CODE (XEXP (addr, 1)) == REG) \
731 reg1 = XEXP (addr, 1); \
732 addr = XEXP (addr, 0); \
734 if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
735 || GET_CODE (addr) == SIGN_EXTEND) \
736 { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
737 /* for OLD_INDEXING \
738 else if (GET_CODE (addr) == PLUS) \
740 if (GET_CODE (XEXP (addr, 0)) == REG) \
742 reg2 = XEXP (addr, 0); \
743 addr = XEXP (addr, 1); \
745 else if (GET_CODE (XEXP (addr, 1)) == REG) \
747 reg2 = XEXP (addr, 1); \
748 addr = XEXP (addr, 0); \
751 */ \
752 if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
753 if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
754 || GET_CODE (reg1) == MULT)) \
755 || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
756 { breg = reg2; ireg = reg1; } \
757 else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
758 { breg = reg1; ireg = reg2; } \
759 if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
760 { int scale = 1; \
761 if (GET_CODE (ireg) == MULT) \
762 { scale = INTVAL (XEXP (ireg, 1)); \
763 ireg = XEXP (ireg, 0); } \
764 if (GET_CODE (ireg) == SIGN_EXTEND) \
765 fprintf (FILE, "(.L%d,pc,%s.w", \
766 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
767 reg_names[REGNO (XEXP (ireg, 0))]); \
768 else \
769 fprintf (FILE, "(.L%d,pc,%s.l", \
770 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
771 reg_names[REGNO (ireg)]); \
772 if (scale != 1) fprintf (FILE, "*%d", scale); \
773 putc (')', FILE); \
774 break; } \
775 if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF \
776 && ! (flag_pic && breg == pic_offset_table_rtx)) \
778 fprintf (FILE, "(.L%d,pc,%s.l", \
779 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
780 reg_names[REGNO (breg)]); \
781 putc (')', FILE); \
782 break; } \
783 if (ireg != 0 || breg != 0) \
784 { int scale = 1; \
785 if (breg == 0) \
786 abort (); \
787 putc ('(', FILE); \
788 if (addr != 0) \
790 output_addr_const (FILE, addr); \
791 putc (',', FILE); \
793 fprintf (FILE, "%s", reg_names[REGNO (breg)]); \
794 if (ireg != 0) \
795 putc (',', FILE); \
796 if (ireg != 0 && GET_CODE (ireg) == MULT) \
797 { scale = INTVAL (XEXP (ireg, 1)); \
798 ireg = XEXP (ireg, 0); } \
799 if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
800 fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
801 else if (ireg != 0) \
802 fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
803 if (scale != 1) fprintf (FILE, "*%d", scale); \
804 putc (')', FILE); \
805 break; \
807 else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
808 { fprintf (FILE, "(.L%d,pc,%s.w)", \
809 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
810 reg_names[REGNO (reg1)]); \
811 break; } \
812 default: \
813 if (GET_CODE (addr) == CONST_INT \
814 && INTVAL (addr) < 0x8000 \
815 && INTVAL (addr) >= -0x8000) \
816 fprintf (FILE, "%d.w", INTVAL (addr)); \
817 else \
818 output_addr_const (FILE, addr); \
822 #endif /* ! use gas */