xref: /openbsd-src/gnu/usr.bin/gcc/gcc/config/m68k/atari.h (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1*c87b03e5Sespie /* Definitions of target machine for GNU compiler.
2*c87b03e5Sespie    Atari TT ASV version.
3*c87b03e5Sespie    Copyright (C) 1994, 1995, 2000 Free Software Foundation, Inc.
4*c87b03e5Sespie 
5*c87b03e5Sespie This file is part of GNU CC.
6*c87b03e5Sespie 
7*c87b03e5Sespie GNU CC is free software; you can redistribute it and/or modify
8*c87b03e5Sespie it under the terms of the GNU General Public License as published by
9*c87b03e5Sespie the Free Software Foundation; either version 2, or (at your option)
10*c87b03e5Sespie any later version.
11*c87b03e5Sespie 
12*c87b03e5Sespie GNU CC is distributed in the hope that it will be useful,
13*c87b03e5Sespie but WITHOUT ANY WARRANTY; without even the implied warranty of
14*c87b03e5Sespie MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*c87b03e5Sespie GNU General Public License for more details.
16*c87b03e5Sespie 
17*c87b03e5Sespie You should have received a copy of the GNU General Public License
18*c87b03e5Sespie along with GNU CC; see the file COPYING.  If not, write to
19*c87b03e5Sespie the Free Software Foundation, 59 Temple Place - Suite 330,
20*c87b03e5Sespie Boston, MA 02111-1307, USA.  */
21*c87b03e5Sespie 
22*c87b03e5Sespie #include "m68k/m68kv4.h"
23*c87b03e5Sespie 
24*c87b03e5Sespie /* Dollars and dots in labels are not allowed.  */
25*c87b03e5Sespie 
26*c87b03e5Sespie #define NO_DOLLAR_IN_LABEL
27*c87b03e5Sespie #define NO_DOT_IN_LABEL
28*c87b03e5Sespie 
29*c87b03e5Sespie /* Alter assembler syntax for fsgldiv and fsglmul.
30*c87b03e5Sespie    It is highly likely that this is a generic SGS m68k assembler dependency.
31*c87b03e5Sespie    If so, it should eventually be handled in the m68k/sgs.h ASM_OUTPUT_OPCODE
32*c87b03e5Sespie    macro, like the other SGS assembler quirks.  -fnf */
33*c87b03e5Sespie 
34*c87b03e5Sespie #define FSGLDIV_USE_S		/* Use fsgldiv.s, not fsgldiv.x */
35*c87b03e5Sespie #define FSGLMUL_USE_S		/* Use fsglmul.s, not fsglmul.x */
36*c87b03e5Sespie 
37*c87b03e5Sespie /* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
38*c87b03e5Sespie    Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
39*c87b03e5Sespie    fails to assemble.  Luckily "Lnnn(pc,d0.l*2)" produces the results
40*c87b03e5Sespie    we want.  This difference can be accommodated by making the assembler
41*c87b03e5Sespie    define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
42*c87b03e5Sespie    string, as necessary.  This is accomplished via the ASM_OUTPUT_CASE_END
43*c87b03e5Sespie    macro. (the Amiga assembler has this bug) */
44*c87b03e5Sespie 
45*c87b03e5Sespie #undef ASM_OUTPUT_CASE_END
46*c87b03e5Sespie #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE)				\
47*c87b03e5Sespie do {									\
48*c87b03e5Sespie   if (switch_table_difference_label_flag)				\
49*c87b03e5Sespie     asm_fprintf ((FILE), "%s%LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\
50*c87b03e5Sespie   switch_table_difference_label_flag = 0;				\
51*c87b03e5Sespie } while (0)
52*c87b03e5Sespie 
53*c87b03e5Sespie int switch_table_difference_label_flag;
54*c87b03e5Sespie 
55*c87b03e5Sespie /* This definition of ASM_OUTPUT_ASCII is the same as the one in m68k/sgs.h,
56*c87b03e5Sespie    which has been overridden by the one in svr4.h.  However, we can't use
57*c87b03e5Sespie    the one in svr4.h because the ASV assembler croaks on some of the
58*c87b03e5Sespie    strings that it emits (such as .string "\"%s\"\n").  */
59*c87b03e5Sespie 
60*c87b03e5Sespie #undef ASM_OUTPUT_ASCII
61*c87b03e5Sespie #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)				\
62*c87b03e5Sespie {								\
63*c87b03e5Sespie   register size_t sp = 0, limit = (LEN);			\
64*c87b03e5Sespie   fputs (integer_asm_op (1, TRUE), (FILE));			\
65*c87b03e5Sespie   do {								\
66*c87b03e5Sespie     int ch = (PTR)[sp];						\
67*c87b03e5Sespie     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')		\
68*c87b03e5Sespie       {								\
69*c87b03e5Sespie 	fprintf ((FILE), "'%c", ch);				\
70*c87b03e5Sespie       }								\
71*c87b03e5Sespie     else							\
72*c87b03e5Sespie       {								\
73*c87b03e5Sespie 	fprintf ((FILE), "0x%x", ch);				\
74*c87b03e5Sespie       }								\
75*c87b03e5Sespie     if (++sp < limit)						\
76*c87b03e5Sespie       {								\
77*c87b03e5Sespie 	if ((sp % 10) == 0)					\
78*c87b03e5Sespie 	  {							\
79*c87b03e5Sespie 	    fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE));	\
80*c87b03e5Sespie 	  }							\
81*c87b03e5Sespie 	else							\
82*c87b03e5Sespie 	  {							\
83*c87b03e5Sespie 	    putc (',', (FILE));					\
84*c87b03e5Sespie 	  }							\
85*c87b03e5Sespie       }								\
86*c87b03e5Sespie   } while (sp < limit);						\
87*c87b03e5Sespie   putc ('\n', (FILE));						\
88*c87b03e5Sespie }
89*c87b03e5Sespie 
90*c87b03e5Sespie /* Override these for the sake of an assembler bug: the ASV
91*c87b03e5Sespie    assembler can't handle .LC0@GOT syntax.  This pollutes the final
92*c87b03e5Sespie    table for shared librarys but what's a poor soul to do; sigh... RFH */
93*c87b03e5Sespie 
94*c87b03e5Sespie #undef ASM_GENERATE_INTERNAL_LABEL
95*c87b03e5Sespie #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
96*c87b03e5Sespie do {							\
97*c87b03e5Sespie   if (flag_pic && !strcmp(PREFIX,"LC"))			\
98*c87b03e5Sespie     sprintf (LABEL, "*%s%%%ld", PREFIX, (long)(NUM));	\
99*c87b03e5Sespie   else							\
100*c87b03e5Sespie     sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM)); \
101*c87b03e5Sespie } while (0)
102*c87b03e5Sespie 
103*c87b03e5Sespie #undef ASM_OUTPUT_INTERNAL_LABEL
104*c87b03e5Sespie #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)	\
105*c87b03e5Sespie   if (flag_pic && !strcmp(PREFIX,"LC"))			\
106*c87b03e5Sespie     fprintf (FILE, "%s%%%d:\n", PREFIX, NUM);		\
107*c87b03e5Sespie   else							\
108*c87b03e5Sespie     asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
109