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