1*a2142627SBen Jolitz /* Definitions for Unix assembler syntax for the Intel 80386. 2*a2142627SBen Jolitz Copyright (C) 1988 Free Software Foundation, Inc. 3*a2142627SBen Jolitz 4*a2142627SBen Jolitz This file is part of GNU CC. 5*a2142627SBen Jolitz 6*a2142627SBen Jolitz GNU CC is free software; you can redistribute it and/or modify 7*a2142627SBen Jolitz it under the terms of the GNU General Public License as published by 8*a2142627SBen Jolitz the Free Software Foundation; either version 2, or (at your option) 9*a2142627SBen Jolitz any later version. 10*a2142627SBen Jolitz 11*a2142627SBen Jolitz GNU CC is distributed in the hope that it will be useful, 12*a2142627SBen Jolitz but WITHOUT ANY WARRANTY; without even the implied warranty of 13*a2142627SBen Jolitz MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*a2142627SBen Jolitz GNU General Public License for more details. 15*a2142627SBen Jolitz 16*a2142627SBen Jolitz You should have received a copy of the GNU General Public License 17*a2142627SBen Jolitz along with GNU CC; see the file COPYING. If not, write to 18*a2142627SBen Jolitz the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 19*a2142627SBen Jolitz 20*a2142627SBen Jolitz /* This file defines the aspects of assembler syntax 21*a2142627SBen Jolitz that are the same for all the i386 Unix systems 22*a2142627SBen Jolitz (though they may differ in non-Unix systems). */ 23*a2142627SBen Jolitz 24*a2142627SBen Jolitz /* Define some concatenation macros to concatenate an opcode 25*a2142627SBen Jolitz and one, two or three operands. In other assembler syntaxes 26*a2142627SBen Jolitz they may alter the order of ther operands. */ 27*a2142627SBen Jolitz 28*a2142627SBen Jolitz /* Note that the other files fail to use these 29*a2142627SBen Jolitz in some of the places where they should. */ 30*a2142627SBen Jolitz 31*a2142627SBen Jolitz #ifdef __STDC__ 32*a2142627SBen Jolitz #define AS2(a,b,c) #a " " #b "," #c 33*a2142627SBen Jolitz #define AS3(a,b,c,d) #a " " #b "," #c "," #d 34*a2142627SBen Jolitz #define AS1(a,b) #a " " #b 35*a2142627SBen Jolitz #else 36*a2142627SBen Jolitz #define AS1(a,b) "a b" 37*a2142627SBen Jolitz #define AS2(a,b,c) "a b,c" 38*a2142627SBen Jolitz #define AS3(a,b,c,d) "a b,c,d" 39*a2142627SBen Jolitz #endif 40*a2142627SBen Jolitz 41*a2142627SBen Jolitz /* Define macro used to output shift-double opcodes when the shift 42*a2142627SBen Jolitz count is in %cl. Some assemblers require %cl as an argument; 43*a2142627SBen Jolitz some don't. This macro controls what to do: by default, don't 44*a2142627SBen Jolitz print %cl. */ 45*a2142627SBen Jolitz #define AS3_SHIFT_DOUBLE(a,b,c,d) AS2 (a,c,d) 46*a2142627SBen Jolitz 47*a2142627SBen Jolitz /* Output the size-letter for an opcode. 48*a2142627SBen Jolitz CODE is the letter used in an operand spec (L, B, W, S or Q). 49*a2142627SBen Jolitz CH is the corresponding lower case letter 50*a2142627SBen Jolitz (except if CODE is `Q' then CH is `l', unless GAS_MNEMONICS). */ 51*a2142627SBen Jolitz #define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE)) 52*a2142627SBen Jolitz 53*a2142627SBen Jolitz /* Opcode suffix for fullword insn. */ 54*a2142627SBen Jolitz #define L_SIZE "l" 55*a2142627SBen Jolitz 56*a2142627SBen Jolitz /* Prefix for register names in this syntax. */ 57*a2142627SBen Jolitz #define RP "%" 58*a2142627SBen Jolitz 59*a2142627SBen Jolitz /* Prefix for immediate operands in this syntax. */ 60*a2142627SBen Jolitz #define IP "$" 61*a2142627SBen Jolitz 62*a2142627SBen Jolitz /* Indirect call instructions should use `*'. */ 63*a2142627SBen Jolitz #define USE_STAR 1 64*a2142627SBen Jolitz 65*a2142627SBen Jolitz /* Prefix for a memory-operand X. */ 66*a2142627SBen Jolitz #define PRINT_PTR(X, FILE) 67*a2142627SBen Jolitz 68*a2142627SBen Jolitz /* Delimiters that surround base reg and index reg. */ 69*a2142627SBen Jolitz #define ADDR_BEG(FILE) putc('(', (FILE)) 70*a2142627SBen Jolitz #define ADDR_END(FILE) putc(')', (FILE)) 71*a2142627SBen Jolitz 72*a2142627SBen Jolitz /* Print an index register (whose rtx is IREG). */ 73*a2142627SBen Jolitz #define PRINT_IREG(FILE,IREG) \ 74*a2142627SBen Jolitz do \ 75*a2142627SBen Jolitz { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \ 76*a2142627SBen Jolitz while (0) 77*a2142627SBen Jolitz 78*a2142627SBen Jolitz /* Print an index scale factor SCALE. */ 79*a2142627SBen Jolitz #define PRINT_SCALE(FILE,SCALE) \ 80*a2142627SBen Jolitz if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE)) 81*a2142627SBen Jolitz 82*a2142627SBen Jolitz /* Print a base/index combination. 83*a2142627SBen Jolitz BREG is the base reg rtx, IREG is the index reg rtx, 84*a2142627SBen Jolitz and SCALE is the index scale factor (an integer). */ 85*a2142627SBen Jolitz 86*a2142627SBen Jolitz #define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \ 87*a2142627SBen Jolitz { ADDR_BEG (FILE); \ 88*a2142627SBen Jolitz if (BREG) PRINT_REG ((BREG), 0, (FILE)); \ 89*a2142627SBen Jolitz if ((IREG) != 0) \ 90*a2142627SBen Jolitz { PRINT_IREG ((FILE), (IREG)); \ 91*a2142627SBen Jolitz PRINT_SCALE ((FILE), (SCALE)); } \ 92*a2142627SBen Jolitz ADDR_END (FILE); } 93*a2142627SBen Jolitz 94*a2142627SBen Jolitz /* Define the syntax of pseudo-ops, labels and comments. */ 95*a2142627SBen Jolitz 96*a2142627SBen Jolitz /* String containing the assembler's comment-starter. */ 97*a2142627SBen Jolitz 98*a2142627SBen Jolitz #define ASM_COMMENT_START "/" 99*a2142627SBen Jolitz #define COMMENT_BEGIN "/" 100*a2142627SBen Jolitz 101*a2142627SBen Jolitz /* Output to assembler file text saying following lines 102*a2142627SBen Jolitz may contain character constants, extra white space, comments, etc. */ 103*a2142627SBen Jolitz 104*a2142627SBen Jolitz #define ASM_APP_ON "/APP\n" 105*a2142627SBen Jolitz 106*a2142627SBen Jolitz /* Output to assembler file text saying following lines 107*a2142627SBen Jolitz no longer contain unusual constructs. */ 108*a2142627SBen Jolitz 109*a2142627SBen Jolitz #define ASM_APP_OFF "/NO_APP\n" 110*a2142627SBen Jolitz 111*a2142627SBen Jolitz /* Output before read-only data. */ 112*a2142627SBen Jolitz 113*a2142627SBen Jolitz #define TEXT_SECTION_ASM_OP ".text" 114*a2142627SBen Jolitz 115*a2142627SBen Jolitz /* Output before writable (initialized) data. */ 116*a2142627SBen Jolitz 117*a2142627SBen Jolitz #define DATA_SECTION_ASM_OP ".data" 118*a2142627SBen Jolitz 119*a2142627SBen Jolitz /* Output before writable (uninitialized) data. */ 120*a2142627SBen Jolitz 121*a2142627SBen Jolitz #define BSS_SECTION_ASM_OP ".bss" 122*a2142627SBen Jolitz 123*a2142627SBen Jolitz /* This is how to output a command to make the user-level label named NAME 124*a2142627SBen Jolitz defined for reference from other files. */ 125*a2142627SBen Jolitz 126*a2142627SBen Jolitz #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ 127*a2142627SBen Jolitz (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) 128*a2142627SBen Jolitz 129*a2142627SBen Jolitz /* By default, target has a 80387, uses IEEE compatible arithmetic, 130*a2142627SBen Jolitz and returns float values in the 387, ie, 131*a2142627SBen Jolitz (TARGET_80387 | TARGET_IEEE_FP | TARGET_FLOAT_RETURNS_IN_80387) */ 132*a2142627SBen Jolitz 133*a2142627SBen Jolitz #define TARGET_DEFAULT 0301 134*a2142627SBen Jolitz 135*a2142627SBen Jolitz /* Floating-point return values come in the FP register. */ 136*a2142627SBen Jolitz 137*a2142627SBen Jolitz #define VALUE_REGNO(MODE) \ 138*a2142627SBen Jolitz (GET_MODE_CLASS (MODE) == MODE_FLOAT \ 139*a2142627SBen Jolitz && TARGET_FLOAT_RETURNS_IN_80387 ? FIRST_FLOAT_REG : 0) 140*a2142627SBen Jolitz 141*a2142627SBen Jolitz /* 1 if N is a possible register number for a function value. */ 142*a2142627SBen Jolitz 143*a2142627SBen Jolitz #define FUNCTION_VALUE_REGNO_P(N) \ 144*a2142627SBen Jolitz ((N) == 0 || ((N)== FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387)) 145*a2142627SBen Jolitz 146