i386.h revision 102801
190285Sobrien/* Definitions of target machine for GNU compiler for IA-32.
290285Sobrien   Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
390285Sobrien   2001, 2002 Free Software Foundation, Inc.
418334Speter
518334SpeterThis file is part of GNU CC.
618334Speter
718334SpeterGNU CC 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
1218334SpeterGNU CC 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
1818334Speteralong with GNU CC; see the file COPYING.  If not, write to
1918334Speterthe Free Software Foundation, 59 Temple Place - Suite 330,
2090285SobrienBoston, MA 02111-1307, USA.  */
2118334Speter
2218334Speter/* The purpose of this file is to define the characteristics of the i386,
2318334Speter   independent of assembler syntax or operating system.
2418334Speter
2518334Speter   Three other files build on this one to describe a specific assembler syntax:
2618334Speter   bsd386.h, att386.h, and sun386.h.
2718334Speter
2818334Speter   The actual tm.h file for a particular system should include
2918334Speter   this file, and then the file for the appropriate assembler syntax.
3018334Speter
3118334Speter   Many macros that specify assembler syntax are omitted entirely from
3218334Speter   this file because they really belong in the files for particular
3390285Sobrien   assemblers.  These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR,
3490285Sobrien   ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many
3590285Sobrien   that start with ASM_ or end in ASM_OP.  */
3618334Speter
3790285Sobrien
3852295Sobrien/* $FreeBSD: head/contrib/gcc/config/i386/i386.h 102801 2002-09-01 21:12:30Z kan $ */
3952295Sobrien
4018334Speter
4118334Speter/* Stubs for half-pic support if not OSF/1 reference platform.  */
4218334Speter
4318334Speter#ifndef HALF_PIC_P
4418334Speter#define HALF_PIC_P() 0
4518334Speter#define HALF_PIC_NUMBER_PTRS 0
4618334Speter#define HALF_PIC_NUMBER_REFS 0
4718334Speter#define HALF_PIC_ENCODE(DECL)
4818334Speter#define HALF_PIC_DECLARE(NAME)
4990285Sobrien#define HALF_PIC_INIT()	error ("half-pic init called on systems that don't support it")
5018334Speter#define HALF_PIC_ADDRESS_P(X) 0
5190285Sobrien#define HALF_PIC_PTR(X) (X)
5218334Speter#define HALF_PIC_FINISH(STREAM)
5318334Speter#endif
5418334Speter
5550654Sobrien/* Define the specific costs for a given cpu */
5650654Sobrien
5750654Sobrienstruct processor_costs {
5890285Sobrien  const int add;		/* cost of an add instruction */
5990285Sobrien  const int lea;		/* cost of a lea instruction */
6090285Sobrien  const int shift_var;		/* variable shift costs */
6190285Sobrien  const int shift_const;	/* constant shift costs */
6290285Sobrien  const int mult_init;		/* cost of starting a multiply */
6390285Sobrien  const int mult_bit;		/* cost of multiply per each bit set */
6490285Sobrien  const int divide;		/* cost of a divide/mod */
6590285Sobrien  int movsx;			/* The cost of movsx operation.  */
6690285Sobrien  int movzx;			/* The cost of movzx operation.  */
6790285Sobrien  const int large_insn;		/* insns larger than this cost more */
6890285Sobrien  const int move_ratio;		/* The threshold of number of scalar
6990285Sobrien				   memory-to-memory move insns.  */
7090285Sobrien  const int movzbl_load;	/* cost of loading using movzbl */
7190285Sobrien  const int int_load[3];	/* cost of loading integer registers
7290285Sobrien				   in QImode, HImode and SImode relative
7390285Sobrien				   to reg-reg move (2).  */
7490285Sobrien  const int int_store[3];	/* cost of storing integer register
7590285Sobrien				   in QImode, HImode and SImode */
7690285Sobrien  const int fp_move;		/* cost of reg,reg fld/fst */
7790285Sobrien  const int fp_load[3];		/* cost of loading FP register
7890285Sobrien				   in SFmode, DFmode and XFmode */
7990285Sobrien  const int fp_store[3];	/* cost of storing FP register
8090285Sobrien				   in SFmode, DFmode and XFmode */
8190285Sobrien  const int mmx_move;		/* cost of moving MMX register.  */
8290285Sobrien  const int mmx_load[2];	/* cost of loading MMX register
8390285Sobrien				   in SImode and DImode */
8490285Sobrien  const int mmx_store[2];	/* cost of storing MMX register
8590285Sobrien				   in SImode and DImode */
8690285Sobrien  const int sse_move;		/* cost of moving SSE register.  */
8790285Sobrien  const int sse_load[3];	/* cost of loading SSE register
8890285Sobrien				   in SImode, DImode and TImode*/
8990285Sobrien  const int sse_store[3];	/* cost of storing SSE register
9090285Sobrien				   in SImode, DImode and TImode*/
9190285Sobrien  const int mmxsse_to_integer;	/* cost of moving mmxsse register to
9290285Sobrien				   integer and vice versa.  */
9390285Sobrien  const int prefetch_block;	/* bytes moved to cache for prefetch.  */
9490285Sobrien  const int simultaneous_prefetches; /* number of parallel prefetch
9590285Sobrien				   operations.  */
9650654Sobrien};
9750654Sobrien
9890285Sobrienextern const struct processor_costs *ix86_cost;
9950654Sobrien
10018334Speter/* Run-time compilation parameters selecting different hardware subsets.  */
10118334Speter
10218334Speterextern int target_flags;
10318334Speter
10418334Speter/* Macros used in the machine description to test the flags.  */
10518334Speter
10618334Speter/* configure can arrange to make this 2, to force a 486.  */
10790285Sobrien
10818334Speter#ifndef TARGET_CPU_DEFAULT
10918334Speter#define TARGET_CPU_DEFAULT 0
11018334Speter#endif
11118334Speter
11218334Speter/* Masks for the -m switches */
11390285Sobrien#define MASK_80387		0x00000001	/* Hardware floating point */
11490285Sobrien#define MASK_RTD		0x00000002	/* Use ret that pops args */
11590285Sobrien#define MASK_ALIGN_DOUBLE	0x00000004	/* align doubles to 2 word boundary */
11690285Sobrien#define MASK_SVR3_SHLIB		0x00000008	/* Uninit locals into bss */
11790285Sobrien#define MASK_IEEE_FP		0x00000010	/* IEEE fp comparisons */
11890285Sobrien#define MASK_FLOAT_RETURNS	0x00000020	/* Return float in st(0) */
11990285Sobrien#define MASK_NO_FANCY_MATH_387	0x00000040	/* Disable sin, cos, sqrt */
12090285Sobrien#define MASK_OMIT_LEAF_FRAME_POINTER 0x080      /* omit leaf frame pointers */
12190285Sobrien#define MASK_STACK_PROBE	0x00000100	/* Enable stack probing */
12290285Sobrien#define MASK_NO_ALIGN_STROPS	0x00000200	/* Enable aligning of string ops.  */
12390285Sobrien#define MASK_INLINE_ALL_STROPS	0x00000400	/* Inline stringops in all cases */
12490285Sobrien#define MASK_NO_PUSH_ARGS	0x00000800	/* Use push instructions */
12590285Sobrien#define MASK_ACCUMULATE_OUTGOING_ARGS 0x00001000/* Accumulate outgoing args */
12690285Sobrien#define MASK_ACCUMULATE_OUTGOING_ARGS_SET 0x00002000
12790285Sobrien#define MASK_MMX		0x00004000	/* Support MMX regs/builtins */
12890285Sobrien#define MASK_MMX_SET		0x00008000
12990285Sobrien#define MASK_SSE		0x00010000	/* Support SSE regs/builtins */
13090285Sobrien#define MASK_SSE_SET		0x00020000
13190285Sobrien#define MASK_SSE2		0x00040000	/* Support SSE2 regs/builtins */
13290285Sobrien#define MASK_SSE2_SET		0x00080000
13390285Sobrien#define MASK_3DNOW		0x00100000	/* Support 3Dnow builtins */
13490285Sobrien#define MASK_3DNOW_SET		0x00200000
13590285Sobrien#define MASK_3DNOW_A		0x00400000	/* Support Athlon 3Dnow builtins */
13690285Sobrien#define MASK_3DNOW_A_SET	0x00800000
13790285Sobrien#define MASK_128BIT_LONG_DOUBLE 0x01000000	/* long double size is 128bit */
13890285Sobrien#define MASK_64BIT		0x02000000	/* Produce 64bit code */
13990285Sobrien/* ... overlap with subtarget options starts by 0x04000000.  */
14090285Sobrien#define MASK_NO_RED_ZONE	0x04000000	/* Do not use red zone */
14197911Sobrien#define MASK_NO_ALIGN_LONG_STRINGS 0x08000000	/* Do not align long strings specially */
14218334Speter
14318334Speter/* Use the floating point instructions */
14418334Speter#define TARGET_80387 (target_flags & MASK_80387)
14518334Speter
14618334Speter/* Compile using ret insn that pops args.
14718334Speter   This will not work unless you use prototypes at least
14818334Speter   for all functions that can take varying numbers of args.  */
14918334Speter#define TARGET_RTD (target_flags & MASK_RTD)
15018334Speter
15118334Speter/* Align doubles to a two word boundary.  This breaks compatibility with
15218334Speter   the published ABI's for structures containing doubles, but produces
15318334Speter   faster code on the pentium.  */
15418334Speter#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
15518334Speter
15690285Sobrien/* Use push instructions to save outgoing args.  */
15790285Sobrien#define TARGET_PUSH_ARGS (!(target_flags & MASK_NO_PUSH_ARGS))
15890285Sobrien
15990285Sobrien/* Accumulate stack adjustments to prologue/epilogue.  */
16090285Sobrien#define TARGET_ACCUMULATE_OUTGOING_ARGS \
16190285Sobrien (target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
16290285Sobrien
16318334Speter/* Put uninitialized locals into bss, not data.
16418334Speter   Meaningful only on svr3.  */
16518334Speter#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
16618334Speter
16718334Speter/* Use IEEE floating point comparisons.  These handle correctly the cases
16818334Speter   where the result of a comparison is unordered.  Normally SIGFPE is
16918334Speter   generated in such cases, in which case this isn't needed.  */
17018334Speter#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
17118334Speter
17218334Speter/* Functions that return a floating point value may return that value
17318334Speter   in the 387 FPU or in 386 integer registers.  If set, this flag causes
17490285Sobrien   the 387 to be used, which is compatible with most calling conventions.  */
17518334Speter#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
17618334Speter
17790285Sobrien/* Long double is 128bit instead of 96bit, even when only 80bits are used.
17890285Sobrien   This mode wastes cache, but avoid misaligned data accesses and simplifies
17990285Sobrien   address calculations.  */
18090285Sobrien#define TARGET_128BIT_LONG_DOUBLE (target_flags & MASK_128BIT_LONG_DOUBLE)
18190285Sobrien
18218334Speter/* Disable generation of FP sin, cos and sqrt operations for 387.
18318334Speter   This is because FreeBSD lacks these in the math-emulator-code */
18418334Speter#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
18518334Speter
18650654Sobrien/* Don't create frame pointers for leaf functions */
18790285Sobrien#define TARGET_OMIT_LEAF_FRAME_POINTER \
18890285Sobrien  (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
18950654Sobrien
19018334Speter/* Debug GO_IF_LEGITIMATE_ADDRESS */
19190285Sobrien#define TARGET_DEBUG_ADDR (ix86_debug_addr_string != 0)
19218334Speter
19318334Speter/* Debug FUNCTION_ARG macros */
19490285Sobrien#define TARGET_DEBUG_ARG (ix86_debug_arg_string != 0)
19518334Speter
19690285Sobrien/* 64bit Sledgehammer mode */
19790285Sobrien#ifdef TARGET_BI_ARCH
19890285Sobrien#define TARGET_64BIT (target_flags & MASK_64BIT)
19990285Sobrien#else
20090285Sobrien#ifdef TARGET_64BIT_DEFAULT
20190285Sobrien#define TARGET_64BIT 1
20290285Sobrien#else
20390285Sobrien#define TARGET_64BIT 0
20490285Sobrien#endif
20590285Sobrien#endif
20618334Speter
20750654Sobrien#define TARGET_386 (ix86_cpu == PROCESSOR_I386)
20850654Sobrien#define TARGET_486 (ix86_cpu == PROCESSOR_I486)
20950654Sobrien#define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM)
21050654Sobrien#define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO)
21152295Sobrien#define TARGET_K6 (ix86_cpu == PROCESSOR_K6)
21290285Sobrien#define TARGET_ATHLON (ix86_cpu == PROCESSOR_ATHLON)
21390285Sobrien#define TARGET_PENTIUM4 (ix86_cpu == PROCESSOR_PENTIUM4)
21452295Sobrien
21552295Sobrien#define CPUMASK (1 << ix86_cpu)
21652295Sobrienextern const int x86_use_leave, x86_push_memory, x86_zero_extend_with_and;
21752295Sobrienextern const int x86_use_bit_test, x86_cmove, x86_deep_branch;
21890285Sobrienextern const int x86_branch_hints, x86_unroll_strlen;
21990285Sobrienextern const int x86_double_with_add, x86_partial_reg_stall, x86_movx;
22090285Sobrienextern const int x86_use_loop, x86_use_fiop, x86_use_mov0;
22190285Sobrienextern const int x86_use_cltd, x86_read_modify_write;
22290285Sobrienextern const int x86_read_modify, x86_split_long_moves;
22390285Sobrienextern const int x86_promote_QImode, x86_single_stringop;
22490285Sobrienextern const int x86_himode_math, x86_qimode_math, x86_promote_qi_regs;
22590285Sobrienextern const int x86_promote_hi_regs, x86_integer_DFmode_moves;
22690285Sobrienextern const int x86_add_esp_4, x86_add_esp_8, x86_sub_esp_4, x86_sub_esp_8;
22790285Sobrienextern const int x86_partial_reg_dependency, x86_memory_mismatch_stall;
22890285Sobrienextern const int x86_accumulate_outgoing_args, x86_prologue_using_move;
22990285Sobrienextern const int x86_epilogue_using_move, x86_decompose_lea;
23096294Sobrienextern const int x86_arch_always_fancy_math_387;
23190285Sobrienextern int x86_prefetch_sse;
23252295Sobrien
23352295Sobrien#define TARGET_USE_LEAVE (x86_use_leave & CPUMASK)
23452295Sobrien#define TARGET_PUSH_MEMORY (x86_push_memory & CPUMASK)
23552295Sobrien#define TARGET_ZERO_EXTEND_WITH_AND (x86_zero_extend_with_and & CPUMASK)
23652295Sobrien#define TARGET_USE_BIT_TEST (x86_use_bit_test & CPUMASK)
23752295Sobrien#define TARGET_UNROLL_STRLEN (x86_unroll_strlen & CPUMASK)
23890285Sobrien/* For sane SSE instruction set generation we need fcomi instruction.  It is
23990285Sobrien   safe to enable all CMOVE instructions.  */
24090285Sobrien#define TARGET_CMOVE ((x86_cmove & (1 << ix86_arch)) || TARGET_SSE)
24152295Sobrien#define TARGET_DEEP_BRANCH_PREDICTION (x86_deep_branch & CPUMASK)
24290285Sobrien#define TARGET_BRANCH_PREDICTION_HINTS (x86_branch_hints & CPUMASK)
24352295Sobrien#define TARGET_DOUBLE_WITH_ADD (x86_double_with_add & CPUMASK)
24490285Sobrien#define TARGET_USE_SAHF ((x86_use_sahf & CPUMASK) && !TARGET_64BIT)
24590285Sobrien#define TARGET_MOVX (x86_movx & CPUMASK)
24690285Sobrien#define TARGET_PARTIAL_REG_STALL (x86_partial_reg_stall & CPUMASK)
24790285Sobrien#define TARGET_USE_LOOP (x86_use_loop & CPUMASK)
24890285Sobrien#define TARGET_USE_FIOP (x86_use_fiop & CPUMASK)
24990285Sobrien#define TARGET_USE_MOV0 (x86_use_mov0 & CPUMASK)
25090285Sobrien#define TARGET_USE_CLTD (x86_use_cltd & CPUMASK)
25190285Sobrien#define TARGET_SPLIT_LONG_MOVES (x86_split_long_moves & CPUMASK)
25290285Sobrien#define TARGET_READ_MODIFY_WRITE (x86_read_modify_write & CPUMASK)
25390285Sobrien#define TARGET_READ_MODIFY (x86_read_modify & CPUMASK)
25490285Sobrien#define TARGET_PROMOTE_QImode (x86_promote_QImode & CPUMASK)
25590285Sobrien#define TARGET_SINGLE_STRINGOP (x86_single_stringop & CPUMASK)
25690285Sobrien#define TARGET_QIMODE_MATH (x86_qimode_math & CPUMASK)
25790285Sobrien#define TARGET_HIMODE_MATH (x86_himode_math & CPUMASK)
25890285Sobrien#define TARGET_PROMOTE_QI_REGS (x86_promote_qi_regs & CPUMASK)
25990285Sobrien#define TARGET_PROMOTE_HI_REGS (x86_promote_hi_regs & CPUMASK)
26090285Sobrien#define TARGET_ADD_ESP_4 (x86_add_esp_4 & CPUMASK)
26190285Sobrien#define TARGET_ADD_ESP_8 (x86_add_esp_8 & CPUMASK)
26290285Sobrien#define TARGET_SUB_ESP_4 (x86_sub_esp_4 & CPUMASK)
26390285Sobrien#define TARGET_SUB_ESP_8 (x86_sub_esp_8 & CPUMASK)
26490285Sobrien#define TARGET_INTEGER_DFMODE_MOVES (x86_integer_DFmode_moves & CPUMASK)
26590285Sobrien#define TARGET_PARTIAL_REG_DEPENDENCY (x86_partial_reg_dependency & CPUMASK)
26690285Sobrien#define TARGET_MEMORY_MISMATCH_STALL (x86_memory_mismatch_stall & CPUMASK)
26790285Sobrien#define TARGET_PROLOGUE_USING_MOVE (x86_prologue_using_move & CPUMASK)
26890285Sobrien#define TARGET_EPILOGUE_USING_MOVE (x86_epilogue_using_move & CPUMASK)
26990285Sobrien#define TARGET_DECOMPOSE_LEA (x86_decompose_lea & CPUMASK)
27090285Sobrien#define TARGET_PREFETCH_SSE (x86_prefetch_sse)
27152295Sobrien
27250654Sobrien#define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
27318334Speter
27490285Sobrien#define TARGET_ALIGN_STRINGOPS (!(target_flags & MASK_NO_ALIGN_STROPS))
27590285Sobrien#define TARGET_INLINE_ALL_STRINGOPS (target_flags & MASK_INLINE_ALL_STROPS)
27618334Speter
27790285Sobrien#define ASSEMBLER_DIALECT (ix86_asm_dialect)
27890285Sobrien
27990285Sobrien#define TARGET_SSE ((target_flags & (MASK_SSE | MASK_SSE2)) != 0)
28090285Sobrien#define TARGET_SSE2 ((target_flags & MASK_SSE2) != 0)
28190285Sobrien#define TARGET_SSE_MATH ((ix86_fpmath & FPMATH_SSE) != 0)
28290285Sobrien#define TARGET_MIX_SSE_I387 ((ix86_fpmath & FPMATH_SSE) \
28390285Sobrien			     && (ix86_fpmath & FPMATH_387))
28490285Sobrien#define TARGET_MMX ((target_flags & MASK_MMX) != 0)
28590285Sobrien#define TARGET_3DNOW ((target_flags & MASK_3DNOW) != 0)
28690285Sobrien#define TARGET_3DNOW_A ((target_flags & MASK_3DNOW_A) != 0)
28790285Sobrien
28890285Sobrien#define TARGET_RED_ZONE (!(target_flags & MASK_NO_RED_ZONE))
28990285Sobrien
29097911Sobrien#define TARGET_NO_ALIGN_LONG_STRINGS (target_flags & MASK_NO_ALIGN_LONG_STRINGS)
29197911Sobrien
29296294Sobrien/* WARNING: Do not mark empty strings for translation, as calling
29396294Sobrien            gettext on an empty string does NOT return an empty
29496294Sobrien            string. */
29596294Sobrien
29696294Sobrien
29790285Sobrien#define TARGET_SWITCHES							      \
29890285Sobrien{ { "80387",			 MASK_80387, N_("Use hardware fp") },	      \
29990285Sobrien  { "no-80387",			-MASK_80387, N_("Do not use hardware fp") },  \
30090285Sobrien  { "hard-float",		 MASK_80387, N_("Use hardware fp") },	      \
30190285Sobrien  { "soft-float",		-MASK_80387, N_("Do not use hardware fp") },  \
30290285Sobrien  { "no-soft-float",		 MASK_80387, N_("Use hardware fp") },	      \
30396294Sobrien  { "386",			 0, "" /*Deprecated.*/},		      \
30496294Sobrien  { "486",			 0, "" /*Deprecated.*/},		      \
30596294Sobrien  { "pentium",			 0, "" /*Deprecated.*/},		      \
30696294Sobrien  { "pentiumpro",		 0, "" /*Deprecated.*/},		      \
30796294Sobrien  { "intel-syntax",		 0, "" /*Deprecated.*/},	 	      \
30896294Sobrien  { "no-intel-syntax",		 0, "" /*Deprecated.*/},	 	      \
30990285Sobrien  { "rtd",			 MASK_RTD,				      \
31090285Sobrien    N_("Alternate calling convention") },				      \
31190285Sobrien  { "no-rtd",			-MASK_RTD,				      \
31290285Sobrien    N_("Use normal calling convention") },				      \
31390285Sobrien  { "align-double",		 MASK_ALIGN_DOUBLE,			      \
31490285Sobrien    N_("Align some doubles on dword boundary") },			      \
31590285Sobrien  { "no-align-double",		-MASK_ALIGN_DOUBLE,			      \
31690285Sobrien    N_("Align doubles on word boundary") },				      \
31790285Sobrien  { "svr3-shlib",		 MASK_SVR3_SHLIB,			      \
31890285Sobrien    N_("Uninitialized locals in .bss")  },				      \
31990285Sobrien  { "no-svr3-shlib",		-MASK_SVR3_SHLIB,			      \
32090285Sobrien    N_("Uninitialized locals in .data") },				      \
32190285Sobrien  { "ieee-fp",			 MASK_IEEE_FP,				      \
32290285Sobrien    N_("Use IEEE math for fp comparisons") },				      \
32390285Sobrien  { "no-ieee-fp",		-MASK_IEEE_FP,				      \
32490285Sobrien    N_("Do not use IEEE math for fp comparisons") },			      \
32590285Sobrien  { "fp-ret-in-387",		 MASK_FLOAT_RETURNS,			      \
32690285Sobrien    N_("Return values of functions in FPU registers") },		      \
32790285Sobrien  { "no-fp-ret-in-387",		-MASK_FLOAT_RETURNS ,			      \
32890285Sobrien    N_("Do not return values of functions in FPU registers")},		      \
32990285Sobrien  { "no-fancy-math-387",	 MASK_NO_FANCY_MATH_387,		      \
33090285Sobrien    N_("Do not generate sin, cos, sqrt for FPU") },			      \
33190285Sobrien  { "fancy-math-387",		-MASK_NO_FANCY_MATH_387,		      \
33290285Sobrien     N_("Generate sin, cos, sqrt for FPU")},				      \
33390285Sobrien  { "omit-leaf-frame-pointer",	 MASK_OMIT_LEAF_FRAME_POINTER,		      \
33490285Sobrien    N_("Omit the frame pointer in leaf functions") },			      \
33590285Sobrien  { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER, "" },	      \
33690285Sobrien  { "stack-arg-probe",		 MASK_STACK_PROBE,			      \
33790285Sobrien    N_("Enable stack probing") },					      \
33890285Sobrien  { "no-stack-arg-probe",	-MASK_STACK_PROBE, "" },		      \
33990285Sobrien  { "windows",			0, 0 /* undocumented */ },		      \
34090285Sobrien  { "dll",			0,  0 /* undocumented */ },		      \
34190285Sobrien  { "align-stringops",		-MASK_NO_ALIGN_STROPS,			      \
34290285Sobrien    N_("Align destination of the string operations") },			      \
34390285Sobrien  { "no-align-stringops",	 MASK_NO_ALIGN_STROPS,			      \
34490285Sobrien    N_("Do not align destination of the string operations") },		      \
34590285Sobrien  { "inline-all-stringops",	 MASK_INLINE_ALL_STROPS,		      \
34690285Sobrien    N_("Inline all known string operations") },				      \
34790285Sobrien  { "no-inline-all-stringops",	-MASK_INLINE_ALL_STROPS,		      \
34890285Sobrien    N_("Do not inline all known string operations") },			      \
34990285Sobrien  { "push-args",		-MASK_NO_PUSH_ARGS,			      \
35090285Sobrien    N_("Use push instructions to save outgoing arguments") },		      \
35190285Sobrien  { "no-push-args",		MASK_NO_PUSH_ARGS,			      \
35290285Sobrien    N_("Do not use push instructions to save outgoing arguments") },	      \
35390285Sobrien  { "accumulate-outgoing-args",	(MASK_ACCUMULATE_OUTGOING_ARGS		      \
35490285Sobrien				 | MASK_ACCUMULATE_OUTGOING_ARGS_SET),	      \
35590285Sobrien    N_("Use push instructions to save outgoing arguments") },		      \
35690285Sobrien  { "no-accumulate-outgoing-args",MASK_ACCUMULATE_OUTGOING_ARGS_SET,	      \
35790285Sobrien    N_("Do not use push instructions to save outgoing arguments") },	      \
35890285Sobrien  { "mmx",			 MASK_MMX | MASK_MMX_SET,		      \
35990285Sobrien    N_("Support MMX built-in functions") },				      \
36090285Sobrien  { "no-mmx",			 -MASK_MMX,				      \
36190285Sobrien    N_("Do not support MMX built-in functions") },			      \
36296294Sobrien  { "no-mmx",			 MASK_MMX_SET, "" },			      \
36390285Sobrien  { "3dnow",                     MASK_3DNOW | MASK_3DNOW_SET,		      \
36490285Sobrien    N_("Support 3DNow! built-in functions") },				      \
36596294Sobrien  { "no-3dnow",                  -MASK_3DNOW, "" },			      \
36690285Sobrien  { "no-3dnow",                  MASK_3DNOW_SET,			      \
36790285Sobrien    N_("Do not support 3DNow! built-in functions") },			      \
36890285Sobrien  { "sse",			 MASK_SSE | MASK_SSE_SET,		      \
36990285Sobrien    N_("Support MMX and SSE built-in functions and code generation") },	      \
37096294Sobrien  { "no-sse",			 -MASK_SSE, "" },	 		      \
37190285Sobrien  { "no-sse",			 MASK_SSE_SET,				      \
37290285Sobrien    N_("Do not support MMX and SSE built-in functions and code generation") },\
37390285Sobrien  { "sse2",			 MASK_SSE2 | MASK_SSE2_SET,		      \
37490285Sobrien    N_("Support MMX, SSE and SSE2 built-in functions and code generation") }, \
37596294Sobrien  { "no-sse2",			 -MASK_SSE2, "" },			      \
37690285Sobrien  { "no-sse2",			 MASK_SSE2_SET,				      \
37790285Sobrien    N_("Do not support MMX, SSE and SSE2 built-in functions and code generation") },    \
37890285Sobrien  { "128bit-long-double",	 MASK_128BIT_LONG_DOUBLE,		      \
37990285Sobrien    N_("sizeof(long double) is 16") },					      \
38090285Sobrien  { "96bit-long-double",	-MASK_128BIT_LONG_DOUBLE,		      \
38190285Sobrien    N_("sizeof(long double) is 12") },					      \
38290285Sobrien  { "64",			MASK_64BIT,				      \
38390285Sobrien    N_("Generate 64bit x86-64 code") },					      \
38490285Sobrien  { "32",			-MASK_64BIT,				      \
38590285Sobrien    N_("Generate 32bit i386 code") },					      \
38690285Sobrien  { "red-zone",			-MASK_NO_RED_ZONE,			      \
38790285Sobrien    N_("Use red-zone in the x86-64 code") },				      \
38890285Sobrien  { "no-red-zone",		MASK_NO_RED_ZONE,			      \
38990285Sobrien    N_("Do not use red-zone in the x86-64 code") },			      \
39097911Sobrien  { "no-align-long-strings",	 MASK_NO_ALIGN_LONG_STRINGS,		      \
39197911Sobrien    N_("Do not align long strings specially") },			      \
39297911Sobrien  { "align-long-strings",	-MASK_NO_ALIGN_LONG_STRINGS,		      \
39397911Sobrien    N_("Align strings longer than 30 on a 32-byte boundary") },		      \
39490285Sobrien  SUBTARGET_SWITCHES							      \
39590285Sobrien  { "", TARGET_DEFAULT, 0 }}
39690285Sobrien
39790285Sobrien#ifdef TARGET_64BIT_DEFAULT
39890285Sobrien#define TARGET_DEFAULT (MASK_64BIT | TARGET_SUBTARGET_DEFAULT)
39990285Sobrien#else
40090285Sobrien#define TARGET_DEFAULT TARGET_SUBTARGET_DEFAULT
40190285Sobrien#endif
40290285Sobrien
40350654Sobrien/* Which processor to schedule for. The cpu attribute defines a list that
40450654Sobrien   mirrors this list, so changes to i386.md must be made at the same time.  */
40550654Sobrien
40650654Sobrienenum processor_type
40790285Sobrien{
40890285Sobrien  PROCESSOR_I386,			/* 80386 */
40950654Sobrien  PROCESSOR_I486,			/* 80486DX, 80486SX, 80486DX[24] */
41050654Sobrien  PROCESSOR_PENTIUM,
41152295Sobrien  PROCESSOR_PENTIUMPRO,
41290285Sobrien  PROCESSOR_K6,
41390285Sobrien  PROCESSOR_ATHLON,
41490285Sobrien  PROCESSOR_PENTIUM4,
41590285Sobrien  PROCESSOR_max
41690285Sobrien};
41790285Sobrienenum fpmath_unit
41890285Sobrien{
41990285Sobrien  FPMATH_387 = 1,
42090285Sobrien  FPMATH_SSE = 2
42190285Sobrien};
42250654Sobrien
42350654Sobrienextern enum processor_type ix86_cpu;
42490285Sobrienextern enum fpmath_unit ix86_fpmath;
42550654Sobrien
42650654Sobrienextern int ix86_arch;
42750654Sobrien
42818334Speter/* This macro is similar to `TARGET_SWITCHES' but defines names of
42918334Speter   command options that have values.  Its definition is an
43018334Speter   initializer with a subgrouping for each command option.
43118334Speter
43218334Speter   Each subgrouping contains a string constant, that defines the
43318334Speter   fixed part of the option name, and the address of a variable.  The
43418334Speter   variable, type `char *', is set to the variable part of the given
43518334Speter   option if the fixed part matches.  The actual option name is made
43618334Speter   by appending `-m' to the specified name.  */
43790285Sobrien#define TARGET_OPTIONS						\
43890285Sobrien{ { "cpu=",		&ix86_cpu_string,			\
43990285Sobrien    N_("Schedule code for given CPU")},				\
44090285Sobrien  { "fpmath=",		&ix86_fpmath_string,			\
44190285Sobrien    N_("Generate floating point mathematics using given instruction set")},\
44290285Sobrien  { "arch=",		&ix86_arch_string,			\
44390285Sobrien    N_("Generate code for given CPU")},				\
44490285Sobrien  { "regparm=",		&ix86_regparm_string,			\
44590285Sobrien    N_("Number of registers used to pass integer arguments") },	\
44690285Sobrien  { "align-loops=",	&ix86_align_loops_string,		\
44790285Sobrien    N_("Loop code aligned to this power of 2") },		\
44890285Sobrien  { "align-jumps=",	&ix86_align_jumps_string,		\
44990285Sobrien    N_("Jump targets are aligned to this power of 2") },	\
45090285Sobrien  { "align-functions=",	&ix86_align_funcs_string,		\
45190285Sobrien    N_("Function starts are aligned to this power of 2") },	\
45290285Sobrien  { "preferred-stack-boundary=",				\
45390285Sobrien    &ix86_preferred_stack_boundary_string,			\
45490285Sobrien    N_("Attempt to keep stack aligned to this power of 2") },	\
45590285Sobrien  { "branch-cost=",	&ix86_branch_cost_string,		\
45690285Sobrien    N_("Branches are this expensive (1-5, arbitrary units)") },	\
45790285Sobrien  { "cmodel=", &ix86_cmodel_string,				\
45890285Sobrien    N_("Use given x86-64 code model") },			\
45990285Sobrien  { "debug-arg", &ix86_debug_arg_string,			\
46096294Sobrien    "" /* Undocumented. */ },					\
46190285Sobrien  { "debug-addr", &ix86_debug_addr_string,			\
46296294Sobrien    "" /* Undocumented. */ },					\
46390285Sobrien  { "asm=", &ix86_asm_string,					\
46490285Sobrien    N_("Use given assembler dialect") },			\
46590285Sobrien  SUBTARGET_OPTIONS						\
46618334Speter}
46718334Speter
46818334Speter/* Sometimes certain combinations of command options do not make
46918334Speter   sense on a particular target machine.  You can define a macro
47018334Speter   `OVERRIDE_OPTIONS' to take account of this.  This macro, if
47118334Speter   defined, is executed once just after all the command options have
47218334Speter   been parsed.
47318334Speter
47418334Speter   Don't use this macro to turn on various extra optimizations for
47518334Speter   `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.  */
47618334Speter
47718334Speter#define OVERRIDE_OPTIONS override_options ()
47818334Speter
47918334Speter/* These are meant to be redefined in the host dependent files */
48018334Speter#define SUBTARGET_SWITCHES
48118334Speter#define SUBTARGET_OPTIONS
48218334Speter
48350654Sobrien/* Define this to change the optimizations performed by default.  */
48490285Sobrien#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
48590285Sobrien  optimization_options ((LEVEL), (SIZE))
48650654Sobrien
48750654Sobrien/* Specs for the compiler proper */
48850654Sobrien
48950654Sobrien#ifndef CC1_CPU_SPEC
49050654Sobrien#define CC1_CPU_SPEC "\
49150654Sobrien%{!mcpu*: \
49290285Sobrien%{m386:-mcpu=i386 \
49390285Sobrien%n`-m386' is deprecated. Use `-march=i386' or `-mcpu=i386' instead.\n} \
49490285Sobrien%{m486:-mcpu=i486 \
49590285Sobrien%n`-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead.\n} \
49690285Sobrien%{mpentium:-mcpu=pentium \
49790285Sobrien%n`-mpentium' is deprecated. Use `-march=pentium' or `-mcpu=pentium' instead.\n} \
49890285Sobrien%{mpentiumpro:-mcpu=pentiumpro \
49990285Sobrien%n`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mcpu=pentiumpro' instead.\n}} \
50090285Sobrien%{mintel-syntax:-masm=intel \
50190285Sobrien%n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.\n} \
50290285Sobrien%{mno-intel-syntax:-masm=att \
50390285Sobrien%n`-mno-intel-syntax' is deprecated. Use `-masm=att' instead.\n}"
50450654Sobrien#endif
50518334Speter
50690285Sobrien#define TARGET_CPU_DEFAULT_i386 0
50790285Sobrien#define TARGET_CPU_DEFAULT_i486 1
50890285Sobrien#define TARGET_CPU_DEFAULT_pentium 2
50990285Sobrien#define TARGET_CPU_DEFAULT_pentium_mmx 3
51090285Sobrien#define TARGET_CPU_DEFAULT_pentiumpro 4
51190285Sobrien#define TARGET_CPU_DEFAULT_pentium2 5
51290285Sobrien#define TARGET_CPU_DEFAULT_pentium3 6
51390285Sobrien#define TARGET_CPU_DEFAULT_pentium4 7
51490285Sobrien#define TARGET_CPU_DEFAULT_k6 8
51590285Sobrien#define TARGET_CPU_DEFAULT_k6_2 9
51690285Sobrien#define TARGET_CPU_DEFAULT_k6_3 10
51790285Sobrien#define TARGET_CPU_DEFAULT_athlon 11
51890285Sobrien#define TARGET_CPU_DEFAULT_athlon_sse 12
51950654Sobrien
52090285Sobrien#define TARGET_CPU_DEFAULT_NAMES {"i386", "i486", "pentium", "pentium-mmx",\
52190285Sobrien				  "pentiumpro", "pentium2", "pentium3", \
52290285Sobrien				  "pentium4", "k6", "k6-2", "k6-3",\
52390285Sobrien				  "athlon", "athlon-4"}
52450654Sobrien#ifndef CPP_CPU_DEFAULT_SPEC
52590285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_i486
52690285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i486__"
52752295Sobrien#endif
52890285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_pentium
52990285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i586__ -D__tune_pentium__"
53052295Sobrien#endif
53190285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_pentium_mmx
53290285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i586__ -D__tune_pentium__ -D__tune_pentium_mmx__"
53350654Sobrien#endif
53490285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_pentiumpro
53590285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i686__ -D__tune_pentiumpro__"
53650654Sobrien#endif
53790285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_pentium2
53890285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i686__ -D__tune_pentiumpro__\
53990285Sobrien-D__tune_pentium2__"
54090285Sobrien#endif
54190285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_pentium3
54290285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i686__ -D__tune_pentiumpro__\
54390285Sobrien-D__tune_pentium2__ -D__tune_pentium3__"
54490285Sobrien#endif
54590285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_pentium4
54690285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_pentium4__"
54790285Sobrien#endif
54890285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_k6
54990285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__"
55090285Sobrien#endif
55190285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_k6_2
55290285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__ -D__tune_k6_2__"
55390285Sobrien#endif
55490285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_k6_3
55590285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__ -D__tune_k6_3__"
55690285Sobrien#endif
55790285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_athlon
55890285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_athlon__"
55990285Sobrien#endif
56090285Sobrien#if TARGET_CPU_DEFAULT == TARGET_CPU_DEFAULT_athlon_sse
56190285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_athlon__ -D__tune_athlon_sse__"
56290285Sobrien#endif
56352295Sobrien#ifndef CPP_CPU_DEFAULT_SPEC
56490285Sobrien#define CPP_CPU_DEFAULT_SPEC "-D__tune_i386__"
56550654Sobrien#endif
56650654Sobrien#endif /* CPP_CPU_DEFAULT_SPEC */
56750654Sobrien
56890285Sobrien#ifdef TARGET_BI_ARCH
56990285Sobrien#define NO_BUILTIN_SIZE_TYPE
57090285Sobrien#define NO_BUILTIN_PTRDIFF_TYPE
57190285Sobrien#endif
57290285Sobrien
57390285Sobrien#ifdef NO_BUILTIN_SIZE_TYPE
57490285Sobrien#define CPP_CPU32_SIZE_TYPE_SPEC \
57590285Sobrien  " -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int"
57690285Sobrien#define CPP_CPU64_SIZE_TYPE_SPEC \
57790285Sobrien  " -D__SIZE_TYPE__=unsigned\\ long\\ int -D__PTRDIFF_TYPE__=long\\ int"
57890285Sobrien#else
57990285Sobrien#define CPP_CPU32_SIZE_TYPE_SPEC ""
58090285Sobrien#define CPP_CPU64_SIZE_TYPE_SPEC ""
58190285Sobrien#endif
58290285Sobrien
58390285Sobrien#define CPP_CPU32_SPEC \
58497543Sobrien  "-Acpu=i386 -Amachine=i386 %{!ansi:%{!std=c*:%{!std=i*:-Di386}}} -D__i386 \
58597543Sobrien-D__i386__ %(cpp_cpu32sizet)"
58690285Sobrien
58790285Sobrien#define CPP_CPU64_SPEC \
58890285Sobrien  "-Acpu=x86_64 -Amachine=x86_64 -D__x86_64 -D__x86_64__ %(cpp_cpu64sizet)"
58990285Sobrien
59090285Sobrien#define CPP_CPUCOMMON_SPEC "\
59190285Sobrien%{march=i386:%{!mcpu*:-D__tune_i386__ }}\
59290285Sobrien%{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
59390285Sobrien%{march=pentium|march=i586:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
59490285Sobrien  %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ }}\
59590285Sobrien%{march=pentium-mmx:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
59690285Sobrien  -D__pentium__mmx__ \
59790285Sobrien  %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ -D__tune_pentium_mmx__}}\
59890285Sobrien%{march=pentiumpro|march=i686:-D__i686 -D__i686__ \
59990285Sobrien  -D__pentiumpro -D__pentiumpro__ \
60090285Sobrien  %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}\
60190285Sobrien%{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
60290285Sobrien%{march=k6-2:-D__k6 -D__k6__ -D__k6_2__ \
60390285Sobrien  %{!mcpu*:-D__tune_k6__ -D__tune_k6_2__ }}\
60490285Sobrien%{march=k6-3:-D__k6 -D__k6__ -D__k6_3__ \
60590285Sobrien  %{!mcpu*:-D__tune_k6__ -D__tune_k6_3__ }}\
60690285Sobrien%{march=athlon|march=athlon-tbird:-D__athlon -D__athlon__ \
60790285Sobrien  %{!mcpu*:-D__tune_athlon__ }}\
60890285Sobrien%{march=athlon-4|march=athlon-xp|march=athlon-mp:-D__athlon -D__athlon__ \
60990285Sobrien  -D__athlon_sse__ \
61090285Sobrien  %{!mcpu*:-D__tune_athlon__ -D__tune_athlon_sse__ }}\
61190285Sobrien%{march=pentium4:-D__pentium4 -D__pentium4__ %{!mcpu*:-D__tune_pentium4__ }}\
61290285Sobrien%{m386|mcpu=i386:-D__tune_i386__ }\
61390285Sobrien%{m486|mcpu=i486:-D__tune_i486__ }\
61490285Sobrien%{mpentium|mcpu=pentium|mcpu=i586|mcpu=pentium-mmx:-D__tune_i586__ -D__tune_pentium__ }\
61590285Sobrien%{mpentiumpro|mcpu=pentiumpro|mcpu=i686|cpu=pentium2|cpu=pentium3:-D__tune_i686__ \
61690285Sobrien-D__tune_pentiumpro__ }\
61790285Sobrien%{mcpu=k6|mcpu=k6-2|mcpu=k6-3:-D__tune_k6__ }\
61890285Sobrien%{mcpu=athlon|mcpu=athlon-tbird|mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
61990285Sobrien-D__tune_athlon__ }\
62090285Sobrien%{mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
62190285Sobrien-D__tune_athlon_sse__ }\
62290285Sobrien%{mcpu=pentium4:-D__tune_pentium4__ }\
623102801Skan%{march=athlon-xp|march=athlon-mp|march=pentium3|march=pentium4:\
62490285Sobrien-D__SSE__ }\
62590285Sobrien%{march=pentium-mmx|march=k6|march=k6-2|march=k6-3\
62696294Sobrien|march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
62790285Sobrien|march=athlon-mp|march=pentium2|march=pentium3|march=pentium4: -D__MMX__ }\
62890285Sobrien%{march=k6-2|march=k6-3\
62996294Sobrien|march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
63090285Sobrien|march=athlon-mp: -D__3dNOW__ }\
63190285Sobrien%{march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
63290285Sobrien|march=athlon-mp: -D__3dNOW_A__ }\
63390285Sobrien%{march=pentium4: -D__SSE2__ }\
63490285Sobrien%{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
63590285Sobrien
63650654Sobrien#ifndef CPP_CPU_SPEC
63790285Sobrien#ifdef TARGET_BI_ARCH
63890285Sobrien#ifdef TARGET_64BIT_DEFAULT
63990285Sobrien#define CPP_CPU_SPEC "%{m32:%(cpp_cpu32)}%{!m32:%(cpp_cpu64)} %(cpp_cpucommon)"
64090285Sobrien#else
64190285Sobrien#define CPP_CPU_SPEC "%{m64:%(cpp_cpu64)}%{!m64:%(cpp_cpu32)} %(cpp_cpucommon)"
64250654Sobrien#endif
64390285Sobrien#else
64490285Sobrien#ifdef TARGET_64BIT_DEFAULT
64590285Sobrien#define CPP_CPU_SPEC "%(cpp_cpu64) %(cpp_cpucommon)"
64690285Sobrien#else
64790285Sobrien#define CPP_CPU_SPEC "%(cpp_cpu32) %(cpp_cpucommon)"
64890285Sobrien#endif
64990285Sobrien#endif
65090285Sobrien#endif
65150654Sobrien
65250654Sobrien#ifndef CC1_SPEC
65390285Sobrien#define CC1_SPEC "%(cc1_cpu) "
65450654Sobrien#endif
65550654Sobrien
65650654Sobrien/* This macro defines names of additional specifications to put in the
65750654Sobrien   specs that can be used in various specifications like CC1_SPEC.  Its
65850654Sobrien   definition is an initializer with a subgrouping for each command option.
65950654Sobrien
66050654Sobrien   Each subgrouping contains a string constant, that defines the
66150654Sobrien   specification name, and a string constant that used by the GNU CC driver
66250654Sobrien   program.
66350654Sobrien
66450654Sobrien   Do not define this macro if it does not need to do anything.  */
66550654Sobrien
66650654Sobrien#ifndef SUBTARGET_EXTRA_SPECS
66750654Sobrien#define SUBTARGET_EXTRA_SPECS
66850654Sobrien#endif
66950654Sobrien
67050654Sobrien#define EXTRA_SPECS							\
67150654Sobrien  { "cpp_cpu_default",	CPP_CPU_DEFAULT_SPEC },				\
67250654Sobrien  { "cpp_cpu",	CPP_CPU_SPEC },						\
67390285Sobrien  { "cpp_cpu32", CPP_CPU32_SPEC },					\
67490285Sobrien  { "cpp_cpu64", CPP_CPU64_SPEC },					\
67590285Sobrien  { "cpp_cpu32sizet", CPP_CPU32_SIZE_TYPE_SPEC },			\
67690285Sobrien  { "cpp_cpu64sizet", CPP_CPU64_SIZE_TYPE_SPEC },			\
67790285Sobrien  { "cpp_cpucommon", CPP_CPUCOMMON_SPEC },				\
67850654Sobrien  { "cc1_cpu",  CC1_CPU_SPEC },						\
67950654Sobrien  SUBTARGET_EXTRA_SPECS
68050654Sobrien
68118334Speter/* target machine storage layout */
68218334Speter
68390285Sobrien/* Define for XFmode or TFmode extended real floating point support.
68490285Sobrien   This will automatically cause REAL_ARITHMETIC to be defined.
68590285Sobrien
68690285Sobrien   The XFmode is specified by i386 ABI, while TFmode may be faster
68790285Sobrien   due to alignment and simplifications in the address calculations.
68890285Sobrien */
68990285Sobrien#define LONG_DOUBLE_TYPE_SIZE (TARGET_128BIT_LONG_DOUBLE ? 128 : 96)
69090285Sobrien#define MAX_LONG_DOUBLE_TYPE_SIZE 128
69190285Sobrien#ifdef __x86_64__
69290285Sobrien#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
69390285Sobrien#else
69490285Sobrien#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 96
69590285Sobrien#endif
69690285Sobrien/* Tell real.c that this is the 80-bit Intel extended float format
69790285Sobrien   packaged in a 128-bit or 96bit entity.  */
69890285Sobrien#define INTEL_EXTENDED_IEEE_FORMAT 1
69918334Speter
70090285Sobrien
70190285Sobrien#define SHORT_TYPE_SIZE 16
70290285Sobrien#define INT_TYPE_SIZE 32
70390285Sobrien#define FLOAT_TYPE_SIZE 32
70497912Sobrien#ifndef LONG_TYPE_SIZE
70590285Sobrien#define LONG_TYPE_SIZE BITS_PER_WORD
70697912Sobrien#endif
70790285Sobrien#define MAX_WCHAR_TYPE_SIZE 32
70890285Sobrien#define DOUBLE_TYPE_SIZE 64
70990285Sobrien#define LONG_LONG_TYPE_SIZE 64
71090285Sobrien
71190285Sobrien#if defined (TARGET_BI_ARCH) || defined (TARGET_64BIT_DEFAULT)
71290285Sobrien#define MAX_BITS_PER_WORD 64
71390285Sobrien#define MAX_LONG_TYPE_SIZE 64
71490285Sobrien#else
71590285Sobrien#define MAX_BITS_PER_WORD 32
71690285Sobrien#define MAX_LONG_TYPE_SIZE 32
71790285Sobrien#endif
71890285Sobrien
71918334Speter/* Define if you don't want extended real, but do want to use the
72018334Speter   software floating point emulator for REAL_ARITHMETIC and
72190285Sobrien   decimal <-> binary conversion.  */
72218334Speter/* #define REAL_ARITHMETIC */
72318334Speter
72418334Speter/* Define this if most significant byte of a word is the lowest numbered.  */
72518334Speter/* That is true on the 80386.  */
72618334Speter
72718334Speter#define BITS_BIG_ENDIAN 0
72818334Speter
72918334Speter/* Define this if most significant byte of a word is the lowest numbered.  */
73018334Speter/* That is not true on the 80386.  */
73118334Speter#define BYTES_BIG_ENDIAN 0
73218334Speter
73318334Speter/* Define this if most significant word of a multiword number is the lowest
73418334Speter   numbered.  */
73518334Speter/* Not true for 80386 */
73618334Speter#define WORDS_BIG_ENDIAN 0
73718334Speter
73818334Speter/* number of bits in an addressable storage unit */
73918334Speter#define BITS_PER_UNIT 8
74018334Speter
74118334Speter/* Width in bits of a "word", which is the contents of a machine register.
74218334Speter   Note that this is not necessarily the width of data type `int';
74318334Speter   if using 16-bit ints on a 80386, this would still be 32.
74418334Speter   But on a machine with 16-bit registers, this would be 16.  */
74590285Sobrien#define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
74618334Speter
74718334Speter/* Width of a word, in units (bytes).  */
74890285Sobrien#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
74990285Sobrien#define MIN_UNITS_PER_WORD 4
75018334Speter
75118334Speter/* Width in bits of a pointer.
75218334Speter   See also the macro `Pmode' defined below.  */
75390285Sobrien#define POINTER_SIZE BITS_PER_WORD
75418334Speter
75518334Speter/* Allocation boundary (in *bits*) for storing arguments in argument list.  */
75690285Sobrien#define PARM_BOUNDARY BITS_PER_WORD
75718334Speter
75890285Sobrien/* Boundary (in *bits*) on which stack pointer should be aligned.  */
75990285Sobrien#define STACK_BOUNDARY BITS_PER_WORD
76018334Speter
76152295Sobrien/* Boundary (in *bits*) on which the stack pointer preferrs to be
76252295Sobrien   aligned; the compiler cannot rely on having this alignment.  */
76390285Sobrien#define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
76452295Sobrien
76590285Sobrien/* As of July 2001, many runtimes to not align the stack properly when
76690285Sobrien   entering main.  This causes expand_main_function to forcably align
76790285Sobrien   the stack, which results in aligned frames for functions called from
76890285Sobrien   main, though it does nothing for the alignment of main itself.  */
76990285Sobrien#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN \
77090285Sobrien  (ix86_preferred_stack_boundary > STACK_BOUNDARY && !TARGET_64BIT)
77118334Speter
77290285Sobrien/* Allocation boundary for the code of a function.  */
77390285Sobrien#define FUNCTION_BOUNDARY 16
77418334Speter
77590285Sobrien/* Alignment of field after `int : 0' in a structure.  */
77618334Speter
77790285Sobrien#define EMPTY_FIELD_BOUNDARY BITS_PER_WORD
77890285Sobrien
77918334Speter/* Minimum size in bits of the largest boundary to which any
78018334Speter   and all fundamental data types supported by the hardware
78118334Speter   might need to be aligned. No data type wants to be aligned
78290285Sobrien   rounder than this.
78390285Sobrien
78490285Sobrien   Pentium+ preferrs DFmode values to be aligned to 64 bit boundary
78590285Sobrien   and Pentium Pro XFmode values at 128 bit boundaries.  */
78618334Speter
78790285Sobrien#define BIGGEST_ALIGNMENT 128
78890285Sobrien
78990285Sobrien/* Decide whether a variable of mode MODE must be 128 bit aligned.  */
79090285Sobrien#define ALIGN_MODE_128(MODE) \
79190285Sobrien ((MODE) == XFmode || (MODE) == TFmode || ((MODE) == TImode) \
79290285Sobrien  || (MODE) == V4SFmode	|| (MODE) == V4SImode)
79390285Sobrien
79490285Sobrien/* The published ABIs say that doubles should be aligned on word
79590285Sobrien   boundaries, so lower the aligment for structure fields unless
79690285Sobrien   -malign-double is set.  */
797102801Skan
798102801Skan/* ??? Blah -- this macro is used directly by libobjc.  Since it
799102801Skan   supports no vector modes, cut out the complexity and fall back
800102801Skan   on BIGGEST_FIELD_ALIGNMENT.  */
801102801Skan#ifdef IN_TARGET_LIBS
802102801Skan#define BIGGEST_FIELD_ALIGNMENT 32
80390285Sobrien#else
804102801Skan#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
805102801Skan   x86_field_alignment (FIELD, COMPUTED)
80690285Sobrien#endif
80790285Sobrien
80850654Sobrien/* If defined, a C expression to compute the alignment given to a
80990285Sobrien   constant that is being placed in memory.  EXP is the constant
81050654Sobrien   and ALIGN is the alignment that the object would ordinarily have.
81150654Sobrien   The value of this macro is used instead of that alignment to align
81250654Sobrien   the object.
81350654Sobrien
81450654Sobrien   If this macro is not defined, then ALIGN is used.
81550654Sobrien
81650654Sobrien   The typical use of this macro is to increase alignment for string
81750654Sobrien   constants to be word aligned so that `strcpy' calls that copy
81850654Sobrien   constants can be done inline.  */
81950654Sobrien
82090285Sobrien#define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment ((EXP), (ALIGN))
82150654Sobrien
82250654Sobrien/* If defined, a C expression to compute the alignment for a static
82350654Sobrien   variable.  TYPE is the data type, and ALIGN is the alignment that
82450654Sobrien   the object would ordinarily have.  The value of this macro is used
82550654Sobrien   instead of that alignment to align the object.
82650654Sobrien
82750654Sobrien   If this macro is not defined, then ALIGN is used.
82850654Sobrien
82950654Sobrien   One use of this macro is to increase alignment of medium-size
83050654Sobrien   data to make it all fit in fewer cache lines.  Another is to
83150654Sobrien   cause character arrays to be word-aligned so that `strcpy' calls
83250654Sobrien   that copy constants to character arrays can be done inline.  */
83350654Sobrien
83490285Sobrien#define DATA_ALIGNMENT(TYPE, ALIGN) ix86_data_alignment ((TYPE), (ALIGN))
83550654Sobrien
83652295Sobrien/* If defined, a C expression to compute the alignment for a local
83752295Sobrien   variable.  TYPE is the data type, and ALIGN is the alignment that
83852295Sobrien   the object would ordinarily have.  The value of this macro is used
83952295Sobrien   instead of that alignment to align the object.
84052295Sobrien
84152295Sobrien   If this macro is not defined, then ALIGN is used.
84252295Sobrien
84352295Sobrien   One use of this macro is to increase alignment of medium-size
84452295Sobrien   data to make it all fit in fewer cache lines.  */
84552295Sobrien
84690285Sobrien#define LOCAL_ALIGNMENT(TYPE, ALIGN) ix86_local_alignment ((TYPE), (ALIGN))
84752295Sobrien
84890285Sobrien/* If defined, a C expression that gives the alignment boundary, in
84990285Sobrien   bits, of an argument with the specified mode and type.  If it is
85090285Sobrien   not defined, `PARM_BOUNDARY' is used for all arguments.  */
85190285Sobrien
85290285Sobrien#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
85390285Sobrien  ix86_function_arg_boundary ((MODE), (TYPE))
85490285Sobrien
85518334Speter/* Set this non-zero if move instructions will actually fail to work
85618334Speter   when given unaligned data.  */
85718334Speter#define STRICT_ALIGNMENT 0
85818334Speter
85918334Speter/* If bit field type is int, don't let it cross an int,
86018334Speter   and give entire struct the alignment of an int.  */
86118334Speter/* Required on the 386 since it doesn't have bitfield insns.  */
86218334Speter#define PCC_BITFIELD_TYPE_MATTERS 1
86318334Speter
86418334Speter/* Standard register usage.  */
86518334Speter
86618334Speter/* This processor has special stack-like registers.  See reg-stack.c
86790285Sobrien   for details.  */
86818334Speter
86918334Speter#define STACK_REGS
87090285Sobrien#define IS_STACK_MODE(MODE)					\
87190285Sobrien  ((MODE) == DFmode || (MODE) == SFmode || (MODE) == XFmode	\
87290285Sobrien   || (MODE) == TFmode)
87318334Speter
87418334Speter/* Number of actual hardware registers.
87518334Speter   The hardware registers are assigned numbers for the compiler
87618334Speter   from 0 to just below FIRST_PSEUDO_REGISTER.
87718334Speter   All registers that the compiler knows about must be given numbers,
87818334Speter   even those that are not normally considered general registers.
87918334Speter
88018334Speter   In the 80386 we give the 8 general purpose registers the numbers 0-7.
88118334Speter   We number the floating point registers 8-15.
88218334Speter   Note that registers 0-7 can be accessed as a  short or int,
88318334Speter   while only 0-3 may be used with byte `mov' instructions.
88418334Speter
88518334Speter   Reg 16 does not correspond to any hardware register, but instead
88618334Speter   appears in the RTL as an argument pointer prior to reload, and is
88718334Speter   eliminated during reloading in favor of either the stack or frame
88890285Sobrien   pointer.  */
88918334Speter
89090285Sobrien#define FIRST_PSEUDO_REGISTER 53
89118334Speter
89290285Sobrien/* Number of hardware registers that go into the DWARF-2 unwind info.
89390285Sobrien   If not defined, equals FIRST_PSEUDO_REGISTER.  */
89490285Sobrien
89590285Sobrien#define DWARF_FRAME_REGISTERS 17
89690285Sobrien
89718334Speter/* 1 for registers that have pervasive standard uses
89818334Speter   and are not available for the register allocator.
89990285Sobrien   On the 80386, the stack pointer is such, as is the arg pointer.
90090285Sobrien
90190285Sobrien   The value is an mask - bit 1 is set for fixed registers
90290285Sobrien   for 32bit target, while 2 is set for fixed registers for 64bit.
90390285Sobrien   Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
90490285Sobrien */
90590285Sobrien#define FIXED_REGISTERS						\
90690285Sobrien/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/	\
90790285Sobrien{  0, 0, 0, 0, 0, 0, 0, 3, 0,  0,  0,  0,  0,  0,  0,  0,	\
90890285Sobrien/*arg,flags,fpsr,dir,frame*/					\
90990285Sobrien    3,    3,   3,  3,    3,					\
91090285Sobrien/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/			\
91190285Sobrien     0,   0,   0,   0,   0,   0,   0,   0,			\
91290285Sobrien/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/			\
91390285Sobrien     0,   0,   0,   0,   0,   0,   0,   0,			\
91490285Sobrien/*  r8,  r9, r10, r11, r12, r13, r14, r15*/			\
91590285Sobrien     1,   1,   1,   1,   1,   1,   1,   1,			\
91690285Sobrien/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/		\
91790285Sobrien     1,   1,    1,    1,    1,    1,    1,    1}
91890285Sobrien
91918334Speter
92018334Speter/* 1 for registers not available across function calls.
92118334Speter   These must include the FIXED_REGISTERS and also any
92218334Speter   registers that can be used without being saved.
92318334Speter   The latter must include the registers where values are returned
92418334Speter   and the register where structure-value addresses are passed.
92590285Sobrien   Aside from that, you can include as many other registers as you like.
92690285Sobrien
92790285Sobrien   The value is an mask - bit 1 is set for call used
92890285Sobrien   for 32bit target, while 2 is set for call used for 64bit.
92990285Sobrien   Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
93090285Sobrien*/
93190285Sobrien#define CALL_USED_REGISTERS					\
93290285Sobrien/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/	\
93390285Sobrien{  3, 3, 3, 0, 2, 2, 0, 3, 3,  3,  3,  3,  3,  3,  3,  3,	\
93490285Sobrien/*arg,flags,fpsr,dir,frame*/					\
93590285Sobrien     3,   3,   3,  3,    3,					\
93690285Sobrien/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/			\
93790285Sobrien     3,   3,   3,   3,   3,  3,    3,   3,			\
93890285Sobrien/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/			\
93990285Sobrien     3,   3,   3,   3,   3,   3,   3,   3,			\
94090285Sobrien/*  r8,  r9, r10, r11, r12, r13, r14, r15*/			\
94190285Sobrien     3,   3,   3,   3,   1,   1,   1,   1,			\
94290285Sobrien/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/		\
94390285Sobrien     3,   3,    3,    3,    3,    3,    3,    3}		\
94418334Speter
94518334Speter/* Order in which to allocate registers.  Each register must be
94618334Speter   listed once, even those in FIXED_REGISTERS.  List frame pointer
94718334Speter   late and fixed registers last.  Note that, in general, we prefer
94818334Speter   registers listed in CALL_USED_REGISTERS, keeping the others
94918334Speter   available for storage of persistent values.
95018334Speter
95196294Sobrien   The ORDER_REGS_FOR_LOCAL_ALLOC actually overwrite the order,
95296294Sobrien   so this is just empty initializer for array.  */
95318334Speter
95496294Sobrien#define REG_ALLOC_ORDER 					\
95596294Sobrien{  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\
95696294Sobrien   18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,	\
95796294Sobrien   33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,  \
95896294Sobrien   48, 49, 50, 51, 52 }
95918334Speter
96096294Sobrien/* ORDER_REGS_FOR_LOCAL_ALLOC is a macro which permits reg_alloc_order
96196294Sobrien   to be rearranged based on a particular function.  When using sse math,
96296294Sobrien   we want to allocase SSE before x87 registers and vice vera.  */
96318334Speter
96496294Sobrien#define ORDER_REGS_FOR_LOCAL_ALLOC x86_order_regs_for_local_alloc ()
96518334Speter
96618334Speter
96718334Speter/* Macro to conditionally modify fixed_regs/call_used_regs.  */
96890285Sobrien#define CONDITIONAL_REGISTER_USAGE					\
96990285Sobriendo {									\
97090285Sobrien    int i;								\
97190285Sobrien    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)				\
97290285Sobrien      {									\
97390285Sobrien        fixed_regs[i] = (fixed_regs[i] & (TARGET_64BIT ? 2 : 1)) != 0;	\
97490285Sobrien        call_used_regs[i] = (call_used_regs[i]				\
97590285Sobrien			     & (TARGET_64BIT ? 2 : 1)) != 0;		\
97690285Sobrien      }									\
97796294Sobrien    if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)			\
97890285Sobrien      {									\
97990285Sobrien	fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;			\
98090285Sobrien	call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;			\
98190285Sobrien      }									\
98290285Sobrien    if (! TARGET_MMX)							\
98390285Sobrien      {									\
98490285Sobrien	int i;								\
98590285Sobrien        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)			\
98690285Sobrien          if (TEST_HARD_REG_BIT (reg_class_contents[(int)MMX_REGS], i))	\
98790285Sobrien	    fixed_regs[i] = call_used_regs[i] = 1;		 	\
98890285Sobrien      }									\
98990285Sobrien    if (! TARGET_SSE)							\
99090285Sobrien      {									\
99190285Sobrien	int i;								\
99290285Sobrien        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)			\
99390285Sobrien          if (TEST_HARD_REG_BIT (reg_class_contents[(int)SSE_REGS], i))	\
99490285Sobrien	    fixed_regs[i] = call_used_regs[i] = 1;		 	\
99590285Sobrien      }									\
99690285Sobrien    if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387)		\
99790285Sobrien      {									\
99890285Sobrien	int i;								\
99990285Sobrien	HARD_REG_SET x;							\
100090285Sobrien        COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]);	\
100190285Sobrien        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)			\
100290285Sobrien          if (TEST_HARD_REG_BIT (x, i)) 				\
100390285Sobrien	    fixed_regs[i] = call_used_regs[i] = 1;			\
100490285Sobrien      }									\
100590285Sobrien  } while (0)
100618334Speter
100718334Speter/* Return number of consecutive hard regs needed starting at reg REGNO
100818334Speter   to hold something of mode MODE.
100918334Speter   This is ordinarily the length in words of a value of mode MODE
101018334Speter   but can be less for certain modes in special long registers.
101118334Speter
101218334Speter   Actually there are no two word move instructions for consecutive
101318334Speter   registers.  And only registers 0-3 may have mov byte instructions
101418334Speter   applied to them.
101518334Speter   */
101618334Speter
101718334Speter#define HARD_REGNO_NREGS(REGNO, MODE)   \
101890285Sobrien  (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO)	\
101990285Sobrien   ? (COMPLEX_MODE_P (MODE) ? 2 : 1)					\
102090285Sobrien   : ((MODE) == TFmode							\
102190285Sobrien      ? (TARGET_64BIT ? 2 : 3)						\
102290285Sobrien      : (MODE) == TCmode						\
102390285Sobrien      ? (TARGET_64BIT ? 4 : 6)						\
102490285Sobrien      : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
102518334Speter
102690285Sobrien#define VALID_SSE_REG_MODE(MODE)					\
102790285Sobrien    ((MODE) == TImode || (MODE) == V4SFmode || (MODE) == V4SImode	\
102890285Sobrien     || (MODE) == SFmode						\
102990285Sobrien     || (TARGET_SSE2 && ((MODE) == DFmode || VALID_MMX_REG_MODE (MODE))))
103018334Speter
103190285Sobrien#define VALID_MMX_REG_MODE_3DNOW(MODE) \
103290285Sobrien    ((MODE) == V2SFmode || (MODE) == SFmode)
103318334Speter
103490285Sobrien#define VALID_MMX_REG_MODE(MODE)					\
103590285Sobrien    ((MODE) == DImode || (MODE) == V8QImode || (MODE) == V4HImode	\
103690285Sobrien     || (MODE) == V2SImode || (MODE) == SImode)
103718334Speter
103890285Sobrien#define VECTOR_MODE_SUPPORTED_P(MODE)					\
103990285Sobrien    (VALID_SSE_REG_MODE (MODE) && TARGET_SSE ? 1			\
104090285Sobrien     : VALID_MMX_REG_MODE (MODE) && TARGET_MMX ? 1			\
104190285Sobrien     : VALID_MMX_REG_MODE_3DNOW (MODE) && TARGET_3DNOW ? 1 : 0)
104290285Sobrien
104390285Sobrien#define VALID_FP_MODE_P(MODE)						\
104490285Sobrien    ((MODE) == SFmode || (MODE) == DFmode || (MODE) == TFmode		\
104590285Sobrien     || (!TARGET_64BIT && (MODE) == XFmode)				\
104690285Sobrien     || (MODE) == SCmode || (MODE) == DCmode || (MODE) == TCmode	\
104790285Sobrien     || (!TARGET_64BIT && (MODE) == XCmode))
104890285Sobrien
104990285Sobrien#define VALID_INT_MODE_P(MODE)						\
105090285Sobrien    ((MODE) == QImode || (MODE) == HImode || (MODE) == SImode		\
105190285Sobrien     || (MODE) == DImode						\
105290285Sobrien     || (MODE) == CQImode || (MODE) == CHImode || (MODE) == CSImode	\
105390285Sobrien     || (MODE) == CDImode						\
105490285Sobrien     || (TARGET_64BIT && ((MODE) == TImode || (MODE) == CTImode)))
105590285Sobrien
105690285Sobrien/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
105790285Sobrien
105890285Sobrien#define HARD_REGNO_MODE_OK(REGNO, MODE)	\
105990285Sobrien   ix86_hard_regno_mode_ok ((REGNO), (MODE))
106090285Sobrien
106118334Speter/* Value is 1 if it is a good idea to tie two pseudo registers
106218334Speter   when one has mode MODE1 and one has mode MODE2.
106318334Speter   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
106418334Speter   for any hard reg, then this must be 0 for correct output.  */
106518334Speter
106650654Sobrien#define MODES_TIEABLE_P(MODE1, MODE2)				\
106750654Sobrien  ((MODE1) == (MODE2)						\
106890285Sobrien   || (((MODE1) == HImode || (MODE1) == SImode			\
106990285Sobrien	|| ((MODE1) == QImode					\
107090285Sobrien	    && (TARGET_64BIT || !TARGET_PARTIAL_REG_STALL))	\
107190285Sobrien        || ((MODE1) == DImode && TARGET_64BIT))			\
107290285Sobrien       && ((MODE2) == HImode || (MODE2) == SImode		\
107390285Sobrien	   || ((MODE1) == QImode				\
107490285Sobrien	       && (TARGET_64BIT || !TARGET_PARTIAL_REG_STALL))	\
107590285Sobrien	   || ((MODE2) == DImode && TARGET_64BIT))))
107618334Speter
107790285Sobrien
107890285Sobrien/* Specify the modes required to caller save a given hard regno.
107990285Sobrien   We do this on i386 to prevent flags from being saved at all.
108090285Sobrien
108190285Sobrien   Kill any attempts to combine saving of modes.  */
108290285Sobrien
108390285Sobrien#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE)			\
108490285Sobrien  (CC_REGNO_P (REGNO) ? VOIDmode					\
108590285Sobrien   : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode			\
108690285Sobrien   : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS))	\
108790285Sobrien   : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode		\
108890285Sobrien   : (MODE) == QImode && (REGNO) >= 4 && !TARGET_64BIT ? SImode 	\
108990285Sobrien   : (MODE))
109018334Speter/* Specify the registers used for certain standard purposes.
109118334Speter   The values of these macros are register numbers.  */
109218334Speter
109318334Speter/* on the 386 the pc register is %eip, and is not usable as a general
109418334Speter   register.  The ordinary mov instructions won't work */
109518334Speter/* #define PC_REGNUM  */
109618334Speter
109718334Speter/* Register to use for pushing function arguments.  */
109818334Speter#define STACK_POINTER_REGNUM 7
109918334Speter
110018334Speter/* Base register for access to local variables of the function.  */
110190285Sobrien#define HARD_FRAME_POINTER_REGNUM 6
110218334Speter
110390285Sobrien/* Base register for access to local variables of the function.  */
110490285Sobrien#define FRAME_POINTER_REGNUM 20
110590285Sobrien
110618334Speter/* First floating point reg */
110718334Speter#define FIRST_FLOAT_REG 8
110818334Speter
110918334Speter/* First & last stack-like regs */
111018334Speter#define FIRST_STACK_REG FIRST_FLOAT_REG
111118334Speter#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
111218334Speter
111390285Sobrien#define FLAGS_REG 17
111490285Sobrien#define FPSR_REG 18
111590285Sobrien#define DIRFLAG_REG 19
111690285Sobrien
111790285Sobrien#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)
111890285Sobrien#define LAST_SSE_REG  (FIRST_SSE_REG + 7)
111990285Sobrien
112090285Sobrien#define FIRST_MMX_REG  (LAST_SSE_REG + 1)
112190285Sobrien#define LAST_MMX_REG   (FIRST_MMX_REG + 7)
112290285Sobrien
112390285Sobrien#define FIRST_REX_INT_REG  (LAST_MMX_REG + 1)
112490285Sobrien#define LAST_REX_INT_REG   (FIRST_REX_INT_REG + 7)
112590285Sobrien
112690285Sobrien#define FIRST_REX_SSE_REG  (LAST_REX_INT_REG + 1)
112790285Sobrien#define LAST_REX_SSE_REG   (FIRST_REX_SSE_REG + 7)
112890285Sobrien
112918334Speter/* Value should be nonzero if functions must have frame pointers.
113018334Speter   Zero means the frame pointer need not be set up (and parms
113118334Speter   may be accessed via the stack pointer) in functions that seem suitable.
113218334Speter   This is computed in `reload', in reload1.c.  */
113390285Sobrien#define FRAME_POINTER_REQUIRED  ix86_frame_pointer_required ()
113418334Speter
113590285Sobrien/* Override this in other tm.h files to cope with various OS losage
113690285Sobrien   requiring a frame pointer.  */
113790285Sobrien#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
113890285Sobrien#define SUBTARGET_FRAME_POINTER_REQUIRED 0
113990285Sobrien#endif
114090285Sobrien
114190285Sobrien/* Make sure we can access arbitrary call frames.  */
114290285Sobrien#define SETUP_FRAME_ADDRESSES()  ix86_setup_frame_addresses ()
114390285Sobrien
114418334Speter/* Base register for access to arguments of the function.  */
114518334Speter#define ARG_POINTER_REGNUM 16
114618334Speter
114790285Sobrien/* Register in which static-chain is passed to a function.
114890285Sobrien   We do use ECX as static chain register for 32 bit ABI.  On the
114990285Sobrien   64bit ABI, ECX is an argument register, so we use R10 instead.  */
115090285Sobrien#define STATIC_CHAIN_REGNUM (TARGET_64BIT ? FIRST_REX_INT_REG + 10 - 8 : 2)
115118334Speter
115218334Speter/* Register to hold the addressing base for position independent
115396294Sobrien   code access to data items.  We don't use PIC pointer for 64bit
115496294Sobrien   mode.  Define the regnum to dummy value to prevent gcc from
115596294Sobrien   pessimizing code dealing with EBX.  */
115696294Sobrien#define PIC_OFFSET_TABLE_REGNUM \
115796294Sobrien  (TARGET_64BIT || !flag_pic ? INVALID_REGNUM : 3)
115818334Speter
115918334Speter/* Register in which address to store a structure value
116018334Speter   arrives in the function.  On the 386, the prologue
116118334Speter   copies this from the stack to register %eax.  */
116218334Speter#define STRUCT_VALUE_INCOMING 0
116318334Speter
116418334Speter/* Place in which caller passes the structure value address.
116518334Speter   0 means push the value on the stack like an argument.  */
116618334Speter#define STRUCT_VALUE 0
116718334Speter
116818334Speter/* A C expression which can inhibit the returning of certain function
116918334Speter   values in registers, based on the type of value.  A nonzero value
117018334Speter   says to return the function value in memory, just as large
117118334Speter   structures are always returned.  Here TYPE will be a C expression
117218334Speter   of type `tree', representing the data type of the value.
117318334Speter
117418334Speter   Note that values of mode `BLKmode' must be explicitly handled by
117518334Speter   this macro.  Also, the option `-fpcc-struct-return' takes effect
117618334Speter   regardless of this macro.  On most systems, it is possible to
117718334Speter   leave the macro undefined; this causes a default definition to be
117818334Speter   used, whose value is the constant 1 for `BLKmode' values, and 0
117918334Speter   otherwise.
118018334Speter
118118334Speter   Do not use this macro to indicate that structures and unions
118218334Speter   should always be returned in memory.  You should instead use
118318334Speter   `DEFAULT_PCC_STRUCT_RETURN' to indicate this.  */
118418334Speter
118518334Speter#define RETURN_IN_MEMORY(TYPE) \
118690285Sobrien  ix86_return_in_memory (TYPE)
118718334Speter
118818334Speter
118918334Speter/* Define the classes of registers for register constraints in the
119018334Speter   machine description.  Also define ranges of constants.
119118334Speter
119218334Speter   One of the classes must always be named ALL_REGS and include all hard regs.
119318334Speter   If there is more than one class, another class must be named NO_REGS
119418334Speter   and contain no registers.
119518334Speter
119618334Speter   The name GENERAL_REGS must be the name of a class (or an alias for
119718334Speter   another name such as ALL_REGS).  This is the class of registers
119818334Speter   that is allowed by "g" or "r" in a register constraint.
119918334Speter   Also, registers outside this class are allocated only when
120018334Speter   instructions express preferences for them.
120118334Speter
120218334Speter   The classes must be numbered in nondecreasing order; that is,
120318334Speter   a larger-numbered class must never be contained completely
120418334Speter   in a smaller-numbered class.
120518334Speter
120618334Speter   For any two classes, it is very desirable that there be another
120718334Speter   class that represents their union.
120818334Speter
120918334Speter   It might seem that class BREG is unnecessary, since no useful 386
121018334Speter   opcode needs reg %ebx.  But some systems pass args to the OS in ebx,
121190285Sobrien   and the "b" register constraint is useful in asms for syscalls.
121218334Speter
121390285Sobrien   The flags and fpsr registers are in no class.  */
121490285Sobrien
121518334Speterenum reg_class
121618334Speter{
121718334Speter  NO_REGS,
121890285Sobrien  AREG, DREG, CREG, BREG, SIREG, DIREG,
121918334Speter  AD_REGS,			/* %eax/%edx for DImode */
122018334Speter  Q_REGS,			/* %eax %ebx %ecx %edx */
122190285Sobrien  NON_Q_REGS,			/* %esi %edi %ebp %esp */
122218334Speter  INDEX_REGS,			/* %eax %ebx %ecx %edx %esi %edi %ebp */
122390285Sobrien  LEGACY_REGS,			/* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
122490285Sobrien  GENERAL_REGS,			/* %eax %ebx %ecx %edx %esi %edi %ebp %esp %r8 - %r15*/
122518334Speter  FP_TOP_REG, FP_SECOND_REG,	/* %st(0) %st(1) */
122618334Speter  FLOAT_REGS,
122790285Sobrien  SSE_REGS,
122890285Sobrien  MMX_REGS,
122990285Sobrien  FP_TOP_SSE_REGS,
123090285Sobrien  FP_SECOND_SSE_REGS,
123190285Sobrien  FLOAT_SSE_REGS,
123290285Sobrien  FLOAT_INT_REGS,
123390285Sobrien  INT_SSE_REGS,
123490285Sobrien  FLOAT_INT_SSE_REGS,
123518334Speter  ALL_REGS, LIM_REG_CLASSES
123618334Speter};
123718334Speter
123890285Sobrien#define N_REG_CLASSES ((int) LIM_REG_CLASSES)
123918334Speter
124090285Sobrien#define INTEGER_CLASS_P(CLASS) \
124190285Sobrien  reg_class_subset_p ((CLASS), GENERAL_REGS)
124290285Sobrien#define FLOAT_CLASS_P(CLASS) \
124390285Sobrien  reg_class_subset_p ((CLASS), FLOAT_REGS)
124490285Sobrien#define SSE_CLASS_P(CLASS) \
124590285Sobrien  reg_class_subset_p ((CLASS), SSE_REGS)
124690285Sobrien#define MMX_CLASS_P(CLASS) \
124790285Sobrien  reg_class_subset_p ((CLASS), MMX_REGS)
124890285Sobrien#define MAYBE_INTEGER_CLASS_P(CLASS) \
124990285Sobrien  reg_classes_intersect_p ((CLASS), GENERAL_REGS)
125090285Sobrien#define MAYBE_FLOAT_CLASS_P(CLASS) \
125190285Sobrien  reg_classes_intersect_p ((CLASS), FLOAT_REGS)
125290285Sobrien#define MAYBE_SSE_CLASS_P(CLASS) \
125390285Sobrien  reg_classes_intersect_p (SSE_REGS, (CLASS))
125490285Sobrien#define MAYBE_MMX_CLASS_P(CLASS) \
125590285Sobrien  reg_classes_intersect_p (MMX_REGS, (CLASS))
125618334Speter
125790285Sobrien#define Q_CLASS_P(CLASS) \
125890285Sobrien  reg_class_subset_p ((CLASS), Q_REGS)
125990285Sobrien
126018334Speter/* Give names of register classes as strings for dump file.   */
126118334Speter
126218334Speter#define REG_CLASS_NAMES \
126318334Speter{  "NO_REGS",				\
126418334Speter   "AREG", "DREG", "CREG", "BREG",	\
126590285Sobrien   "SIREG", "DIREG",			\
126618334Speter   "AD_REGS",				\
126790285Sobrien   "Q_REGS", "NON_Q_REGS",		\
126818334Speter   "INDEX_REGS",			\
126990285Sobrien   "LEGACY_REGS",			\
127018334Speter   "GENERAL_REGS",			\
127118334Speter   "FP_TOP_REG", "FP_SECOND_REG",	\
127218334Speter   "FLOAT_REGS",			\
127390285Sobrien   "SSE_REGS",				\
127490285Sobrien   "MMX_REGS",				\
127590285Sobrien   "FP_TOP_SSE_REGS",			\
127690285Sobrien   "FP_SECOND_SSE_REGS",		\
127790285Sobrien   "FLOAT_SSE_REGS",			\
127890285Sobrien   "FLOAT_INT_REGS",			\
127990285Sobrien   "INT_SSE_REGS",			\
128090285Sobrien   "FLOAT_INT_SSE_REGS",		\
128118334Speter   "ALL_REGS" }
128218334Speter
128318334Speter/* Define which registers fit in which classes.
128418334Speter   This is an initializer for a vector of HARD_REG_SET
128518334Speter   of length N_REG_CLASSES.  */
128618334Speter
128790285Sobrien#define REG_CLASS_CONTENTS						\
128890285Sobrien{     { 0x00,     0x0 },						\
128990285Sobrien      { 0x01,     0x0 }, { 0x02, 0x0 },	/* AREG, DREG */		\
129090285Sobrien      { 0x04,     0x0 }, { 0x08, 0x0 },	/* CREG, BREG */		\
129190285Sobrien      { 0x10,     0x0 }, { 0x20, 0x0 },	/* SIREG, DIREG */		\
129290285Sobrien      { 0x03,     0x0 },		/* AD_REGS */			\
129390285Sobrien      { 0x0f,     0x0 },		/* Q_REGS */			\
129490285Sobrien  { 0x1100f0,  0x1fe0 },		/* NON_Q_REGS */		\
129590285Sobrien      { 0x7f,  0x1fe0 },		/* INDEX_REGS */		\
129690285Sobrien  { 0x1100ff,  0x0 },			/* LEGACY_REGS */		\
129790285Sobrien  { 0x1100ff,  0x1fe0 },		/* GENERAL_REGS */		\
129890285Sobrien     { 0x100,     0x0 }, { 0x0200, 0x0 },/* FP_TOP_REG, FP_SECOND_REG */\
129990285Sobrien    { 0xff00,     0x0 },		/* FLOAT_REGS */		\
130090285Sobrien{ 0x1fe00000,0x1fe000 },		/* SSE_REGS */			\
130190285Sobrien{ 0xe0000000,    0x1f },		/* MMX_REGS */			\
130290285Sobrien{ 0x1fe00100,0x1fe000 },		/* FP_TOP_SSE_REG */		\
130390285Sobrien{ 0x1fe00200,0x1fe000 },		/* FP_SECOND_SSE_REG */		\
130490285Sobrien{ 0x1fe0ff00,0x1fe000 },		/* FLOAT_SSE_REGS */		\
130590285Sobrien   { 0x1ffff,  0x1fe0 },		/* FLOAT_INT_REGS */		\
130690285Sobrien{ 0x1fe100ff,0x1fffe0 },		/* INT_SSE_REGS */		\
130790285Sobrien{ 0x1fe1ffff,0x1fffe0 },		/* FLOAT_INT_SSE_REGS */	\
130890285Sobrien{ 0xffffffff,0x1fffff }							\
130990285Sobrien}
131018334Speter
131118334Speter/* The same information, inverted:
131218334Speter   Return the class number of the smallest class containing
131318334Speter   reg number REGNO.  This could be a conditional expression
131418334Speter   or could index an array.  */
131518334Speter
131618334Speter#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
131718334Speter
131818334Speter/* When defined, the compiler allows registers explicitly used in the
131918334Speter   rtl to be used as spill registers but prevents the compiler from
132090285Sobrien   extending the lifetime of these registers.  */
132118334Speter
132250654Sobrien#define SMALL_REGISTER_CLASSES 1
132318334Speter
132418334Speter#define QI_REG_P(X) \
132518334Speter  (REG_P (X) && REGNO (X) < 4)
132690285Sobrien
132790285Sobrien#define GENERAL_REGNO_P(N) \
132890285Sobrien  ((N) < 8 || REX_INT_REGNO_P (N))
132990285Sobrien
133090285Sobrien#define GENERAL_REG_P(X) \
133190285Sobrien  (REG_P (X) && GENERAL_REGNO_P (REGNO (X)))
133290285Sobrien
133390285Sobrien#define ANY_QI_REG_P(X) (TARGET_64BIT ? GENERAL_REG_P(X) : QI_REG_P (X))
133490285Sobrien
133518334Speter#define NON_QI_REG_P(X) \
133618334Speter  (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
133718334Speter
133890285Sobrien#define REX_INT_REGNO_P(N) ((N) >= FIRST_REX_INT_REG && (N) <= LAST_REX_INT_REG)
133990285Sobrien#define REX_INT_REG_P(X) (REG_P (X) && REX_INT_REGNO_P (REGNO (X)))
134090285Sobrien
134118334Speter#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
134290285Sobrien#define FP_REGNO_P(N) ((N) >= FIRST_STACK_REG && (N) <= LAST_STACK_REG)
134390285Sobrien#define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X)))
134490285Sobrien#define ANY_FP_REGNO_P(N) (FP_REGNO_P (N) || SSE_REGNO_P (N))
134590285Sobrien
134690285Sobrien#define SSE_REGNO_P(N) \
134790285Sobrien  (((N) >= FIRST_SSE_REG && (N) <= LAST_SSE_REG) \
134890285Sobrien   || ((N) >= FIRST_REX_SSE_REG && (N) <= LAST_REX_SSE_REG))
134990285Sobrien
135090285Sobrien#define SSE_REGNO(N) \
135190285Sobrien  ((N) < 8 ? FIRST_SSE_REG + (N) : FIRST_REX_SSE_REG + (N) - 8)
135290285Sobrien#define SSE_REG_P(N) (REG_P (N) && SSE_REGNO_P (REGNO (N)))
135390285Sobrien
135490285Sobrien#define SSE_FLOAT_MODE_P(MODE) \
135596294Sobrien  ((TARGET_SSE && (MODE) == SFmode) || (TARGET_SSE2 && (MODE) == DFmode))
135690285Sobrien
135790285Sobrien#define MMX_REGNO_P(N) ((N) >= FIRST_MMX_REG && (N) <= LAST_MMX_REG)
135890285Sobrien#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP)))
135918334Speter
136090285Sobrien#define STACK_REG_P(XOP)		\
136190285Sobrien  (REG_P (XOP) &&		       	\
136290285Sobrien   REGNO (XOP) >= FIRST_STACK_REG &&	\
136390285Sobrien   REGNO (XOP) <= LAST_STACK_REG)
136418334Speter
136590285Sobrien#define NON_STACK_REG_P(XOP) (REG_P (XOP) && ! STACK_REG_P (XOP))
136618334Speter
136790285Sobrien#define STACK_TOP_P(XOP) (REG_P (XOP) && REGNO (XOP) == FIRST_STACK_REG)
136818334Speter
136990285Sobrien#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
137090285Sobrien#define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG)
137118334Speter
137290285Sobrien/* Indicate whether hard register numbered REG_NO should be converted
137390285Sobrien   to SSA form.  */
137490285Sobrien#define CONVERT_HARD_REGISTER_TO_SSA_P(REG_NO) \
137590285Sobrien  ((REG_NO) == FLAGS_REG || (REG_NO) == ARG_POINTER_REGNUM)
137618334Speter
137718334Speter/* The class value for index registers, and the one for base regs.  */
137818334Speter
137918334Speter#define INDEX_REG_CLASS INDEX_REGS
138018334Speter#define BASE_REG_CLASS GENERAL_REGS
138118334Speter
138218334Speter/* Get reg_class from a letter such as appears in the machine description.  */
138318334Speter
138418334Speter#define REG_CLASS_FROM_LETTER(C)	\
138518334Speter  ((C) == 'r' ? GENERAL_REGS :					\
138690285Sobrien   (C) == 'R' ? LEGACY_REGS :					\
138790285Sobrien   (C) == 'q' ? TARGET_64BIT ? GENERAL_REGS : Q_REGS :		\
138890285Sobrien   (C) == 'Q' ? Q_REGS :					\
138918334Speter   (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387	\
139018334Speter		 ? FLOAT_REGS					\
139118334Speter		 : NO_REGS) :					\
139218334Speter   (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387	\
139318334Speter		 ? FP_TOP_REG					\
139418334Speter		 : NO_REGS) :					\
139518334Speter   (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387	\
139618334Speter		 ? FP_SECOND_REG				\
139718334Speter		 : NO_REGS) :					\
139818334Speter   (C) == 'a' ? AREG :						\
139918334Speter   (C) == 'b' ? BREG :						\
140018334Speter   (C) == 'c' ? CREG :						\
140118334Speter   (C) == 'd' ? DREG :						\
140290285Sobrien   (C) == 'x' ? TARGET_SSE ? SSE_REGS : NO_REGS :		\
140390285Sobrien   (C) == 'Y' ? TARGET_SSE2? SSE_REGS : NO_REGS :		\
140490285Sobrien   (C) == 'y' ? TARGET_MMX ? MMX_REGS : NO_REGS :		\
140518334Speter   (C) == 'A' ? AD_REGS :					\
140618334Speter   (C) == 'D' ? DIREG :						\
140718334Speter   (C) == 'S' ? SIREG : NO_REGS)
140818334Speter
140918334Speter/* The letters I, J, K, L and M in a register constraint string
141018334Speter   can be used to stand for particular ranges of immediate operands.
141118334Speter   This macro defines what the ranges are.
141218334Speter   C is the letter, and VALUE is a constant value.
141318334Speter   Return 1 if VALUE is in the range specified by C.
141418334Speter
141518334Speter   I is for non-DImode shifts.
141618334Speter   J is for DImode shifts.
141790285Sobrien   K is for signed imm8 operands.
141890285Sobrien   L is for andsi as zero-extending move.
141918334Speter   M is for shifts that can be executed by the "lea" opcode.
142090285Sobrien   N is for immedaite operands for out/in instructions (0-255)
142118334Speter   */
142218334Speter
142390285Sobrien#define CONST_OK_FOR_LETTER_P(VALUE, C)				\
142490285Sobrien  ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31			\
142590285Sobrien   : (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63			\
142690285Sobrien   : (C) == 'K' ? (VALUE) >= -128 && (VALUE) <= 127		\
142790285Sobrien   : (C) == 'L' ? (VALUE) == 0xff || (VALUE) == 0xffff		\
142890285Sobrien   : (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3			\
142990285Sobrien   : (C) == 'N' ? (VALUE) >= 0 && (VALUE) <= 255		\
143090285Sobrien   : 0)
143118334Speter
143218334Speter/* Similar, but for floating constants, and defining letters G and H.
143318334Speter   Here VALUE is the CONST_DOUBLE rtx itself.  We allow constants even if
143418334Speter   TARGET_387 isn't set, because the stack register converter may need to
143552295Sobrien   load 0.0 into the function value register.  */
143618334Speter
143718334Speter#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
143890285Sobrien  ((C) == 'G' ? standard_80387_constant_p (VALUE) \
143990285Sobrien   : ((C) == 'H' ? standard_sse_constant_p (VALUE) : 0))
144018334Speter
144190285Sobrien/* A C expression that defines the optional machine-dependent
144290285Sobrien   constraint letters that can be used to segregate specific types of
144390285Sobrien   operands, usually memory references, for the target machine.  Any
144490285Sobrien   letter that is not elsewhere defined and not matched by
144590285Sobrien   `REG_CLASS_FROM_LETTER' may be used.  Normally this macro will not
144690285Sobrien   be defined.
144790285Sobrien
144890285Sobrien   If it is required for a particular target machine, it should
144990285Sobrien   return 1 if VALUE corresponds to the operand type represented by
145090285Sobrien   the constraint letter C.  If C is not defined as an extra
145190285Sobrien   constraint, the value returned should be 0 regardless of VALUE.  */
145290285Sobrien
145390285Sobrien#define EXTRA_CONSTRAINT(VALUE, C)				\
145490285Sobrien  ((C) == 'e' ? x86_64_sign_extended_value (VALUE)		\
145590285Sobrien   : (C) == 'Z' ? x86_64_zero_extended_value (VALUE)		\
145690285Sobrien   : 0)
145790285Sobrien
145818334Speter/* Place additional restrictions on the register class to use when it
145918334Speter   is necessary to be able to hold a value of mode MODE in a reload
146090285Sobrien   register for which class CLASS would ordinarily be used.  */
146118334Speter
146290285Sobrien#define LIMIT_RELOAD_CLASS(MODE, CLASS) 			\
146390285Sobrien  ((MODE) == QImode && !TARGET_64BIT				\
146490285Sobrien   && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS		\
146590285Sobrien       || (CLASS) == LEGACY_REGS || (CLASS) == INDEX_REGS)	\
146618334Speter   ? Q_REGS : (CLASS))
146718334Speter
146818334Speter/* Given an rtx X being reloaded into a reg required to be
146918334Speter   in class CLASS, return the class of reg to actually use.
147018334Speter   In general this is just CLASS; but on some machines
147118334Speter   in some cases it is preferable to use a more restrictive class.
147218334Speter   On the 80386 series, we prevent floating constants from being
147318334Speter   reloaded into floating registers (since no move-insn can do that)
147418334Speter   and we ensure that QImodes aren't reloaded into the esi or edi reg.  */
147518334Speter
147618334Speter/* Put float CONST_DOUBLE in the constant pool instead of fp regs.
147718334Speter   QImode must go into class Q_REGS.
147818334Speter   Narrow ALL_REGS to GENERAL_REGS.  This supports allowing movsf and
147990285Sobrien   movdf to do mem-to-mem moves through integer regs.  */
148018334Speter
148190285Sobrien#define PREFERRED_RELOAD_CLASS(X, CLASS) \
148290285Sobrien   ix86_preferred_reload_class ((X), (CLASS))
148318334Speter
148418334Speter/* If we are copying between general and FP registers, we need a memory
148590285Sobrien   location. The same is true for SSE and MMX registers.  */
148690285Sobrien#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
148790285Sobrien  ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1)
148818334Speter
148990285Sobrien/* QImode spills from non-QI registers need a scratch.  This does not
149090285Sobrien   happen often -- the only example so far requires an uninitialized
149190285Sobrien   pseudo.  */
149218334Speter
149390285Sobrien#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT)			\
149490285Sobrien  (((CLASS) == GENERAL_REGS || (CLASS) == LEGACY_REGS			\
149590285Sobrien    || (CLASS) == INDEX_REGS) && !TARGET_64BIT && (MODE) == QImode	\
149690285Sobrien   ? Q_REGS : NO_REGS)
149790285Sobrien
149818334Speter/* Return the maximum number of consecutive registers
149918334Speter   needed to represent mode MODE in a register of class CLASS.  */
150018334Speter/* On the 80386, this is the size of MODE in words,
150190285Sobrien   except in the FP regs, where a single reg is always enough.
150290285Sobrien   The TFmodes are really just 80bit values, so we use only 3 registers
150390285Sobrien   to hold them, instead of 4, as the size would suggest.
150490285Sobrien */
150590285Sobrien#define CLASS_MAX_NREGS(CLASS, MODE)					\
150690285Sobrien (!MAYBE_INTEGER_CLASS_P (CLASS)					\
150790285Sobrien  ? (COMPLEX_MODE_P (MODE) ? 2 : 1)					\
150890285Sobrien  : ((GET_MODE_SIZE ((MODE) == TFmode ? XFmode : (MODE))		\
150990285Sobrien     + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
151018334Speter
151118334Speter/* A C expression whose value is nonzero if pseudos that have been
151218334Speter   assigned to registers of class CLASS would likely be spilled
151318334Speter   because registers of CLASS are needed for spill registers.
151418334Speter
151518334Speter   The default value of this macro returns 1 if CLASS has exactly one
151618334Speter   register and zero otherwise.  On most machines, this default
151718334Speter   should be used.  Only define this macro to some other expression
151818334Speter   if pseudo allocated by `local-alloc.c' end up in memory because
151918334Speter   their hard registers were needed for spill registers.  If this
152018334Speter   macro returns nonzero for those classes, those pseudos will only
152118334Speter   be allocated by `global.c', which knows how to reallocate the
152218334Speter   pseudo to another register.  If there would not be another
152318334Speter   register available for reallocation, you should not change the
152418334Speter   definition of this macro since the only effect of such a
152518334Speter   definition would be to slow down register allocation.  */
152618334Speter
152718334Speter#define CLASS_LIKELY_SPILLED_P(CLASS)					\
152818334Speter  (((CLASS) == AREG)							\
152918334Speter   || ((CLASS) == DREG)							\
153018334Speter   || ((CLASS) == CREG)							\
153118334Speter   || ((CLASS) == BREG)							\
153218334Speter   || ((CLASS) == AD_REGS)						\
153318334Speter   || ((CLASS) == SIREG)						\
153418334Speter   || ((CLASS) == DIREG))
153518334Speter
153690285Sobrien/* A C statement that adds to CLOBBERS any hard regs the port wishes
153790285Sobrien   to automatically clobber for all asms.
153890285Sobrien
153990285Sobrien   We do this in the new i386 backend to maintain source compatibility
154090285Sobrien   with the old cc0-based compiler.  */
154190285Sobrien
154290285Sobrien#define MD_ASM_CLOBBERS(CLOBBERS)					\
154390285Sobrien  do {									\
154490285Sobrien    (CLOBBERS) = tree_cons (NULL_TREE, build_string (5, "flags"),	\
154590285Sobrien			    (CLOBBERS));				\
154690285Sobrien    (CLOBBERS) = tree_cons (NULL_TREE, build_string (4, "fpsr"),	\
154790285Sobrien			    (CLOBBERS));				\
154890285Sobrien    (CLOBBERS) = tree_cons (NULL_TREE, build_string (7, "dirflag"),	\
154990285Sobrien			    (CLOBBERS));				\
155090285Sobrien  } while (0)
155118334Speter
155218334Speter/* Stack layout; function entry, exit and calling.  */
155318334Speter
155418334Speter/* Define this if pushing a word on the stack
155518334Speter   makes the stack pointer a smaller address.  */
155618334Speter#define STACK_GROWS_DOWNWARD
155718334Speter
155818334Speter/* Define this if the nominal address of the stack frame
155918334Speter   is at the high-address end of the local variables;
156018334Speter   that is, each additional local variable allocated
156118334Speter   goes at a more negative offset in the frame.  */
156218334Speter#define FRAME_GROWS_DOWNWARD
156318334Speter
156418334Speter/* Offset within stack frame to start allocating local variables at.
156518334Speter   If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
156618334Speter   first local allocated.  Otherwise, it is the offset to the BEGINNING
156718334Speter   of the first local allocated.  */
156818334Speter#define STARTING_FRAME_OFFSET 0
156918334Speter
157018334Speter/* If we generate an insn to push BYTES bytes,
157118334Speter   this says how many the stack pointer really advances by.
157218334Speter   On 386 pushw decrements by exactly 2 no matter what the position was.
157318334Speter   On the 386 there is no pushb; we use pushw instead, and this
157490285Sobrien   has the effect of rounding up to 2.
157590285Sobrien
157690285Sobrien   For 64bit ABI we round up to 8 bytes.
157790285Sobrien */
157818334Speter
157990285Sobrien#define PUSH_ROUNDING(BYTES) \
158090285Sobrien  (TARGET_64BIT		     \
158190285Sobrien   ? (((BYTES) + 7) & (-8))  \
158290285Sobrien   : (((BYTES) + 1) & (-2)))
158318334Speter
158490285Sobrien/* If defined, the maximum amount of space required for outgoing arguments will
158590285Sobrien   be computed and placed into the variable
158690285Sobrien   `current_function_outgoing_args_size'.  No space will be pushed onto the
158790285Sobrien   stack for each call; instead, the function prologue should increase the stack
158890285Sobrien   frame size by this amount.  */
158990285Sobrien
159090285Sobrien#define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS
159190285Sobrien
159290285Sobrien/* If defined, a C expression whose value is nonzero when we want to use PUSH
159390285Sobrien   instructions to pass outgoing arguments.  */
159490285Sobrien
159590285Sobrien#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)
159690285Sobrien
159718334Speter/* Offset of first parameter from the argument pointer register value.  */
159818334Speter#define FIRST_PARM_OFFSET(FNDECL) 0
159918334Speter
160090285Sobrien/* Define this macro if functions should assume that stack space has been
160190285Sobrien   allocated for arguments even when their values are passed in registers.
160290285Sobrien
160390285Sobrien   The value of this macro is the size, in bytes, of the area reserved for
160490285Sobrien   arguments passed in registers for the function represented by FNDECL.
160590285Sobrien
160690285Sobrien   This space can be allocated by the caller, or be a part of the
160790285Sobrien   machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
160890285Sobrien   which.  */
160990285Sobrien#define REG_PARM_STACK_SPACE(FNDECL) 0
161090285Sobrien
161190285Sobrien/* Define as a C expression that evaluates to nonzero if we do not know how
161290285Sobrien   to pass TYPE solely in registers.  The file expr.h defines a
161390285Sobrien   definition that is usually appropriate, refer to expr.h for additional
161490285Sobrien   documentation. If `REG_PARM_STACK_SPACE' is defined, the argument will be
161590285Sobrien   computed in the stack and then loaded into a register.  */
161690285Sobrien#define MUST_PASS_IN_STACK(MODE, TYPE)				\
161790285Sobrien  ((TYPE) != 0							\
161890285Sobrien   && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST		\
161990285Sobrien       || TREE_ADDRESSABLE (TYPE)				\
162090285Sobrien       || ((MODE) == TImode)					\
162190285Sobrien       || ((MODE) == BLKmode 					\
162290285Sobrien	   && ! ((TYPE) != 0					\
162390285Sobrien		 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
162490285Sobrien		 && 0 == (int_size_in_bytes (TYPE)		\
162590285Sobrien			  % (PARM_BOUNDARY / BITS_PER_UNIT)))	\
162690285Sobrien	   && (FUNCTION_ARG_PADDING (MODE, TYPE)		\
162790285Sobrien	       == (BYTES_BIG_ENDIAN ? upward : downward)))))
162890285Sobrien
162918334Speter/* Value is the number of bytes of arguments automatically
163018334Speter   popped when returning from a subroutine call.
163118334Speter   FUNDECL is the declaration node of the function (as a tree),
163218334Speter   FUNTYPE is the data type of the function (as a tree),
163318334Speter   or for a library call it is an identifier node for the subroutine name.
163418334Speter   SIZE is the number of bytes of arguments passed on the stack.
163518334Speter
163618334Speter   On the 80386, the RTD insn may be used to pop them if the number
163718334Speter     of args is fixed, but if the number is variable then the caller
163818334Speter     must pop them all.  RTD can't be used for library calls now
163918334Speter     because the library is compiled with the Unix compiler.
164018334Speter   Use of RTD is a selectable option, since it is incompatible with
164118334Speter   standard Unix calling sequences.  If the option is not selected,
164218334Speter   the caller must always pop the args.
164318334Speter
164418334Speter   The attribute stdcall is equivalent to RTD on a per module basis.  */
164518334Speter
164690285Sobrien#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) \
164790285Sobrien  ix86_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE))
164818334Speter
164918334Speter/* Define how to find the value returned by a function.
165018334Speter   VALTYPE is the data type of the value (as a tree).
165118334Speter   If the precise function being called is known, FUNC is its FUNCTION_DECL;
165218334Speter   otherwise, FUNC is 0.  */
165318334Speter#define FUNCTION_VALUE(VALTYPE, FUNC)  \
165490285Sobrien   ix86_function_value (VALTYPE)
165518334Speter
165690285Sobrien#define FUNCTION_VALUE_REGNO_P(N) \
165790285Sobrien  ix86_function_value_regno_p (N)
165890285Sobrien
165918334Speter/* Define how to find the value returned by a library function
166018334Speter   assuming the value has mode MODE.  */
166118334Speter
166218334Speter#define LIBCALL_VALUE(MODE) \
166390285Sobrien  ix86_libcall_value (MODE)
166418334Speter
166518334Speter/* Define the size of the result block used for communication between
166618334Speter   untyped_call and untyped_return.  The block contains a DImode value
166718334Speter   followed by the block used by fnsave and frstor.  */
166818334Speter
166918334Speter#define APPLY_RESULT_SIZE (8+108)
167018334Speter
167118334Speter/* 1 if N is a possible register number for function argument passing.  */
167290285Sobrien#define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p (N)
167318334Speter
167418334Speter/* Define a data type for recording info about an argument list
167518334Speter   during the scan of that argument list.  This data type should
167618334Speter   hold all necessary information about the function itself
167718334Speter   and about the args processed so far, enough to enable macros
167818334Speter   such as FUNCTION_ARG to determine where the next arg should go.  */
167918334Speter
168090285Sobrientypedef struct ix86_args {
168118334Speter  int words;			/* # words passed so far */
168218334Speter  int nregs;			/* # registers available for passing */
168318334Speter  int regno;			/* next available register number */
168490285Sobrien  int sse_words;		/* # sse words passed so far */
168590285Sobrien  int sse_nregs;		/* # sse registers available for passing */
168690285Sobrien  int sse_regno;		/* next available sse register number */
168790285Sobrien  int maybe_vaarg;		/* true for calls to possibly vardic fncts.  */
168818334Speter} CUMULATIVE_ARGS;
168918334Speter
169018334Speter/* Initialize a variable CUM of type CUMULATIVE_ARGS
169118334Speter   for a call to a function whose data type is FNTYPE.
169218334Speter   For a library call, FNTYPE is 0.  */
169318334Speter
169490285Sobrien#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
169590285Sobrien  init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME))
169618334Speter
169718334Speter/* Update the data in CUM to advance over an argument
169818334Speter   of mode MODE and data type TYPE.
169918334Speter   (TYPE is null for libcalls where that information may not be available.)  */
170018334Speter
170190285Sobrien#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
170290285Sobrien  function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
170318334Speter
170418334Speter/* Define where to put the arguments to a function.
170518334Speter   Value is zero to push the argument on the stack,
170618334Speter   or a hard register in which to store the argument.
170718334Speter
170818334Speter   MODE is the argument's machine mode.
170918334Speter   TYPE is the data type of the argument (as a tree).
171018334Speter    This is null for libcalls where that information may
171118334Speter    not be available.
171218334Speter   CUM is a variable of type CUMULATIVE_ARGS which gives info about
171318334Speter    the preceding args and about the function being called.
171418334Speter   NAMED is nonzero if this argument is a named parameter
171518334Speter    (otherwise it is an extra parameter matching an ellipsis).  */
171618334Speter
171718334Speter#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
171890285Sobrien  function_arg (&(CUM), (MODE), (TYPE), (NAMED))
171918334Speter
172018334Speter/* For an arg passed partly in registers and partly in memory,
172118334Speter   this is the number of registers used.
172218334Speter   For args passed entirely in registers or entirely in memory, zero.  */
172318334Speter
172490285Sobrien#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
172518334Speter
172690285Sobrien/* If PIC, we cannot make sibling calls to global functions
172790285Sobrien   because the PLT requires %ebx live.
172890285Sobrien   If we are returning floats on the register stack, we cannot make
172990285Sobrien   sibling calls to functions that return floats.  (The stack adjust
173090285Sobrien   instruction will wind up after the sibcall jump, and not be executed.) */
173190285Sobrien#define FUNCTION_OK_FOR_SIBCALL(DECL)					\
173290285Sobrien  ((DECL)								\
173390285Sobrien   && (! flag_pic || ! TREE_PUBLIC (DECL))				\
173490285Sobrien   && (! TARGET_FLOAT_RETURNS_IN_80387					\
173590285Sobrien       || ! FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (TREE_TYPE (DECL))))	\
173690285Sobrien       || FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (TREE_TYPE (cfun->decl))))))
173750654Sobrien
173890285Sobrien/* Perform any needed actions needed for a function that is receiving a
173990285Sobrien   variable number of arguments.
174050654Sobrien
174190285Sobrien   CUM is as above.
174218334Speter
174390285Sobrien   MODE and TYPE are the mode and type of the current parameter.
174418334Speter
174590285Sobrien   PRETEND_SIZE is a variable that should be set to the amount of stack
174690285Sobrien   that must be pushed by the prolog to pretend that our caller pushed
174790285Sobrien   it.
174818334Speter
174990285Sobrien   Normally, this macro will push all remaining incoming registers on the
175090285Sobrien   stack and set PRETEND_SIZE to the length of the registers pushed.  */
175118334Speter
175290285Sobrien#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PRETEND_SIZE, NO_RTL)	\
175390285Sobrien  ix86_setup_incoming_varargs (&(CUM), (MODE), (TYPE), &(PRETEND_SIZE), \
175490285Sobrien			       (NO_RTL))
175518334Speter
175690285Sobrien/* Define the `__builtin_va_list' type for the ABI.  */
175790285Sobrien#define BUILD_VA_LIST_TYPE(VALIST) \
175890285Sobrien  ((VALIST) = ix86_build_va_list ())
175918334Speter
176090285Sobrien/* Implement `va_start' for varargs and stdarg.  */
176190285Sobrien#define EXPAND_BUILTIN_VA_START(STDARG, VALIST, NEXTARG) \
176290285Sobrien  ix86_va_start ((STDARG), (VALIST), (NEXTARG))
176318334Speter
176490285Sobrien/* Implement `va_arg'.  */
176590285Sobrien#define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
176690285Sobrien  ix86_va_arg ((VALIST), (TYPE))
176718334Speter
176890285Sobrien/* This macro is invoked at the end of compilation.  It is used here to
176990285Sobrien   output code for -fpic that will load the return address into %ebx.  */
177018334Speter
177190285Sobrien#undef ASM_FILE_END
177290285Sobrien#define ASM_FILE_END(FILE)  ix86_asm_file_end (FILE)
177350654Sobrien
177490285Sobrien/* Output assembler code to FILE to increment profiler label # LABELNO
177590285Sobrien   for profiling a function entry.  */
177650654Sobrien
177790285Sobrien#define FUNCTION_PROFILER(FILE, LABELNO)				\
177890285Sobriendo {									\
177990285Sobrien  if (flag_pic)								\
178090285Sobrien    {									\
178190285Sobrien      fprintf ((FILE), "\tleal\t%sP%d@GOTOFF(%%ebx),%%edx\n",		\
178290285Sobrien	       LPREFIX, (LABELNO));					\
178390285Sobrien      fprintf ((FILE), "\tcall\t*_mcount@GOT(%%ebx)\n");		\
178450654Sobrien    }									\
178590285Sobrien  else									\
178690285Sobrien    {									\
178790285Sobrien      fprintf ((FILE), "\tmovl\t$%sP%d,%%edx\n", LPREFIX, (LABELNO));	\
178890285Sobrien      fprintf ((FILE), "\tcall\t_mcount\n");				\
178950654Sobrien    }									\
179090285Sobrien} while (0)
179118334Speter
179218334Speter/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
179318334Speter   the stack pointer does not matter.  The value is tested only in
179418334Speter   functions that have frame pointers.
179518334Speter   No definition is equivalent to always zero.  */
179618334Speter/* Note on the 386 it might be more efficient not to define this since
179718334Speter   we have to restore it ourselves from the frame pointer, in order to
179818334Speter   use pop */
179918334Speter
180018334Speter#define EXIT_IGNORE_STACK 1
180118334Speter
180218334Speter/* Output assembler code for a block containing the constant parts
180318334Speter   of a trampoline, leaving space for the variable parts.  */
180418334Speter
180552295Sobrien/* On the 386, the trampoline contains two instructions:
180618334Speter     mov #STATIC,ecx
180752295Sobrien     jmp FUNCTION
180852295Sobrien   The trampoline is generated entirely at runtime.  The operand of JMP
180952295Sobrien   is the address of FUNCTION relative to the instruction following the
181052295Sobrien   JMP (which is 5 bytes long).  */
181118334Speter
181218334Speter/* Length in units of the trampoline for entering a nested function.  */
181318334Speter
181490285Sobrien#define TRAMPOLINE_SIZE (TARGET_64BIT ? 23 : 10)
181518334Speter
181618334Speter/* Emit RTL insns to initialize the variable parts of a trampoline.
181718334Speter   FNADDR is an RTX for the address of the function's pure code.
181818334Speter   CXT is an RTX for the static chain value for the function.  */
181918334Speter
182090285Sobrien#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
182190285Sobrien  x86_initialize_trampoline ((TRAMP), (FNADDR), (CXT))
182218334Speter
182318334Speter/* Definitions for register eliminations.
182418334Speter
182518334Speter   This is an array of structures.  Each structure initializes one pair
182618334Speter   of eliminable registers.  The "from" register number is given first,
182718334Speter   followed by "to".  Eliminations of the same "from" register are listed
182818334Speter   in order of preference.
182918334Speter
183090285Sobrien   There are two registers that can always be eliminated on the i386.
183190285Sobrien   The frame pointer and the arg pointer can be replaced by either the
183290285Sobrien   hard frame pointer or to the stack pointer, depending upon the
183390285Sobrien   circumstances.  The hard frame pointer is not used before reload and
183490285Sobrien   so it is not eligible for elimination.  */
183518334Speter
183690285Sobrien#define ELIMINABLE_REGS					\
183790285Sobrien{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},		\
183890285Sobrien { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},	\
183990285Sobrien { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},		\
184090285Sobrien { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}	\
184118334Speter
184290285Sobrien/* Given FROM and TO register numbers, say whether this elimination is
184390285Sobrien   allowed.  Frame pointer elimination is automatically handled.
184418334Speter
184518334Speter   All other eliminations are valid.  */
184618334Speter
184790285Sobrien#define CAN_ELIMINATE(FROM, TO) \
184890285Sobrien  ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
184918334Speter
185018334Speter/* Define the offset between two registers, one to be eliminated, and the other
185118334Speter   its replacement, at the start of a routine.  */
185218334Speter
185390285Sobrien#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
185490285Sobrien  ((OFFSET) = ix86_initial_elimination_offset ((FROM), (TO)))
185518334Speter
185618334Speter/* Addressing modes, and classification of registers for them.  */
185718334Speter
185852295Sobrien/* #define HAVE_POST_INCREMENT 0 */
185952295Sobrien/* #define HAVE_POST_DECREMENT 0 */
186018334Speter
186152295Sobrien/* #define HAVE_PRE_DECREMENT 0 */
186252295Sobrien/* #define HAVE_PRE_INCREMENT 0 */
186318334Speter
186418334Speter/* Macros to check register numbers against specific register classes.  */
186518334Speter
186618334Speter/* These assume that REGNO is a hard or pseudo reg number.
186718334Speter   They give nonzero only if REGNO is a hard reg of the suitable class
186818334Speter   or a pseudo reg currently allocated to a suitable hard reg.
186918334Speter   Since they use reg_renumber, they are safe only once reg_renumber
187018334Speter   has been allocated, which happens in local-alloc.c.  */
187118334Speter
187290285Sobrien#define REGNO_OK_FOR_INDEX_P(REGNO) 					\
187390285Sobrien  ((REGNO) < STACK_POINTER_REGNUM 					\
187490285Sobrien   || (REGNO >= FIRST_REX_INT_REG					\
187590285Sobrien       && (REGNO) <= LAST_REX_INT_REG)					\
187690285Sobrien   || ((unsigned) reg_renumber[(REGNO)] >= FIRST_REX_INT_REG		\
187790285Sobrien       && (unsigned) reg_renumber[(REGNO)] <= LAST_REX_INT_REG)		\
187890285Sobrien   || (unsigned) reg_renumber[(REGNO)] < STACK_POINTER_REGNUM)
187918334Speter
188090285Sobrien#define REGNO_OK_FOR_BASE_P(REGNO) 					\
188190285Sobrien  ((REGNO) <= STACK_POINTER_REGNUM 					\
188290285Sobrien   || (REGNO) == ARG_POINTER_REGNUM 					\
188390285Sobrien   || (REGNO) == FRAME_POINTER_REGNUM 					\
188490285Sobrien   || (REGNO >= FIRST_REX_INT_REG					\
188590285Sobrien       && (REGNO) <= LAST_REX_INT_REG)					\
188690285Sobrien   || ((unsigned) reg_renumber[(REGNO)] >= FIRST_REX_INT_REG		\
188790285Sobrien       && (unsigned) reg_renumber[(REGNO)] <= LAST_REX_INT_REG)		\
188890285Sobrien   || (unsigned) reg_renumber[(REGNO)] <= STACK_POINTER_REGNUM)
188918334Speter
189090285Sobrien#define REGNO_OK_FOR_SIREG_P(REGNO) \
189190285Sobrien  ((REGNO) == 4 || reg_renumber[(REGNO)] == 4)
189290285Sobrien#define REGNO_OK_FOR_DIREG_P(REGNO) \
189390285Sobrien  ((REGNO) == 5 || reg_renumber[(REGNO)] == 5)
189418334Speter
189518334Speter/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
189618334Speter   and check its validity for a certain class.
189718334Speter   We have two alternate definitions for each of them.
189818334Speter   The usual definition accepts all pseudo regs; the other rejects
189918334Speter   them unless they have been allocated suitable hard regs.
190018334Speter   The symbol REG_OK_STRICT causes the latter definition to be used.
190118334Speter
190218334Speter   Most source files want to accept pseudo regs in the hope that
190318334Speter   they will get allocated to the class that the insn wants them to be in.
190418334Speter   Source files for reload pass need to be strict.
190518334Speter   After reload, it makes no difference, since pseudo regs have
190618334Speter   been eliminated by then.  */
190718334Speter
190818334Speter
190918334Speter/* Non strict versions, pseudos are ok */
191018334Speter#define REG_OK_FOR_INDEX_NONSTRICT_P(X)					\
191118334Speter  (REGNO (X) < STACK_POINTER_REGNUM					\
191290285Sobrien   || (REGNO (X) >= FIRST_REX_INT_REG					\
191390285Sobrien       && REGNO (X) <= LAST_REX_INT_REG)				\
191418334Speter   || REGNO (X) >= FIRST_PSEUDO_REGISTER)
191518334Speter
191618334Speter#define REG_OK_FOR_BASE_NONSTRICT_P(X)					\
191718334Speter  (REGNO (X) <= STACK_POINTER_REGNUM					\
191818334Speter   || REGNO (X) == ARG_POINTER_REGNUM					\
191990285Sobrien   || REGNO (X) == FRAME_POINTER_REGNUM 				\
192090285Sobrien   || (REGNO (X) >= FIRST_REX_INT_REG					\
192190285Sobrien       && REGNO (X) <= LAST_REX_INT_REG)				\
192218334Speter   || REGNO (X) >= FIRST_PSEUDO_REGISTER)
192318334Speter
192418334Speter/* Strict versions, hard registers only */
192518334Speter#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
192618334Speter#define REG_OK_FOR_BASE_STRICT_P(X)  REGNO_OK_FOR_BASE_P (REGNO (X))
192718334Speter
192818334Speter#ifndef REG_OK_STRICT
192990285Sobrien#define REG_OK_FOR_INDEX_P(X)  REG_OK_FOR_INDEX_NONSTRICT_P (X)
193090285Sobrien#define REG_OK_FOR_BASE_P(X)   REG_OK_FOR_BASE_NONSTRICT_P (X)
193118334Speter
193218334Speter#else
193390285Sobrien#define REG_OK_FOR_INDEX_P(X)  REG_OK_FOR_INDEX_STRICT_P (X)
193490285Sobrien#define REG_OK_FOR_BASE_P(X)   REG_OK_FOR_BASE_STRICT_P (X)
193518334Speter#endif
193618334Speter
193718334Speter/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
193818334Speter   that is a valid memory address for an instruction.
193918334Speter   The MODE argument is the machine mode for the MEM expression
194018334Speter   that wants to use this address.
194118334Speter
194218334Speter   The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
194318334Speter   except for CONSTANT_ADDRESS_P which is usually machine-independent.
194418334Speter
194518334Speter   See legitimize_pic_address in i386.c for details as to what
194618334Speter   constitutes a legitimate address when -fpic is used.  */
194718334Speter
194818334Speter#define MAX_REGS_PER_ADDRESS 2
194918334Speter
195052295Sobrien#define CONSTANT_ADDRESS_P(X)					\
195152295Sobrien  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
195290285Sobrien   || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST	\
195390285Sobrien   || GET_CODE (X) == CONST_DOUBLE)
195418334Speter
195518334Speter/* Nonzero if the constant value X is a legitimate general operand.
195618334Speter   It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
195718334Speter
195890285Sobrien#define LEGITIMATE_CONSTANT_P(X) 1
195918334Speter
196018334Speter#ifdef REG_OK_STRICT
196118334Speter#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)				\
196290285Sobriendo {									\
196390285Sobrien  if (legitimate_address_p ((MODE), (X), 1))				\
196418334Speter    goto ADDR;								\
196590285Sobrien} while (0)
196618334Speter
196718334Speter#else
196818334Speter#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)				\
196990285Sobriendo {									\
197090285Sobrien  if (legitimate_address_p ((MODE), (X), 0))				\
197118334Speter    goto ADDR;								\
197290285Sobrien} while (0)
197318334Speter
197418334Speter#endif
197518334Speter
197690285Sobrien/* If defined, a C expression to determine the base term of address X.
197790285Sobrien   This macro is used in only one place: `find_base_term' in alias.c.
197890285Sobrien
197990285Sobrien   It is always safe for this macro to not be defined.  It exists so
198090285Sobrien   that alias analysis can understand machine-dependent addresses.
198190285Sobrien
198290285Sobrien   The typical use of this macro is to handle addresses containing
198390285Sobrien   a label_ref or symbol_ref within an UNSPEC.  */
198490285Sobrien
198590285Sobrien#define FIND_BASE_TERM(X) ix86_find_base_term (X)
198690285Sobrien
198718334Speter/* Try machine-dependent ways of modifying an illegitimate address
198818334Speter   to be legitimate.  If we find one, return the new, valid address.
198918334Speter   This macro is used in only one place: `memory_address' in explow.c.
199018334Speter
199118334Speter   OLDX is the address as it was before break_out_memory_refs was called.
199218334Speter   In some cases it is useful to look at this to decide what needs to be done.
199318334Speter
199418334Speter   MODE and WIN are passed so that this macro can use
199518334Speter   GO_IF_LEGITIMATE_ADDRESS.
199618334Speter
199718334Speter   It is always safe for this macro to do nothing.  It exists to recognize
199818334Speter   opportunities to optimize the output.
199918334Speter
200018334Speter   For the 80386, we handle X+REG by loading X into a register R and
200118334Speter   using R+REG.  R will go in a general reg and indexing will be used.
200218334Speter   However, if REG is a broken-out memory address or multiplication,
200318334Speter   nothing needs to be done because REG can certainly go in a general reg.
200418334Speter
200518334Speter   When -fpic is used, special handling is needed for symbolic references.
200618334Speter   See comments by legitimize_pic_address in i386.c for details.  */
200718334Speter
200818334Speter#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)				\
200990285Sobriendo {									\
201090285Sobrien  (X) = legitimize_address ((X), (OLDX), (MODE));			\
201190285Sobrien  if (memory_address_p ((MODE), (X)))					\
201218334Speter    goto WIN;								\
201390285Sobrien} while (0)
201418334Speter
201590285Sobrien#define REWRITE_ADDRESS(X) rewrite_address (X)
201650654Sobrien
201718334Speter/* Nonzero if the constant value X is a legitimate general operand
201818334Speter   when generating PIC code.  It is given that flag_pic is on and
201918334Speter   that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
202018334Speter
202190285Sobrien#define LEGITIMATE_PIC_OPERAND_P(X)		\
202290285Sobrien  (! SYMBOLIC_CONST (X)				\
202390285Sobrien   || legitimate_pic_address_disp_p (X))
202418334Speter
202518334Speter#define SYMBOLIC_CONST(X)	\
202690285Sobrien  (GET_CODE (X) == SYMBOL_REF						\
202790285Sobrien   || GET_CODE (X) == LABEL_REF						\
202890285Sobrien   || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
202918334Speter
203018334Speter/* Go to LABEL if ADDR (a legitimate address expression)
203118334Speter   has an effect that depends on the machine mode it is used for.
203218334Speter   On the 80386, only postdecrement and postincrement address depend thus
203318334Speter   (the amount of decrement or increment being the length of the operand).  */
203490285Sobrien#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)	\
203590285Sobriendo {							\
203690285Sobrien if (GET_CODE (ADDR) == POST_INC			\
203790285Sobrien     || GET_CODE (ADDR) == POST_DEC)			\
203890285Sobrien   goto LABEL;						\
203990285Sobrien} while (0)
204018334Speter
204190285Sobrien/* Codes for all the SSE/MMX builtins.  */
204290285Sobrienenum ix86_builtins
204390285Sobrien{
204490285Sobrien  IX86_BUILTIN_ADDPS,
204590285Sobrien  IX86_BUILTIN_ADDSS,
204690285Sobrien  IX86_BUILTIN_DIVPS,
204790285Sobrien  IX86_BUILTIN_DIVSS,
204890285Sobrien  IX86_BUILTIN_MULPS,
204990285Sobrien  IX86_BUILTIN_MULSS,
205090285Sobrien  IX86_BUILTIN_SUBPS,
205190285Sobrien  IX86_BUILTIN_SUBSS,
205290285Sobrien
205390285Sobrien  IX86_BUILTIN_CMPEQPS,
205490285Sobrien  IX86_BUILTIN_CMPLTPS,
205590285Sobrien  IX86_BUILTIN_CMPLEPS,
205690285Sobrien  IX86_BUILTIN_CMPGTPS,
205790285Sobrien  IX86_BUILTIN_CMPGEPS,
205890285Sobrien  IX86_BUILTIN_CMPNEQPS,
205990285Sobrien  IX86_BUILTIN_CMPNLTPS,
206090285Sobrien  IX86_BUILTIN_CMPNLEPS,
206190285Sobrien  IX86_BUILTIN_CMPNGTPS,
206290285Sobrien  IX86_BUILTIN_CMPNGEPS,
206390285Sobrien  IX86_BUILTIN_CMPORDPS,
206490285Sobrien  IX86_BUILTIN_CMPUNORDPS,
206590285Sobrien  IX86_BUILTIN_CMPNEPS,
206690285Sobrien  IX86_BUILTIN_CMPEQSS,
206790285Sobrien  IX86_BUILTIN_CMPLTSS,
206890285Sobrien  IX86_BUILTIN_CMPLESS,
206990285Sobrien  IX86_BUILTIN_CMPGTSS,
207090285Sobrien  IX86_BUILTIN_CMPGESS,
207190285Sobrien  IX86_BUILTIN_CMPNEQSS,
207290285Sobrien  IX86_BUILTIN_CMPNLTSS,
207390285Sobrien  IX86_BUILTIN_CMPNLESS,
207490285Sobrien  IX86_BUILTIN_CMPNGTSS,
207590285Sobrien  IX86_BUILTIN_CMPNGESS,
207690285Sobrien  IX86_BUILTIN_CMPORDSS,
207790285Sobrien  IX86_BUILTIN_CMPUNORDSS,
207890285Sobrien  IX86_BUILTIN_CMPNESS,
207990285Sobrien
208090285Sobrien  IX86_BUILTIN_COMIEQSS,
208190285Sobrien  IX86_BUILTIN_COMILTSS,
208290285Sobrien  IX86_BUILTIN_COMILESS,
208390285Sobrien  IX86_BUILTIN_COMIGTSS,
208490285Sobrien  IX86_BUILTIN_COMIGESS,
208590285Sobrien  IX86_BUILTIN_COMINEQSS,
208690285Sobrien  IX86_BUILTIN_UCOMIEQSS,
208790285Sobrien  IX86_BUILTIN_UCOMILTSS,
208890285Sobrien  IX86_BUILTIN_UCOMILESS,
208990285Sobrien  IX86_BUILTIN_UCOMIGTSS,
209090285Sobrien  IX86_BUILTIN_UCOMIGESS,
209190285Sobrien  IX86_BUILTIN_UCOMINEQSS,
209290285Sobrien
209390285Sobrien  IX86_BUILTIN_CVTPI2PS,
209490285Sobrien  IX86_BUILTIN_CVTPS2PI,
209590285Sobrien  IX86_BUILTIN_CVTSI2SS,
209690285Sobrien  IX86_BUILTIN_CVTSS2SI,
209790285Sobrien  IX86_BUILTIN_CVTTPS2PI,
209890285Sobrien  IX86_BUILTIN_CVTTSS2SI,
209990285Sobrien
210090285Sobrien  IX86_BUILTIN_MAXPS,
210190285Sobrien  IX86_BUILTIN_MAXSS,
210290285Sobrien  IX86_BUILTIN_MINPS,
210390285Sobrien  IX86_BUILTIN_MINSS,
210490285Sobrien
210590285Sobrien  IX86_BUILTIN_LOADAPS,
210690285Sobrien  IX86_BUILTIN_LOADUPS,
210790285Sobrien  IX86_BUILTIN_STOREAPS,
210890285Sobrien  IX86_BUILTIN_STOREUPS,
210990285Sobrien  IX86_BUILTIN_LOADSS,
211090285Sobrien  IX86_BUILTIN_STORESS,
211190285Sobrien  IX86_BUILTIN_MOVSS,
211290285Sobrien
211390285Sobrien  IX86_BUILTIN_MOVHLPS,
211490285Sobrien  IX86_BUILTIN_MOVLHPS,
211590285Sobrien  IX86_BUILTIN_LOADHPS,
211690285Sobrien  IX86_BUILTIN_LOADLPS,
211790285Sobrien  IX86_BUILTIN_STOREHPS,
211890285Sobrien  IX86_BUILTIN_STORELPS,
211990285Sobrien
212090285Sobrien  IX86_BUILTIN_MASKMOVQ,
212190285Sobrien  IX86_BUILTIN_MOVMSKPS,
212290285Sobrien  IX86_BUILTIN_PMOVMSKB,
212390285Sobrien
212490285Sobrien  IX86_BUILTIN_MOVNTPS,
212590285Sobrien  IX86_BUILTIN_MOVNTQ,
212690285Sobrien
212790285Sobrien  IX86_BUILTIN_PACKSSWB,
212890285Sobrien  IX86_BUILTIN_PACKSSDW,
212990285Sobrien  IX86_BUILTIN_PACKUSWB,
213090285Sobrien
213190285Sobrien  IX86_BUILTIN_PADDB,
213290285Sobrien  IX86_BUILTIN_PADDW,
213390285Sobrien  IX86_BUILTIN_PADDD,
213490285Sobrien  IX86_BUILTIN_PADDSB,
213590285Sobrien  IX86_BUILTIN_PADDSW,
213690285Sobrien  IX86_BUILTIN_PADDUSB,
213790285Sobrien  IX86_BUILTIN_PADDUSW,
213890285Sobrien  IX86_BUILTIN_PSUBB,
213990285Sobrien  IX86_BUILTIN_PSUBW,
214090285Sobrien  IX86_BUILTIN_PSUBD,
214190285Sobrien  IX86_BUILTIN_PSUBSB,
214290285Sobrien  IX86_BUILTIN_PSUBSW,
214390285Sobrien  IX86_BUILTIN_PSUBUSB,
214490285Sobrien  IX86_BUILTIN_PSUBUSW,
214590285Sobrien
214690285Sobrien  IX86_BUILTIN_PAND,
214790285Sobrien  IX86_BUILTIN_PANDN,
214890285Sobrien  IX86_BUILTIN_POR,
214990285Sobrien  IX86_BUILTIN_PXOR,
215090285Sobrien
215190285Sobrien  IX86_BUILTIN_PAVGB,
215290285Sobrien  IX86_BUILTIN_PAVGW,
215390285Sobrien
215490285Sobrien  IX86_BUILTIN_PCMPEQB,
215590285Sobrien  IX86_BUILTIN_PCMPEQW,
215690285Sobrien  IX86_BUILTIN_PCMPEQD,
215790285Sobrien  IX86_BUILTIN_PCMPGTB,
215890285Sobrien  IX86_BUILTIN_PCMPGTW,
215990285Sobrien  IX86_BUILTIN_PCMPGTD,
216090285Sobrien
216190285Sobrien  IX86_BUILTIN_PEXTRW,
216290285Sobrien  IX86_BUILTIN_PINSRW,
216390285Sobrien
216490285Sobrien  IX86_BUILTIN_PMADDWD,
216590285Sobrien
216690285Sobrien  IX86_BUILTIN_PMAXSW,
216790285Sobrien  IX86_BUILTIN_PMAXUB,
216890285Sobrien  IX86_BUILTIN_PMINSW,
216990285Sobrien  IX86_BUILTIN_PMINUB,
217090285Sobrien
217190285Sobrien  IX86_BUILTIN_PMULHUW,
217290285Sobrien  IX86_BUILTIN_PMULHW,
217390285Sobrien  IX86_BUILTIN_PMULLW,
217490285Sobrien
217590285Sobrien  IX86_BUILTIN_PSADBW,
217690285Sobrien  IX86_BUILTIN_PSHUFW,
217790285Sobrien
217890285Sobrien  IX86_BUILTIN_PSLLW,
217990285Sobrien  IX86_BUILTIN_PSLLD,
218090285Sobrien  IX86_BUILTIN_PSLLQ,
218190285Sobrien  IX86_BUILTIN_PSRAW,
218290285Sobrien  IX86_BUILTIN_PSRAD,
218390285Sobrien  IX86_BUILTIN_PSRLW,
218490285Sobrien  IX86_BUILTIN_PSRLD,
218590285Sobrien  IX86_BUILTIN_PSRLQ,
218690285Sobrien  IX86_BUILTIN_PSLLWI,
218790285Sobrien  IX86_BUILTIN_PSLLDI,
218890285Sobrien  IX86_BUILTIN_PSLLQI,
218990285Sobrien  IX86_BUILTIN_PSRAWI,
219090285Sobrien  IX86_BUILTIN_PSRADI,
219190285Sobrien  IX86_BUILTIN_PSRLWI,
219290285Sobrien  IX86_BUILTIN_PSRLDI,
219390285Sobrien  IX86_BUILTIN_PSRLQI,
219490285Sobrien
219590285Sobrien  IX86_BUILTIN_PUNPCKHBW,
219690285Sobrien  IX86_BUILTIN_PUNPCKHWD,
219790285Sobrien  IX86_BUILTIN_PUNPCKHDQ,
219890285Sobrien  IX86_BUILTIN_PUNPCKLBW,
219990285Sobrien  IX86_BUILTIN_PUNPCKLWD,
220090285Sobrien  IX86_BUILTIN_PUNPCKLDQ,
220190285Sobrien
220290285Sobrien  IX86_BUILTIN_SHUFPS,
220390285Sobrien
220490285Sobrien  IX86_BUILTIN_RCPPS,
220590285Sobrien  IX86_BUILTIN_RCPSS,
220690285Sobrien  IX86_BUILTIN_RSQRTPS,
220790285Sobrien  IX86_BUILTIN_RSQRTSS,
220890285Sobrien  IX86_BUILTIN_SQRTPS,
220990285Sobrien  IX86_BUILTIN_SQRTSS,
221090285Sobrien
221190285Sobrien  IX86_BUILTIN_UNPCKHPS,
221290285Sobrien  IX86_BUILTIN_UNPCKLPS,
221390285Sobrien
221490285Sobrien  IX86_BUILTIN_ANDPS,
221590285Sobrien  IX86_BUILTIN_ANDNPS,
221690285Sobrien  IX86_BUILTIN_ORPS,
221790285Sobrien  IX86_BUILTIN_XORPS,
221890285Sobrien
221990285Sobrien  IX86_BUILTIN_EMMS,
222090285Sobrien  IX86_BUILTIN_LDMXCSR,
222190285Sobrien  IX86_BUILTIN_STMXCSR,
222290285Sobrien  IX86_BUILTIN_SFENCE,
222390285Sobrien
222490285Sobrien  /* 3DNow! Original */
222590285Sobrien  IX86_BUILTIN_FEMMS,
222690285Sobrien  IX86_BUILTIN_PAVGUSB,
222790285Sobrien  IX86_BUILTIN_PF2ID,
222890285Sobrien  IX86_BUILTIN_PFACC,
222990285Sobrien  IX86_BUILTIN_PFADD,
223090285Sobrien  IX86_BUILTIN_PFCMPEQ,
223190285Sobrien  IX86_BUILTIN_PFCMPGE,
223290285Sobrien  IX86_BUILTIN_PFCMPGT,
223390285Sobrien  IX86_BUILTIN_PFMAX,
223490285Sobrien  IX86_BUILTIN_PFMIN,
223590285Sobrien  IX86_BUILTIN_PFMUL,
223690285Sobrien  IX86_BUILTIN_PFRCP,
223790285Sobrien  IX86_BUILTIN_PFRCPIT1,
223890285Sobrien  IX86_BUILTIN_PFRCPIT2,
223990285Sobrien  IX86_BUILTIN_PFRSQIT1,
224090285Sobrien  IX86_BUILTIN_PFRSQRT,
224190285Sobrien  IX86_BUILTIN_PFSUB,
224290285Sobrien  IX86_BUILTIN_PFSUBR,
224390285Sobrien  IX86_BUILTIN_PI2FD,
224490285Sobrien  IX86_BUILTIN_PMULHRW,
224590285Sobrien
224690285Sobrien  /* 3DNow! Athlon Extensions */
224790285Sobrien  IX86_BUILTIN_PF2IW,
224890285Sobrien  IX86_BUILTIN_PFNACC,
224990285Sobrien  IX86_BUILTIN_PFPNACC,
225090285Sobrien  IX86_BUILTIN_PI2FW,
225190285Sobrien  IX86_BUILTIN_PSWAPDSI,
225290285Sobrien  IX86_BUILTIN_PSWAPDSF,
225390285Sobrien
225490285Sobrien  IX86_BUILTIN_SSE_ZERO,
225590285Sobrien  IX86_BUILTIN_MMX_ZERO,
225690285Sobrien
225790285Sobrien  IX86_BUILTIN_MAX
225890285Sobrien};
225990285Sobrien
226018334Speter/* Define this macro if references to a symbol must be treated
226118334Speter   differently depending on something about the variable or
226218334Speter   function named by the symbol (such as what section it is in).
226318334Speter
226418334Speter   On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
226518334Speter   so that we may access it directly in the GOT.  */
226618334Speter
226790285Sobrien#define ENCODE_SECTION_INFO(DECL)				\
226890285Sobriendo {								\
226990285Sobrien    if (flag_pic)						\
227090285Sobrien      {								\
227190285Sobrien	rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'	\
227290285Sobrien		   ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));	\
227390285Sobrien								\
227490285Sobrien	if (GET_CODE (rtl) == MEM)				\
227590285Sobrien	  {							\
227690285Sobrien	    if (TARGET_DEBUG_ADDR				\
227790285Sobrien		&& TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd')	\
227890285Sobrien	      {							\
227990285Sobrien		fprintf (stderr, "Encode %s, public = %d\n",	\
228090285Sobrien			 IDENTIFIER_POINTER (DECL_NAME (DECL)),	\
228190285Sobrien			 TREE_PUBLIC (DECL));			\
228290285Sobrien	      }							\
228390285Sobrien	    							\
228490285Sobrien	    SYMBOL_REF_FLAG (XEXP (rtl, 0))			\
228590285Sobrien	      = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'	\
228690285Sobrien		 || ! TREE_PUBLIC (DECL));			\
228790285Sobrien	  }							\
228890285Sobrien      }								\
228990285Sobrien} while (0)
229018334Speter
229118334Speter/* The `FINALIZE_PIC' macro serves as a hook to emit these special
229218334Speter   codes once the function is being compiled into assembly code, but
229318334Speter   not before.  (It is not done before, because in the case of
229418334Speter   compiling an inline function, it would lead to multiple PIC
229518334Speter   prologues being included in functions which used inline functions
229618334Speter   and were compiled to assembly language.)  */
229718334Speter
229890285Sobrien#define FINALIZE_PIC \
229990285Sobrien  (current_function_uses_pic_offset_table |= current_function_profile)
230018334Speter
230118334Speter
230218334Speter/* Max number of args passed in registers.  If this is more than 3, we will
230318334Speter   have problems with ebx (register #4), since it is a caller save register and
230418334Speter   is also used as the pic register in ELF.  So for now, don't allow more than
230518334Speter   3 registers to be passed in registers.  */
230618334Speter
230790285Sobrien#define REGPARM_MAX (TARGET_64BIT ? 6 : 3)
230818334Speter
230990285Sobrien#define SSE_REGPARM_MAX (TARGET_64BIT ? 8 : 0)
231090285Sobrien
231118334Speter
231218334Speter/* Specify the machine mode that this machine uses
231318334Speter   for the index in the tablejump instruction.  */
231490285Sobrien#define CASE_VECTOR_MODE (!TARGET_64BIT || flag_pic ? SImode : DImode)
231518334Speter
231650654Sobrien/* Define as C expression which evaluates to nonzero if the tablejump
231750654Sobrien   instruction expects the table to contain offsets from the address of the
231850654Sobrien   table.
231990285Sobrien   Do not define this if the table should contain absolute addresses.  */
232050654Sobrien/* #define CASE_VECTOR_PC_RELATIVE 1 */
232118334Speter
232218334Speter/* Define this as 1 if `char' should by default be signed; else as 0.  */
232318334Speter#define DEFAULT_SIGNED_CHAR 1
232418334Speter
232590285Sobrien/* Number of bytes moved into a data cache for a single prefetch operation.  */
232690285Sobrien#define PREFETCH_BLOCK ix86_cost->prefetch_block
232790285Sobrien
232890285Sobrien/* Number of prefetch operations that can be done in parallel.  */
232990285Sobrien#define SIMULTANEOUS_PREFETCHES ix86_cost->simultaneous_prefetches
233090285Sobrien
233118334Speter/* Max number of bytes we can move from memory to memory
233218334Speter   in one reasonably fast instruction.  */
233390285Sobrien#define MOVE_MAX 16
233418334Speter
233590285Sobrien/* MOVE_MAX_PIECES is the number of bytes at a time which we can
233690285Sobrien   move efficiently, as opposed to  MOVE_MAX which is the maximum
233790285Sobrien   number of bytes we can move with a single instruction.  */
233890285Sobrien#define MOVE_MAX_PIECES (TARGET_64BIT ? 8 : 4)
233990285Sobrien
234052295Sobrien/* If a memory-to-memory move would take MOVE_RATIO or more simple
234152295Sobrien   move-instruction pairs, we will do a movstr or libcall instead.
234252295Sobrien   Increasing the value will always make code faster, but eventually
234352295Sobrien   incurs high cost in increased code size.
234418334Speter
234590285Sobrien   If you don't define this, a reasonable default is used.  */
234618334Speter
234790285Sobrien#define MOVE_RATIO (optimize_size ? 3 : ix86_cost->move_ratio)
234818334Speter
234918334Speter/* Define if shifts truncate the shift count
235018334Speter   which implies one can omit a sign-extension or zero-extension
235118334Speter   of a shift count.  */
235290285Sobrien/* On i386, shifts do truncate the count.  But bit opcodes don't.  */
235318334Speter
235418334Speter/* #define SHIFT_COUNT_TRUNCATED */
235518334Speter
235618334Speter/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
235718334Speter   is done just by pretending it is already truncated.  */
235818334Speter#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
235918334Speter
236018334Speter/* We assume that the store-condition-codes instructions store 0 for false
236118334Speter   and some other value for true.  This is the value stored for true.  */
236218334Speter
236318334Speter#define STORE_FLAG_VALUE 1
236418334Speter
236518334Speter/* When a prototype says `char' or `short', really pass an `int'.
236618334Speter   (The 386 can't easily push less than an int.)  */
236718334Speter
236896294Sobrien#define PROMOTE_PROTOTYPES (!TARGET_64BIT)
236918334Speter
237090285Sobrien/* A macro to update M and UNSIGNEDP when an object whose type is
237190285Sobrien   TYPE and which has the specified mode and signedness is to be
237290285Sobrien   stored in a register.  This macro is only called when TYPE is a
237390285Sobrien   scalar type.
237490285Sobrien
237590285Sobrien   On i386 it is sometimes useful to promote HImode and QImode
237690285Sobrien   quantities to SImode.  The choice depends on target type.  */
237790285Sobrien
237890285Sobrien#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) 		\
237990285Sobriendo {							\
238090285Sobrien  if (((MODE) == HImode && TARGET_PROMOTE_HI_REGS)	\
238190285Sobrien      || ((MODE) == QImode && TARGET_PROMOTE_QI_REGS))	\
238290285Sobrien    (MODE) = SImode;					\
238390285Sobrien} while (0)
238490285Sobrien
238518334Speter/* Specify the machine mode that pointers have.
238618334Speter   After generation of rtl, the compiler makes no further distinction
238718334Speter   between pointers and any other objects of this machine mode.  */
238890285Sobrien#define Pmode (TARGET_64BIT ? DImode : SImode)
238918334Speter
239018334Speter/* A function address in a call instruction
239118334Speter   is a byte address (for indexing purposes)
239218334Speter   so give the MEM rtx a byte's mode.  */
239318334Speter#define FUNCTION_MODE QImode
239450654Sobrien
239550654Sobrien/* A part of a C `switch' statement that describes the relative costs
239650654Sobrien   of constant RTL expressions.  It must contain `case' labels for
239750654Sobrien   expression codes `const_int', `const', `symbol_ref', `label_ref'
239850654Sobrien   and `const_double'.  Each case must ultimately reach a `return'
239950654Sobrien   statement to return the relative cost of the use of that kind of
240050654Sobrien   constant value in an expression.  The cost may depend on the
240150654Sobrien   precise value of the constant, which is available for examination
240250654Sobrien   in X, and the rtx code of the expression in which it is contained,
240350654Sobrien   found in OUTER_CODE.
240450654Sobrien
240550654Sobrien   CODE is the expression code--redundant, since it can be obtained
240650654Sobrien   with `GET_CODE (X)'.  */
240718334Speter
240890285Sobrien#define CONST_COSTS(RTX, CODE, OUTER_CODE)			\
240918334Speter  case CONST_INT:						\
241018334Speter  case CONST:							\
241118334Speter  case LABEL_REF:						\
241218334Speter  case SYMBOL_REF:						\
241390285Sobrien    if (TARGET_64BIT && !x86_64_sign_extended_value (RTX))	\
241490285Sobrien      return 3;							\
241590285Sobrien    if (TARGET_64BIT && !x86_64_zero_extended_value (RTX))	\
241690285Sobrien      return 2;							\
241790285Sobrien    return flag_pic && SYMBOLIC_CONST (RTX) ? 1 : 0;		\
241850654Sobrien								\
241918334Speter  case CONST_DOUBLE:						\
242018334Speter    {								\
242118334Speter      int code;							\
242218334Speter      if (GET_MODE (RTX) == VOIDmode)				\
242390285Sobrien	return 0;						\
242450654Sobrien								\
242518334Speter      code = standard_80387_constant_p (RTX);			\
242690285Sobrien      return code == 1 ? 1 :					\
242790285Sobrien	     code == 2 ? 2 :					\
242890285Sobrien			 3;					\
242918334Speter    }
243018334Speter
243150654Sobrien/* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
243290285Sobrien#define TOPLEVEL_COSTS_N_INSNS(N) \
243390285Sobrien  do { total = COSTS_N_INSNS (N); goto egress_rtx_costs; } while (0)
243418334Speter
243550654Sobrien/* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
243650654Sobrien   This can be used, for example, to indicate how costly a multiply
243750654Sobrien   instruction is.  In writing this macro, you can use the construct
243850654Sobrien   `COSTS_N_INSNS (N)' to specify a cost equal to N fast
243950654Sobrien   instructions.  OUTER_CODE is the code of the expression in which X
244050654Sobrien   is contained.
244150654Sobrien
244250654Sobrien   This macro is optional; do not define it if the default cost
244350654Sobrien   assumptions are adequate for the target machine.  */
244450654Sobrien
244590285Sobrien#define RTX_COSTS(X, CODE, OUTER_CODE)					\
244690285Sobrien  case ZERO_EXTEND:							\
244790285Sobrien    /* The zero extensions is often completely free on x86_64, so make	\
244890285Sobrien       it as cheap as possible.  */					\
244990285Sobrien    if (TARGET_64BIT && GET_MODE (X) == DImode				\
245090285Sobrien	&& GET_MODE (XEXP (X, 0)) == SImode)				\
245190285Sobrien      {									\
245290285Sobrien	total = 1; goto egress_rtx_costs;				\
245390285Sobrien      } 								\
245490285Sobrien    else								\
245590285Sobrien      TOPLEVEL_COSTS_N_INSNS (TARGET_ZERO_EXTEND_WITH_AND ?		\
245690285Sobrien			      ix86_cost->add : ix86_cost->movzx);	\
245790285Sobrien    break;								\
245890285Sobrien  case SIGN_EXTEND:							\
245990285Sobrien    TOPLEVEL_COSTS_N_INSNS (ix86_cost->movsx);				\
246090285Sobrien    break;								\
246150654Sobrien  case ASHIFT:								\
246250654Sobrien    if (GET_CODE (XEXP (X, 1)) == CONST_INT				\
246390285Sobrien	&& (GET_MODE (XEXP (X, 0)) != DImode || TARGET_64BIT))		\
246450654Sobrien      {									\
246550654Sobrien	HOST_WIDE_INT value = INTVAL (XEXP (X, 1));			\
246650654Sobrien	if (value == 1)							\
246790285Sobrien	  TOPLEVEL_COSTS_N_INSNS (ix86_cost->add);			\
246890285Sobrien	if ((value == 2 || value == 3)					\
246990285Sobrien	    && !TARGET_DECOMPOSE_LEA					\
247090285Sobrien	    && ix86_cost->lea <= ix86_cost->shift_const)		\
247190285Sobrien	  TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea);			\
247250654Sobrien      }									\
247350654Sobrien    /* fall through */							\
247450654Sobrien		  							\
247550654Sobrien  case ROTATE:								\
247650654Sobrien  case ASHIFTRT:							\
247750654Sobrien  case LSHIFTRT:							\
247850654Sobrien  case ROTATERT:							\
247990285Sobrien    if (!TARGET_64BIT && GET_MODE (XEXP (X, 0)) == DImode)		\
248050654Sobrien      {									\
248150654Sobrien	if (GET_CODE (XEXP (X, 1)) == CONST_INT)			\
248250654Sobrien	  {								\
248350654Sobrien	    if (INTVAL (XEXP (X, 1)) > 32)				\
248490285Sobrien	      TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const + 2);	\
248590285Sobrien	    else							\
248690285Sobrien	      TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const * 2);	\
248750654Sobrien	  }								\
248890285Sobrien	else								\
248990285Sobrien	  {								\
249090285Sobrien	    if (GET_CODE (XEXP (X, 1)) == AND)				\
249190285Sobrien	      TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 2);		\
249290285Sobrien	    else							\
249390285Sobrien	      TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2);	\
249490285Sobrien	  }								\
249550654Sobrien      }									\
249690285Sobrien    else								\
249790285Sobrien      {									\
249890285Sobrien	if (GET_CODE (XEXP (X, 1)) == CONST_INT)			\
249990285Sobrien	  TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const);		\
250090285Sobrien	else								\
250190285Sobrien	  TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_var);		\
250290285Sobrien      }									\
250390285Sobrien    break;								\
250450654Sobrien									\
250550654Sobrien  case MULT:								\
250650654Sobrien    if (GET_CODE (XEXP (X, 1)) == CONST_INT)				\
250750654Sobrien      {									\
250850654Sobrien	unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1));		\
250950654Sobrien	int nbits = 0;							\
251050654Sobrien									\
251150654Sobrien	while (value != 0)						\
251250654Sobrien	  {								\
251350654Sobrien	    nbits++;							\
251450654Sobrien	    value >>= 1;						\
251550654Sobrien	  } 								\
251650654Sobrien									\
251790285Sobrien	TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init			\
251890285Sobrien			        + nbits * ix86_cost->mult_bit);		\
251950654Sobrien      }									\
252050654Sobrien    else			/* This is arbitrary */			\
252150654Sobrien      TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init			\
252250654Sobrien			      + 7 * ix86_cost->mult_bit);		\
252350654Sobrien									\
252450654Sobrien  case DIV:								\
252550654Sobrien  case UDIV:								\
252650654Sobrien  case MOD:								\
252750654Sobrien  case UMOD:								\
252850654Sobrien    TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide);				\
252950654Sobrien									\
253050654Sobrien  case PLUS:								\
253190285Sobrien    if (!TARGET_DECOMPOSE_LEA						\
253290285Sobrien	&& INTEGRAL_MODE_P (GET_MODE (X))				\
253390285Sobrien	&& GET_MODE_BITSIZE (GET_MODE (X)) <= GET_MODE_BITSIZE (Pmode))	\
253490285Sobrien      {									\
253590285Sobrien        if (GET_CODE (XEXP (X, 0)) == PLUS				\
253690285Sobrien	    && GET_CODE (XEXP (XEXP (X, 0), 0)) == MULT			\
253790285Sobrien	    && GET_CODE (XEXP (XEXP (XEXP (X, 0), 0), 1)) == CONST_INT	\
253890285Sobrien	    && CONSTANT_P (XEXP (X, 1)))				\
253990285Sobrien	  {								\
254090285Sobrien	    HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 0), 0), 1));\
254190285Sobrien	    if (val == 2 || val == 4 || val == 8)			\
254290285Sobrien	      {								\
254390285Sobrien		return (COSTS_N_INSNS (ix86_cost->lea)			\
254490285Sobrien			+ rtx_cost (XEXP (XEXP (X, 0), 1),		\
254590285Sobrien				    (OUTER_CODE))			\
254690285Sobrien			+ rtx_cost (XEXP (XEXP (XEXP (X, 0), 0), 0),	\
254790285Sobrien				    (OUTER_CODE))			\
254890285Sobrien			+ rtx_cost (XEXP (X, 1), (OUTER_CODE)));	\
254990285Sobrien	      }								\
255090285Sobrien	  }								\
255190285Sobrien	else if (GET_CODE (XEXP (X, 0)) == MULT				\
255290285Sobrien		 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT)	\
255390285Sobrien	  {								\
255490285Sobrien	    HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1));		\
255590285Sobrien	    if (val == 2 || val == 4 || val == 8)			\
255690285Sobrien	      {								\
255790285Sobrien		return (COSTS_N_INSNS (ix86_cost->lea)			\
255890285Sobrien			+ rtx_cost (XEXP (XEXP (X, 0), 0),		\
255990285Sobrien				    (OUTER_CODE))			\
256090285Sobrien			+ rtx_cost (XEXP (X, 1), (OUTER_CODE)));	\
256190285Sobrien	      }								\
256290285Sobrien	  }								\
256390285Sobrien	else if (GET_CODE (XEXP (X, 0)) == PLUS)			\
256490285Sobrien	  {								\
256590285Sobrien	    return (COSTS_N_INSNS (ix86_cost->lea)			\
256690285Sobrien		    + rtx_cost (XEXP (XEXP (X, 0), 0), (OUTER_CODE))	\
256790285Sobrien		    + rtx_cost (XEXP (XEXP (X, 0), 1), (OUTER_CODE))	\
256890285Sobrien		    + rtx_cost (XEXP (X, 1), (OUTER_CODE)));		\
256990285Sobrien	  }								\
257090285Sobrien      }									\
257150654Sobrien									\
257250654Sobrien    /* fall through */							\
257350654Sobrien  case AND:								\
257450654Sobrien  case IOR:								\
257550654Sobrien  case XOR:								\
257650654Sobrien  case MINUS:								\
257790285Sobrien    if (!TARGET_64BIT && GET_MODE (X) == DImode)			\
257890285Sobrien      return (COSTS_N_INSNS (ix86_cost->add) * 2			\
257990285Sobrien	      + (rtx_cost (XEXP (X, 0), (OUTER_CODE))			\
258090285Sobrien	         << (GET_MODE (XEXP (X, 0)) != DImode))			\
258190285Sobrien	      + (rtx_cost (XEXP (X, 1), (OUTER_CODE))			\
258290285Sobrien 	         << (GET_MODE (XEXP (X, 1)) != DImode)));		\
258390285Sobrien									\
258490285Sobrien    /* fall through */							\
258550654Sobrien  case NEG:								\
258650654Sobrien  case NOT:								\
258790285Sobrien    if (!TARGET_64BIT && GET_MODE (X) == DImode)			\
258890285Sobrien      TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2);			\
258990285Sobrien    TOPLEVEL_COSTS_N_INSNS (ix86_cost->add);				\
259090285Sobrien									\
259190285Sobrien  egress_rtx_costs:							\
259290285Sobrien    break;
259350654Sobrien
259450654Sobrien
259550654Sobrien/* An expression giving the cost of an addressing mode that contains
259650654Sobrien   ADDRESS.  If not defined, the cost is computed from the ADDRESS
259750654Sobrien   expression and the `CONST_COSTS' values.
259850654Sobrien
259950654Sobrien   For most CISC machines, the default cost is a good approximation
260050654Sobrien   of the true cost of the addressing mode.  However, on RISC
260150654Sobrien   machines, all instructions normally have the same length and
260250654Sobrien   execution time.  Hence all addresses will have equal costs.
260350654Sobrien
260450654Sobrien   In cases where more than one form of an address is known, the form
260550654Sobrien   with the lowest cost will be used.  If multiple forms have the
260650654Sobrien   same, lowest, cost, the one that is the most complex will be used.
260750654Sobrien
260850654Sobrien   For example, suppose an address that is equal to the sum of a
260950654Sobrien   register and a constant is used twice in the same basic block.
261050654Sobrien   When this macro is not defined, the address will be computed in a
261150654Sobrien   register and memory references will be indirect through that
261250654Sobrien   register.  On machines where the cost of the addressing mode
261350654Sobrien   containing the sum is no higher than that of a simple indirect
261450654Sobrien   reference, this will produce an additional instruction and
261550654Sobrien   possibly require an additional register.  Proper specification of
261650654Sobrien   this macro eliminates this overhead for such machines.
261750654Sobrien
261850654Sobrien   Similar use of this macro is made in strength reduction of loops.
261950654Sobrien
262050654Sobrien   ADDRESS need not be valid as an address.  In such a case, the cost
262150654Sobrien   is not relevant and can be any value; invalid addresses need not be
262250654Sobrien   assigned a different cost.
262350654Sobrien
262450654Sobrien   On machines where an address involving more than one register is as
262550654Sobrien   cheap as an address computation involving only one register,
262650654Sobrien   defining `ADDRESS_COST' to reflect this can cause two registers to
262750654Sobrien   be live over a region of code where only one would have been if
262850654Sobrien   `ADDRESS_COST' were not defined in that manner.  This effect should
262950654Sobrien   be considered in the definition of this macro.  Equivalent costs
263050654Sobrien   should probably only be given to addresses with different numbers
263150654Sobrien   of registers on machines with lots of registers.
263250654Sobrien
263350654Sobrien   This macro will normally either not be defined or be defined as a
263450654Sobrien   constant.
263550654Sobrien
263618334Speter   For i386, it is better to use a complex address than let gcc copy
263718334Speter   the address into a reg and make a new pseudo.  But not if the address
263818334Speter   requires to two regs - that would mean more pseudos with longer
263918334Speter   lifetimes.  */
264018334Speter
264118334Speter#define ADDRESS_COST(RTX) \
264290285Sobrien  ix86_address_cost (RTX)
264350654Sobrien
264490285Sobrien/* A C expression for the cost of moving data from a register in class FROM to
264590285Sobrien   one in class TO.  The classes are expressed using the enumeration values
264690285Sobrien   such as `GENERAL_REGS'.  A value of 2 is the default; other values are
264790285Sobrien   interpreted relative to that.
264850654Sobrien
264990285Sobrien   It is not required that the cost always equal 2 when FROM is the same as TO;
265090285Sobrien   on some machines it is expensive to move between registers if they are not
265190285Sobrien   general registers.  */
265250654Sobrien
265390285Sobrien#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
265490285Sobrien   ix86_register_move_cost ((MODE), (CLASS1), (CLASS2))
265550654Sobrien
265650654Sobrien/* A C expression for the cost of moving data of mode M between a
265750654Sobrien   register and memory.  A value of 2 is the default; this cost is
265850654Sobrien   relative to those in `REGISTER_MOVE_COST'.
265950654Sobrien
266050654Sobrien   If moving between registers and memory is more expensive than
266150654Sobrien   between two registers, you should define this macro to express the
266250654Sobrien   relative cost.  */
266350654Sobrien
266490285Sobrien#define MEMORY_MOVE_COST(MODE, CLASS, IN)	\
266590285Sobrien  ix86_memory_move_cost ((MODE), (CLASS), (IN))
266650654Sobrien
266750654Sobrien/* A C expression for the cost of a branch instruction.  A value of 1
266850654Sobrien   is the default; other values are interpreted relative to that.  */
266950654Sobrien
267090285Sobrien#define BRANCH_COST ix86_branch_cost
267150654Sobrien
267250654Sobrien/* Define this macro as a C expression which is nonzero if accessing
267350654Sobrien   less than a word of memory (i.e. a `char' or a `short') is no
267450654Sobrien   faster than accessing a word of memory, i.e., if such access
267550654Sobrien   require more than one instruction or if there is no difference in
267650654Sobrien   cost between byte and (aligned) word loads.
267750654Sobrien
267850654Sobrien   When this macro is not defined, the compiler will access a field by
267950654Sobrien   finding the smallest containing object; when it is defined, a
268050654Sobrien   fullword load will be used if alignment permits.  Unless bytes
268150654Sobrien   accesses are faster than word accesses, using word accesses is
268250654Sobrien   preferable since it may eliminate subsequent memory access if
268350654Sobrien   subsequent accesses occur to other fields in the same word of the
268450654Sobrien   structure, but to different bytes.  */
268550654Sobrien
268650654Sobrien#define SLOW_BYTE_ACCESS 0
268750654Sobrien
268850654Sobrien/* Nonzero if access to memory by shorts is slow and undesirable.  */
268950654Sobrien#define SLOW_SHORT_ACCESS 0
269050654Sobrien
269150654Sobrien/* Define this macro to be the value 1 if unaligned accesses have a
269250654Sobrien   cost many times greater than aligned accesses, for example if they
269350654Sobrien   are emulated in a trap handler.
269450654Sobrien
269550654Sobrien   When this macro is non-zero, the compiler will act as if
269650654Sobrien   `STRICT_ALIGNMENT' were non-zero when generating code for block
269750654Sobrien   moves.  This can cause significantly more instructions to be
269850654Sobrien   produced.  Therefore, do not set this macro non-zero if unaligned
269950654Sobrien   accesses only add a cycle or two to the time for a memory access.
270050654Sobrien
270150654Sobrien   If the value of this macro is always zero, it need not be defined.  */
270250654Sobrien
270390285Sobrien/* #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 0 */
270450654Sobrien
270550654Sobrien/* Define this macro to inhibit strength reduction of memory
270650654Sobrien   addresses.  (On some machines, such strength reduction seems to do
270750654Sobrien   harm rather than good.)  */
270850654Sobrien
270950654Sobrien/* #define DONT_REDUCE_ADDR */
271050654Sobrien
271150654Sobrien/* Define this macro if it is as good or better to call a constant
271250654Sobrien   function address than to call an address kept in a register.
271350654Sobrien
271450654Sobrien   Desirable on the 386 because a CALL with a constant address is
271550654Sobrien   faster than one with a register address.  */
271650654Sobrien
271750654Sobrien#define NO_FUNCTION_CSE
271850654Sobrien
271950654Sobrien/* Define this macro if it is as good or better for a function to call
272050654Sobrien   itself with an explicit address than to call an address kept in a
272150654Sobrien   register.  */
272250654Sobrien
272350654Sobrien#define NO_RECURSIVE_FUNCTION_CSE
272490285Sobrien
272590285Sobrien/* Add any extra modes needed to represent the condition code.
272650654Sobrien
272790285Sobrien   For the i386, we need separate modes when floating-point
272890285Sobrien   equality comparisons are being done.
272990285Sobrien
273090285Sobrien   Add CCNO to indicate comparisons against zero that requires
273190285Sobrien   Overflow flag to be unset.  Sign bit test is used instead and
273290285Sobrien   thus can be used to form "a&b>0" type of tests.
273350654Sobrien
273490285Sobrien   Add CCGC to indicate comparisons agains zero that allows
273590285Sobrien   unspecified garbage in the Carry flag.  This mode is used
273690285Sobrien   by inc/dec instructions.
273750654Sobrien
273890285Sobrien   Add CCGOC to indicate comparisons agains zero that allows
273990285Sobrien   unspecified garbage in the Carry and Overflow flag. This
274090285Sobrien   mode is used to simulate comparisons of (a-b) and (a+b)
274190285Sobrien   against zero using sub/cmp/add operations.
274250654Sobrien
274390285Sobrien   Add CCZ to indicate that only the Zero flag is valid.  */
274452295Sobrien
274590285Sobrien#define EXTRA_CC_MODES		\
274690285Sobrien	CC (CCGCmode, "CCGC")	\
274790285Sobrien	CC (CCGOCmode, "CCGOC")	\
274890285Sobrien	CC (CCNOmode, "CCNO")	\
274990285Sobrien	CC (CCZmode, "CCZ")	\
275090285Sobrien	CC (CCFPmode, "CCFP")	\
275190285Sobrien	CC (CCFPUmode, "CCFPU")
275218334Speter
275318334Speter/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
275418334Speter   return the mode to be used for the comparison.
275518334Speter
275618334Speter   For floating-point equality comparisons, CCFPEQmode should be used.
275790285Sobrien   VOIDmode should be used in all other cases.
275818334Speter
275990285Sobrien   For integer comparisons against zero, reduce to CCNOmode or CCZmode if
276090285Sobrien   possible, to allow for more combinations.  */
276118334Speter
276290285Sobrien#define SELECT_CC_MODE(OP, X, Y) ix86_cc_mode ((OP), (X), (Y))
276318334Speter
276490285Sobrien/* Return non-zero if MODE implies a floating point inequality can be
276590285Sobrien   reversed.  */
276618334Speter
276790285Sobrien#define REVERSIBLE_CC_MODE(MODE) 1
276818334Speter
276990285Sobrien/* A C expression whose value is reversed condition code of the CODE for
277090285Sobrien   comparison done in CC_MODE mode.  */
277190285Sobrien#define REVERSE_CONDITION(CODE, MODE) \
277290285Sobrien  ((MODE) != CCFPmode && (MODE) != CCFPUmode ? reverse_condition (CODE) \
277390285Sobrien   : reverse_condition_maybe_unordered (CODE))
277418334Speter
277518334Speter
277618334Speter/* Control the assembler format that we output, to the extent
277718334Speter   this does not vary between assemblers.  */
277818334Speter
277918334Speter/* How to refer to registers in assembler output.
278090285Sobrien   This sequence is indexed by compiler's hard-register-number (see above).  */
278118334Speter
278218334Speter/* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
278318334Speter   For non floating point regs, the following are the HImode names.
278418334Speter
278518334Speter   For float regs, the stack top is sometimes referred to as "%st(0)"
278618334Speter   instead of just "%st".  PRINT_REG handles this with the "y" code.  */
278718334Speter
278890285Sobrien#undef  HI_REGISTER_NAMES
278990285Sobrien#define HI_REGISTER_NAMES						\
279090285Sobrien{"ax","dx","cx","bx","si","di","bp","sp",				\
279190285Sobrien "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","",	\
279290285Sobrien "flags","fpsr", "dirflag", "frame",					\
279390285Sobrien "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",		\
279490285Sobrien "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7"	,		\
279590285Sobrien "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",			\
279690285Sobrien "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"}
279718334Speter
279818334Speter#define REGISTER_NAMES HI_REGISTER_NAMES
279918334Speter
280018334Speter/* Table of additional register names to use in user input.  */
280118334Speter
280218334Speter#define ADDITIONAL_REGISTER_NAMES \
280350654Sobrien{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 },	\
280450654Sobrien  { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 },	\
280590285Sobrien  { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 },	\
280690285Sobrien  { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 },	\
280750654Sobrien  { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 },		\
280890285Sobrien  { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 },		\
280990285Sobrien  { "mm0", 8},  { "mm1", 9},  { "mm2", 10}, { "mm3", 11},	\
281090285Sobrien  { "mm4", 12}, { "mm5", 13}, { "mm6", 14}, { "mm7", 15} }
281118334Speter
281218334Speter/* Note we are omitting these since currently I don't know how
281318334Speterto get gcc to use these, since they want the same but different
281418334Speternumber as al, and ax.
281518334Speter*/
281618334Speter
281718334Speter#define QI_REGISTER_NAMES \
281890285Sobrien{"al", "dl", "cl", "bl", "sil", "dil", "bpl", "spl",}
281918334Speter
282018334Speter/* These parallel the array above, and can be used to access bits 8:15
282190285Sobrien   of regs 0 through 3.  */
282218334Speter
282318334Speter#define QI_HIGH_REGISTER_NAMES \
282418334Speter{"ah", "dh", "ch", "bh", }
282518334Speter
282618334Speter/* How to renumber registers for dbx and gdb.  */
282718334Speter
282890285Sobrien#define DBX_REGISTER_NUMBER(N) \
282990285Sobrien  (TARGET_64BIT ? dbx64_register_map[(N)] : dbx_register_map[(N)])
283018334Speter
283190285Sobrienextern int const dbx_register_map[FIRST_PSEUDO_REGISTER];
283290285Sobrienextern int const dbx64_register_map[FIRST_PSEUDO_REGISTER];
283390285Sobrienextern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
283490285Sobrien
283550654Sobrien/* Before the prologue, RA is at 0(%esp).  */
283650654Sobrien#define INCOMING_RETURN_ADDR_RTX \
283750654Sobrien  gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
283890285Sobrien
283950654Sobrien/* After the prologue, RA is at -4(AP) in the current frame.  */
284090285Sobrien#define RETURN_ADDR_RTX(COUNT, FRAME)					   \
284190285Sobrien  ((COUNT) == 0								   \
284290285Sobrien   ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)) \
284390285Sobrien   : gen_rtx_MEM (Pmode, plus_constant (FRAME, UNITS_PER_WORD)))
284450654Sobrien
284590285Sobrien/* PC is dbx register 8; let's use that column for RA.  */
284690285Sobrien#define DWARF_FRAME_RETURN_COLUMN 	(TARGET_64BIT ? 16 : 8)
284750654Sobrien
284850654Sobrien/* Before the prologue, the top of the frame is at 4(%esp).  */
284990285Sobrien#define INCOMING_FRAME_SP_OFFSET UNITS_PER_WORD
285050654Sobrien
285190285Sobrien/* Describe how we implement __builtin_eh_return.  */
285290285Sobrien#define EH_RETURN_DATA_REGNO(N)	((N) < 2 ? (N) : INVALID_REGNUM)
285390285Sobrien#define EH_RETURN_STACKADJ_RTX	gen_rtx_REG (Pmode, 2)
285418334Speter
285518334Speter
285690285Sobrien/* Select a format to encode pointers in exception handling data.  CODE
285790285Sobrien   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
285890285Sobrien   true if the symbol may be affected by dynamic relocations.
285918334Speter
286090285Sobrien   ??? All x86 object file formats are capable of representing this.
286190285Sobrien   After all, the relocation needed is the same as for the call insn.
286290285Sobrien   Whether or not a particular assembler allows us to enter such, I
286390285Sobrien   guess we'll have to see.  */
286490285Sobrien#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)       		\
286590285Sobrien  (flag_pic								\
286690285Sobrien    ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4\
286790285Sobrien   : DW_EH_PE_absptr)
286818334Speter
286990285Sobrien/* This is how to output the definition of a user-level label named NAME,
287090285Sobrien   such as the label on a static function or variable NAME.  */
287118334Speter
287290285Sobrien#define ASM_OUTPUT_LABEL(FILE, NAME)	\
287390285Sobrien  (assemble_name ((FILE), (NAME)), fputs (":\n", (FILE)))
287418334Speter
287518334Speter/* Store in OUTPUT a string (made with alloca) containing
287618334Speter   an assembler-name for a local static variable named NAME.
287718334Speter   LABELNO is an integer which is different for each call.  */
287818334Speter
287918334Speter#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)	\
288018334Speter( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),	\
288118334Speter  sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
288218334Speter
288318334Speter/* This is how to output an insn to push a register on the stack.
288418334Speter   It need not be very fast code.  */
288518334Speter
288690285Sobrien#define ASM_OUTPUT_REG_PUSH(FILE, REGNO)  \
288790285Sobrien  asm_fprintf ((FILE), "\tpush{l}\t%%e%s\n", reg_names[(REGNO)])
288818334Speter
288918334Speter/* This is how to output an insn to pop a register from the stack.
289018334Speter   It need not be very fast code.  */
289118334Speter
289290285Sobrien#define ASM_OUTPUT_REG_POP(FILE, REGNO)  \
289390285Sobrien  asm_fprintf ((FILE), "\tpop{l}\t%%e%s\n", reg_names[(REGNO)])
289418334Speter
289590285Sobrien/* This is how to output an element of a case-vector that is absolute.  */
289618334Speter
289718334Speter#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
289890285Sobrien  ix86_output_addr_vec_elt ((FILE), (VALUE))
289918334Speter
290090285Sobrien/* This is how to output an element of a case-vector that is relative.  */
290118334Speter
290250654Sobrien#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
290390285Sobrien  ix86_output_addr_diff_elt ((FILE), (VALUE), (REL))
290418334Speter
290590285Sobrien/* Under some conditions we need jump tables in the text section, because
290690285Sobrien   the assembler cannot handle label differences between sections.  */
290718334Speter
290890285Sobrien#define JUMP_TABLES_IN_TEXT_SECTION \
290990285Sobrien  (!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA)
291018334Speter
291190285Sobrien/* A C statement that outputs an address constant appropriate to
291290285Sobrien   for DWARF debugging.  */
291390285Sobrien
291490285Sobrien#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, X) \
291590285Sobrien  i386_dwarf_output_addr_const ((FILE), (X))
291690285Sobrien
291790285Sobrien/* Either simplify a location expression, or return the original.  */
291890285Sobrien
291990285Sobrien#define ASM_SIMPLIFY_DWARF_ADDR(X) \
292090285Sobrien  i386_simplify_dwarf_addr (X)
292190285Sobrien
292290285Sobrien/* Switch to init or fini section via SECTION_OP, emit a call to FUNC,
292390285Sobrien   and switch back.  For x86 we do this only to save a few bytes that
292490285Sobrien   would otherwise be unused in the text section.  */
292590285Sobrien#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
292690285Sobrien   asm (SECTION_OP "\n\t"				\
292790285Sobrien	"call " USER_LABEL_PREFIX #FUNC "\n"		\
292890285Sobrien	TEXT_SECTION_ASM_OP);
292918334Speter
293018334Speter/* Print operand X (an rtx) in assembler syntax to file FILE.
293118334Speter   CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
293290285Sobrien   Effect of various CODE letters is described in i386.c near
293390285Sobrien   print_operand function.  */
293418334Speter
293590285Sobrien#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
293690285Sobrien  ((CODE) == '*' || (CODE) == '+')
293718334Speter
293818334Speter/* Print the name of a register based on its machine mode and number.
293918334Speter   If CODE is 'w', pretend the mode is HImode.
294018334Speter   If CODE is 'b', pretend the mode is QImode.
294118334Speter   If CODE is 'k', pretend the mode is SImode.
294290285Sobrien   If CODE is 'q', pretend the mode is DImode.
294318334Speter   If CODE is 'h', pretend the reg is the `high' byte register.
294490285Sobrien   If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op.  */
294518334Speter
294690285Sobrien#define PRINT_REG(X, CODE, FILE)  \
294790285Sobrien  print_reg ((X), (CODE), (FILE))
294818334Speter
294918334Speter#define PRINT_OPERAND(FILE, X, CODE)  \
295090285Sobrien  print_operand ((FILE), (X), (CODE))
295118334Speter
295218334Speter#define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
295390285Sobrien  print_operand_address ((FILE), (ADDR))
295418334Speter
295518334Speter/* Print the name of a register for based on its machine mode and number.
295618334Speter   This macro is used to print debugging output.
295718334Speter   This macro is different from PRINT_REG in that it may be used in
295818334Speter   programs that are not linked with aux-output.o.  */
295918334Speter
296090285Sobrien#define DEBUG_PRINT_REG(X, CODE, FILE)			\
296190285Sobrien  do { static const char * const hi_name[] = HI_REGISTER_NAMES;	\
296290285Sobrien       static const char * const qi_name[] = QI_REGISTER_NAMES;	\
296390285Sobrien       fprintf ((FILE), "%d ", REGNO (X));		\
296490285Sobrien       if (REGNO (X) == FLAGS_REG)			\
296590285Sobrien	 { fputs ("flags", (FILE)); break; }		\
296690285Sobrien       if (REGNO (X) == DIRFLAG_REG)			\
296790285Sobrien	 { fputs ("dirflag", (FILE)); break; }		\
296890285Sobrien       if (REGNO (X) == FPSR_REG)			\
296990285Sobrien	 { fputs ("fpsr", (FILE)); break; }		\
297018334Speter       if (REGNO (X) == ARG_POINTER_REGNUM)		\
297190285Sobrien	 { fputs ("argp", (FILE)); break; }		\
297290285Sobrien       if (REGNO (X) == FRAME_POINTER_REGNUM)		\
297390285Sobrien	 { fputs ("frame", (FILE)); break; }		\
297418334Speter       if (STACK_TOP_P (X))				\
297590285Sobrien	 { fputs ("st(0)", (FILE)); break; }		\
297618334Speter       if (FP_REG_P (X))				\
297790285Sobrien	 { fputs (hi_name[REGNO(X)], (FILE)); break; }	\
297890285Sobrien       if (REX_INT_REG_P (X))				\
297990285Sobrien	 {						\
298090285Sobrien	   switch (GET_MODE_SIZE (GET_MODE (X)))	\
298190285Sobrien	     {						\
298290285Sobrien	     default:					\
298390285Sobrien	     case 8:					\
298490285Sobrien	       fprintf ((FILE), "r%i", REGNO (X)	\
298590285Sobrien			- FIRST_REX_INT_REG + 8);	\
298690285Sobrien	       break;					\
298790285Sobrien	     case 4:					\
298890285Sobrien	       fprintf ((FILE), "r%id", REGNO (X)	\
298990285Sobrien			- FIRST_REX_INT_REG + 8);	\
299090285Sobrien	       break;					\
299190285Sobrien	     case 2:					\
299290285Sobrien	       fprintf ((FILE), "r%iw", REGNO (X)	\
299390285Sobrien			- FIRST_REX_INT_REG + 8);	\
299490285Sobrien	       break;					\
299590285Sobrien	     case 1:					\
299690285Sobrien	       fprintf ((FILE), "r%ib", REGNO (X)	\
299790285Sobrien			- FIRST_REX_INT_REG + 8);	\
299890285Sobrien	       break;					\
299990285Sobrien	     }						\
300090285Sobrien	   break;					\
300190285Sobrien	 }						\
300218334Speter       switch (GET_MODE_SIZE (GET_MODE (X)))		\
300318334Speter	 {						\
300490285Sobrien	 case 8:					\
300590285Sobrien	   fputs ("r", (FILE));				\
300690285Sobrien	   fputs (hi_name[REGNO (X)], (FILE));		\
300790285Sobrien	   break;					\
300818334Speter	 default:					\
300990285Sobrien	   fputs ("e", (FILE));				\
301018334Speter	 case 2:					\
301190285Sobrien	   fputs (hi_name[REGNO (X)], (FILE));		\
301218334Speter	   break;					\
301318334Speter	 case 1:					\
301490285Sobrien	   fputs (qi_name[REGNO (X)], (FILE));		\
301518334Speter	   break;					\
301618334Speter	 }						\
301718334Speter     } while (0)
301818334Speter
301918334Speter/* a letter which is not needed by the normal asm syntax, which
302018334Speter   we can use for operand syntax in the extended asm */
302118334Speter
302218334Speter#define ASM_OPERAND_LETTER '#'
302318334Speter#define RET return ""
302490285Sobrien#define AT_SP(MODE) (gen_rtx_MEM ((MODE), stack_pointer_rtx))
302518334Speter
302690285Sobrien/* Define the codes that are matched by predicates in i386.c.  */
302750654Sobrien
302890285Sobrien#define PREDICATE_CODES							\
302990285Sobrien  {"x86_64_immediate_operand", {CONST_INT, SUBREG, REG,			\
303090285Sobrien				SYMBOL_REF, LABEL_REF, CONST}},		\
303190285Sobrien  {"x86_64_nonmemory_operand", {CONST_INT, SUBREG, REG,			\
303290285Sobrien				SYMBOL_REF, LABEL_REF, CONST}},		\
303390285Sobrien  {"x86_64_movabs_operand", {CONST_INT, SUBREG, REG,			\
303490285Sobrien				SYMBOL_REF, LABEL_REF, CONST}},		\
303590285Sobrien  {"x86_64_szext_nonmemory_operand", {CONST_INT, SUBREG, REG,		\
303690285Sobrien				     SYMBOL_REF, LABEL_REF, CONST}},	\
303790285Sobrien  {"x86_64_general_operand", {CONST_INT, SUBREG, REG, MEM,		\
303890285Sobrien			      SYMBOL_REF, LABEL_REF, CONST}},		\
303990285Sobrien  {"x86_64_szext_general_operand", {CONST_INT, SUBREG, REG, MEM,	\
304090285Sobrien				   SYMBOL_REF, LABEL_REF, CONST}},	\
304190285Sobrien  {"x86_64_zext_immediate_operand", {CONST_INT, CONST_DOUBLE, CONST,	\
304290285Sobrien				       SYMBOL_REF, LABEL_REF}},		\
304390285Sobrien  {"shiftdi_operand", {SUBREG, REG, MEM}},				\
304490285Sobrien  {"const_int_1_operand", {CONST_INT}},					\
3045102801Skan  {"const_int_1_31_operand", {CONST_INT}},				\
304690285Sobrien  {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}},			\
304790285Sobrien  {"aligned_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,	\
304890285Sobrien		       LABEL_REF, SUBREG, REG, MEM}},			\
304990285Sobrien  {"pic_symbolic_operand", {CONST}},					\
305090285Sobrien  {"call_insn_operand", {REG, SUBREG, MEM, SYMBOL_REF}},		\
305190285Sobrien  {"constant_call_address_operand", {SYMBOL_REF, CONST}},		\
305290285Sobrien  {"const0_operand", {CONST_INT, CONST_DOUBLE}},			\
305390285Sobrien  {"const1_operand", {CONST_INT}},					\
305490285Sobrien  {"const248_operand", {CONST_INT}},					\
305590285Sobrien  {"incdec_operand", {CONST_INT}},					\
305690285Sobrien  {"mmx_reg_operand", {REG}},						\
305790285Sobrien  {"reg_no_sp_operand", {SUBREG, REG}},					\
305890285Sobrien  {"general_no_elim_operand", {CONST_INT, CONST_DOUBLE, CONST,		\
305990285Sobrien			SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM}},	\
306090285Sobrien  {"nonmemory_no_elim_operand", {CONST_INT, REG, SUBREG}},		\
306190285Sobrien  {"q_regs_operand", {SUBREG, REG}},					\
306290285Sobrien  {"non_q_regs_operand", {SUBREG, REG}},				\
306390285Sobrien  {"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU, UNORDERED, \
306490285Sobrien				 ORDERED, LT, UNLT, GT, UNGT, LE, UNLE,	\
306590285Sobrien				 GE, UNGE, LTGT, UNEQ}},		\
306690285Sobrien  {"sse_comparison_operator", {EQ, LT, LE, UNORDERED, NE, UNGE, UNGT,	\
306790285Sobrien			       ORDERED, UNEQ, UNLT, UNLE, LTGT, GE, GT	\
306890285Sobrien			       }},					\
306990285Sobrien  {"ix86_comparison_operator", {EQ, NE, LE, LT, GE, GT, LEU, LTU, GEU,	\
307090285Sobrien			       GTU, UNORDERED, ORDERED, UNLE, UNLT,	\
307190285Sobrien			       UNGE, UNGT, LTGT, UNEQ }},		\
307290285Sobrien  {"cmp_fp_expander_operand", {CONST_DOUBLE, SUBREG, REG, MEM}},	\
307390285Sobrien  {"ext_register_operand", {SUBREG, REG}},				\
307490285Sobrien  {"binary_fp_operator", {PLUS, MINUS, MULT, DIV}},			\
307590285Sobrien  {"mult_operator", {MULT}},						\
307690285Sobrien  {"div_operator", {DIV}},						\
307790285Sobrien  {"arith_or_logical_operator", {PLUS, MULT, AND, IOR, XOR, SMIN, SMAX, \
307890285Sobrien				 UMIN, UMAX, COMPARE, MINUS, DIV, MOD,	\
307990285Sobrien				 UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT,	\
308090285Sobrien				 LSHIFTRT, ROTATERT}},			\
308190285Sobrien  {"promotable_binary_operator", {PLUS, MULT, AND, IOR, XOR, ASHIFT}},	\
308290285Sobrien  {"memory_displacement_operand", {MEM}},				\
308390285Sobrien  {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,	\
308490285Sobrien		     LABEL_REF, SUBREG, REG, MEM, AND}},		\
308590285Sobrien  {"long_memory_operand", {MEM}},
308650654Sobrien
308790285Sobrien/* A list of predicates that do special things with modes, and so
308890285Sobrien   should not elicit warnings for VOIDmode match_operand.  */
308990285Sobrien
309090285Sobrien#define SPECIAL_MODE_PREDICATES \
309190285Sobrien  "ext_register_operand",
309250654Sobrien
309390285Sobrien/* CM_32 is used by 32bit ABI
309490285Sobrien   CM_SMALL is small model assuming that all code and data fits in the first
309590285Sobrien   31bits of address space.
309690285Sobrien   CM_KERNEL is model assuming that all code and data fits in the negative
309790285Sobrien   31bits of address space.
309890285Sobrien   CM_MEDIUM is model assuming that code fits in the first 31bits of address
309990285Sobrien   space.  Size of data is unlimited.
310090285Sobrien   CM_LARGE is model making no assumptions about size of particular sections.
310190285Sobrien
310290285Sobrien   CM_SMALL_PIC is model for PIC libraries assuming that code+data+got/plt
310390285Sobrien   tables first in 31bits of address space.
310490285Sobrien */
310590285Sobrienenum cmodel {
310690285Sobrien  CM_32,
310790285Sobrien  CM_SMALL,
310890285Sobrien  CM_KERNEL,
310990285Sobrien  CM_MEDIUM,
311090285Sobrien  CM_LARGE,
311190285Sobrien  CM_SMALL_PIC
311290285Sobrien};
311318334Speter
311490285Sobrien/* Size of the RED_ZONE area.  */
311590285Sobrien#define RED_ZONE_SIZE 128
311690285Sobrien/* Reserved area of the red zone for temporaries.  */
311790285Sobrien#define RED_ZONE_RESERVE 8
311890285Sobrienextern const char *ix86_debug_arg_string, *ix86_debug_addr_string;
311950654Sobrien
312090285Sobrienenum asm_dialect {
312190285Sobrien  ASM_ATT,
312290285Sobrien  ASM_INTEL
312390285Sobrien};
312490285Sobrienextern const char *ix86_asm_string;
312590285Sobrienextern enum asm_dialect ix86_asm_dialect;
312690285Sobrien/* Value of -mcmodel specified by user.  */
312790285Sobrienextern const char *ix86_cmodel_string;
312890285Sobrienextern enum cmodel ix86_cmodel;
312990285Sobrien
313018334Speter/* Variables in i386.c */
313190285Sobrienextern const char *ix86_cpu_string;		/* for -mcpu=<xxx> */
313290285Sobrienextern const char *ix86_arch_string;		/* for -march=<xxx> */
313390285Sobrienextern const char *ix86_fpmath_string;		/* for -mfpmath=<xxx> */
313490285Sobrienextern const char *ix86_regparm_string;		/* # registers to use to pass args */
313590285Sobrienextern const char *ix86_align_loops_string;	/* power of two alignment for loops */
313690285Sobrienextern const char *ix86_align_jumps_string;	/* power of two alignment for non-loop jumps */
313790285Sobrienextern const char *ix86_align_funcs_string;	/* power of two alignment for functions */
313890285Sobrienextern const char *ix86_preferred_stack_boundary_string;/* power of two alignment for stack boundary */
313990285Sobrienextern const char *ix86_branch_cost_string;	/* values 1-5: see jump.c */
314090285Sobrienextern int ix86_regparm;			/* ix86_regparm_string as a number */
314190285Sobrienextern int ix86_preferred_stack_boundary;	/* preferred stack boundary alignment in bits */
314290285Sobrienextern int ix86_branch_cost;			/* values 1-5: see jump.c */
314390285Sobrienextern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER]; /* smalled class containing REGNO */
314490285Sobrienextern rtx ix86_compare_op0;	/* operand 0 for comparisons */
314590285Sobrienextern rtx ix86_compare_op1;	/* operand 1 for comparisons */
314690285Sobrien
314790285Sobrien/* To properly truncate FP values into integers, we need to set i387 control
314890285Sobrien   word.  We can't emit proper mode switching code before reload, as spills
314990285Sobrien   generated by reload may truncate values incorrectly, but we still can avoid
315090285Sobrien   redundant computation of new control word by the mode switching pass.
315190285Sobrien   The fldcw instructions are still emitted redundantly, but this is probably
315290285Sobrien   not going to be noticeable problem, as most CPUs do have fast path for
315390285Sobrien   the sequence.
315418334Speter
315590285Sobrien   The machinery is to emit simple truncation instructions and split them
315690285Sobrien   before reload to instructions having USEs of two memory locations that
315790285Sobrien   are filled by this code to old and new control word.
315890285Sobrien
315990285Sobrien   Post-reload pass may be later used to eliminate the redundant fildcw if
316090285Sobrien   needed.  */
316118334Speter
316290285Sobrienenum fp_cw_mode {FP_CW_STORED, FP_CW_UNINITIALIZED, FP_CW_ANY};
316350654Sobrien
316490285Sobrien/* Define this macro if the port needs extra instructions inserted
316590285Sobrien   for mode switching in an optimizing compilation.  */
316690285Sobrien
316790285Sobrien#define OPTIMIZE_MODE_SWITCHING(ENTITY) 1
316890285Sobrien
316990285Sobrien/* If you define `OPTIMIZE_MODE_SWITCHING', you have to define this as
317090285Sobrien   initializer for an array of integers.  Each initializer element N
317190285Sobrien   refers to an entity that needs mode switching, and specifies the
317290285Sobrien   number of different modes that might need to be set for this
317390285Sobrien   entity.  The position of the initializer in the initializer -
317490285Sobrien   starting counting at zero - determines the integer that is used to
317590285Sobrien   refer to the mode-switched entity in question.  */
317690285Sobrien
317790285Sobrien#define NUM_MODES_FOR_MODE_SWITCHING { FP_CW_ANY }
317890285Sobrien
317990285Sobrien/* ENTITY is an integer specifying a mode-switched entity.  If
318090285Sobrien   `OPTIMIZE_MODE_SWITCHING' is defined, you must define this macro to
318190285Sobrien   return an integer value not larger than the corresponding element
318290285Sobrien   in `NUM_MODES_FOR_MODE_SWITCHING', to denote the mode that ENTITY
318390285Sobrien   must be switched into prior to the execution of INSN.  */
318490285Sobrien
318590285Sobrien#define MODE_NEEDED(ENTITY, I)						\
318690285Sobrien  (GET_CODE (I) == CALL_INSN						\
318790285Sobrien   || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
318890285Sobrien				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
318990285Sobrien   ? FP_CW_UNINITIALIZED						\
319090285Sobrien   : recog_memoized (I) < 0 || get_attr_type (I) != TYPE_FISTP		\
319190285Sobrien   ? FP_CW_ANY								\
319290285Sobrien   : FP_CW_STORED)
319390285Sobrien
319490285Sobrien/* This macro specifies the order in which modes for ENTITY are
319590285Sobrien   processed.  0 is the highest priority.  */
319690285Sobrien
319790285Sobrien#define MODE_PRIORITY_TO_MODE(ENTITY, N) (N)
319890285Sobrien
319990285Sobrien/* Generate one or more insns to set ENTITY to MODE.  HARD_REG_LIVE
320090285Sobrien   is the set of hard registers live at the point where the insn(s)
320190285Sobrien   are to be inserted.  */
320290285Sobrien
320390285Sobrien#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
320490285Sobrien  ((MODE) == FP_CW_STORED						\
320590285Sobrien   ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
320690285Sobrien				  assign_386_stack_local (HImode, 2)), 0\
320790285Sobrien   : 0)
320818334Speter
320990285Sobrien/* Avoid renaming of stack registers, as doing so in combination with
321090285Sobrien   scheduling just increases amount of live registers at time and in
321190285Sobrien   the turn amount of fxch instructions needed.
321290285Sobrien
321390285Sobrien   ??? Maybe Pentium chips benefits from renaming, someone can try...  */
321490285Sobrien
321590285Sobrien#define HARD_REGNO_RENAME_OK(SRC, TARGET)  \
321690285Sobrien   ((SRC) < FIRST_STACK_REG || (SRC) > LAST_STACK_REG)
321790285Sobrien
321890285Sobrien
321918334Speter/*
322018334SpeterLocal variables:
322118334Speterversion-control: t
322218334SpeterEnd:
322318334Speter*/
3224