150397Sobrien/* Definitions for Intel 386 using GAS.
2169689Skan   Copyright (C) 1988, 1993, 1994, 1996, 2002, 2004
3169689Skan   Free Software Foundation, Inc.
418334Speter
5132718SkanThis file is part of GCC.
618334Speter
7132718SkanGCC is free software; you can redistribute it and/or modify
818334Speterit under the terms of the GNU General Public License as published by
918334Speterthe Free Software Foundation; either version 2, or (at your option)
1018334Speterany later version.
1118334Speter
12132718SkanGCC is distributed in the hope that it will be useful,
1318334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of
1418334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1518334SpeterGNU General Public License for more details.
1618334Speter
1718334SpeterYou should have received a copy of the GNU General Public License
18132718Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
2118334Speter
2218334Speter/* Note that i386/seq-gas.h is a GAS configuration that does not use this
2390075Sobrien   file.  */
2418334Speter
2518334Speter/* Use the bsd assembler syntax.  */
2618334Speter/* we need to do this because gas is really a bsd style assembler,
2718334Speter * and so doesn't work well this these att-isms:
2818334Speter *
2918334Speter *  ASM_OUTPUT_SKIP is .set .,.+N, which isn't implemented in gas
3018334Speter *  ASM_OUTPUT_LOCAL is done with .set .,.+N, but that can't be
3118334Speter *   used to define bss static space
3218334Speter *
3318334Speter * Next is the question of whether to uses underscores.  RMS didn't
3418334Speter * like this idea at first, but since it is now obvious that we
3518334Speter * need this separate tm file for use with gas, at least to get
3618334Speter * dbx debugging info, I think we should also switch to underscores.
3718334Speter * We can keep i386v for real att style output, and the few
3818334Speter * people who want both form will have to compile twice.
3918334Speter */
4018334Speter
4118334Speter/* these come from i386/bsd.h, but are specific to sequent */
4218334Speter#undef DBX_NO_XREFS
4318334Speter#undef DBX_CONTIN_LENGTH
4418334Speter
4518334Speter/* Ask for COFF symbols.  */
4618334Speter
47117395Skan#define SDB_DEBUGGING_INFO 1
4818334Speter
4918334Speter/* Output #ident as a .ident.  */
5018334Speter
5118334Speter#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
5218334Speter
5350397Sobrien/* In the past there was confusion as to what the argument to .align was
5450397Sobrien   in GAS.  For the last several years the rule has been this: for a.out
5550397Sobrien   file formats that argument is LOG, and for all other file formats the
5650397Sobrien   argument is 1<<LOG.
5718334Speter
5850397Sobrien   However, GAS now has .p2align and .balign pseudo-ops so to remove any
5950397Sobrien   doubt or guess work, and since this file is used for both a.out and other
6050397Sobrien   file formats, we use one of them.  */
6150397Sobrien
6250397Sobrien#ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
6318334Speter#undef ASM_OUTPUT_ALIGN
6450397Sobrien#define ASM_OUTPUT_ALIGN(FILE,LOG) \
6550397Sobrien  if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
6618334Speter#endif
6718334Speter
6850397Sobrien/* A C statement to output to the stdio stream FILE an assembler
6950397Sobrien   command to advance the location counter to a multiple of 1<<LOG
7050397Sobrien   bytes if it is within MAX_SKIP bytes.
7118334Speter
7250397Sobrien   This is used to align code labels according to Intel recommendations.  */
7318334Speter
7450397Sobrien#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
7550397Sobrien#  define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
7652284Sobrien     if ((LOG) != 0) {\
7752284Sobrien       if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
7852284Sobrien       else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
7952284Sobrien     }
8050397Sobrien#endif
8118334Speter
8218334Speter/* A C statement or statements which output an assembler instruction
8318334Speter   opcode to the stdio stream STREAM.  The macro-operand PTR is a
8418334Speter   variable of type `char *' which points to the opcode name in its
8518334Speter   "internal" form--the form that is written in the machine description.
8618334Speter
8718334Speter   GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
8818334Speter   So use `repe' instead.  */
8918334Speter
9018334Speter#define ASM_OUTPUT_OPCODE(STREAM, PTR)	\
9118334Speter{									\
9218334Speter  if ((PTR)[0] == 'r'							\
9318334Speter      && (PTR)[1] == 'e'						\
9418334Speter      && (PTR)[2] == 'p')						\
9518334Speter    {									\
9618334Speter      if ((PTR)[3] == 'z')						\
9718334Speter	{								\
9818334Speter	  fprintf (STREAM, "repe");					\
9918334Speter	  (PTR) += 4;							\
10018334Speter	}								\
10118334Speter      else if ((PTR)[3] == 'n' && (PTR)[4] == 'z')			\
10218334Speter	{								\
10318334Speter	  fprintf (STREAM, "repne");					\
10418334Speter	  (PTR) += 5;							\
10518334Speter	}								\
10618334Speter    }									\
10718334Speter}
10818334Speter
10918334Speter/* Define macro used to output shift-double opcodes when the shift
11018334Speter   count is in %cl.  Some assemblers require %cl as an argument;
11118334Speter   some don't.
11218334Speter
11390075Sobrien   GAS requires the %cl argument, so override i386/unix.h.  */
11418334Speter
11550397Sobrien#undef SHIFT_DOUBLE_OMITS_COUNT
11650397Sobrien#define SHIFT_DOUBLE_OMITS_COUNT 0
11718334Speter
11890075Sobrien/* Print opcodes the way that GAS expects them.  */
11918334Speter#define GAS_MNEMONICS 1
12018334Speter
121169689Skan/* The comment-starter string as GAS expects it. */
122169689Skan#undef ASM_COMMENT_START
123169689Skan#define ASM_COMMENT_START "#"
124169689Skan
125132718Skan#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
126