gas.h revision 117395
150397Sobrien/* Definitions for Intel 386 using GAS.
2117395Skan   Copyright (C) 1988, 1993, 1994, 1996, 2002 Free Software Foundation, Inc.
318334Speter
418334SpeterThis file is part of GNU CC.
518334Speter
618334SpeterGNU CC is free software; you can redistribute it and/or modify
718334Speterit under the terms of the GNU General Public License as published by
818334Speterthe Free Software Foundation; either version 2, or (at your option)
918334Speterany later version.
1018334Speter
1118334SpeterGNU CC is distributed in the hope that it will be useful,
1218334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of
1318334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1418334SpeterGNU General Public License for more details.
1518334Speter
1618334SpeterYou should have received a copy of the GNU General Public License
1718334Speteralong with GNU CC; see the file COPYING.  If not, write to
1818334Speterthe Free Software Foundation, 59 Temple Place - Suite 330,
1918334SpeterBoston, MA 02111-1307, USA.  */
2018334Speter
2118334Speter/* Note that i386/seq-gas.h is a GAS configuration that does not use this
2290075Sobrien   file.  */
2318334Speter
2418334Speter/* Use the bsd assembler syntax.  */
2518334Speter/* we need to do this because gas is really a bsd style assembler,
2618334Speter * and so doesn't work well this these att-isms:
2718334Speter *
2818334Speter *  ASM_OUTPUT_SKIP is .set .,.+N, which isn't implemented in gas
2918334Speter *  ASM_OUTPUT_LOCAL is done with .set .,.+N, but that can't be
3018334Speter *   used to define bss static space
3118334Speter *
3218334Speter * Next is the question of whether to uses underscores.  RMS didn't
3318334Speter * like this idea at first, but since it is now obvious that we
3418334Speter * need this separate tm file for use with gas, at least to get
3518334Speter * dbx debugging info, I think we should also switch to underscores.
3618334Speter * We can keep i386v for real att style output, and the few
3718334Speter * people who want both form will have to compile twice.
3818334Speter */
3918334Speter
4018334Speter/* these come from i386/bsd.h, but are specific to sequent */
4118334Speter#undef DBX_NO_XREFS
4218334Speter#undef DBX_CONTIN_LENGTH
4318334Speter
4418334Speter/* Ask for COFF symbols.  */
4518334Speter
46117395Skan#define SDB_DEBUGGING_INFO 1
4718334Speter
4818334Speter/* Output #ident as a .ident.  */
4918334Speter
5018334Speter#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
5118334Speter
5218334Speter/* Implicit library calls should use memcpy, not bcopy, etc.  */
5318334Speter
5418334Speter#define TARGET_MEM_FUNCTIONS
5518334Speter
5650397Sobrien/* In the past there was confusion as to what the argument to .align was
5750397Sobrien   in GAS.  For the last several years the rule has been this: for a.out
5850397Sobrien   file formats that argument is LOG, and for all other file formats the
5950397Sobrien   argument is 1<<LOG.
6018334Speter
6150397Sobrien   However, GAS now has .p2align and .balign pseudo-ops so to remove any
6250397Sobrien   doubt or guess work, and since this file is used for both a.out and other
6350397Sobrien   file formats, we use one of them.  */
6450397Sobrien
6550397Sobrien#ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
6618334Speter#undef ASM_OUTPUT_ALIGN
6750397Sobrien#define ASM_OUTPUT_ALIGN(FILE,LOG) \
6850397Sobrien  if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
6918334Speter#endif
7018334Speter
7150397Sobrien/* A C statement to output to the stdio stream FILE an assembler
7250397Sobrien   command to advance the location counter to a multiple of 1<<LOG
7350397Sobrien   bytes if it is within MAX_SKIP bytes.
7418334Speter
7550397Sobrien   This is used to align code labels according to Intel recommendations.  */
7618334Speter
7750397Sobrien#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
7850397Sobrien#  define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
7952284Sobrien     if ((LOG) != 0) {\
8052284Sobrien       if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
8152284Sobrien       else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
8252284Sobrien     }
8350397Sobrien#endif
8418334Speter
8518334Speter/* A C statement or statements which output an assembler instruction
8618334Speter   opcode to the stdio stream STREAM.  The macro-operand PTR is a
8718334Speter   variable of type `char *' which points to the opcode name in its
8818334Speter   "internal" form--the form that is written in the machine description.
8918334Speter
9018334Speter   GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
9118334Speter   So use `repe' instead.  */
9218334Speter
9318334Speter#define ASM_OUTPUT_OPCODE(STREAM, PTR)	\
9418334Speter{									\
9518334Speter  if ((PTR)[0] == 'r'							\
9618334Speter      && (PTR)[1] == 'e'						\
9718334Speter      && (PTR)[2] == 'p')						\
9818334Speter    {									\
9918334Speter      if ((PTR)[3] == 'z')						\
10018334Speter	{								\
10118334Speter	  fprintf (STREAM, "repe");					\
10218334Speter	  (PTR) += 4;							\
10318334Speter	}								\
10418334Speter      else if ((PTR)[3] == 'n' && (PTR)[4] == 'z')			\
10518334Speter	{								\
10618334Speter	  fprintf (STREAM, "repne");					\
10718334Speter	  (PTR) += 5;							\
10818334Speter	}								\
10918334Speter    }									\
11018334Speter}
11118334Speter
11218334Speter/* Define macro used to output shift-double opcodes when the shift
11318334Speter   count is in %cl.  Some assemblers require %cl as an argument;
11418334Speter   some don't.
11518334Speter
11690075Sobrien   GAS requires the %cl argument, so override i386/unix.h.  */
11718334Speter
11850397Sobrien#undef SHIFT_DOUBLE_OMITS_COUNT
11950397Sobrien#define SHIFT_DOUBLE_OMITS_COUNT 0
12018334Speter
12190075Sobrien/* Print opcodes the way that GAS expects them.  */
12218334Speter#define GAS_MNEMONICS 1
12318334Speter
12490075Sobrien/* Output at beginning of assembler file.  */
12590075Sobrien/* The .file command should always begin the output.  */
12690075Sobrien#undef ASM_FILE_START
12790075Sobrien#define ASM_FILE_START(FILE)						\
12890075Sobrien  do {									\
12990075Sobrien	if (ix86_asm_dialect == ASM_INTEL)				\
13090075Sobrien	  fputs ("\t.intel_syntax\n", FILE);				\
13190075Sobrien        output_file_directive (FILE, main_input_filename);		\
13290075Sobrien  } while (0)
133