]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/i386.h
Daily bump.
[thirdparty/gcc.git] / gcc / config / i386 / i386.h
CommitLineData
e075ae69 1/* Definitions of target machine for GNU compiler for IA-32.
cf011243
AO
2 Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001 Free Software Foundation, Inc.
c98f8742
JVA
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
97aadbb9 19the Free Software Foundation, 59 Temple Place - Suite 330,
d4ba09c0 20Boston, MA 02111-1307, USA. */
c98f8742
JVA
21
22/* The purpose of this file is to define the characteristics of the i386,
b4ac57ab 23 independent of assembler syntax or operating system.
c98f8742
JVA
24
25 Three other files build on this one to describe a specific assembler syntax:
26 bsd386.h, att386.h, and sun386.h.
27
28 The actual tm.h file for a particular system should include
29 this file, and then the file for the appropriate assembler syntax.
30
31 Many macros that specify assembler syntax are omitted entirely from
32 this file because they really belong in the files for particular
e075ae69
RH
33 assemblers. These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR,
34 ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many
35 that start with ASM_ or end in ASM_OP. */
c98f8742 36
95393dfd
CH
37/* Stubs for half-pic support if not OSF/1 reference platform. */
38
39#ifndef HALF_PIC_P
40#define HALF_PIC_P() 0
41#define HALF_PIC_NUMBER_PTRS 0
42#define HALF_PIC_NUMBER_REFS 0
43#define HALF_PIC_ENCODE(DECL)
44#define HALF_PIC_DECLARE(NAME)
45#define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.")
46#define HALF_PIC_ADDRESS_P(X) 0
47#define HALF_PIC_PTR(X) X
48#define HALF_PIC_FINISH(STREAM)
49#endif
50
d4ba09c0
SC
51/* Define the specific costs for a given cpu */
52
53struct processor_costs {
54 int add; /* cost of an add instruction */
55 int lea; /* cost of a lea instruction */
56 int shift_var; /* variable shift costs */
57 int shift_const; /* constant shift costs */
58 int mult_init; /* cost of starting a multiply */
59 int mult_bit; /* cost of multiply per each bit set */
60 int divide; /* cost of a divide/mod */
e075ae69 61 int large_insn; /* insns larger than this cost more */
ac775968
ZW
62 int move_ratio; /* The threshold of number of scalar
63 memory-to-memory move insns. */
7c6b971d 64 int movzbl_load; /* cost of loading using movzbl */
96e7ae40
JH
65 int int_load[3]; /* cost of loading integer registers
66 in QImode, HImode and SImode relative
67 to reg-reg move (2). */
68 int int_store[3]; /* cost of storing integer register
69 in QImode, HImode and SImode */
70 int fp_move; /* cost of reg,reg fld/fst */
71 int fp_load[3]; /* cost of loading FP register
72 in SFmode, DFmode and XFmode */
73 int fp_store[3]; /* cost of storing FP register
74 in SFmode, DFmode and XFmode */
fa79946e
JH
75 int mmx_move; /* cost of moving MMX register. */
76 int mmx_load[2]; /* cost of loading MMX register
77 in SImode and DImode */
78 int mmx_store[2]; /* cost of storing MMX register
79 in SImode and DImode */
80 int sse_move; /* cost of moving SSE register. */
81 int sse_load[3]; /* cost of loading SSE register
82 in SImode, DImode and TImode*/
83 int sse_store[3]; /* cost of storing SSE register
84 in SImode, DImode and TImode*/
85 int mmxsse_to_integer; /* cost of moving mmxsse register to
86 integer and vice versa. */
d4ba09c0
SC
87};
88
89extern struct processor_costs *ix86_cost;
90
c98f8742
JVA
91/* Run-time compilation parameters selecting different hardware subsets. */
92
93extern int target_flags;
94
95/* Macros used in the machine description to test the flags. */
96
ddd5a7c1 97/* configure can arrange to make this 2, to force a 486. */
e075ae69 98
35b528be
RS
99#ifndef TARGET_CPU_DEFAULT
100#define TARGET_CPU_DEFAULT 0
101#endif
102
3b3c6a3f 103/* Masks for the -m switches */
e075ae69
RH
104#define MASK_80387 0x00000001 /* Hardware floating point */
105#define MASK_RTD 0x00000002 /* Use ret that pops args */
106#define MASK_ALIGN_DOUBLE 0x00000004 /* align doubles to 2 word boundary */
107#define MASK_SVR3_SHLIB 0x00000008 /* Uninit locals into bss */
108#define MASK_IEEE_FP 0x00000010 /* IEEE fp comparisons */
109#define MASK_FLOAT_RETURNS 0x00000020 /* Return float in st(0) */
110#define MASK_NO_FANCY_MATH_387 0x00000040 /* Disable sin, cos, sqrt */
111#define MASK_OMIT_LEAF_FRAME_POINTER 0x080 /* omit leaf frame pointers */
112#define MASK_STACK_PROBE 0x00000100 /* Enable stack probing */
79f05c19
JH
113#define MASK_NO_ALIGN_STROPS 0x00001000 /* Enable aligning of string ops. */
114#define MASK_INLINE_ALL_STROPS 0x00002000 /* Inline stringops in all cases */
f73ad30e
JH
115#define MASK_NO_PUSH_ARGS 0x00004000 /* Use push instructions */
116#define MASK_ACCUMULATE_OUTGOING_ARGS 0x00008000/* Accumulate outgoing args */
a7180f70
BS
117#define MASK_MMX 0x00010000 /* Support MMX regs/builtins */
118#define MASK_SSE 0x00020000 /* Support SSE regs/builtins */
446988df
JH
119#define MASK_SSE2 0x00040000 /* Support SSE2 regs/builtins */
120#define MASK_128BIT_LONG_DOUBLE 0x00080000 /* long double size is 128bit */
121#define MASK_MIX_SSE_I387 0x00100000 /* Mix SSE and i387 instructions */
25f94bb5 122#define MASK_64BIT 0x00200000 /* Produce 64bit code */
e075ae69
RH
123
124/* Temporary codegen switches */
dc174fb1
MM
125#define MASK_INTEL_SYNTAX 0x00000200
126#define MASK_DEBUG_ARG 0x00000400 /* function_arg */
127#define MASK_DEBUG_ADDR 0x00000800 /* GO_IF_LEGITIMATE_ADDRESS */
3b3c6a3f
MM
128
129/* Use the floating point instructions */
130#define TARGET_80387 (target_flags & MASK_80387)
131
c98f8742
JVA
132/* Compile using ret insn that pops args.
133 This will not work unless you use prototypes at least
134 for all functions that can take varying numbers of args. */
3b3c6a3f
MM
135#define TARGET_RTD (target_flags & MASK_RTD)
136
b08de47e
MM
137/* Align doubles to a two word boundary. This breaks compatibility with
138 the published ABI's for structures containing doubles, but produces
139 faster code on the pentium. */
140#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
c98f8742 141
f73ad30e
JH
142/* Use push instructions to save outgoing args. */
143#define TARGET_PUSH_ARGS (!(target_flags & MASK_NO_PUSH_ARGS))
144
145/* Accumulate stack adjustments to prologue/epilogue. */
146#define TARGET_ACCUMULATE_OUTGOING_ARGS \
147 (target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
148
d7cd15e9
RS
149/* Put uninitialized locals into bss, not data.
150 Meaningful only on svr3. */
3b3c6a3f 151#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
d7cd15e9 152
c572e5ba
JVA
153/* Use IEEE floating point comparisons. These handle correctly the cases
154 where the result of a comparison is unordered. Normally SIGFPE is
155 generated in such cases, in which case this isn't needed. */
3b3c6a3f 156#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
c572e5ba 157
8c2bf92a
JVA
158/* Functions that return a floating point value may return that value
159 in the 387 FPU or in 386 integer registers. If set, this flag causes
160 the 387 to be used, which is compatible with most calling conventions. */
3b3c6a3f 161#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
8c2bf92a 162
2b589241
JH
163/* Long double is 128bit instead of 96bit, even when only 80bits are used.
164 This mode wastes cache, but avoid missaligned data accesses and simplifies
165 address calculations. */
166#define TARGET_128BIT_LONG_DOUBLE (target_flags & MASK_128BIT_LONG_DOUBLE)
167
099800e3
RK
168/* Disable generation of FP sin, cos and sqrt operations for 387.
169 This is because FreeBSD lacks these in the math-emulator-code */
3b3c6a3f
MM
170#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
171
2f2fa5b1 172/* Don't create frame pointers for leaf functions */
e075ae69
RH
173#define TARGET_OMIT_LEAF_FRAME_POINTER \
174 (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
f6f58ba3 175
3b3c6a3f
MM
176/* Debug GO_IF_LEGITIMATE_ADDRESS */
177#define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR)
178
b08de47e
MM
179/* Debug FUNCTION_ARG macros */
180#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
181
25f94bb5
JH
182/* 64bit Sledgehammer mode */
183#define TARGET_64BIT (target_flags & MASK_64BIT)
184
f7746310
SC
185#define TARGET_386 (ix86_cpu == PROCESSOR_I386)
186#define TARGET_486 (ix86_cpu == PROCESSOR_I486)
187#define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM)
3a0433fd 188#define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO)
a269a03c 189#define TARGET_K6 (ix86_cpu == PROCESSOR_K6)
309ada50 190#define TARGET_ATHLON (ix86_cpu == PROCESSOR_ATHLON)
b4e89e2d 191#define TARGET_PENTIUM4 (ix86_cpu == PROCESSOR_PENTIUM4)
a269a03c
JC
192
193#define CPUMASK (1 << ix86_cpu)
194extern const int x86_use_leave, x86_push_memory, x86_zero_extend_with_and;
195extern const int x86_use_bit_test, x86_cmove, x86_deep_branch;
b4e89e2d 196extern const int x86_unroll_strlen;
e075ae69
RH
197extern const int x86_double_with_add, x86_partial_reg_stall, x86_movx;
198extern const int x86_use_loop, x86_use_fiop, x86_use_mov0;
199extern const int x86_use_cltd, x86_read_modify_write;
200extern const int x86_read_modify, x86_split_long_moves;
f90800f8 201extern const int x86_promote_QImode, x86_single_stringop;
d9f32422 202extern const int x86_himode_math, x86_qimode_math, x86_promote_qi_regs;
0b5107cf 203extern const int x86_promote_hi_regs, x86_integer_DFmode_moves;
bdeb029c 204extern const int x86_add_esp_4, x86_add_esp_8, x86_sub_esp_4, x86_sub_esp_8;
0b5107cf 205extern const int x86_partial_reg_dependency, x86_memory_mismatch_stall;
a269a03c
JC
206
207#define TARGET_USE_LEAVE (x86_use_leave & CPUMASK)
208#define TARGET_PUSH_MEMORY (x86_push_memory & CPUMASK)
209#define TARGET_ZERO_EXTEND_WITH_AND (x86_zero_extend_with_and & CPUMASK)
210#define TARGET_USE_BIT_TEST (x86_use_bit_test & CPUMASK)
211#define TARGET_UNROLL_STRLEN (x86_unroll_strlen & CPUMASK)
0644b628
JH
212/* For sane SSE instruction set generation we need fcomi instruction. It is
213 safe to enable all CMOVE instructions. */
214#define TARGET_CMOVE ((x86_cmove & (1 << ix86_arch)) || TARGET_SSE)
a269a03c
JC
215#define TARGET_DEEP_BRANCH_PREDICTION (x86_deep_branch & CPUMASK)
216#define TARGET_DOUBLE_WITH_ADD (x86_double_with_add & CPUMASK)
e075ae69
RH
217#define TARGET_USE_SAHF (x86_use_sahf & CPUMASK)
218#define TARGET_MOVX (x86_movx & CPUMASK)
219#define TARGET_PARTIAL_REG_STALL (x86_partial_reg_stall & CPUMASK)
220#define TARGET_USE_LOOP (x86_use_loop & CPUMASK)
221#define TARGET_USE_FIOP (x86_use_fiop & CPUMASK)
222#define TARGET_USE_MOV0 (x86_use_mov0 & CPUMASK)
223#define TARGET_USE_CLTD (x86_use_cltd & CPUMASK)
224#define TARGET_SPLIT_LONG_MOVES (x86_split_long_moves & CPUMASK)
225#define TARGET_READ_MODIFY_WRITE (x86_read_modify_write & CPUMASK)
226#define TARGET_READ_MODIFY (x86_read_modify & CPUMASK)
e9e80858 227#define TARGET_PROMOTE_QImode (x86_promote_QImode & CPUMASK)
f90800f8 228#define TARGET_SINGLE_STRINGOP (x86_single_stringop & CPUMASK)
d9f32422
JH
229#define TARGET_QIMODE_MATH (x86_qimode_math & CPUMASK)
230#define TARGET_HIMODE_MATH (x86_himode_math & CPUMASK)
231#define TARGET_PROMOTE_QI_REGS (x86_promote_qi_regs & CPUMASK)
232#define TARGET_PROMOTE_HI_REGS (x86_promote_hi_regs & CPUMASK)
bdeb029c
JH
233#define TARGET_ADD_ESP_4 (x86_add_esp_4 & CPUMASK)
234#define TARGET_ADD_ESP_8 (x86_add_esp_8 & CPUMASK)
235#define TARGET_SUB_ESP_4 (x86_sub_esp_4 & CPUMASK)
236#define TARGET_SUB_ESP_8 (x86_sub_esp_8 & CPUMASK)
0b5107cf
JH
237#define TARGET_INTEGER_DFMODE_MOVES (x86_integer_DFmode_moves & CPUMASK)
238#define TARGET_PARTIAL_REG_DEPENDENCY (x86_partial_reg_dependency & CPUMASK)
239#define TARGET_MEMORY_MISMATCH_STALL (x86_memory_mismatch_stall & CPUMASK)
a269a03c 240
8c9be447 241#define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
3b3c6a3f 242
79f05c19
JH
243#define TARGET_ALIGN_STRINGOPS (!(target_flags & MASK_NO_ALIGN_STROPS))
244#define TARGET_INLINE_ALL_STRINGOPS (target_flags & MASK_INLINE_ALL_STROPS)
245
e075ae69
RH
246#define ASSEMBLER_DIALECT ((target_flags & MASK_INTEL_SYNTAX) != 0)
247
446988df
JH
248#define TARGET_SSE ((target_flags & (MASK_SSE | MASK_SSE2)) != 0)
249#define TARGET_SSE2 ((target_flags & MASK_SSE2) != 0)
250#define TARGET_MIX_SSE_I387 ((target_flags & MASK_MIX_SSE_I387) != 0)
a7180f70
BS
251#define TARGET_MMX ((target_flags & MASK_MMX) != 0)
252
e075ae69 253#define TARGET_SWITCHES \
047142d3
PT
254{ { "80387", MASK_80387, N_("Use hardware fp") }, \
255 { "no-80387", -MASK_80387, N_("Do not use hardware fp") }, \
256 { "hard-float", MASK_80387, N_("Use hardware fp") }, \
257 { "soft-float", -MASK_80387, N_("Do not use hardware fp") }, \
258 { "no-soft-float", MASK_80387, N_("Use hardware fp") }, \
259 { "386", 0, N_("Same as -mcpu=i386") }, \
260 { "486", 0, N_("Same as -mcpu=i486") }, \
261 { "pentium", 0, N_("Same as -mcpu=pentium") }, \
262 { "pentiumpro", 0, N_("Same as -mcpu=pentiumpro") }, \
263 { "rtd", MASK_RTD, \
264 N_("Alternate calling convention") }, \
265 { "no-rtd", -MASK_RTD, \
266 N_("Use normal calling convention") }, \
e075ae69 267 { "align-double", MASK_ALIGN_DOUBLE, \
047142d3 268 N_("Align some doubles on dword boundary") }, \
e075ae69 269 { "no-align-double", -MASK_ALIGN_DOUBLE, \
047142d3 270 N_("Align doubles on word boundary") }, \
e075ae69 271 { "svr3-shlib", MASK_SVR3_SHLIB, \
047142d3 272 N_("Uninitialized locals in .bss") }, \
e075ae69 273 { "no-svr3-shlib", -MASK_SVR3_SHLIB, \
047142d3 274 N_("Uninitialized locals in .data") }, \
e075ae69 275 { "ieee-fp", MASK_IEEE_FP, \
047142d3 276 N_("Use IEEE math for fp comparisons") }, \
e075ae69 277 { "no-ieee-fp", -MASK_IEEE_FP, \
047142d3 278 N_("Do not use IEEE math for fp comparisons") }, \
e075ae69 279 { "fp-ret-in-387", MASK_FLOAT_RETURNS, \
047142d3 280 N_("Return values of functions in FPU registers") }, \
e075ae69 281 { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS , \
047142d3 282 N_("Do not return values of functions in FPU registers")}, \
e075ae69 283 { "no-fancy-math-387", MASK_NO_FANCY_MATH_387, \
047142d3 284 N_("Do not generate sin, cos, sqrt for FPU") }, \
e075ae69 285 { "fancy-math-387", -MASK_NO_FANCY_MATH_387, \
047142d3 286 N_("Generate sin, cos, sqrt for FPU")}, \
e075ae69 287 { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER, \
047142d3 288 N_("Omit the frame pointer in leaf functions") }, \
e075ae69
RH
289 { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER, "" }, \
290 { "debug-addr", MASK_DEBUG_ADDR, 0 /* undocumented */ }, \
291 { "no-debug-addr", -MASK_DEBUG_ADDR, 0 /* undocumented */ }, \
292 { "debug-arg", MASK_DEBUG_ARG, 0 /* undocumented */ }, \
293 { "no-debug-arg", -MASK_DEBUG_ARG, 0 /* undocumented */ }, \
047142d3
PT
294 { "stack-arg-probe", MASK_STACK_PROBE, \
295 N_("Enable stack probing") }, \
e075ae69
RH
296 { "no-stack-arg-probe", -MASK_STACK_PROBE, "" }, \
297 { "windows", 0, 0 /* undocumented */ }, \
298 { "dll", 0, 0 /* undocumented */ }, \
299 { "intel-syntax", MASK_INTEL_SYNTAX, \
047142d3 300 N_("Emit Intel syntax assembler opcodes") }, \
e075ae69 301 { "no-intel-syntax", -MASK_INTEL_SYNTAX, "" }, \
79f05c19 302 { "align-stringops", -MASK_NO_ALIGN_STROPS, \
047142d3 303 N_("Align destination of the string operations") }, \
79f05c19 304 { "no-align-stringops", MASK_NO_ALIGN_STROPS, \
047142d3 305 N_("Do not align destination of the string operations") }, \
4be2e5d9 306 { "inline-all-stringops", MASK_INLINE_ALL_STROPS, \
047142d3 307 N_("Inline all known string operations") }, \
79f05c19 308 { "no-inline-all-stringops", -MASK_INLINE_ALL_STROPS, \
047142d3 309 N_("Do not inline all known string operations") }, \
f73ad30e 310 { "push-args", -MASK_NO_PUSH_ARGS, \
047142d3 311 N_("Use push instructions to save outgoing arguments") }, \
053f1126 312 { "no-push-args", MASK_NO_PUSH_ARGS, \
047142d3 313 N_("Do not use push instructions to save outgoing arguments") }, \
f73ad30e 314 { "accumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS, \
047142d3 315 N_("Use push instructions to save outgoing arguments") }, \
053f1126 316 { "no-accumulate-outgoing-args",-MASK_ACCUMULATE_OUTGOING_ARGS, \
047142d3
PT
317 N_("Do not use push instructions to save outgoing arguments") }, \
318 { "mmx", MASK_MMX, N_("Support MMX builtins") }, \
319 { "no-mmx", -MASK_MMX, \
320 N_("Do not support MMX builtins") }, \
321 { "sse", MASK_SSE, \
446988df 322 N_("Support MMX and SSE builtins and code generation") }, \
a7180f70 323 { "no-sse", -MASK_SSE, \
446988df
JH
324 N_("Do not support MMX and SSE builtins and code generation") }, \
325 { "sse2", MASK_SSE2, \
326 N_("Support MMX, SSE and SSE2 builtins and code generation") }, \
327 { "no-sse2", -MASK_SSE2, \
328 N_("Do not support MMX, SSE and SSE2 builtins and code generation") }, \
329 { "mix-sse-i387", MASK_MIX_SSE_I387, \
330 N_("Use both SSE and i387 instruction sets for floating point arithmetics") },\
331 { "nomix-sse-i387", -MASK_MIX_SSE_I387, \
332 N_("Use both SSE and i387 instruction sets for floating point arithmetics") },\
2b589241
JH
333 { "128bit-long-double", MASK_128BIT_LONG_DOUBLE, \
334 N_("sizeof(long double) is 16.") }, \
335 { "96bit-long-double", -MASK_128BIT_LONG_DOUBLE, \
336 N_("sizeof(long double) is 12.") }, \
25f94bb5
JH
337 { "64", MASK_64BIT, \
338 N_("Generate 64bit x86-64 code") }, \
339 { "32", -MASK_64BIT, \
340 N_("Generate 32bit i386 code") }, \
e075ae69
RH
341 SUBTARGET_SWITCHES \
342 { "", TARGET_DEFAULT, 0 }}
241e1a89 343
25f94bb5
JH
344#ifdef TARGET_64BIT_DEFAULT
345#define TARGET_DEFAULT (MASK_64BIT | TARGET_SUBTARGET_DEFAULT)
346#else
347#define TARGET_DEFAULT TARGET_SUBTARGET_DEFAULT
348#endif
349
d4ba09c0
SC
350/* Which processor to schedule for. The cpu attribute defines a list that
351 mirrors this list, so changes to i386.md must be made at the same time. */
352
241e1a89 353enum processor_type
e075ae69
RH
354{
355 PROCESSOR_I386, /* 80386 */
241e1a89
SC
356 PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */
357 PROCESSOR_PENTIUM,
a269a03c 358 PROCESSOR_PENTIUMPRO,
e075ae69 359 PROCESSOR_K6,
309ada50 360 PROCESSOR_ATHLON,
b4e89e2d 361 PROCESSOR_PENTIUM4,
e075ae69
RH
362 PROCESSOR_max
363};
241e1a89 364
e42ea7f9 365extern enum processor_type ix86_cpu;
241e1a89 366
bcd86433 367extern int ix86_arch;
241e1a89 368
f5316dfe
MM
369/* This macro is similar to `TARGET_SWITCHES' but defines names of
370 command options that have values. Its definition is an
371 initializer with a subgrouping for each command option.
372
373 Each subgrouping contains a string constant, that defines the
374 fixed part of the option name, and the address of a variable. The
375 variable, type `char *', is set to the variable part of the given
376 option if the fixed part matches. The actual option name is made
377 by appending `-m' to the specified name. */
e075ae69
RH
378#define TARGET_OPTIONS \
379{ { "cpu=", &ix86_cpu_string, \
047142d3 380 N_("Schedule code for given CPU")}, \
e075ae69 381 { "arch=", &ix86_arch_string, \
047142d3 382 N_("Generate code for given CPU")}, \
e075ae69 383 { "regparm=", &ix86_regparm_string, \
047142d3 384 N_("Number of registers used to pass integer arguments") }, \
e075ae69 385 { "align-loops=", &ix86_align_loops_string, \
047142d3 386 N_("Loop code aligned to this power of 2") }, \
e075ae69 387 { "align-jumps=", &ix86_align_jumps_string, \
047142d3 388 N_("Jump targets are aligned to this power of 2") }, \
e075ae69 389 { "align-functions=", &ix86_align_funcs_string, \
047142d3 390 N_("Function starts are aligned to this power of 2") }, \
e075ae69
RH
391 { "preferred-stack-boundary=", \
392 &ix86_preferred_stack_boundary_string, \
047142d3 393 N_("Attempt to keep stack aligned to this power of 2") }, \
e075ae69 394 { "branch-cost=", &ix86_branch_cost_string, \
047142d3 395 N_("Branches are this expensive (1-5, arbitrary units)") }, \
e075ae69 396 SUBTARGET_OPTIONS \
b08de47e 397}
f5316dfe
MM
398
399/* Sometimes certain combinations of command options do not make
400 sense on a particular target machine. You can define a macro
401 `OVERRIDE_OPTIONS' to take account of this. This macro, if
402 defined, is executed once just after all the command options have
403 been parsed.
404
405 Don't use this macro to turn on various extra optimizations for
406 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
407
408#define OVERRIDE_OPTIONS override_options ()
409
410/* These are meant to be redefined in the host dependent files */
95393dfd 411#define SUBTARGET_SWITCHES
f5316dfe 412#define SUBTARGET_OPTIONS
95393dfd 413
d4ba09c0 414/* Define this to change the optimizations performed by default. */
c6aded7c 415#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
d4ba09c0 416
241e1a89
SC
417/* Specs for the compiler proper */
418
628714d8
RK
419#ifndef CC1_CPU_SPEC
420#define CC1_CPU_SPEC "\
241e1a89 421%{!mcpu*: \
4a88a060
JH
422%{m386:-mcpu=i386 \
423%n`-mpentium' is deprecated. Use `-march' or `-mcpu' instead.\n} \
424%{m486:-mcpu=i486 \
425%n`-mpentium' is deprecated. Use `-march' or `-mcpu' instead.\n} \
426%{mpentium:-mcpu=pentium \
427%n`-mpentium' is deprecated. Use `-march' or `-mcpu' instead.\n} \
428%{mpentiumpro:-mcpu=pentiumpro \
429%n`-mpentiumpro' is deprecated. Use `-march' or `-mcpu' instead.\n}}"
241e1a89 430#endif
c98f8742 431\f
84b77fba 432#ifndef CPP_CPU_DEFAULT_SPEC
d5c65c96 433#if TARGET_CPU_DEFAULT == 1
5a6ee819
RH
434#define CPP_CPU_DEFAULT_SPEC "-D__tune_i486__"
435#endif
da594c94 436#if TARGET_CPU_DEFAULT == 2
0d97fd9e 437#define CPP_CPU_DEFAULT_SPEC "-D__tune_i586__ -D__tune_pentium__"
5a6ee819 438#endif
da594c94 439#if TARGET_CPU_DEFAULT == 3
0d97fd9e 440#define CPP_CPU_DEFAULT_SPEC "-D__tune_i686__ -D__tune_pentiumpro__"
da594c94 441#endif
5a6ee819
RH
442#if TARGET_CPU_DEFAULT == 4
443#define CPP_CPU_DEFAULT_SPEC "-D__tune_k6__"
da594c94 444#endif
309ada50
JH
445#if TARGET_CPU_DEFAULT == 5
446#define CPP_CPU_DEFAULT_SPEC "-D__tune_athlon__"
447#endif
b4e89e2d
JH
448#if TARGET_CPU_DEFAULT == 6
449#define CPP_CPU_DEFAULT_SPEC "-D__tune_pentium4__"
450#endif
5a6ee819
RH
451#ifndef CPP_CPU_DEFAULT_SPEC
452#define CPP_CPU_DEFAULT_SPEC "-D__tune_i386__"
84b77fba
JW
453#endif
454#endif /* CPP_CPU_DEFAULT_SPEC */
33c1d53a 455
84b77fba 456#ifndef CPP_CPU_SPEC
bcd86433 457#define CPP_CPU_SPEC "\
2b57e919 458-Acpu=i386 -Amachine=i386 \
930bbdd2 459%{!ansi:%{!std=c*:%{!std=i*:-Di386}}} -D__i386 -D__i386__ \
5a6ee819
RH
460%{march=i386:%{!mcpu*:-D__tune_i386__ }}\
461%{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
0d97fd9e
RH
462%{march=pentium|march=i586:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
463 %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ }}\
464%{march=pentiumpro|march=i686:-D__i686 -D__i686__ \
465 -D__pentiumpro -D__pentiumpro__ \
466 %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}\
5a6ee819 467%{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
309ada50 468%{march=athlon:-D__athlon -D__athlon__ %{!mcpu*:-D__tune_athlon__ }}\
b4e89e2d 469%{mpentium4=pentium4:-D__pentium4 -D__pentium4__ %{!mcpu*:-D__tune_pentium4__ }}\
5a6ee819
RH
470%{m386|mcpu=i386:-D__tune_i386__ }\
471%{m486|mcpu=i486:-D__tune_i486__ }\
0d97fd9e
RH
472%{mpentium|mcpu=pentium|mcpu=i586:-D__tune_i586__ -D__tune_pentium__ }\
473%{mpentiumpro|mcpu=pentiumpro|mcpu=i686:-D__tune_i686__ -D__tune_pentiumpro__ }\
5a6ee819 474%{mcpu=k6:-D__tune_k6__ }\
309ada50 475%{mcpu=athlon:-D__tune_athlon__ }\
b4e89e2d 476%{mcpu=pentium4:-D__tune_pentium4__ }\
5a6ee819 477%{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
84b77fba 478#endif
bcd86433 479
628714d8 480#ifndef CC1_SPEC
8015b78d 481#define CC1_SPEC "%(cc1_cpu) "
628714d8
RK
482#endif
483
484/* This macro defines names of additional specifications to put in the
485 specs that can be used in various specifications like CC1_SPEC. Its
486 definition is an initializer with a subgrouping for each command option.
bcd86433
SC
487
488 Each subgrouping contains a string constant, that defines the
489 specification name, and a string constant that used by the GNU CC driver
490 program.
491
492 Do not define this macro if it does not need to do anything. */
493
494#ifndef SUBTARGET_EXTRA_SPECS
495#define SUBTARGET_EXTRA_SPECS
496#endif
497
498#define EXTRA_SPECS \
84b77fba 499 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
bcd86433 500 { "cpp_cpu", CPP_CPU_SPEC }, \
628714d8 501 { "cc1_cpu", CC1_CPU_SPEC }, \
bcd86433
SC
502 SUBTARGET_EXTRA_SPECS
503\f
c98f8742
JVA
504/* target machine storage layout */
505
2b589241
JH
506/* Define for XFmode or TFmode extended real floating point support.
507 This will automatically cause REAL_ARITHMETIC to be defined.
508
509 The XFmode is specified by i386 ABI, while TFmode may be faster
510 due to alignment and simplifications in the address calculations.
511 */
512#define LONG_DOUBLE_TYPE_SIZE (TARGET_128BIT_LONG_DOUBLE ? 128 : 96)
513#define MAX_LONG_DOUBLE_TYPE_SIZE 128
65d9c0ab
JH
514#ifdef __x86_64__
515#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
516#else
517#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 96
518#endif
2b589241
JH
519/* Tell real.c that this is the 80-bit Intel extended float format
520 packaged in a 128-bit or 96bit entity. */
521#define INTEL_EXTENDED_IEEE_FORMAT
522
0038aea6 523
65d9c0ab
JH
524#define SHORT_TYPE_SIZE 16
525#define INT_TYPE_SIZE 32
526#define FLOAT_TYPE_SIZE 32
527#define LONG_TYPE_SIZE BITS_PER_WORD
2faf6b96 528#define MAX_WCHAR_TYPE_SIZE 32
65d9c0ab
JH
529#define MAX_LONG_TYPE_SIZE 64
530#define DOUBLE_TYPE_SIZE 64
531#define LONG_LONG_TYPE_SIZE 64
532
0038aea6
JVA
533/* Define if you don't want extended real, but do want to use the
534 software floating point emulator for REAL_ARITHMETIC and
535 decimal <-> binary conversion. */
536/* #define REAL_ARITHMETIC */
537
c98f8742
JVA
538/* Define this if most significant byte of a word is the lowest numbered. */
539/* That is true on the 80386. */
540
541#define BITS_BIG_ENDIAN 0
542
543/* Define this if most significant byte of a word is the lowest numbered. */
544/* That is not true on the 80386. */
545#define BYTES_BIG_ENDIAN 0
546
547/* Define this if most significant word of a multiword number is the lowest
548 numbered. */
549/* Not true for 80386 */
550#define WORDS_BIG_ENDIAN 0
551
b4ac57ab 552/* number of bits in an addressable storage unit */
c98f8742
JVA
553#define BITS_PER_UNIT 8
554
555/* Width in bits of a "word", which is the contents of a machine register.
556 Note that this is not necessarily the width of data type `int';
557 if using 16-bit ints on a 80386, this would still be 32.
558 But on a machine with 16-bit registers, this would be 16. */
65d9c0ab
JH
559#define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
560#define MAX_BITS_PER_WORD 64
c98f8742
JVA
561
562/* Width of a word, in units (bytes). */
65d9c0ab
JH
563#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
564#define MIN_UNITS_PER_WORD 4
c98f8742
JVA
565
566/* Width in bits of a pointer.
567 See also the macro `Pmode' defined below. */
65d9c0ab 568#define POINTER_SIZE BITS_PER_WORD
c98f8742
JVA
569
570/* Allocation boundary (in *bits*) for storing arguments in argument list. */
65d9c0ab 571#define PARM_BOUNDARY BITS_PER_WORD
c98f8742 572
e075ae69 573/* Boundary (in *bits*) on which stack pointer should be aligned. */
65d9c0ab 574#define STACK_BOUNDARY BITS_PER_WORD
c98f8742 575
3af4bd89
JH
576/* Boundary (in *bits*) on which the stack pointer preferrs to be
577 aligned; the compiler cannot rely on having this alignment. */
e075ae69 578#define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
65954bd8 579
e075ae69
RH
580/* Allocation boundary for the code of a function. */
581#define FUNCTION_BOUNDARY \
582 (1 << ((ix86_align_funcs >= 0 ? ix86_align_funcs : -ix86_align_funcs) + 3))
c98f8742
JVA
583
584/* Alignment of field after `int : 0' in a structure. */
585
65d9c0ab 586#define EMPTY_FIELD_BOUNDARY BITS_PER_WORD
c98f8742
JVA
587
588/* Minimum size in bits of the largest boundary to which any
589 and all fundamental data types supported by the hardware
590 might need to be aligned. No data type wants to be aligned
17f24ff0
JH
591 rounder than this.
592
593 Pentium+ preferrs DFmode values to be alignmed to 64 bit boundary
594 and Pentium Pro XFmode values at 128 bit boundaries. */
595
596#define BIGGEST_ALIGNMENT 128
597
a7180f70
BS
598/* Decide whether a variable of mode MODE must be 128 bit aligned. */
599#define ALIGN_MODE_128(MODE) \
2b589241
JH
600 ((MODE) == XFmode || (MODE) == TFmode || ((MODE) == TImode) \
601 || (MODE) == V4SFmode || (MODE) == V4SImode)
a7180f70 602
17f24ff0 603/* The published ABIs say that doubles should be aligned on word
6fc605d8
ZW
604 boundaries, so lower the aligment for structure fields unless
605 -malign-double is set. */
606/* BIGGEST_FIELD_ALIGNMENT is also used in libobjc, where it must be
607 constant. Use the smaller value in that context. */
608#ifndef IN_TARGET_LIBS
65d9c0ab 609#define BIGGEST_FIELD_ALIGNMENT (TARGET_64BIT ? 128 : (TARGET_ALIGN_DOUBLE ? 64 : 32))
6fc605d8
ZW
610#else
611#define BIGGEST_FIELD_ALIGNMENT 32
612#endif
c98f8742 613
e5e8a8bf 614/* If defined, a C expression to compute the alignment given to a
a7180f70 615 constant that is being placed in memory. EXP is the constant
e5e8a8bf
JW
616 and ALIGN is the alignment that the object would ordinarily have.
617 The value of this macro is used instead of that alignment to align
618 the object.
619
620 If this macro is not defined, then ALIGN is used.
621
622 The typical use of this macro is to increase alignment for string
623 constants to be word aligned so that `strcpy' calls that copy
624 constants can be done inline. */
625
a7180f70 626#define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment (EXP, ALIGN)
d4ba09c0 627
8a022443
JW
628/* If defined, a C expression to compute the alignment for a static
629 variable. TYPE is the data type, and ALIGN is the alignment that
630 the object would ordinarily have. The value of this macro is used
631 instead of that alignment to align the object.
632
633 If this macro is not defined, then ALIGN is used.
634
635 One use of this macro is to increase alignment of medium-size
636 data to make it all fit in fewer cache lines. Another is to
637 cause character arrays to be word-aligned so that `strcpy' calls
638 that copy constants to character arrays can be done inline. */
639
a7180f70 640#define DATA_ALIGNMENT(TYPE, ALIGN) ix86_data_alignment (TYPE, ALIGN)
d16790f2
JW
641
642/* If defined, a C expression to compute the alignment for a local
643 variable. TYPE is the data type, and ALIGN is the alignment that
644 the object would ordinarily have. The value of this macro is used
645 instead of that alignment to align the object.
646
647 If this macro is not defined, then ALIGN is used.
648
649 One use of this macro is to increase alignment of medium-size
650 data to make it all fit in fewer cache lines. */
651
a7180f70 652#define LOCAL_ALIGNMENT(TYPE, ALIGN) ix86_local_alignment (TYPE, ALIGN)
8a022443 653
b4ac57ab 654/* Set this non-zero if move instructions will actually fail to work
c98f8742 655 when given unaligned data. */
b4ac57ab 656#define STRICT_ALIGNMENT 0
c98f8742
JVA
657
658/* If bit field type is int, don't let it cross an int,
659 and give entire struct the alignment of an int. */
660/* Required on the 386 since it doesn't have bitfield insns. */
661#define PCC_BITFIELD_TYPE_MATTERS 1
662
663/* Align loop starts for optimal branching. */
e075ae69
RH
664#define LOOP_ALIGN(LABEL) \
665 (ix86_align_loops < 0 ? -ix86_align_loops : ix86_align_loops)
666#define LOOP_ALIGN_MAX_SKIP \
667 (ix86_align_loops < -3 ? (1<<(-ix86_align_loops-1))-1 : 0)
668
669/* This is how to align an instruction for optimal branching. */
670#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
671 (ix86_align_jumps < 0 ? -ix86_align_jumps : ix86_align_jumps)
672#define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP \
673 (ix86_align_jumps < -3 ? (1<<(-ix86_align_jumps-1))-1 : 0)
c98f8742
JVA
674\f
675/* Standard register usage. */
676
677/* This processor has special stack-like registers. See reg-stack.c
678 for details. */
679
680#define STACK_REGS
2b589241
JH
681#define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode \
682 || mode==XFmode || mode==TFmode)
c98f8742
JVA
683
684/* Number of actual hardware registers.
685 The hardware registers are assigned numbers for the compiler
686 from 0 to just below FIRST_PSEUDO_REGISTER.
687 All registers that the compiler knows about must be given numbers,
688 even those that are not normally considered general registers.
689
690 In the 80386 we give the 8 general purpose registers the numbers 0-7.
691 We number the floating point registers 8-15.
692 Note that registers 0-7 can be accessed as a short or int,
693 while only 0-3 may be used with byte `mov' instructions.
694
695 Reg 16 does not correspond to any hardware register, but instead
696 appears in the RTL as an argument pointer prior to reload, and is
697 eliminated during reloading in favor of either the stack or frame
698 pointer. */
699
3f3f2124 700#define FIRST_PSEUDO_REGISTER 53
c98f8742 701
3073d01c
ML
702/* Number of hardware registers that go into the DWARF-2 unwind info.
703 If not defined, equals FIRST_PSEUDO_REGISTER. */
704
705#define DWARF_FRAME_REGISTERS 17
706
c98f8742
JVA
707/* 1 for registers that have pervasive standard uses
708 and are not available for the register allocator.
3f3f2124
JH
709 On the 80386, the stack pointer is such, as is the arg pointer.
710
711 The value is an mask - bit 1 is set for fixed registers
712 for 32bit target, while 2 is set for fixed registers for 64bit.
713 Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
714 */
a7180f70
BS
715#define FIXED_REGISTERS \
716/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \
3f3f2124 717{ 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, \
a7180f70 718/*arg,flags,fpsr,dir,frame*/ \
3f3f2124 719 3, 3, 3, 3, 3, \
a7180f70
BS
720/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \
721 0, 0, 0, 0, 0, 0, 0, 0, \
722/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \
3f3f2124
JH
723 0, 0, 0, 0, 0, 0, 0, 0, \
724/* r8, r9, r10, r11, r12, r13, r14, r15*/ \
725 1, 1, 1, 1, 1, 1, 1, 1, \
726/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
727 1, 1, 1, 1, 1, 1, 1, 1}
728
c98f8742
JVA
729
730/* 1 for registers not available across function calls.
731 These must include the FIXED_REGISTERS and also any
732 registers that can be used without being saved.
733 The latter must include the registers where values are returned
734 and the register where structure-value addresses are passed.
3f3f2124
JH
735 Aside from that, you can include as many other registers as you like.
736
737 The value is an mask - bit 1 is set for call used
738 for 32bit target, while 2 is set for call used for 64bit.
739 Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
740*/
a7180f70
BS
741#define CALL_USED_REGISTERS \
742/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \
3f3f2124 743{ 3, 3, 3, 0, 2, 2, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, \
a7180f70 744/*arg,flags,fpsr,dir,frame*/ \
3f3f2124 745 3, 3, 3, 3, 3, \
a7180f70 746/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \
3f3f2124 747 3, 3, 3, 3, 3, 3, 3, 3, \
a7180f70 748/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \
3f3f2124
JH
749 3, 3, 3, 3, 3, 3, 3, 3, \
750/* r8, r9, r10, r11, r12, r13, r14, r15*/ \
751 3, 3, 3, 3, 1, 1, 1, 1, \
752/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
753 3, 3, 3, 3, 3, 3, 3, 3} \
c98f8742 754
3b3c6a3f
MM
755/* Order in which to allocate registers. Each register must be
756 listed once, even those in FIXED_REGISTERS. List frame pointer
757 late and fixed registers last. Note that, in general, we prefer
758 registers listed in CALL_USED_REGISTERS, keeping the others
759 available for storage of persistent values.
760
761 Three different versions of REG_ALLOC_ORDER have been tried:
762
763 If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
764 but slower code on simple functions returning values in eax.
765
766 If the order is eax, ecx, edx, ... it causes reload to abort when compiling
767 perl 4.036 due to not being able to create a DImode register (to hold a 2
768 word union).
769
770 If the order is eax, edx, ecx, ... it produces better code for simple
771 functions, and a slightly slower compiler. Users complained about the code
772 generated by allocating edx first, so restore the 'natural' order of things. */
773
a7180f70 774#define REG_ALLOC_ORDER \
3f3f2124
JH
775/*ax,dx,cx,*/ \
776{ 0, 1, 2, \
777/* bx,si,di,bp,sp,*/ \
778 3, 4, 5, 6, 7, \
779/*r8,r9,r10,r11,*/ \
780 37,38, 39, 40, \
781/*r12,r15,r14,r13*/ \
782 41, 44, 43, 42, \
a7180f70
BS
783/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \
784 21, 22, 23, 24, 25, 26, 27, 28, \
3f3f2124
JH
785/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
786 45, 46, 47, 48, 49, 50, 51, 52, \
266da7a2
JH
787/*st,st1,st2,st3,st4,st5,st6,st7*/ \
788 8, 9, 10, 11, 12, 13, 14, 15, \
3f3f2124
JH
789/*,arg,cc,fpsr,dir,frame*/ \
790 16,17, 18, 19, 20, \
a7180f70
BS
791/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \
792 29, 30, 31, 32, 33, 34, 35, 36 }
f5316dfe 793
c98f8742 794/* Macro to conditionally modify fixed_regs/call_used_regs. */
a7180f70
BS
795#define CONDITIONAL_REGISTER_USAGE \
796 { \
3f3f2124
JH
797 int i; \
798 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \
799 { \
800 fixed_regs[i] = (fixed_regs[i] & (TARGET_64BIT ? 2 : 1)) != 0; \
801 call_used_regs[i] = (call_used_regs[i] \
802 & (TARGET_64BIT ? 2 : 1)) != 0; \
803 } \
a7180f70
BS
804 if (flag_pic) \
805 { \
806 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
807 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
808 } \
809 if (! TARGET_MMX) \
810 { \
811 int i; \
812 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \
813 if (TEST_HARD_REG_BIT (reg_class_contents[(int)MMX_REGS], i)) \
814 fixed_regs[i] = call_used_regs[i] = 1; \
815 } \
816 if (! TARGET_SSE) \
817 { \
818 int i; \
819 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \
820 if (TEST_HARD_REG_BIT (reg_class_contents[(int)SSE_REGS], i)) \
821 fixed_regs[i] = call_used_regs[i] = 1; \
822 } \
823 if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
824 { \
825 int i; \
826 HARD_REG_SET x; \
827 COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
828 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \
829 if (TEST_HARD_REG_BIT (x, i)) \
830 fixed_regs[i] = call_used_regs[i] = 1; \
831 } \
c98f8742
JVA
832 }
833
834/* Return number of consecutive hard regs needed starting at reg REGNO
835 to hold something of mode MODE.
836 This is ordinarily the length in words of a value of mode MODE
837 but can be less for certain modes in special long registers.
838
839 Actually there are no two word move instructions for consecutive
840 registers. And only registers 0-3 may have mov byte instructions
841 applied to them.
842 */
843
844#define HARD_REGNO_NREGS(REGNO, MODE) \
a7180f70 845 (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) ? 1 \
2b589241
JH
846 : (MODE == TFmode \
847 ? 3 \
848 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
c98f8742 849
a7180f70 850#define VALID_SSE_REG_MODE(MODE) \
446988df
JH
851 ((MODE) == TImode || (MODE) == V4SFmode || (MODE) == V4SImode \
852 || (MODE) == SFmode || (TARGET_SSE2 && (MODE) == DFmode))
a7180f70
BS
853
854#define VALID_MMX_REG_MODE(MODE) \
855 ((MODE) == DImode || (MODE) == V8QImode || (MODE) == V4HImode \
856 || (MODE) == V2SImode || (MODE) == SImode)
857
858#define VECTOR_MODE_SUPPORTED_P(MODE) \
859 (VALID_SSE_REG_MODE (MODE) && TARGET_SSE ? 1 \
860 : VALID_MMX_REG_MODE (MODE) && TARGET_MMX ? 1 : 0)
861
a946dd00
JH
862#define VALID_FP_MODE_P(mode) \
863 ((mode) == SFmode || (mode) == DFmode || (mode) == TFmode \
864 || (mode) == XFmode \
865 || (mode) == SCmode || (mode) == DCmode || (mode) == TCmode\
866 || (mode) == XCmode)
867
868#define VALID_INT_MODE_P(mode) \
869 ((mode) == QImode || (mode) == HImode || (mode) == SImode \
870 || (mode) == DImode \
871 || (mode) == CQImode || (mode) == CHImode || (mode) == CSImode \
872 || (mode) == CDImode)
873
e075ae69 874/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
48227a2c 875
a946dd00
JH
876#define HARD_REGNO_MODE_OK(REGNO, MODE) \
877 ix86_hard_regno_mode_ok (REGNO, MODE)
c98f8742
JVA
878
879/* Value is 1 if it is a good idea to tie two pseudo registers
880 when one has mode MODE1 and one has mode MODE2.
881 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
882 for any hard reg, then this must be 0 for correct output. */
883
95912252
RH
884#define MODES_TIEABLE_P(MODE1, MODE2) \
885 ((MODE1) == (MODE2) \
63be02db
JM
886 || ((MODE1) == SImode && (MODE2) == HImode) \
887 || ((MODE1) == HImode && (MODE2) == SImode))
c98f8742 888
e075ae69 889/* Specify the modes required to caller save a given hard regno.
787dc842 890 We do this on i386 to prevent flags from being saved at all.
e075ae69 891
787dc842
JH
892 Kill any attempts to combine saving of modes. */
893
894#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
e075ae69 895 (CC_REGNO_P (REGNO) ? VOIDmode \
787dc842
JH
896 : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \
897 : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS)) \
898 : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \
899 : (MODE) == QImode && (REGNO) >= 4 ? SImode : (MODE))
e075ae69 900
c98f8742
JVA
901/* Specify the registers used for certain standard purposes.
902 The values of these macros are register numbers. */
903
904/* on the 386 the pc register is %eip, and is not usable as a general
905 register. The ordinary mov instructions won't work */
906/* #define PC_REGNUM */
907
908/* Register to use for pushing function arguments. */
909#define STACK_POINTER_REGNUM 7
910
911/* Base register for access to local variables of the function. */
564d80f4
JH
912#define HARD_FRAME_POINTER_REGNUM 6
913
914/* Base register for access to local variables of the function. */
915#define FRAME_POINTER_REGNUM 20
c98f8742
JVA
916
917/* First floating point reg */
918#define FIRST_FLOAT_REG 8
919
920/* First & last stack-like regs */
921#define FIRST_STACK_REG FIRST_FLOAT_REG
922#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
923
e075ae69
RH
924#define FLAGS_REG 17
925#define FPSR_REG 18
7c7ef435 926#define DIRFLAG_REG 19
e075ae69 927
a7180f70
BS
928#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)
929#define LAST_SSE_REG (FIRST_SSE_REG + 7)
930
931#define FIRST_MMX_REG (LAST_SSE_REG + 1)
932#define LAST_MMX_REG (FIRST_MMX_REG + 7)
933
3f3f2124
JH
934#define FIRST_REX_INT_REG (LAST_MMX_REG + 1)
935#define LAST_REX_INT_REG (FIRST_REX_INT_REG + 7)
936
937#define FIRST_REX_SSE_REG (LAST_REX_INT_REG + 1)
938#define LAST_REX_SSE_REG (FIRST_REX_SSE_REG + 7)
939
c98f8742
JVA
940/* Value should be nonzero if functions must have frame pointers.
941 Zero means the frame pointer need not be set up (and parms
942 may be accessed via the stack pointer) in functions that seem suitable.
943 This is computed in `reload', in reload1.c. */
6fca22eb
RH
944#define FRAME_POINTER_REQUIRED ix86_frame_pointer_required ()
945
946/* Override this in other tm.h files to cope with various OS losage
947 requiring a frame pointer. */
948#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
949#define SUBTARGET_FRAME_POINTER_REQUIRED 0
950#endif
951
952/* Make sure we can access arbitrary call frames. */
953#define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses ()
c98f8742
JVA
954
955/* Base register for access to arguments of the function. */
956#define ARG_POINTER_REGNUM 16
957
958/* Register in which static-chain is passed to a function. */
959#define STATIC_CHAIN_REGNUM 2
960
961/* Register to hold the addressing base for position independent
962 code access to data items. */
963#define PIC_OFFSET_TABLE_REGNUM 3
964
965/* Register in which address to store a structure value
966 arrives in the function. On the 386, the prologue
967 copies this from the stack to register %eax. */
968#define STRUCT_VALUE_INCOMING 0
969
970/* Place in which caller passes the structure value address.
971 0 means push the value on the stack like an argument. */
972#define STRUCT_VALUE 0
713225d4
MM
973
974/* A C expression which can inhibit the returning of certain function
975 values in registers, based on the type of value. A nonzero value
976 says to return the function value in memory, just as large
977 structures are always returned. Here TYPE will be a C expression
978 of type `tree', representing the data type of the value.
979
980 Note that values of mode `BLKmode' must be explicitly handled by
981 this macro. Also, the option `-fpcc-struct-return' takes effect
982 regardless of this macro. On most systems, it is possible to
983 leave the macro undefined; this causes a default definition to be
984 used, whose value is the constant 1 for `BLKmode' values, and 0
985 otherwise.
986
987 Do not use this macro to indicate that structures and unions
988 should always be returned in memory. You should instead use
989 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
990
04b1a223
JH
991#define RETURN_IN_MEMORY(TYPE) \
992 ((TYPE_MODE (TYPE) == BLKmode) \
993 || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8)\
994 || (int_size_in_bytes (TYPE) > 12 && TYPE_MODE (TYPE) != TImode \
995 && TYPE_MODE (TYPE) != TFmode && ! VECTOR_MODE_P (TYPE_MODE (TYPE))))
713225d4 996
c98f8742
JVA
997\f
998/* Define the classes of registers for register constraints in the
999 machine description. Also define ranges of constants.
1000
1001 One of the classes must always be named ALL_REGS and include all hard regs.
1002 If there is more than one class, another class must be named NO_REGS
1003 and contain no registers.
1004
1005 The name GENERAL_REGS must be the name of a class (or an alias for
1006 another name such as ALL_REGS). This is the class of registers
1007 that is allowed by "g" or "r" in a register constraint.
1008 Also, registers outside this class are allocated only when
1009 instructions express preferences for them.
1010
1011 The classes must be numbered in nondecreasing order; that is,
1012 a larger-numbered class must never be contained completely
1013 in a smaller-numbered class.
1014
1015 For any two classes, it is very desirable that there be another
ab408a86
JVA
1016 class that represents their union.
1017
1018 It might seem that class BREG is unnecessary, since no useful 386
1019 opcode needs reg %ebx. But some systems pass args to the OS in ebx,
e075ae69
RH
1020 and the "b" register constraint is useful in asms for syscalls.
1021
1022 The flags and fpsr registers are in no class. */
c98f8742
JVA
1023
1024enum reg_class
1025{
1026 NO_REGS,
e075ae69 1027 AREG, DREG, CREG, BREG, SIREG, DIREG,
4b71cd6e 1028 AD_REGS, /* %eax/%edx for DImode */
c98f8742 1029 Q_REGS, /* %eax %ebx %ecx %edx */
564d80f4 1030 NON_Q_REGS, /* %esi %edi %ebp %esp */
c98f8742 1031 INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
3f3f2124
JH
1032 LEGACY_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
1033 GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp %r8 - %r15*/
c98f8742
JVA
1034 FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
1035 FLOAT_REGS,
a7180f70
BS
1036 SSE_REGS,
1037 MMX_REGS,
446988df
JH
1038 FP_TOP_SSE_REGS,
1039 FP_SECOND_SSE_REGS,
1040 FLOAT_SSE_REGS,
1041 FLOAT_INT_REGS,
1042 INT_SSE_REGS,
1043 FLOAT_INT_SSE_REGS,
c98f8742
JVA
1044 ALL_REGS, LIM_REG_CLASSES
1045};
1046
1047#define N_REG_CLASSES (int) LIM_REG_CLASSES
1048
4cbb525c 1049#define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
f84aa48a
JH
1050#define SSE_CLASS_P(CLASS) (reg_class_subset_p (CLASS, SSE_REGS))
1051#define MMX_CLASS_P(CLASS) (reg_class_subset_p (CLASS, MMX_REGS))
1052#define MAYBE_FLOAT_CLASS_P(CLASS) (reg_classes_intersect_p (CLASS, FLOAT_REGS))
1053#define MAYBE_SSE_CLASS_P(CLASS) (reg_classes_intersect_p (SSE_REGS, CLASS))
1054#define MAYBE_MMX_CLASS_P(CLASS) (reg_classes_intersect_p (MMX_REGS, CLASS))
4cbb525c 1055
7c6b971d
JH
1056#define Q_CLASS_P(CLASS) (reg_class_subset_p (CLASS, Q_REGS))
1057
c98f8742
JVA
1058/* Give names of register classes as strings for dump file. */
1059
1060#define REG_CLASS_NAMES \
1061{ "NO_REGS", \
ab408a86 1062 "AREG", "DREG", "CREG", "BREG", \
c98f8742 1063 "SIREG", "DIREG", \
e075ae69
RH
1064 "AD_REGS", \
1065 "Q_REGS", "NON_Q_REGS", \
c98f8742 1066 "INDEX_REGS", \
3f3f2124 1067 "LEGACY_REGS", \
c98f8742
JVA
1068 "GENERAL_REGS", \
1069 "FP_TOP_REG", "FP_SECOND_REG", \
1070 "FLOAT_REGS", \
a7180f70
BS
1071 "SSE_REGS", \
1072 "MMX_REGS", \
446988df
JH
1073 "FP_TOP_SSE_REGS", \
1074 "FP_SECOND_SSE_REGS", \
1075 "FLOAT_SSE_REGS", \
8fcaaa80 1076 "FLOAT_INT_REGS", \
446988df
JH
1077 "INT_SSE_REGS", \
1078 "FLOAT_INT_SSE_REGS", \
c98f8742
JVA
1079 "ALL_REGS" }
1080
1081/* Define which registers fit in which classes.
1082 This is an initializer for a vector of HARD_REG_SET
1083 of length N_REG_CLASSES. */
1084
a7180f70 1085#define REG_CLASS_CONTENTS \
3f3f2124
JH
1086{ { 0x00, 0x0 }, \
1087 { 0x01, 0x0 }, { 0x02, 0x0 }, /* AREG, DREG */ \
1088 { 0x04, 0x0 }, { 0x08, 0x0 }, /* CREG, BREG */ \
1089 { 0x10, 0x0 }, { 0x20, 0x0 }, /* SIREG, DIREG */ \
1090 { 0x03, 0x0 }, /* AD_REGS */ \
1091 { 0x0f, 0x0 }, /* Q_REGS */ \
1092 { 0x1100f0, 0x1fe0 }, /* NON_Q_REGS */ \
1093 { 0x7f, 0x1fe0 }, /* INDEX_REGS */ \
1094 { 0x1100ff, 0x0 }, /* LEGACY_REGS */ \
1095 { 0x1100ff, 0x1fe0 }, /* GENERAL_REGS */ \
1096 { 0x100, 0x0 }, { 0x0200, 0x0 },/* FP_TOP_REG, FP_SECOND_REG */\
1097 { 0xff00, 0x0 }, /* FLOAT_REGS */ \
1098{ 0x1fe00000,0x1fe000 }, /* SSE_REGS */ \
1099{ 0xe0000000, 0x1f }, /* MMX_REGS */ \
1100{ 0x1fe00100,0x1fe000 }, /* FP_TOP_SSE_REG */ \
1101{ 0x1fe00200,0x1fe000 }, /* FP_SECOND_SSE_REG */ \
1102{ 0x1fe0ff00,0x1fe000 }, /* FLOAT_SSE_REGS */ \
1103 { 0x1ffff, 0x1fe0 }, /* FLOAT_INT_REGS */ \
1104{ 0x1fe100ff,0x1fffe0 }, /* INT_SSE_REGS */ \
1105{ 0x1fe1ffff,0x1fffe0 }, /* FLOAT_INT_SSE_REGS */ \
1106{ 0xffffffff,0x1fffff } \
e075ae69 1107}
c98f8742
JVA
1108
1109/* The same information, inverted:
1110 Return the class number of the smallest class containing
1111 reg number REGNO. This could be a conditional expression
1112 or could index an array. */
1113
c98f8742
JVA
1114#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
1115
1116/* When defined, the compiler allows registers explicitly used in the
1117 rtl to be used as spill registers but prevents the compiler from
1118 extending the lifetime of these registers. */
1119
2922fe9e 1120#define SMALL_REGISTER_CLASSES 1
c98f8742
JVA
1121
1122#define QI_REG_P(X) \
1123 (REG_P (X) && REGNO (X) < 4)
3f3f2124
JH
1124
1125#define GENERAL_REGNO_P(n) \
1126 ((n) < 8 || REX_INT_REGNO_P (n))
1127
1128#define GENERAL_REG_P(X) \
1129 (REG_P (X) && GENERAL_REG_REGNO_P (X))
1130
1131#define ANY_QI_REG_P(X) (TARGET_64BIT ? GENERAL_REG_P(X) : QI_REG_P (X))
1132
c98f8742
JVA
1133#define NON_QI_REG_P(X) \
1134 (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
1135
3f3f2124
JH
1136#define REX_INT_REGNO_P(n) ((n) >= FIRST_REX_INT_REG && (n) <= LAST_REX_INT_REG)
1137#define REX_INT_REG_P(X) (REG_P (X) && REX_INT_REGNO_P (REGNO (X)))
1138
c98f8742
JVA
1139#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
1140#define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
446988df
JH
1141#define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X)))
1142#define ANY_FP_REGNO_P(n) (FP_REGNO_P (n) || SSE_REGNO_P (n))
a7180f70 1143
3f3f2124
JH
1144#define SSE_REGNO_P(n) \
1145 (((n) >= FIRST_SSE_REG && (n) <= LAST_SSE_REG) \
1146 || ((n) >= FIRST_REX_SSE_REG && (n) <= LAST_REX_SSE_REG))
1147
1148#define SSE_REGNO(n) \
1149 ((n) < 8 ? FIRST_SSE_REG + (n) : FIRST_REX_SSE_REG + (n) - 8)
446988df
JH
1150#define SSE_REG_P(n) (REG_P (n) && SSE_REGNO_P (REGNO (n)))
1151
1152#define SSE_FLOAT_MODE_P(m) \
1153 ((TARGET_SSE && (m) == SFmode) || (TARGET_SSE2 && (m) == DFmode))
a7180f70
BS
1154
1155#define MMX_REGNO_P(n) ((n) >= FIRST_MMX_REG && (n) <= LAST_MMX_REG)
1156#define MMX_REG_P(xop) (REG_P (xop) && MMX_REGNO_P (REGNO (xop)))
c98f8742
JVA
1157
1158#define STACK_REG_P(xop) (REG_P (xop) && \
1159 REGNO (xop) >= FIRST_STACK_REG && \
1160 REGNO (xop) <= LAST_STACK_REG)
1161
1162#define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
1163
1164#define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
1165
e075ae69
RH
1166#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
1167#define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG)
1168
cdbca172
JO
1169/* Indicate whether hard register numbered REG_NO should be converted
1170 to SSA form. */
1171#define CONVERT_HARD_REGISTER_TO_SSA_P(REG_NO) \
1172 (REG_NO == FLAGS_REG || REG_NO == ARG_POINTER_REGNUM)
1173
c98f8742
JVA
1174/* The class value for index registers, and the one for base regs. */
1175
1176#define INDEX_REG_CLASS INDEX_REGS
1177#define BASE_REG_CLASS GENERAL_REGS
1178
1179/* Get reg_class from a letter such as appears in the machine description. */
1180
1181#define REG_CLASS_FROM_LETTER(C) \
8c2bf92a 1182 ((C) == 'r' ? GENERAL_REGS : \
3f3f2124
JH
1183 (C) == 'R' ? LEGACY_REGS : \
1184 (C) == 'q' ? TARGET_64BIT ? GENERAL_REGS : Q_REGS : \
1185 (C) == 'Q' ? Q_REGS : \
8c2bf92a
JVA
1186 (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
1187 ? FLOAT_REGS \
1188 : NO_REGS) : \
1189 (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
1190 ? FP_TOP_REG \
1191 : NO_REGS) : \
1192 (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
1193 ? FP_SECOND_REG \
1194 : NO_REGS) : \
1195 (C) == 'a' ? AREG : \
1196 (C) == 'b' ? BREG : \
1197 (C) == 'c' ? CREG : \
1198 (C) == 'd' ? DREG : \
446988df
JH
1199 (C) == 'x' ? TARGET_SSE ? SSE_REGS : NO_REGS : \
1200 (C) == 'Y' ? TARGET_SSE2? SSE_REGS : NO_REGS : \
1201 (C) == 'y' ? TARGET_MMX ? MMX_REGS : NO_REGS : \
4b71cd6e 1202 (C) == 'A' ? AD_REGS : \
8c2bf92a 1203 (C) == 'D' ? DIREG : \
c98f8742
JVA
1204 (C) == 'S' ? SIREG : NO_REGS)
1205
1206/* The letters I, J, K, L and M in a register constraint string
1207 can be used to stand for particular ranges of immediate operands.
1208 This macro defines what the ranges are.
1209 C is the letter, and VALUE is a constant value.
1210 Return 1 if VALUE is in the range specified by C.
1211
1212 I is for non-DImode shifts.
1213 J is for DImode shifts.
e075ae69
RH
1214 K is for signed imm8 operands.
1215 L is for andsi as zero-extending move.
c98f8742 1216 M is for shifts that can be executed by the "lea" opcode.
1aa9fd24 1217 N is for immedaite operands for out/in instructions (0-255)
c98f8742
JVA
1218 */
1219
e075ae69
RH
1220#define CONST_OK_FOR_LETTER_P(VALUE, C) \
1221 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 \
1222 : (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 \
1223 : (C) == 'K' ? (VALUE) >= -128 && (VALUE) <= 127 \
1224 : (C) == 'L' ? (VALUE) == 0xff || (VALUE) == 0xffff \
1225 : (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 \
1aa9fd24 1226 : (C) == 'N' ? (VALUE) >= 0 && (VALUE) <= 255 \
e075ae69 1227 : 0)
c98f8742
JVA
1228
1229/* Similar, but for floating constants, and defining letters G and H.
b4ac57ab
RS
1230 Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
1231 TARGET_387 isn't set, because the stack register converter may need to
c47f5ea5 1232 load 0.0 into the function value register. */
c98f8742
JVA
1233
1234#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
2b04e52b
JH
1235 ((C) == 'G' ? standard_80387_constant_p (VALUE) \
1236 : ((C) == 'H' ? standard_sse_constant_p (VALUE) : 0))
c98f8742
JVA
1237
1238/* Place additional restrictions on the register class to use when it
4cbb525c
JVA
1239 is necessary to be able to hold a value of mode MODE in a reload
1240 register for which class CLASS would ordinarily be used. */
c98f8742
JVA
1241
1242#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
1243 ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
1244 ? Q_REGS : (CLASS))
1245
1246/* Given an rtx X being reloaded into a reg required to be
1247 in class CLASS, return the class of reg to actually use.
1248 In general this is just CLASS; but on some machines
1249 in some cases it is preferable to use a more restrictive class.
1250 On the 80386 series, we prevent floating constants from being
1251 reloaded into floating registers (since no move-insn can do that)
1252 and we ensure that QImodes aren't reloaded into the esi or edi reg. */
1253
d398b3b1 1254/* Put float CONST_DOUBLE in the constant pool instead of fp regs.
c98f8742 1255 QImode must go into class Q_REGS.
d398b3b1
JVA
1256 Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
1257 movdf to do mem-to-mem moves through integer regs. */
c98f8742 1258
b66a3ac1 1259#define PREFERRED_RELOAD_CLASS(X,CLASS) \
f84aa48a 1260 ix86_preferred_reload_class (X, CLASS)
85ff473e
JVA
1261
1262/* If we are copying between general and FP registers, we need a memory
f84aa48a 1263 location. The same is true for SSE and MMX registers. */
85ff473e 1264#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
f84aa48a 1265 ix86_secondary_memory_needed (CLASS1, CLASS2, MODE, 1)
e075ae69
RH
1266
1267/* QImode spills from non-QI registers need a scratch. This does not
1268 happen often -- the only example so far requires an uninitialized
1269 pseudo. */
1270
1271#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
1272 ((CLASS) == GENERAL_REGS && (MODE) == QImode ? Q_REGS : NO_REGS)
c98f8742
JVA
1273
1274/* Return the maximum number of consecutive registers
1275 needed to represent mode MODE in a register of class CLASS. */
1276/* On the 80386, this is the size of MODE in words,
1277 except in the FP regs, where a single reg is always enough. */
a7180f70 1278#define CLASS_MAX_NREGS(CLASS, MODE) \
f84aa48a 1279 (FLOAT_CLASS_P (CLASS) || SSE_CLASS_P (CLASS) || MMX_CLASS_P (CLASS) \
a7180f70
BS
1280 ? 1 \
1281 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
f5316dfe
MM
1282
1283/* A C expression whose value is nonzero if pseudos that have been
1284 assigned to registers of class CLASS would likely be spilled
1285 because registers of CLASS are needed for spill registers.
1286
1287 The default value of this macro returns 1 if CLASS has exactly one
1288 register and zero otherwise. On most machines, this default
1289 should be used. Only define this macro to some other expression
1290 if pseudo allocated by `local-alloc.c' end up in memory because
ddd5a7c1 1291 their hard registers were needed for spill registers. If this
f5316dfe
MM
1292 macro returns nonzero for those classes, those pseudos will only
1293 be allocated by `global.c', which knows how to reallocate the
1294 pseudo to another register. If there would not be another
1295 register available for reallocation, you should not change the
1296 definition of this macro since the only effect of such a
1297 definition would be to slow down register allocation. */
1298
1299#define CLASS_LIKELY_SPILLED_P(CLASS) \
1300 (((CLASS) == AREG) \
1301 || ((CLASS) == DREG) \
1302 || ((CLASS) == CREG) \
1303 || ((CLASS) == BREG) \
1304 || ((CLASS) == AD_REGS) \
1305 || ((CLASS) == SIREG) \
1306 || ((CLASS) == DIREG))
1307
e075ae69
RH
1308/* A C statement that adds to CLOBBERS any hard regs the port wishes
1309 to automatically clobber for all asms.
1310
1311 We do this in the new i386 backend to maintain source compatibility
1312 with the old cc0-based compiler. */
1313
1314#define MD_ASM_CLOBBERS(CLOBBERS) \
1315 do { \
1316 (CLOBBERS) = tree_cons (NULL_TREE, build_string (5, "flags"), (CLOBBERS));\
1317 (CLOBBERS) = tree_cons (NULL_TREE, build_string (4, "fpsr"), (CLOBBERS)); \
7c7ef435 1318 (CLOBBERS) = tree_cons (NULL_TREE, build_string (7, "dirflag"), (CLOBBERS)); \
e075ae69 1319 } while (0)
c98f8742
JVA
1320\f
1321/* Stack layout; function entry, exit and calling. */
1322
1323/* Define this if pushing a word on the stack
1324 makes the stack pointer a smaller address. */
1325#define STACK_GROWS_DOWNWARD
1326
1327/* Define this if the nominal address of the stack frame
1328 is at the high-address end of the local variables;
1329 that is, each additional local variable allocated
1330 goes at a more negative offset in the frame. */
1331#define FRAME_GROWS_DOWNWARD
1332
1333/* Offset within stack frame to start allocating local variables at.
1334 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1335 first local allocated. Otherwise, it is the offset to the BEGINNING
1336 of the first local allocated. */
1337#define STARTING_FRAME_OFFSET 0
1338
1339/* If we generate an insn to push BYTES bytes,
1340 this says how many the stack pointer really advances by.
1341 On 386 pushw decrements by exactly 2 no matter what the position was.
1342 On the 386 there is no pushb; we use pushw instead, and this
1343 has the effect of rounding up to 2. */
1344
1345#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
1346
f73ad30e
JH
1347/* If defined, the maximum amount of space required for outgoing arguments will
1348 be computed and placed into the variable
1349 `current_function_outgoing_args_size'. No space will be pushed onto the
1350 stack for each call; instead, the function prologue should increase the stack
1351 frame size by this amount. */
1352
1353#define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS
1354
1355/* If defined, a C expression whose value is nonzero when we want to use PUSH
1356 instructions to pass outgoing arguments. */
1357
1358#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)
1359
c98f8742
JVA
1360/* Offset of first parameter from the argument pointer register value. */
1361#define FIRST_PARM_OFFSET(FNDECL) 0
1362
a7180f70
BS
1363/* Define this macro if functions should assume that stack space has been
1364 allocated for arguments even when their values are passed in registers.
1365
1366 The value of this macro is the size, in bytes, of the area reserved for
1367 arguments passed in registers for the function represented by FNDECL.
1368
1369 This space can be allocated by the caller, or be a part of the
1370 machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
1371 which. */
1372#define REG_PARM_STACK_SPACE(FNDECL) 0
1373
1374/* Define as a C expression that evaluates to nonzero if we do not know how
1375 to pass TYPE solely in registers. The file expr.h defines a
1376 definition that is usually appropriate, refer to expr.h for additional
1377 documentation. If `REG_PARM_STACK_SPACE' is defined, the argument will be
1378 computed in the stack and then loaded into a register. */
1379#define MUST_PASS_IN_STACK(MODE,TYPE) \
1380 ((TYPE) != 0 \
1381 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
1382 || TREE_ADDRESSABLE (TYPE) \
1383 || ((MODE) == TImode) \
1384 || ((MODE) == BLKmode \
1385 && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
1386 && 0 == (int_size_in_bytes (TYPE) \
1387 % (PARM_BOUNDARY / BITS_PER_UNIT))) \
1388 && (FUNCTION_ARG_PADDING (MODE, TYPE) \
1389 == (BYTES_BIG_ENDIAN ? upward : downward)))))
1390
c98f8742
JVA
1391/* Value is the number of bytes of arguments automatically
1392 popped when returning from a subroutine call.
8b109b37 1393 FUNDECL is the declaration node of the function (as a tree),
c98f8742
JVA
1394 FUNTYPE is the data type of the function (as a tree),
1395 or for a library call it is an identifier node for the subroutine name.
1396 SIZE is the number of bytes of arguments passed on the stack.
1397
1398 On the 80386, the RTD insn may be used to pop them if the number
1399 of args is fixed, but if the number is variable then the caller
1400 must pop them all. RTD can't be used for library calls now
1401 because the library is compiled with the Unix compiler.
1402 Use of RTD is a selectable option, since it is incompatible with
1403 standard Unix calling sequences. If the option is not selected,
b08de47e
MM
1404 the caller must always pop the args.
1405
1406 The attribute stdcall is equivalent to RTD on a per module basis. */
c98f8742 1407
b08de47e 1408#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
e075ae69 1409 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE))
c98f8742 1410
8c2bf92a
JVA
1411/* Define how to find the value returned by a function.
1412 VALTYPE is the data type of the value (as a tree).
1413 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1414 otherwise, FUNC is 0. */
c98f8742 1415#define FUNCTION_VALUE(VALTYPE, FUNC) \
f64cecad 1416 gen_rtx_REG (TYPE_MODE (VALTYPE), \
c5c76735 1417 VALUE_REGNO (TYPE_MODE (VALTYPE)))
c98f8742
JVA
1418
1419/* Define how to find the value returned by a library function
1420 assuming the value has mode MODE. */
1421
1422#define LIBCALL_VALUE(MODE) \
f64cecad 1423 gen_rtx_REG (MODE, VALUE_REGNO (MODE))
c98f8742 1424
e9125c09
TW
1425/* Define the size of the result block used for communication between
1426 untyped_call and untyped_return. The block contains a DImode value
1427 followed by the block used by fnsave and frstor. */
1428
1429#define APPLY_RESULT_SIZE (8+108)
1430
b08de47e 1431/* 1 if N is a possible register number for function argument passing. */
a5104211 1432#define FUNCTION_ARG_REGNO_P(N) ((N) < REGPARM_MAX)
c98f8742
JVA
1433
1434/* Define a data type for recording info about an argument list
1435 during the scan of that argument list. This data type should
1436 hold all necessary information about the function itself
1437 and about the args processed so far, enough to enable macros
b08de47e 1438 such as FUNCTION_ARG to determine where the next arg should go. */
c98f8742 1439
e075ae69 1440typedef struct ix86_args {
b08de47e
MM
1441 int words; /* # words passed so far */
1442 int nregs; /* # registers available for passing */
1443 int regno; /* next available register number */
a7180f70
BS
1444 int sse_words; /* # sse words passed so far */
1445 int sse_nregs; /* # sse registers available for passing */
1446 int sse_regno; /* next available sse register number */
b08de47e 1447} CUMULATIVE_ARGS;
c98f8742
JVA
1448
1449/* Initialize a variable CUM of type CUMULATIVE_ARGS
1450 for a call to a function whose data type is FNTYPE.
b08de47e 1451 For a library call, FNTYPE is 0. */
c98f8742 1452
2c7ee1a6 1453#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
b08de47e 1454 (init_cumulative_args (&CUM, FNTYPE, LIBNAME))
c98f8742
JVA
1455
1456/* Update the data in CUM to advance over an argument
1457 of mode MODE and data type TYPE.
1458 (TYPE is null for libcalls where that information may not be available.) */
1459
1460#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
b08de47e 1461 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
c98f8742
JVA
1462
1463/* Define where to put the arguments to a function.
1464 Value is zero to push the argument on the stack,
1465 or a hard register in which to store the argument.
1466
1467 MODE is the argument's machine mode.
1468 TYPE is the data type of the argument (as a tree).
1469 This is null for libcalls where that information may
1470 not be available.
1471 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1472 the preceding args and about the function being called.
1473 NAMED is nonzero if this argument is a named parameter
1474 (otherwise it is an extra parameter matching an ellipsis). */
1475
c98f8742 1476#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
b08de47e 1477 (function_arg (&CUM, MODE, TYPE, NAMED))
c98f8742
JVA
1478
1479/* For an arg passed partly in registers and partly in memory,
1480 this is the number of registers used.
1481 For args passed entirely in registers or entirely in memory, zero. */
1482
e075ae69 1483#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
c98f8742 1484
26f2c02a
ZW
1485/* If PIC, we cannot make sibling calls to global functions
1486 because the PLT requires %ebx live.
1487 If we are returning floats on the register stack, we cannot make
1488 sibling calls to functions that return floats. (The stack adjust
1489 instruction will wind up after the sibcall jump, and not be executed.) */
2a4bbffa
RH
1490#define FUNCTION_OK_FOR_SIBCALL(DECL) \
1491 (DECL \
26f2c02a
ZW
1492 && (! flag_pic || ! TREE_PUBLIC (DECL)) \
1493 && (! TARGET_FLOAT_RETURNS_IN_80387 \
1494 || ! FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (TREE_TYPE (DECL)))) \
1495 || FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (TREE_TYPE (cfun->decl))))))
cbbf65e0 1496
4cf12e7e
RH
1497/* This macro is invoked at the end of compilation. It is used here to
1498 output code for -fpic that will load the return address into %ebx. */
3a0433fd 1499
4cf12e7e
RH
1500#undef ASM_FILE_END
1501#define ASM_FILE_END(FILE) ix86_asm_file_end (FILE)
3a0433fd 1502
c98f8742
JVA
1503/* Output assembler code to FILE to increment profiler label # LABELNO
1504 for profiling a function entry. */
1505
1506#define FUNCTION_PROFILER(FILE, LABELNO) \
1507{ \
1508 if (flag_pic) \
1509 { \
e075ae69 1510 fprintf (FILE, "\tleal\t%sP%d@GOTOFF(%%ebx),%%edx\n", \
c98f8742 1511 LPREFIX, (LABELNO)); \
e075ae69 1512 fprintf (FILE, "\tcall\t*_mcount@GOT(%%ebx)\n"); \
c98f8742
JVA
1513 } \
1514 else \
1515 { \
e075ae69
RH
1516 fprintf (FILE, "\tmovl\t$%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
1517 fprintf (FILE, "\tcall\t_mcount\n"); \
c98f8742
JVA
1518 } \
1519}
1520
1cf5eda8 1521
6e753900
RK
1522/* There are three profiling modes for basic blocks available.
1523 The modes are selected at compile time by using the options
1524 -a or -ax of the gnu compiler.
1525 The variable `profile_block_flag' will be set according to the
1526 selected option.
1cf5eda8 1527
6e753900 1528 profile_block_flag == 0, no option used:
1cf5eda8 1529
6e753900 1530 No profiling done.
1cf5eda8 1531
6e753900
RK
1532 profile_block_flag == 1, -a option used.
1533
1534 Count frequency of execution of every basic block.
1535
1536 profile_block_flag == 2, -ax option used.
1537
1538 Generate code to allow several different profiling modes at run time.
1539 Available modes are:
1540 Produce a trace of all basic blocks.
1541 Count frequency of jump instructions executed.
1542 In every mode it is possible to start profiling upon entering
1543 certain functions and to disable profiling of some other functions.
1544
1545 The result of basic-block profiling will be written to a file `bb.out'.
1546 If the -ax option is used parameters for the profiling will be read
1547 from file `bb.in'.
1548
1549*/
1550
1551/* The following macro shall output assembler code to FILE
e075ae69 1552 to initialize basic-block profiling. */
1cf5eda8
MM
1553
1554#undef FUNCTION_BLOCK_PROFILER
e075ae69
RH
1555#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1556 ix86_output_function_block_profiler (FILE, BLOCK_OR_LABEL)
1cf5eda8 1557
6e753900 1558/* The following macro shall output assembler code to FILE
e075ae69 1559 to increment a counter associated with basic block number BLOCKNO. */
6e753900 1560
e075ae69
RH
1561#define BLOCK_PROFILER(FILE, BLOCKNO) \
1562 ix86_output_block_profiler (FILE, BLOCKNO)
1cf5eda8 1563
e075ae69 1564/* The following macro shall output rtl for the epilogue
6e753900
RK
1565 to indicate a return from function during basic-block profiling.
1566
1567 If profiling_block_flag == 2:
1568
1569 Output assembler code to call function `__bb_trace_ret'.
1570
1571 Note that function `__bb_trace_ret' must not change the
1572 machine state, especially the flag register. To grant
1573 this, you must output code to save and restore registers
78a0d70c
ZW
1574 either in this macro or in the macros MACHINE_STATE_SAVE
1575 and MACHINE_STATE_RESTORE. The last two macros will be
6e753900
RK
1576 used in the function `__bb_trace_ret', so you must make
1577 sure that the function prologue does not change any
78a0d70c 1578 register prior to saving it with MACHINE_STATE_SAVE.
6e753900
RK
1579
1580 else if profiling_block_flag != 0:
1581
1582 The macro will not be used, so it need not distinguish
1583 these cases.
1584*/
1585
e075ae69 1586#define FUNCTION_BLOCK_PROFILER_EXIT \
d8b2fb52 1587emit_call_insn (gen_call (gen_rtx_MEM (QImode, \
e075ae69
RH
1588 gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \
1589 const0_rtx))
6e753900
RK
1590
1591/* The function `__bb_trace_func' is called in every basic block
1592 and is not allowed to change the machine state. Saving (restoring)
1593 the state can either be done in the BLOCK_PROFILER macro,
1594 before calling function (rsp. after returning from function)
1595 `__bb_trace_func', or it can be done inside the function by
1596 defining the macros:
1597
1598 MACHINE_STATE_SAVE(ID)
1599 MACHINE_STATE_RESTORE(ID)
1600
1601 In the latter case care must be taken, that the prologue code
1602 of function `__bb_trace_func' does not already change the
1603 state prior to saving it with MACHINE_STATE_SAVE.
1604
1605 The parameter `ID' is a string identifying a unique macro use.
1606
1607 On the i386 the initialization code at the begin of
1608 function `__bb_trace_func' contains a `sub' instruction
1609 therefore we handle save and restore of the flag register
78a0d70c
ZW
1610 in the BLOCK_PROFILER macro.
1611
1612 Note that ebx, esi, and edi are callee-save, so we don't have to
1613 preserve them explicitly. */
6e753900 1614
e075ae69
RH
1615#define MACHINE_STATE_SAVE(ID) \
1616do { \
1617 register int eax_ __asm__("eax"); \
1618 register int ecx_ __asm__("ecx"); \
1619 register int edx_ __asm__("edx"); \
78a0d70c
ZW
1620 __asm__ __volatile__ ("\
1621push{l} %0\n\t\
1622push{l} %1\n\t\
1623push{l} %2" \
1624 : : "r"(eax_), "r"(ecx_), "r"(edx_)); \
e075ae69
RH
1625} while (0);
1626
1627#define MACHINE_STATE_RESTORE(ID) \
1628do { \
1629 register int eax_ __asm__("eax"); \
1630 register int ecx_ __asm__("ecx"); \
1631 register int edx_ __asm__("edx"); \
78a0d70c
ZW
1632 __asm__ __volatile__ ("\
1633pop{l} %2\n\t\
1634pop{l} %1\n\t\
1635pop{l} %0" \
1636 : "=r"(eax_), "=r"(ecx_), "=r"(edx_)); \
e075ae69 1637} while (0);
6e753900 1638
c98f8742
JVA
1639/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1640 the stack pointer does not matter. The value is tested only in
1641 functions that have frame pointers.
1642 No definition is equivalent to always zero. */
1643/* Note on the 386 it might be more efficient not to define this since
1644 we have to restore it ourselves from the frame pointer, in order to
1645 use pop */
1646
1647#define EXIT_IGNORE_STACK 1
1648
c98f8742
JVA
1649/* Output assembler code for a block containing the constant parts
1650 of a trampoline, leaving space for the variable parts. */
1651
a269a03c 1652/* On the 386, the trampoline contains two instructions:
c98f8742 1653 mov #STATIC,ecx
a269a03c
JC
1654 jmp FUNCTION
1655 The trampoline is generated entirely at runtime. The operand of JMP
1656 is the address of FUNCTION relative to the instruction following the
1657 JMP (which is 5 bytes long). */
c98f8742
JVA
1658
1659/* Length in units of the trampoline for entering a nested function. */
1660
a269a03c 1661#define TRAMPOLINE_SIZE 10
c98f8742
JVA
1662
1663/* Emit RTL insns to initialize the variable parts of a trampoline.
1664 FNADDR is an RTX for the address of the function's pure code.
1665 CXT is an RTX for the static chain value for the function. */
1666
1667#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1668{ \
a269a03c
JC
1669 /* Compute offset from the end of the jmp to the target function. */ \
1670 rtx disp = expand_binop (SImode, sub_optab, FNADDR, \
1671 plus_constant (TRAMP, 10), \
1672 NULL_RTX, 1, OPTAB_DIRECT); \
1673 emit_move_insn (gen_rtx_MEM (QImode, TRAMP), GEN_INT (0xb9)); \
f64cecad 1674 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \
a269a03c
JC
1675 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 5)), GEN_INT (0xe9));\
1676 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), disp); \
c98f8742
JVA
1677}
1678\f
1679/* Definitions for register eliminations.
1680
1681 This is an array of structures. Each structure initializes one pair
1682 of eliminable registers. The "from" register number is given first,
1683 followed by "to". Eliminations of the same "from" register are listed
1684 in order of preference.
1685
afc2cd05
NC
1686 There are two registers that can always be eliminated on the i386.
1687 The frame pointer and the arg pointer can be replaced by either the
1688 hard frame pointer or to the stack pointer, depending upon the
1689 circumstances. The hard frame pointer is not used before reload and
1690 so it is not eligible for elimination. */
c98f8742 1691
564d80f4
JH
1692#define ELIMINABLE_REGS \
1693{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1694 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
1695 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1696 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} \
c98f8742 1697
2c5a510c
RH
1698/* Given FROM and TO register numbers, say whether this elimination is
1699 allowed. Frame pointer elimination is automatically handled.
c98f8742
JVA
1700
1701 All other eliminations are valid. */
1702
2c5a510c
RH
1703#define CAN_ELIMINATE(FROM, TO) \
1704 ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
c98f8742
JVA
1705
1706/* Define the offset between two registers, one to be eliminated, and the other
1707 its replacement, at the start of a routine. */
1708
1709#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
0903fcab 1710 (OFFSET) = ix86_initial_elimination_offset (FROM, TO)
c98f8742
JVA
1711\f
1712/* Addressing modes, and classification of registers for them. */
1713
940da324
JL
1714/* #define HAVE_POST_INCREMENT 0 */
1715/* #define HAVE_POST_DECREMENT 0 */
c98f8742 1716
940da324
JL
1717/* #define HAVE_PRE_DECREMENT 0 */
1718/* #define HAVE_PRE_INCREMENT 0 */
c98f8742
JVA
1719
1720/* Macros to check register numbers against specific register classes. */
1721
1722/* These assume that REGNO is a hard or pseudo reg number.
1723 They give nonzero only if REGNO is a hard reg of the suitable class
1724 or a pseudo reg currently allocated to a suitable hard reg.
1725 Since they use reg_renumber, they are safe only once reg_renumber
1726 has been allocated, which happens in local-alloc.c. */
1727
3f3f2124
JH
1728#define REGNO_OK_FOR_INDEX_P(REGNO) \
1729 ((REGNO) < STACK_POINTER_REGNUM \
1730 || (REGNO >= FIRST_REX_INT_REG \
1731 && (REGNO) <= LAST_REX_INT_REG) \
1732 || ((unsigned) reg_renumber[REGNO] >= FIRST_REX_INT_REG \
1733 && (unsigned) reg_renumber[REGNO] <= LAST_REX_INT_REG) \
c98f8742
JVA
1734 || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
1735
3f3f2124
JH
1736#define REGNO_OK_FOR_BASE_P(REGNO) \
1737 ((REGNO) <= STACK_POINTER_REGNUM \
1738 || (REGNO) == ARG_POINTER_REGNUM \
1739 || (REGNO) == FRAME_POINTER_REGNUM \
1740 || (REGNO >= FIRST_REX_INT_REG \
1741 && (REGNO) <= LAST_REX_INT_REG) \
1742 || ((unsigned) reg_renumber[REGNO] >= FIRST_REX_INT_REG \
1743 && (unsigned) reg_renumber[REGNO] <= LAST_REX_INT_REG) \
c98f8742
JVA
1744 || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
1745
1746#define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
1747#define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
1748
1749/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1750 and check its validity for a certain class.
1751 We have two alternate definitions for each of them.
1752 The usual definition accepts all pseudo regs; the other rejects
1753 them unless they have been allocated suitable hard regs.
1754 The symbol REG_OK_STRICT causes the latter definition to be used.
1755
1756 Most source files want to accept pseudo regs in the hope that
1757 they will get allocated to the class that the insn wants them to be in.
1758 Source files for reload pass need to be strict.
1759 After reload, it makes no difference, since pseudo regs have
1760 been eliminated by then. */
1761
c98f8742 1762
3b3c6a3f
MM
1763/* Non strict versions, pseudos are ok */
1764#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
1765 (REGNO (X) < STACK_POINTER_REGNUM \
3f3f2124
JH
1766 || (REGNO (X) >= FIRST_REX_INT_REG \
1767 && REGNO (X) <= LAST_REX_INT_REG) \
c98f8742
JVA
1768 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1769
3b3c6a3f
MM
1770#define REG_OK_FOR_BASE_NONSTRICT_P(X) \
1771 (REGNO (X) <= STACK_POINTER_REGNUM \
1772 || REGNO (X) == ARG_POINTER_REGNUM \
3f3f2124
JH
1773 || REGNO (X) == FRAME_POINTER_REGNUM \
1774 || (REGNO (X) >= FIRST_REX_INT_REG \
1775 && REGNO (X) <= LAST_REX_INT_REG) \
3b3c6a3f 1776 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
c98f8742 1777
3b3c6a3f
MM
1778/* Strict versions, hard registers only */
1779#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1780#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
c98f8742 1781
3b3c6a3f
MM
1782#ifndef REG_OK_STRICT
1783#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
1784#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
3b3c6a3f
MM
1785
1786#else
1787#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
1788#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
c98f8742
JVA
1789#endif
1790
1791/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1792 that is a valid memory address for an instruction.
1793 The MODE argument is the machine mode for the MEM expression
1794 that wants to use this address.
1795
1796 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1797 except for CONSTANT_ADDRESS_P which is usually machine-independent.
1798
1799 See legitimize_pic_address in i386.c for details as to what
1800 constitutes a legitimate address when -fpic is used. */
1801
1802#define MAX_REGS_PER_ADDRESS 2
1803
91bb873f
RH
1804#define CONSTANT_ADDRESS_P(X) \
1805 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1806 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
c98f8742
JVA
1807
1808/* Nonzero if the constant value X is a legitimate general operand.
1809 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1810
d7a29404 1811#define LEGITIMATE_CONSTANT_P(X) 1
c98f8742 1812
3b3c6a3f
MM
1813#ifdef REG_OK_STRICT
1814#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1815{ \
1816 if (legitimate_address_p (MODE, X, 1)) \
1817 goto ADDR; \
1818}
c98f8742 1819
3b3c6a3f
MM
1820#else
1821#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
c98f8742 1822{ \
3b3c6a3f 1823 if (legitimate_address_p (MODE, X, 0)) \
c98f8742 1824 goto ADDR; \
c98f8742
JVA
1825}
1826
3b3c6a3f
MM
1827#endif
1828
b949ea8b
JW
1829/* If defined, a C expression to determine the base term of address X.
1830 This macro is used in only one place: `find_base_term' in alias.c.
1831
1832 It is always safe for this macro to not be defined. It exists so
1833 that alias analysis can understand machine-dependent addresses.
1834
1835 The typical use of this macro is to handle addresses containing
1836 a label_ref or symbol_ref within an UNSPEC. */
1837
1838#define FIND_BASE_TERM(X) ix86_find_base_term (x)
1839
c98f8742
JVA
1840/* Try machine-dependent ways of modifying an illegitimate address
1841 to be legitimate. If we find one, return the new, valid address.
1842 This macro is used in only one place: `memory_address' in explow.c.
1843
1844 OLDX is the address as it was before break_out_memory_refs was called.
1845 In some cases it is useful to look at this to decide what needs to be done.
1846
1847 MODE and WIN are passed so that this macro can use
1848 GO_IF_LEGITIMATE_ADDRESS.
1849
1850 It is always safe for this macro to do nothing. It exists to recognize
1851 opportunities to optimize the output.
1852
1853 For the 80386, we handle X+REG by loading X into a register R and
1854 using R+REG. R will go in a general reg and indexing will be used.
1855 However, if REG is a broken-out memory address or multiplication,
1856 nothing needs to be done because REG can certainly go in a general reg.
1857
1858 When -fpic is used, special handling is needed for symbolic references.
1859 See comments by legitimize_pic_address in i386.c for details. */
1860
3b3c6a3f
MM
1861#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1862{ \
3b3c6a3f
MM
1863 (X) = legitimize_address (X, OLDX, MODE); \
1864 if (memory_address_p (MODE, X)) \
1865 goto WIN; \
1866}
c98f8742 1867
d4ba09c0
SC
1868#define REWRITE_ADDRESS(x) rewrite_address(x)
1869
c98f8742
JVA
1870/* Nonzero if the constant value X is a legitimate general operand
1871 when generating PIC code. It is given that flag_pic is on and
1872 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1873
e075ae69
RH
1874#define LEGITIMATE_PIC_OPERAND_P(X) \
1875 (! SYMBOLIC_CONST (X) \
1876 || legitimate_pic_address_disp_p (X))
c98f8742
JVA
1877
1878#define SYMBOLIC_CONST(X) \
1879(GET_CODE (X) == SYMBOL_REF \
1880 || GET_CODE (X) == LABEL_REF \
1881 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1882
1883/* Go to LABEL if ADDR (a legitimate address expression)
1884 has an effect that depends on the machine mode it is used for.
1885 On the 80386, only postdecrement and postincrement address depend thus
1886 (the amount of decrement or increment being the length of the operand). */
1887#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1888 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1889\f
bd793c65
BS
1890/* Codes for all the SSE/MMX builtins. */
1891enum ix86_builtins
1892{
1893 IX86_BUILTIN_ADDPS,
1894 IX86_BUILTIN_ADDSS,
1895 IX86_BUILTIN_DIVPS,
1896 IX86_BUILTIN_DIVSS,
1897 IX86_BUILTIN_MULPS,
1898 IX86_BUILTIN_MULSS,
1899 IX86_BUILTIN_SUBPS,
1900 IX86_BUILTIN_SUBSS,
1901
1902 IX86_BUILTIN_CMPEQPS,
1903 IX86_BUILTIN_CMPLTPS,
1904 IX86_BUILTIN_CMPLEPS,
1905 IX86_BUILTIN_CMPGTPS,
1906 IX86_BUILTIN_CMPGEPS,
1907 IX86_BUILTIN_CMPNEQPS,
1908 IX86_BUILTIN_CMPNLTPS,
1909 IX86_BUILTIN_CMPNLEPS,
1910 IX86_BUILTIN_CMPNGTPS,
1911 IX86_BUILTIN_CMPNGEPS,
1912 IX86_BUILTIN_CMPORDPS,
1913 IX86_BUILTIN_CMPUNORDPS,
1914 IX86_BUILTIN_CMPNEPS,
1915 IX86_BUILTIN_CMPEQSS,
1916 IX86_BUILTIN_CMPLTSS,
1917 IX86_BUILTIN_CMPLESS,
1918 IX86_BUILTIN_CMPGTSS,
1919 IX86_BUILTIN_CMPGESS,
1920 IX86_BUILTIN_CMPNEQSS,
1921 IX86_BUILTIN_CMPNLTSS,
1922 IX86_BUILTIN_CMPNLESS,
1923 IX86_BUILTIN_CMPNGTSS,
1924 IX86_BUILTIN_CMPNGESS,
1925 IX86_BUILTIN_CMPORDSS,
1926 IX86_BUILTIN_CMPUNORDSS,
1927 IX86_BUILTIN_CMPNESS,
1928
1929 IX86_BUILTIN_COMIEQSS,
1930 IX86_BUILTIN_COMILTSS,
1931 IX86_BUILTIN_COMILESS,
1932 IX86_BUILTIN_COMIGTSS,
1933 IX86_BUILTIN_COMIGESS,
1934 IX86_BUILTIN_COMINEQSS,
1935 IX86_BUILTIN_UCOMIEQSS,
1936 IX86_BUILTIN_UCOMILTSS,
1937 IX86_BUILTIN_UCOMILESS,
1938 IX86_BUILTIN_UCOMIGTSS,
1939 IX86_BUILTIN_UCOMIGESS,
1940 IX86_BUILTIN_UCOMINEQSS,
1941
1942 IX86_BUILTIN_CVTPI2PS,
1943 IX86_BUILTIN_CVTPS2PI,
1944 IX86_BUILTIN_CVTSI2SS,
1945 IX86_BUILTIN_CVTSS2SI,
1946 IX86_BUILTIN_CVTTPS2PI,
1947 IX86_BUILTIN_CVTTSS2SI,
1948 IX86_BUILTIN_M_FROM_INT,
1949 IX86_BUILTIN_M_TO_INT,
1950
1951 IX86_BUILTIN_MAXPS,
1952 IX86_BUILTIN_MAXSS,
1953 IX86_BUILTIN_MINPS,
1954 IX86_BUILTIN_MINSS,
1955
1956 IX86_BUILTIN_LOADAPS,
1957 IX86_BUILTIN_LOADUPS,
1958 IX86_BUILTIN_STOREAPS,
1959 IX86_BUILTIN_STOREUPS,
1960 IX86_BUILTIN_LOADSS,
1961 IX86_BUILTIN_STORESS,
1962 IX86_BUILTIN_MOVSS,
1963
1964 IX86_BUILTIN_MOVHLPS,
1965 IX86_BUILTIN_MOVLHPS,
1966 IX86_BUILTIN_LOADHPS,
1967 IX86_BUILTIN_LOADLPS,
1968 IX86_BUILTIN_STOREHPS,
1969 IX86_BUILTIN_STORELPS,
1970
1971 IX86_BUILTIN_MASKMOVQ,
1972 IX86_BUILTIN_MOVMSKPS,
1973 IX86_BUILTIN_PMOVMSKB,
1974
1975 IX86_BUILTIN_MOVNTPS,
1976 IX86_BUILTIN_MOVNTQ,
1977
1978 IX86_BUILTIN_PACKSSWB,
1979 IX86_BUILTIN_PACKSSDW,
1980 IX86_BUILTIN_PACKUSWB,
1981
1982 IX86_BUILTIN_PADDB,
1983 IX86_BUILTIN_PADDW,
1984 IX86_BUILTIN_PADDD,
1985 IX86_BUILTIN_PADDSB,
1986 IX86_BUILTIN_PADDSW,
1987 IX86_BUILTIN_PADDUSB,
1988 IX86_BUILTIN_PADDUSW,
1989 IX86_BUILTIN_PSUBB,
1990 IX86_BUILTIN_PSUBW,
1991 IX86_BUILTIN_PSUBD,
1992 IX86_BUILTIN_PSUBSB,
1993 IX86_BUILTIN_PSUBSW,
1994 IX86_BUILTIN_PSUBUSB,
1995 IX86_BUILTIN_PSUBUSW,
1996
1997 IX86_BUILTIN_PAND,
1998 IX86_BUILTIN_PANDN,
1999 IX86_BUILTIN_POR,
2000 IX86_BUILTIN_PXOR,
2001
2002 IX86_BUILTIN_PAVGB,
2003 IX86_BUILTIN_PAVGW,
2004
2005 IX86_BUILTIN_PCMPEQB,
2006 IX86_BUILTIN_PCMPEQW,
2007 IX86_BUILTIN_PCMPEQD,
2008 IX86_BUILTIN_PCMPGTB,
2009 IX86_BUILTIN_PCMPGTW,
2010 IX86_BUILTIN_PCMPGTD,
2011
2012 IX86_BUILTIN_PEXTRW,
2013 IX86_BUILTIN_PINSRW,
2014
2015 IX86_BUILTIN_PMADDWD,
2016
2017 IX86_BUILTIN_PMAXSW,
2018 IX86_BUILTIN_PMAXUB,
2019 IX86_BUILTIN_PMINSW,
2020 IX86_BUILTIN_PMINUB,
2021
2022 IX86_BUILTIN_PMULHUW,
2023 IX86_BUILTIN_PMULHW,
2024 IX86_BUILTIN_PMULLW,
2025
2026 IX86_BUILTIN_PSADBW,
2027 IX86_BUILTIN_PSHUFW,
2028
2029 IX86_BUILTIN_PSLLW,
2030 IX86_BUILTIN_PSLLD,
2031 IX86_BUILTIN_PSLLQ,
2032 IX86_BUILTIN_PSRAW,
2033 IX86_BUILTIN_PSRAD,
2034 IX86_BUILTIN_PSRLW,
2035 IX86_BUILTIN_PSRLD,
2036 IX86_BUILTIN_PSRLQ,
2037 IX86_BUILTIN_PSLLWI,
2038 IX86_BUILTIN_PSLLDI,
2039 IX86_BUILTIN_PSLLQI,
2040 IX86_BUILTIN_PSRAWI,
2041 IX86_BUILTIN_PSRADI,
2042 IX86_BUILTIN_PSRLWI,
2043 IX86_BUILTIN_PSRLDI,
2044 IX86_BUILTIN_PSRLQI,
2045
2046 IX86_BUILTIN_PUNPCKHBW,
2047 IX86_BUILTIN_PUNPCKHWD,
2048 IX86_BUILTIN_PUNPCKHDQ,
2049 IX86_BUILTIN_PUNPCKLBW,
2050 IX86_BUILTIN_PUNPCKLWD,
2051 IX86_BUILTIN_PUNPCKLDQ,
2052
2053 IX86_BUILTIN_SHUFPS,
2054
2055 IX86_BUILTIN_RCPPS,
2056 IX86_BUILTIN_RCPSS,
2057 IX86_BUILTIN_RSQRTPS,
2058 IX86_BUILTIN_RSQRTSS,
2059 IX86_BUILTIN_SQRTPS,
2060 IX86_BUILTIN_SQRTSS,
2061
2062 IX86_BUILTIN_UNPCKHPS,
2063 IX86_BUILTIN_UNPCKLPS,
2064
2065 IX86_BUILTIN_ANDPS,
2066 IX86_BUILTIN_ANDNPS,
2067 IX86_BUILTIN_ORPS,
2068 IX86_BUILTIN_XORPS,
2069
2070 IX86_BUILTIN_EMMS,
2071 IX86_BUILTIN_LDMXCSR,
2072 IX86_BUILTIN_STMXCSR,
2073 IX86_BUILTIN_SFENCE,
2074 IX86_BUILTIN_PREFETCH,
2075
2076 /* Composite builtins, expand to more than one insn. */
2077 IX86_BUILTIN_SETPS1,
2078 IX86_BUILTIN_SETPS,
2079 IX86_BUILTIN_CLRPS,
2080 IX86_BUILTIN_SETRPS,
2081 IX86_BUILTIN_LOADPS1,
2082 IX86_BUILTIN_LOADRPS,
2083 IX86_BUILTIN_STOREPS1,
2084 IX86_BUILTIN_STORERPS,
2085
2086 IX86_BUILTIN_MMX_ZERO,
2087
2088 IX86_BUILTIN_MAX
2089};
2090
2091/* Initialize the target-specific builtin functions. Only do something
2092 if TARGET_MMX is nonzero; we take care in ix86_init_builtins not to
2093 enable any SSE builtins if TARGET_SSE is zero. */
2094#define MD_INIT_BUILTINS \
2095 do \
2096 { \
2097 if (TARGET_MMX) \
2098 ix86_init_builtins (); \
2099 } \
2100 while (0)
2101
2102/* Expand a target-specific builtin function. */
2103#define MD_EXPAND_BUILTIN(EXP, TARGET, SUBTARGET, MODE, IGNORE) \
2104 ix86_expand_builtin (EXP, TARGET, SUBTARGET, MODE, IGNORE)
2105\f
c98f8742
JVA
2106/* Define this macro if references to a symbol must be treated
2107 differently depending on something about the variable or
2108 function named by the symbol (such as what section it is in).
2109
b4ac57ab 2110 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
c98f8742
JVA
2111 so that we may access it directly in the GOT. */
2112
90e0ee00
AH
2113#define ENCODE_SECTION_INFO(DECL) \
2114do \
2115 { \
2116 if (flag_pic) \
2117 { \
2118 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
2119 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
2120 \
2121 if (GET_CODE (rtl) == MEM) \
2122 { \
2123 if (TARGET_DEBUG_ADDR \
2124 && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \
2125 { \
2126 fprintf (stderr, "Encode %s, public = %d\n", \
2127 IDENTIFIER_POINTER (DECL_NAME (DECL)), \
2128 TREE_PUBLIC (DECL)); \
2129 } \
2130 \
2131 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
2132 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
2133 || ! TREE_PUBLIC (DECL)); \
2134 } \
2135 } \
2136 } \
c98f8742 2137while (0)
d398b3b1 2138
638b724c
MM
2139/* The `FINALIZE_PIC' macro serves as a hook to emit these special
2140 codes once the function is being compiled into assembly code, but
2141 not before. (It is not done before, because in the case of
2142 compiling an inline function, it would lead to multiple PIC
2143 prologues being included in functions which used inline functions
2144 and were compiled to assembly language.) */
2145
2146#define FINALIZE_PIC \
2147do \
2148 { \
638b724c
MM
2149 current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
2150 } \
2151while (0)
2152
b08de47e
MM
2153\f
2154/* If defined, a C expression whose value is nonzero if IDENTIFIER
2155 with arguments ARGS is a valid machine specific attribute for DECL.
2156 The attributes in ATTRIBUTES have previously been assigned to DECL. */
2157
7db4b149 2158#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
e075ae69 2159 (ix86_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
b08de47e
MM
2160
2161/* If defined, a C expression whose value is nonzero if IDENTIFIER
2162 with arguments ARGS is a valid machine specific attribute for TYPE.
2163 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
2164
7db4b149 2165#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
e075ae69 2166 (ix86_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
b08de47e
MM
2167
2168/* If defined, a C expression whose value is zero if the attributes on
2169 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
2170 two if they are nearly compatible (which causes a warning to be
2171 generated). */
2172
2173#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
e075ae69 2174 (ix86_comp_type_attributes (TYPE1, TYPE2))
b08de47e
MM
2175
2176/* If defined, a C statement that assigns default attributes to newly
2177 defined TYPE. */
2178
2179/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
2180
2181/* Max number of args passed in registers. If this is more than 3, we will
2182 have problems with ebx (register #4), since it is a caller save register and
2183 is also used as the pic register in ELF. So for now, don't allow more than
2184 3 registers to be passed in registers. */
2185
2186#define REGPARM_MAX 3
2187
c98f8742
JVA
2188\f
2189/* Specify the machine mode that this machine uses
2190 for the index in the tablejump instruction. */
2191#define CASE_VECTOR_MODE Pmode
2192
18543a22
ILT
2193/* Define as C expression which evaluates to nonzero if the tablejump
2194 instruction expects the table to contain offsets from the address of the
2195 table.
2196 Do not define this if the table should contain absolute addresses. */
2197/* #define CASE_VECTOR_PC_RELATIVE 1 */
c98f8742
JVA
2198
2199/* Specify the tree operation to be used to convert reals to integers.
2200 This should be changed to take advantage of fist --wfs ??
2201 */
2202#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2203
2204/* This is the kind of divide that is easiest to do in the general case. */
2205#define EASY_DIV_EXPR TRUNC_DIV_EXPR
2206
2207/* Define this as 1 if `char' should by default be signed; else as 0. */
2208#define DEFAULT_SIGNED_CHAR 1
2209
2210/* Max number of bytes we can move from memory to memory
2211 in one reasonably fast instruction. */
65d9c0ab
JH
2212#define MOVE_MAX 16
2213
2214/* MOVE_MAX_PIECES is the number of bytes at a time which we can
2215 move efficiently, as opposed to MOVE_MAX which is the maximum
2216 number of bytes we can move with a single instruction. */
2217#define MOVE_MAX_PIECES (TARGET_64BIT ? 8 : 4)
c98f8742 2218
7e24ffc9
HPN
2219/* If a memory-to-memory move would take MOVE_RATIO or more simple
2220 move-instruction pairs, we will do a movstr or libcall instead.
2221 Increasing the value will always make code faster, but eventually
2222 incurs high cost in increased code size.
c98f8742 2223
e2e52e1b 2224 If you don't define this, a reasonable default is used. */
c98f8742 2225
e2e52e1b 2226#define MOVE_RATIO (optimize_size ? 3 : ix86_cost->move_ratio)
c98f8742
JVA
2227
2228/* Define if shifts truncate the shift count
2229 which implies one can omit a sign-extension or zero-extension
2230 of a shift count. */
241e1a89 2231/* On i386, shifts do truncate the count. But bit opcodes don't. */
c98f8742
JVA
2232
2233/* #define SHIFT_COUNT_TRUNCATED */
2234
2235/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2236 is done just by pretending it is already truncated. */
2237#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2238
2239/* We assume that the store-condition-codes instructions store 0 for false
2240 and some other value for true. This is the value stored for true. */
2241
2242#define STORE_FLAG_VALUE 1
2243
2244/* When a prototype says `char' or `short', really pass an `int'.
2245 (The 386 can't easily push less than an int.) */
2246
cb560352 2247#define PROMOTE_PROTOTYPES 1
c98f8742 2248
d9f32422
JH
2249/* A macro to update M and UNSIGNEDP when an object whose type is
2250 TYPE and which has the specified mode and signedness is to be
2251 stored in a register. This macro is only called when TYPE is a
2252 scalar type.
2253
2254 On i386 it is sometimes usefull to promote HImode and QImode
2255 quantities to SImode. The choice depends on target type. */
2256
2257#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
2258 if (((MODE) == HImode && TARGET_PROMOTE_HI_REGS) \
2259 || ((MODE) == QImode && TARGET_PROMOTE_QI_REGS)) \
2260 (MODE) = SImode;
2261
c98f8742
JVA
2262/* Specify the machine mode that pointers have.
2263 After generation of rtl, the compiler makes no further distinction
2264 between pointers and any other objects of this machine mode. */
65d9c0ab 2265#define Pmode (TARGET_64BIT ? DImode : SImode)
c98f8742
JVA
2266
2267/* A function address in a call instruction
2268 is a byte address (for indexing purposes)
2269 so give the MEM rtx a byte's mode. */
2270#define FUNCTION_MODE QImode
d4ba09c0
SC
2271\f
2272/* A part of a C `switch' statement that describes the relative costs
2273 of constant RTL expressions. It must contain `case' labels for
2274 expression codes `const_int', `const', `symbol_ref', `label_ref'
2275 and `const_double'. Each case must ultimately reach a `return'
2276 statement to return the relative cost of the use of that kind of
2277 constant value in an expression. The cost may depend on the
2278 precise value of the constant, which is available for examination
2279 in X, and the rtx code of the expression in which it is contained,
2280 found in OUTER_CODE.
2281
2282 CODE is the expression code--redundant, since it can be obtained
2283 with `GET_CODE (X)'. */
c98f8742 2284
3bb22aee 2285#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
c98f8742 2286 case CONST_INT: \
e5e809f4 2287 return (unsigned) INTVAL (RTX) < 256 ? 0 : 1; \
c98f8742
JVA
2288 case CONST: \
2289 case LABEL_REF: \
2290 case SYMBOL_REF: \
76565a24 2291 return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \
d4ba09c0 2292 \
c98f8742
JVA
2293 case CONST_DOUBLE: \
2294 { \
7488be4e
JVA
2295 int code; \
2296 if (GET_MODE (RTX) == VOIDmode) \
2297 return 2; \
d4ba09c0 2298 \
7488be4e 2299 code = standard_80387_constant_p (RTX); \
c98f8742
JVA
2300 return code == 1 ? 0 : \
2301 code == 2 ? 1 : \
2302 2; \
3bb22aee 2303 }
c98f8742 2304
76565a24 2305/* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
e075ae69
RH
2306#define TOPLEVEL_COSTS_N_INSNS(N) \
2307 do { total = COSTS_N_INSNS (N); goto egress_rtx_costs; } while (0)
76565a24 2308
d4ba09c0
SC
2309/* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
2310 This can be used, for example, to indicate how costly a multiply
2311 instruction is. In writing this macro, you can use the construct
2312 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
2313 instructions. OUTER_CODE is the code of the expression in which X
2314 is contained.
2315
2316 This macro is optional; do not define it if the default cost
2317 assumptions are adequate for the target machine. */
2318
2319#define RTX_COSTS(X,CODE,OUTER_CODE) \
2320 case ASHIFT: \
2321 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
2322 && GET_MODE (XEXP (X, 0)) == SImode) \
2323 { \
2324 HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
d4ba09c0 2325 if (value == 1) \
e075ae69 2326 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
d4ba09c0 2327 if (value == 2 || value == 3) \
e075ae69 2328 TOPLEVEL_COSTS_N_INSNS (ix86_cost->lea); \
d4ba09c0
SC
2329 } \
2330 /* fall through */ \
2331 \
2332 case ROTATE: \
2333 case ASHIFTRT: \
2334 case LSHIFTRT: \
2335 case ROTATERT: \
76565a24
SC
2336 if (GET_MODE (XEXP (X, 0)) == DImode) \
2337 { \
2338 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
54d26233
MH
2339 { \
2340 if (INTVAL (XEXP (X, 1)) > 32) \
e075ae69
RH
2341 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const + 2); \
2342 else \
2343 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_const * 2); \
2344 } \
2345 else \
2346 { \
2347 if (GET_CODE (XEXP (X, 1)) == AND) \
2348 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 2); \
2349 else \
2350 TOPLEVEL_COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2); \
54d26233 2351 } \
76565a24 2352 } \
e075ae69
RH
2353 else \
2354 { \
2355 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
2356 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_const); \
2357 else \
2358 TOPLEVEL_COSTS_N_INSNS (ix86_cost->shift_var); \
2359 } \
2360 break; \
d4ba09c0
SC
2361 \
2362 case MULT: \
2363 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
2364 { \
2365 unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
2366 int nbits = 0; \
2367 \
2368 while (value != 0) \
2369 { \
2370 nbits++; \
2371 value >>= 1; \
2372 } \
2373 \
630c79be
BS
2374 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
2375 + nbits * ix86_cost->mult_bit); \
d4ba09c0 2376 } \
d4ba09c0 2377 else /* This is arbitrary */ \
76565a24
SC
2378 TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
2379 + 7 * ix86_cost->mult_bit); \
d4ba09c0
SC
2380 \
2381 case DIV: \
2382 case UDIV: \
2383 case MOD: \
2384 case UMOD: \
76565a24 2385 TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \
d4ba09c0
SC
2386 \
2387 case PLUS: \
e075ae69
RH
2388 if (GET_CODE (XEXP (X, 0)) == PLUS \
2389 && GET_CODE (XEXP (XEXP (X, 0), 0)) == MULT \
2390 && GET_CODE (XEXP (XEXP (XEXP (X, 0), 0), 1)) == CONST_INT \
2391 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
2392 { \
2393 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 0), 0), 1)); \
2394 if (val == 2 || val == 4 || val == 8) \
2395 { \
2396 return (COSTS_N_INSNS (ix86_cost->lea) \
2397 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
2398 + rtx_cost (XEXP (XEXP (XEXP (X, 0), 0), 0), OUTER_CODE) \
2399 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
2400 } \
2401 } \
2402 else if (GET_CODE (XEXP (X, 0)) == MULT \
2403 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \
2404 { \
2405 HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \
2406 if (val == 2 || val == 4 || val == 8) \
2407 { \
2408 return (COSTS_N_INSNS (ix86_cost->lea) \
2409 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
2410 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
2411 } \
2412 } \
2413 else if (GET_CODE (XEXP (X, 0)) == PLUS) \
2414 { \
2415 return (COSTS_N_INSNS (ix86_cost->lea) \
2416 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
2417 + rtx_cost (XEXP (XEXP (X, 0), 1), OUTER_CODE) \
2418 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
2419 } \
d4ba09c0
SC
2420 \
2421 /* fall through */ \
2422 case AND: \
2423 case IOR: \
2424 case XOR: \
2425 case MINUS: \
76565a24 2426 if (GET_MODE (X) == DImode) \
e075ae69
RH
2427 return (COSTS_N_INSNS (ix86_cost->add) * 2 \
2428 + (rtx_cost (XEXP (X, 0), OUTER_CODE) \
2429 << (GET_MODE (XEXP (X, 0)) != DImode)) \
2430 + (rtx_cost (XEXP (X, 1), OUTER_CODE) \
2431 << (GET_MODE (XEXP (X, 1)) != DImode))); \
2432 \
2433 /* fall through */ \
d4ba09c0
SC
2434 case NEG: \
2435 case NOT: \
76565a24 2436 if (GET_MODE (X) == DImode) \
e075ae69
RH
2437 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2); \
2438 TOPLEVEL_COSTS_N_INSNS (ix86_cost->add); \
2439 \
2440 egress_rtx_costs: \
2441 break;
d4ba09c0
SC
2442
2443
2444/* An expression giving the cost of an addressing mode that contains
2445 ADDRESS. If not defined, the cost is computed from the ADDRESS
2446 expression and the `CONST_COSTS' values.
2447
2448 For most CISC machines, the default cost is a good approximation
2449 of the true cost of the addressing mode. However, on RISC
2450 machines, all instructions normally have the same length and
2451 execution time. Hence all addresses will have equal costs.
2452
2453 In cases where more than one form of an address is known, the form
2454 with the lowest cost will be used. If multiple forms have the
2455 same, lowest, cost, the one that is the most complex will be used.
2456
2457 For example, suppose an address that is equal to the sum of a
2458 register and a constant is used twice in the same basic block.
2459 When this macro is not defined, the address will be computed in a
2460 register and memory references will be indirect through that
2461 register. On machines where the cost of the addressing mode
2462 containing the sum is no higher than that of a simple indirect
2463 reference, this will produce an additional instruction and
2464 possibly require an additional register. Proper specification of
2465 this macro eliminates this overhead for such machines.
2466
2467 Similar use of this macro is made in strength reduction of loops.
2468
2469 ADDRESS need not be valid as an address. In such a case, the cost
2470 is not relevant and can be any value; invalid addresses need not be
2471 assigned a different cost.
2472
2473 On machines where an address involving more than one register is as
2474 cheap as an address computation involving only one register,
2475 defining `ADDRESS_COST' to reflect this can cause two registers to
2476 be live over a region of code where only one would have been if
2477 `ADDRESS_COST' were not defined in that manner. This effect should
2478 be considered in the definition of this macro. Equivalent costs
2479 should probably only be given to addresses with different numbers
2480 of registers on machines with lots of registers.
2481
2482 This macro will normally either not be defined or be defined as a
2483 constant.
c98f8742
JVA
2484
2485 For i386, it is better to use a complex address than let gcc copy
2486 the address into a reg and make a new pseudo. But not if the address
2487 requires to two regs - that would mean more pseudos with longer
2488 lifetimes. */
2489
2490#define ADDRESS_COST(RTX) \
0806f95f 2491 ix86_address_cost (RTX)
d4ba09c0 2492
96e7ae40
JH
2493/* A C expression for the cost of moving data from a register in class FROM to
2494 one in class TO. The classes are expressed using the enumeration values
2495 such as `GENERAL_REGS'. A value of 2 is the default; other values are
2496 interpreted relative to that.
d4ba09c0 2497
96e7ae40
JH
2498 It is not required that the cost always equal 2 when FROM is the same as TO;
2499 on some machines it is expensive to move between registers if they are not
f84aa48a 2500 general registers. */
d4ba09c0 2501
f84aa48a 2502#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
e76d65d2 2503 ix86_register_move_cost (MODE, CLASS1, CLASS2)
d4ba09c0
SC
2504
2505/* A C expression for the cost of moving data of mode M between a
2506 register and memory. A value of 2 is the default; this cost is
2507 relative to those in `REGISTER_MOVE_COST'.
2508
2509 If moving between registers and memory is more expensive than
2510 between two registers, you should define this macro to express the
fa79946e 2511 relative cost. */
d4ba09c0 2512
fa79946e
JH
2513#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
2514 ix86_memory_move_cost (MODE, CLASS, IN)
d4ba09c0
SC
2515
2516/* A C expression for the cost of a branch instruction. A value of 1
2517 is the default; other values are interpreted relative to that. */
2518
e075ae69 2519#define BRANCH_COST ix86_branch_cost
d4ba09c0
SC
2520
2521/* Define this macro as a C expression which is nonzero if accessing
2522 less than a word of memory (i.e. a `char' or a `short') is no
2523 faster than accessing a word of memory, i.e., if such access
2524 require more than one instruction or if there is no difference in
2525 cost between byte and (aligned) word loads.
2526
2527 When this macro is not defined, the compiler will access a field by
2528 finding the smallest containing object; when it is defined, a
2529 fullword load will be used if alignment permits. Unless bytes
2530 accesses are faster than word accesses, using word accesses is
2531 preferable since it may eliminate subsequent memory access if
2532 subsequent accesses occur to other fields in the same word of the
2533 structure, but to different bytes. */
2534
2535#define SLOW_BYTE_ACCESS 0
2536
2537/* Nonzero if access to memory by shorts is slow and undesirable. */
2538#define SLOW_SHORT_ACCESS 0
2539
2540/* Define this macro if zero-extension (of a `char' or `short' to an
2541 `int') can be done faster if the destination is a register that is
2542 known to be zero.
2543
2544 If you define this macro, you must have instruction patterns that
2545 recognize RTL structures like this:
2546
2547 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
2548
2549 and likewise for `HImode'. */
2550
2551/* #define SLOW_ZERO_EXTEND */
2552
2553/* Define this macro to be the value 1 if unaligned accesses have a
2554 cost many times greater than aligned accesses, for example if they
2555 are emulated in a trap handler.
2556
2557 When this macro is non-zero, the compiler will act as if
2558 `STRICT_ALIGNMENT' were non-zero when generating code for block
2559 moves. This can cause significantly more instructions to be
2560 produced. Therefore, do not set this macro non-zero if unaligned
2561 accesses only add a cycle or two to the time for a memory access.
2562
2563 If the value of this macro is always zero, it need not be defined. */
2564
e1565e65 2565/* #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 0 */
d4ba09c0
SC
2566
2567/* Define this macro to inhibit strength reduction of memory
2568 addresses. (On some machines, such strength reduction seems to do
2569 harm rather than good.) */
2570
2571/* #define DONT_REDUCE_ADDR */
2572
2573/* Define this macro if it is as good or better to call a constant
2574 function address than to call an address kept in a register.
2575
2576 Desirable on the 386 because a CALL with a constant address is
2577 faster than one with a register address. */
2578
2579#define NO_FUNCTION_CSE
2580
2581/* Define this macro if it is as good or better for a function to call
2582 itself with an explicit address than to call an address kept in a
2583 register. */
2584
2585#define NO_RECURSIVE_FUNCTION_CSE
2586
2587/* A C statement (sans semicolon) to update the integer variable COST
2588 based on the relationship between INSN that is dependent on
2589 DEP_INSN through the dependence LINK. The default is to make no
2590 adjustment to COST. This can be used for example to specify to
2591 the scheduler that an output- or anti-dependence does not incur
2592 the same cost as a data-dependence. */
2593
e075ae69
RH
2594#define ADJUST_COST(insn,link,dep_insn,cost) \
2595 (cost) = ix86_adjust_cost(insn, link, dep_insn, cost)
d4ba09c0 2596
e075ae69
RH
2597#define ISSUE_RATE \
2598 ix86_issue_rate ()
2599
79c2ffde 2600#define MD_SCHED_INIT(DUMP, SCHED_VERBOSE, MAX_READY) \
e075ae69 2601 ix86_sched_init (DUMP, SCHED_VERBOSE)
d4ba09c0 2602
e075ae69
RH
2603#define MD_SCHED_REORDER(DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK, CIM) \
2604 (CIM) = ix86_sched_reorder (DUMP, SCHED_VERBOSE, READY, N_READY, CLOCK)
a269a03c 2605
e075ae69
RH
2606#define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \
2607 ((CAN_ISSUE_MORE) = \
2608 ix86_variable_issue (DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE))
c98f8742 2609\f
c572e5ba
JVA
2610/* Add any extra modes needed to represent the condition code.
2611
e075ae69
RH
2612 For the i386, we need separate modes when floating-point
2613 equality comparisons are being done.
9076b9c1
JH
2614
2615 Add CCNO to indicate comparisons against zero that requires
7e08e190
JH
2616 Overflow flag to be unset. Sign bit test is used instead and
2617 thus can be used to form "a&b>0" type of tests.
9076b9c1
JH
2618
2619 Add CCGC to indicate comparisons agains zero that allows
2620 unspecified garbage in the Carry flag. This mode is used
2621 by inc/dec instructions.
e075ae69 2622
2c873473 2623 Add CCGOC to indicate comparisons agains zero that allows
9076b9c1
JH
2624 unspecified garbage in the Carry and Overflow flag. This
2625 mode is used to simulate comparisons of (a-b) and (a+b)
2626 against zero using sub/cmp/add operations.
16189740 2627
7e08e190 2628 Add CCZ to indicate that only the Zero flag is valid. */
c572e5ba 2629
e075ae69 2630#define EXTRA_CC_MODES \
9076b9c1
JH
2631 CC(CCGCmode, "CCGC") \
2632 CC(CCGOCmode, "CCGOC") \
e075ae69 2633 CC(CCNOmode, "CCNO") \
16189740 2634 CC(CCZmode, "CCZ") \
e075ae69
RH
2635 CC(CCFPmode, "CCFP") \
2636 CC(CCFPUmode, "CCFPU")
c572e5ba
JVA
2637
2638/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2639 return the mode to be used for the comparison.
2640
2641 For floating-point equality comparisons, CCFPEQmode should be used.
e075ae69 2642 VOIDmode should be used in all other cases.
c572e5ba 2643
16189740 2644 For integer comparisons against zero, reduce to CCNOmode or CCZmode if
e075ae69 2645 possible, to allow for more combinations. */
c98f8742 2646
9076b9c1 2647#define SELECT_CC_MODE(OP,X,Y) ix86_cc_mode (OP, X, Y)
9e7adcb3
JH
2648
2649/* Return non-zero if MODE implies a floating point inequality can be
2650 reversed. */
2651
2652#define REVERSIBLE_CC_MODE(MODE) 1
2653
2654/* A C expression whose value is reversed condition code of the CODE for
2655 comparison done in CC_MODE mode. */
2656#define REVERSE_CONDITION(CODE, MODE) \
2657 ((MODE) != CCFPmode && (MODE) != CCFPUmode ? reverse_condition (CODE) \
2658 : reverse_condition_maybe_unordered (CODE))
2659
c98f8742
JVA
2660\f
2661/* Control the assembler format that we output, to the extent
2662 this does not vary between assemblers. */
2663
2664/* How to refer to registers in assembler output.
2665 This sequence is indexed by compiler's hard-register-number (see above). */
2666
2667/* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
2668 For non floating point regs, the following are the HImode names.
2669
2670 For float regs, the stack top is sometimes referred to as "%st(0)"
9e06e321 2671 instead of just "%st". PRINT_REG handles this with the "y" code. */
c98f8742 2672
e075ae69
RH
2673#define HI_REGISTER_NAMES \
2674{"ax","dx","cx","bx","si","di","bp","sp", \
2675 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
564d80f4 2676 "flags","fpsr", "dirflag", "frame" }
c98f8742 2677
a7180f70
BS
2678#undef HI_REGISTER_NAMES
2679#define HI_REGISTER_NAMES \
2680{"ax","dx","cx","bx","si","di","bp","sp", \
2681 "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
2682 "flags","fpsr", "dirflag", "frame", \
2683 "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7", \
3f3f2124
JH
2684 "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" , \
2685 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
2686 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"}
a7180f70 2687
c98f8742
JVA
2688#define REGISTER_NAMES HI_REGISTER_NAMES
2689
2690/* Table of additional register names to use in user input. */
2691
2692#define ADDITIONAL_REGISTER_NAMES \
54d26233
MH
2693{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \
2694 { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \
3f3f2124
JH
2695 { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 }, \
2696 { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 }, \
54d26233 2697 { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \
a7180f70
BS
2698 { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 }, \
2699 { "mm0", 8}, { "mm1", 9}, { "mm2", 10}, { "mm3", 11}, \
2700 { "mm4", 12}, { "mm5", 13}, { "mm6", 14}, { "mm7", 15} }
c98f8742
JVA
2701
2702/* Note we are omitting these since currently I don't know how
2703to get gcc to use these, since they want the same but different
2704number as al, and ax.
2705*/
2706
c98f8742 2707#define QI_REGISTER_NAMES \
3f3f2124 2708{"al", "dl", "cl", "bl", "sil", "dil", "bpl", "spl",}
c98f8742
JVA
2709
2710/* These parallel the array above, and can be used to access bits 8:15
2711 of regs 0 through 3. */
2712
2713#define QI_HIGH_REGISTER_NAMES \
2714{"ah", "dh", "ch", "bh", }
2715
a7180f70
BS
2716#define MMX_REGISTER_NAMES \
2717{0,0,0,0,0,0,0,0,"mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7"}
2718
c98f8742
JVA
2719/* How to renumber registers for dbx and gdb. */
2720
0f7fa3d0
JH
2721#define DBX_REGISTER_NUMBER(n) \
2722 (TARGET_64BIT ? dbx64_register_map[n] : dbx_register_map[n])
83774849
RH
2723
2724extern int const dbx_register_map[FIRST_PSEUDO_REGISTER];
0f7fa3d0 2725extern int const dbx64_register_map[FIRST_PSEUDO_REGISTER];
83774849 2726extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
c98f8742 2727
469ac993
JM
2728/* Before the prologue, RA is at 0(%esp). */
2729#define INCOMING_RETURN_ADDR_RTX \
f64cecad 2730 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
c5c76735 2731
e414ab29
RH
2732/* After the prologue, RA is at -4(AP) in the current frame. */
2733#define RETURN_ADDR_RTX(COUNT, FRAME) \
2734 ((COUNT) == 0 \
0f7fa3d0
JH
2735 ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, TARGET_64BIT ? -8 : -4))\
2736 : gen_rtx_MEM (Pmode, plus_constant (FRAME, TARGET_64BIT ? 8 : 4)))
e414ab29 2737
469ac993 2738/* PC is dbx register 8; let's use that column for RA. */
0f7fa3d0 2739#define DWARF_FRAME_RETURN_COLUMN (TARGET_64BIT ? 16 : 8)
469ac993 2740
a6ab3aad 2741/* Before the prologue, the top of the frame is at 4(%esp). */
0f7fa3d0 2742#define INCOMING_FRAME_SP_OFFSET UNITS_PER_WORD
a6ab3aad 2743
c98f8742
JVA
2744/* This is how to output the definition of a user-level label named NAME,
2745 such as the label on a static function or variable NAME. */
2746
2747#define ASM_OUTPUT_LABEL(FILE,NAME) \
2748 (assemble_name (FILE, NAME), fputs (":\n", FILE))
2749
2750/* This is how to output an assembler line defining a `double' constant. */
2751
0038aea6
JVA
2752#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2753do { long l[2]; \
2754 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
e075ae69 2755 fprintf (FILE, "%s\t0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
0038aea6 2756 } while (0)
c98f8742 2757
0038aea6
JVA
2758/* This is how to output a `long double' extended real constant. */
2759
2760#undef ASM_OUTPUT_LONG_DOUBLE
2761#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2b589241 2762do { long l[4]; \
0038aea6 2763 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
2b589241
JH
2764 if (TARGET_128BIT_LONG_DOUBLE) \
2765 fprintf (FILE, "%s\t0x%lx,0x%lx,0x%lx,0x0\n", ASM_LONG, l[0], l[1], l[2]); \
2766 else \
2767 fprintf (FILE, "%s\t0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
0038aea6 2768 } while (0)
c98f8742
JVA
2769
2770/* This is how to output an assembler line defining a `float' constant. */
2771
0038aea6
JVA
2772#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2773do { long l; \
2774 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
e075ae69 2775 fprintf ((FILE), "%s\t0x%lx\n", ASM_LONG, l); \
c98f8742
JVA
2776 } while (0)
2777
c98f8742
JVA
2778/* Store in OUTPUT a string (made with alloca) containing
2779 an assembler-name for a local static variable named NAME.
2780 LABELNO is an integer which is different for each call. */
2781
2782#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2783( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2784 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2785
c98f8742
JVA
2786/* This is how to output an assembler line defining an `int' constant. */
2787
2788#define ASM_OUTPUT_INT(FILE,VALUE) \
e075ae69 2789( fprintf (FILE, "%s\t", ASM_LONG), \
c98f8742
JVA
2790 output_addr_const (FILE,(VALUE)), \
2791 putc('\n',FILE))
2792
2793/* Likewise for `char' and `short' constants. */
2794/* is this supposed to do align too?? */
2795
2796#define ASM_OUTPUT_SHORT(FILE,VALUE) \
e075ae69 2797( fprintf (FILE, "%s\t", ASM_SHORT), \
c98f8742
JVA
2798 output_addr_const (FILE,(VALUE)), \
2799 putc('\n',FILE))
2800
c98f8742 2801#define ASM_OUTPUT_CHAR(FILE,VALUE) \
f0ca81d2 2802( fprintf (FILE, "%s", ASM_BYTE_OP), \
c98f8742
JVA
2803 output_addr_const (FILE, (VALUE)), \
2804 putc ('\n', FILE))
2805
2806/* This is how to output an assembler line for a numeric constant byte. */
2807
2808#define ASM_OUTPUT_BYTE(FILE,VALUE) \
f0ca81d2 2809 asm_fprintf ((FILE), "%s0x%x\n", ASM_BYTE_OP, (VALUE))
c98f8742
JVA
2810
2811/* This is how to output an insn to push a register on the stack.
2812 It need not be very fast code. */
2813
2814#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
e075ae69 2815 asm_fprintf (FILE, "\tpush{l}\t%%e%s\n", reg_names[REGNO])
c98f8742
JVA
2816
2817/* This is how to output an insn to pop a register from the stack.
2818 It need not be very fast code. */
2819
2820#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
e075ae69 2821 asm_fprintf (FILE, "\tpop{l}\t%%e%s\n", reg_names[REGNO])
c98f8742
JVA
2822
2823/* This is how to output an element of a case-vector that is absolute.
2824 */
2825
2826#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2827 fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
2828
2829/* This is how to output an element of a case-vector that is relative.
2830 We don't use these on the 386 yet, because the ATT assembler can't do
2831 forward reference the differences.
2832 */
2833
33f7f353 2834#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
e075ae69 2835 fprintf (FILE, "\t%s\t%s%d-%s%d\n",ASM_LONG, LPREFIX, VALUE, LPREFIX, REL)
c98f8742 2836
1865dbb5
JM
2837/* A C statement that outputs an address constant appropriate to
2838 for DWARF debugging. */
2839
2840#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,X) \
2841 i386_dwarf_output_addr_const((FILE),(X))
2842
2843/* Either simplify a location expression, or return the original. */
2844
2845#define ASM_SIMPLIFY_DWARF_ADDR(X) \
2846 i386_simplify_dwarf_addr(X)
2847
c98f8742
JVA
2848/* Define the parentheses used to group arithmetic operations
2849 in assembler code. */
2850
2851#define ASM_OPEN_PAREN ""
2852#define ASM_CLOSE_PAREN ""
2853
2854/* Define results of standard character escape sequences. */
2855#define TARGET_BELL 007
2856#define TARGET_BS 010
2857#define TARGET_TAB 011
2858#define TARGET_NEWLINE 012
2859#define TARGET_VT 013
2860#define TARGET_FF 014
2861#define TARGET_CR 015
74b42c8b 2862\f
c98f8742
JVA
2863/* Print operand X (an rtx) in assembler syntax to file FILE.
2864 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2865 The CODE z takes the size of operand from the following digit, and
2866 outputs b,w,or l respectively.
2867
2868 On the 80386, we use several such letters:
2869 f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
0038aea6 2870 L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
c98f8742
JVA
2871 R -- print the prefix for register names.
2872 z -- print the opcode suffix for the size of the current operand.
2873 * -- print a star (in certain assembler syntax)
fb204271 2874 A -- print an absolute memory reference.
5cb6195d
RH
2875 P -- if PIC, print an @PLT suffix.
2876 X -- don't print any sort of PIC '@' suffix for a symbol.
5cb6195d
RH
2877 s -- ??? something to do with double shifts. not actually used, afaik.
2878 C -- print a conditional move suffix corresponding to the op code.
2879 c -- likewise, but reverse the condition.
2880 F,f -- likewise, but for floating-point. */
c98f8742
JVA
2881
2882#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
e075ae69 2883 ((CODE) == '*')
c98f8742 2884
74b42c8b
RS
2885/* Print the name of a register based on its machine mode and number.
2886 If CODE is 'w', pretend the mode is HImode.
2887 If CODE is 'b', pretend the mode is QImode.
2888 If CODE is 'k', pretend the mode is SImode.
3f3f2124 2889 If CODE is 'd', pretend the mode is DImode.
74b42c8b
RS
2890 If CODE is 'h', pretend the reg is the `high' byte register.
2891 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
2892
e075ae69
RH
2893#define PRINT_REG(X, CODE, FILE) \
2894 print_reg (X, CODE, FILE)
74b42c8b 2895
c98f8742
JVA
2896#define PRINT_OPERAND(FILE, X, CODE) \
2897 print_operand (FILE, X, CODE)
c98f8742
JVA
2898
2899#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
2900 print_operand_address (FILE, ADDR)
2901
aa3e8d2a
JVA
2902/* Print the name of a register for based on its machine mode and number.
2903 This macro is used to print debugging output.
2904 This macro is different from PRINT_REG in that it may be used in
2905 programs that are not linked with aux-output.o. */
2906
e075ae69 2907#define DEBUG_PRINT_REG(X, CODE, FILE) \
69ddee61
KG
2908 do { static const char * const hi_name[] = HI_REGISTER_NAMES; \
2909 static const char * const qi_name[] = QI_REGISTER_NAMES; \
e075ae69
RH
2910 fprintf (FILE, "%d ", REGNO (X)); \
2911 if (REGNO (X) == FLAGS_REG) \
2912 { fputs ("flags", FILE); break; } \
7c7ef435
JH
2913 if (REGNO (X) == DIRFLAG_REG) \
2914 { fputs ("dirflag", FILE); break; } \
e075ae69
RH
2915 if (REGNO (X) == FPSR_REG) \
2916 { fputs ("fpsr", FILE); break; } \
aa3e8d2a
JVA
2917 if (REGNO (X) == ARG_POINTER_REGNUM) \
2918 { fputs ("argp", FILE); break; } \
564d80f4
JH
2919 if (REGNO (X) == FRAME_POINTER_REGNUM) \
2920 { fputs ("frame", FILE); break; } \
aa3e8d2a
JVA
2921 if (STACK_TOP_P (X)) \
2922 { fputs ("st(0)", FILE); break; } \
b0ceea8c
RK
2923 if (FP_REG_P (X)) \
2924 { fputs (hi_name[REGNO(X)], FILE); break; } \
3f3f2124
JH
2925 if (REX_INT_REG_P (X)) \
2926 { \
2927 switch (GET_MODE_SIZE (GET_MODE (X))) \
2928 { \
2929 default: \
2930 case 8: \
2931 fprintf (FILE, "r%i", REGNO (X) \
2932 - FIRST_REX_INT_REG + 8); \
2933 break; \
2934 case 4: \
2935 fprintf (FILE, "r%id", REGNO (X) \
2936 - FIRST_REX_INT_REG + 8); \
2937 break; \
2938 case 2: \
2939 fprintf (FILE, "r%iw", REGNO (X) \
2940 - FIRST_REX_INT_REG + 8); \
2941 break; \
2942 case 1: \
2943 fprintf (FILE, "r%ib", REGNO (X) \
2944 - FIRST_REX_INT_REG + 8); \
2945 break; \
2946 } \
2947 break; \
2948 } \
aa3e8d2a
JVA
2949 switch (GET_MODE_SIZE (GET_MODE (X))) \
2950 { \
3f3f2124
JH
2951 case 8: \
2952 fputs ("r", FILE); \
2953 fputs (hi_name[REGNO (X)], FILE); \
2954 break; \
b0ceea8c
RK
2955 default: \
2956 fputs ("e", FILE); \
aa3e8d2a
JVA
2957 case 2: \
2958 fputs (hi_name[REGNO (X)], FILE); \
2959 break; \
2960 case 1: \
2961 fputs (qi_name[REGNO (X)], FILE); \
2962 break; \
2963 } \
2964 } while (0)
2965
c98f8742
JVA
2966/* Routines in libgcc that return floats must return them in an fp reg,
2967 just as other functions do which return such values.
2968 These macros make that happen. */
2969
2970#define FLOAT_VALUE_TYPE float
2971#define INTIFY(FLOATVAL) FLOATVAL
2972
c98f8742
JVA
2973/* a letter which is not needed by the normal asm syntax, which
2974 we can use for operand syntax in the extended asm */
2975
2976#define ASM_OPERAND_LETTER '#'
c98f8742 2977#define RET return ""
f64cecad 2978#define AT_SP(mode) (gen_rtx_MEM ((mode), stack_pointer_rtx))
d4ba09c0 2979\f
e075ae69
RH
2980/* Define the codes that are matched by predicates in i386.c. */
2981
2982#define PREDICATE_CODES \
8bad7136 2983 {"const_int_1_operand", {CONST_INT}}, \
e075ae69 2984 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
2247f6ed
JH
2985 {"aligned_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
2986 LABEL_REF, SUBREG, REG, MEM}}, \
e075ae69 2987 {"pic_symbolic_operand", {CONST}}, \
e1ff012c 2988 {"call_insn_operand", {REG, SUBREG, MEM, SYMBOL_REF}}, \
eaf19aba 2989 {"constant_call_address_operand", {SYMBOL_REF, CONST}}, \
e075ae69
RH
2990 {"const0_operand", {CONST_INT, CONST_DOUBLE}}, \
2991 {"const1_operand", {CONST_INT}}, \
2992 {"const248_operand", {CONST_INT}}, \
2993 {"incdec_operand", {CONST_INT}}, \
915119a5 2994 {"mmx_reg_operand", {REG}}, \
e075ae69 2995 {"reg_no_sp_operand", {SUBREG, REG}}, \
2c5a510c
RH
2996 {"general_no_elim_operand", {CONST_INT, CONST_DOUBLE, CONST, \
2997 SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM}}, \
2998 {"nonmemory_no_elim_operand", {CONST_INT, REG, SUBREG}}, \
e075ae69
RH
2999 {"q_regs_operand", {SUBREG, REG}}, \
3000 {"non_q_regs_operand", {SUBREG, REG}}, \
9e7adcb3
JH
3001 {"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU, UNORDERED, \
3002 ORDERED, LT, UNLT, GT, UNGT, LE, UNLE, \
3003 GE, UNGE, LTGT, UNEQ}}, \
bf71a4f8
JH
3004 {"sse_comparison_operator", {EQ, LT, LE, UNORDERED, NE, UNGE, UNGT, \
3005 ORDERED, UNEQ, UNLT, UNLE, LTGT, GE, GT \
3006 }}, \
9076b9c1 3007 {"ix86_comparison_operator", {EQ, NE, LE, LT, GE, GT, LEU, LTU, GEU, \
9e7adcb3
JH
3008 GTU, UNORDERED, ORDERED, UNLE, UNLT, \
3009 UNGE, UNGT, LTGT, UNEQ }}, \
e075ae69
RH
3010 {"cmp_fp_expander_operand", {CONST_DOUBLE, SUBREG, REG, MEM}}, \
3011 {"ext_register_operand", {SUBREG, REG}}, \
3012 {"binary_fp_operator", {PLUS, MINUS, MULT, DIV}}, \
3013 {"mult_operator", {MULT}}, \
3014 {"div_operator", {DIV}}, \
3015 {"arith_or_logical_operator", {PLUS, MULT, AND, IOR, XOR, SMIN, SMAX, \
3016 UMIN, UMAX, COMPARE, MINUS, DIV, MOD, \
3017 UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT, \
3018 LSHIFTRT, ROTATERT}}, \
e9e80858 3019 {"promotable_binary_operator", {PLUS, MULT, AND, IOR, XOR, ASHIFT}}, \
e075ae69
RH
3020 {"memory_displacement_operand", {MEM}}, \
3021 {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
6343a50e
ZW
3022 LABEL_REF, SUBREG, REG, MEM, AND}}, \
3023 {"long_memory_operand", {MEM}},
c76aab11
RH
3024
3025/* A list of predicates that do special things with modes, and so
3026 should not elicit warnings for VOIDmode match_operand. */
3027
3028#define SPECIAL_MODE_PREDICATES \
3029 "ext_register_operand",
c98f8742 3030\f
f5316dfe 3031/* Variables in i386.c */
9c23aa47
ZW
3032extern const char *ix86_cpu_string; /* for -mcpu=<xxx> */
3033extern const char *ix86_arch_string; /* for -march=<xxx> */
e075ae69
RH
3034extern const char *ix86_regparm_string; /* # registers to use to pass args */
3035extern const char *ix86_align_loops_string; /* power of two alignment for loops */
3036extern const char *ix86_align_jumps_string; /* power of two alignment for non-loop jumps */
3037extern const char *ix86_align_funcs_string; /* power of two alignment for functions */
3038extern const char *ix86_preferred_stack_boundary_string;/* power of two alignment for stack boundary */
3039extern const char *ix86_branch_cost_string; /* values 1-5: see jump.c */
3040extern int ix86_regparm; /* ix86_regparm_string as a number */
3041extern int ix86_align_loops; /* power of two alignment for loops */
3042extern int ix86_align_jumps; /* power of two alignment for non-loop jumps */
3043extern int ix86_align_funcs; /* power of two alignment for functions */
3044extern int ix86_preferred_stack_boundary; /* preferred stack boundary alignment in bits */
3045extern int ix86_branch_cost; /* values 1-5: see jump.c */
3046extern const char * const hi_reg_name[]; /* names for 16 bit regs */
3047extern const char * const qi_reg_name[]; /* names for 8 bit regs (low) */
3048extern const char * const qi_high_reg_name[]; /* names for 8 bit regs (high) */
3049extern enum reg_class const regclass_map[]; /* smalled class containing REGNO */
3050extern struct rtx_def *ix86_compare_op0; /* operand 0 for comparisons */
3051extern struct rtx_def *ix86_compare_op1; /* operand 1 for comparisons */
3b3c6a3f 3052\f
c98f8742
JVA
3053/*
3054Local variables:
3055version-control: t
3056End:
3057*/