]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/arm/arm.h
sh.c (max_labelno_before_reorg): New variable.
[thirdparty/gcc.git] / gcc / config / arm / arm.h
CommitLineData
f5a1b0d2 1/* Definitions of target machine for GNU compiler, for ARM.
cf011243 2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
020a4035 3 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
35d965d5 4 Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
8b109b37 5 and Martin Simmons (@harleqn.co.uk).
949d79eb 6 More major hacks by Richard Earnshaw (rearnsha@arm.com)
6cfc7210
NC
7 Minor hacks by Nick Clifton (nickc@cygnus.com)
8
4f448245 9 This file is part of GCC.
35d965d5 10
4f448245
NC
11 GCC is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published
13 by the Free Software Foundation; either version 2, or (at your
14 option) any later version.
35d965d5 15
4f448245
NC
16 GCC is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
35d965d5 20
4f448245
NC
21 You should have received a copy of the GNU General Public License
22 along with GCC; see the file COPYING. If not, write to
39d14dda
KC
23 the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
24 MA 02110-1301, USA. */
35d965d5 25
88657302
RH
26#ifndef GCC_ARM_H
27#define GCC_ARM_H
b355a481 28
35fd3193 29/* The architecture define. */
78011587
PB
30extern char arm_arch_name[];
31
e6471be6
NB
32/* Target CPU builtins. */
33#define TARGET_CPU_CPP_BUILTINS() \
34 do \
35 { \
9b66ebb1
PB
36 /* Define __arm__ even when in thumb mode, for \
37 consistency with armcc. */ \
38 builtin_define ("__arm__"); \
61f0ccff 39 builtin_define ("__APCS_32__"); \
9b66ebb1 40 if (TARGET_THUMB) \
e6471be6
NB
41 builtin_define ("__thumb__"); \
42 \
43 if (TARGET_BIG_END) \
44 { \
45 builtin_define ("__ARMEB__"); \
46 if (TARGET_THUMB) \
47 builtin_define ("__THUMBEB__"); \
48 if (TARGET_LITTLE_WORDS) \
49 builtin_define ("__ARMWEL__"); \
50 } \
51 else \
52 { \
53 builtin_define ("__ARMEL__"); \
54 if (TARGET_THUMB) \
55 builtin_define ("__THUMBEL__"); \
56 } \
57 \
e6471be6
NB
58 if (TARGET_SOFT_FLOAT) \
59 builtin_define ("__SOFTFP__"); \
60 \
9b66ebb1 61 if (TARGET_VFP) \
b5b620a4
JT
62 builtin_define ("__VFP_FP__"); \
63 \
e6471be6
NB
64 /* Add a define for interworking. \
65 Needed when building libgcc.a. */ \
2ad4dcf9 66 if (arm_cpp_interwork) \
e6471be6
NB
67 builtin_define ("__THUMB_INTERWORK__"); \
68 \
69 builtin_assert ("cpu=arm"); \
70 builtin_assert ("machine=arm"); \
78011587
PB
71 \
72 builtin_define (arm_arch_name); \
73 if (arm_arch_cirrus) \
74 builtin_define ("__MAVERICK__"); \
75 if (arm_arch_xscale) \
76 builtin_define ("__XSCALE__"); \
77 if (arm_arch_iwmmxt) \
78 builtin_define ("__IWMMXT__"); \
4adf3e34
PB
79 if (TARGET_AAPCS_BASED) \
80 builtin_define ("__ARM_EABI__"); \
e6471be6
NB
81 } while (0)
82
9b66ebb1
PB
83/* The various ARM cores. */
84enum processor_type
85{
d98a72fd
RE
86#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
87 IDENT,
9b66ebb1
PB
88#include "arm-cores.def"
89#undef ARM_CORE
90 /* Used to indicate that no processor has been specified. */
91 arm_none
92};
93
78011587
PB
94enum target_cpus
95{
d98a72fd
RE
96#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
97 TARGET_CPU_##IDENT,
78011587
PB
98#include "arm-cores.def"
99#undef ARM_CORE
100 TARGET_CPU_generic
101};
102
9b66ebb1
PB
103/* The processor for which instructions should be scheduled. */
104extern enum processor_type arm_tune;
105
d5b7b3ae 106typedef enum arm_cond_code
89c7ca52
RE
107{
108 ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC,
109 ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV
d5b7b3ae
RE
110}
111arm_cc;
6cfc7210 112
d5b7b3ae 113extern arm_cc arm_current_cc;
ff9940b0 114
d5b7b3ae 115#define ARM_INVERSE_CONDITION_CODE(X) ((arm_cc) (((int)X) ^ 1))
89c7ca52 116
6cfc7210
NC
117extern int arm_target_label;
118extern int arm_ccfsm_state;
e2500fed 119extern GTY(()) rtx arm_target_insn;
d5b7b3ae 120/* Define the information needed to generate branch insns. This is
e2500fed
GK
121 stored from the compare operation. */
122extern GTY(()) rtx arm_compare_op0;
123extern GTY(()) rtx arm_compare_op1;
d5b7b3ae 124/* The label of the current constant pool. */
e2500fed 125extern rtx pool_vector_label;
d5b7b3ae 126/* Set to 1 when a return insn is output, this means that the epilogue
d6b4baa4 127 is not needed. */
d5b7b3ae 128extern int return_used_this_function;
e2500fed
GK
129/* Used to produce AOF syntax assembler. */
130extern GTY(()) rtx aof_pic_label;
35d965d5 131\f
d6b4baa4 132/* Just in case configure has failed to define anything. */
7a801826
RE
133#ifndef TARGET_CPU_DEFAULT
134#define TARGET_CPU_DEFAULT TARGET_CPU_generic
135#endif
136
7a801826 137
5742588d 138#undef CPP_SPEC
78011587 139#define CPP_SPEC "%(subtarget_cpp_spec) \
e6471be6
NB
140%{msoft-float:%{mhard-float: \
141 %e-msoft-float and -mhard_float may not be used together}} \
142%{mbig-endian:%{mlittle-endian: \
143 %e-mbig-endian and -mlittle-endian may not be used together}}"
7a801826 144
be393ecf 145#ifndef CC1_SPEC
dfa08768 146#define CC1_SPEC ""
be393ecf 147#endif
7a801826
RE
148
149/* This macro defines names of additional specifications to put in the specs
150 that can be used in various specifications like CC1_SPEC. Its definition
151 is an initializer with a subgrouping for each command option.
152
153 Each subgrouping contains a string constant, that defines the
4f448245 154 specification name, and a string constant that used by the GCC driver
7a801826
RE
155 program.
156
157 Do not define this macro if it does not need to do anything. */
158#define EXTRA_SPECS \
38fc909b 159 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
7a801826
RE
160 SUBTARGET_EXTRA_SPECS
161
914a3b8c 162#ifndef SUBTARGET_EXTRA_SPECS
7a801826 163#define SUBTARGET_EXTRA_SPECS
914a3b8c
DM
164#endif
165
6cfc7210 166#ifndef SUBTARGET_CPP_SPEC
38fc909b 167#define SUBTARGET_CPP_SPEC ""
6cfc7210 168#endif
35d965d5
RS
169\f
170/* Run-time Target Specification. */
ff9940b0 171#ifndef TARGET_VERSION
6cfc7210 172#define TARGET_VERSION fputs (" (ARM/generic)", stderr);
ff9940b0 173#endif
35d965d5 174
9b66ebb1 175#define TARGET_SOFT_FLOAT (arm_float_abi == ARM_FLOAT_ABI_SOFT)
72cdc543
PB
176/* Use hardware floating point instructions. */
177#define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT)
178/* Use hardware floating point calling convention. */
179#define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD)
9b66ebb1
PB
180#define TARGET_FPA (arm_fp_model == ARM_FP_MODEL_FPA)
181#define TARGET_MAVERICK (arm_fp_model == ARM_FP_MODEL_MAVERICK)
182#define TARGET_VFP (arm_fp_model == ARM_FP_MODEL_VFP)
5a9335ef
NC
183#define TARGET_IWMMXT (arm_arch_iwmmxt)
184#define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_ARM)
5848830f 185#define TARGET_IWMMXT_ABI (TARGET_ARM && arm_abi == ARM_ABI_IWMMXT)
d5b7b3ae
RE
186#define TARGET_ARM (! TARGET_THUMB)
187#define TARGET_EITHER 1 /* (TARGET_ARM | TARGET_THUMB) */
c54c7322
RS
188#define TARGET_BACKTRACE (leaf_function_p () \
189 ? TARGET_TPCS_LEAF_FRAME \
190 : TARGET_TPCS_FRAME)
fdd695fd 191#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN)
b6685939
PB
192#define TARGET_AAPCS_BASED \
193 (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS)
3ada8e17 194
d3585b76
DJ
195#define TARGET_HARD_TP (target_thread_pointer == TP_CP15)
196#define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT)
197
b3f8d95d
MM
198/* True iff the full BPABI is being used. If TARGET_BPABI is true,
199 then TARGET_AAPCS_BASED must be true -- but the converse does not
200 hold. TARGET_BPABI implies the use of the BPABI runtime library,
201 etc., in addition to just the AAPCS calling conventions. */
202#ifndef TARGET_BPABI
203#define TARGET_BPABI false
f676971a 204#endif
b3f8d95d 205
7816bea0
DJ
206/* Support for a compile-time default CPU, et cetera. The rules are:
207 --with-arch is ignored if -march or -mcpu are specified.
208 --with-cpu is ignored if -march or -mcpu are specified, and is overridden
209 by --with-arch.
210 --with-tune is ignored if -mtune or -mcpu are specified (but not affected
211 by -march).
9b66ebb1
PB
212 --with-float is ignored if -mhard-float, -msoft-float or -mfloat-abi are
213 specified.
5848830f
PB
214 --with-fpu is ignored if -mfpu is specified.
215 --with-abi is ignored is -mabi is specified. */
7816bea0
DJ
216#define OPTION_DEFAULT_SPECS \
217 {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
218 {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
219 {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \
9b66ebb1
PB
220 {"float", \
221 "%{!msoft-float:%{!mhard-float:%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}}}" }, \
5848830f
PB
222 {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \
223 {"abi", "%{!mabi=*:-mabi=%(VALUE)}"},
7816bea0 224
9b66ebb1
PB
225/* Which floating point model to use. */
226enum arm_fp_model
227{
228 ARM_FP_MODEL_UNKNOWN,
229 /* FPA model (Hardware or software). */
230 ARM_FP_MODEL_FPA,
231 /* Cirrus Maverick floating point model. */
232 ARM_FP_MODEL_MAVERICK,
233 /* VFP floating point model. */
234 ARM_FP_MODEL_VFP
235};
236
237extern enum arm_fp_model arm_fp_model;
238
239/* Which floating point hardware is available. Also update
240 fp_model_for_fpu in arm.c when adding entries to this list. */
29ad9694 241enum fputype
24f0c1b4 242{
9b66ebb1
PB
243 /* No FP hardware. */
244 FPUTYPE_NONE,
29ad9694
RE
245 /* Full FPA support. */
246 FPUTYPE_FPA,
247 /* Emulated FPA hardware, Issue 2 emulator (no LFM/SFM). */
248 FPUTYPE_FPA_EMU2,
249 /* Emulated FPA hardware, Issue 3 emulator. */
250 FPUTYPE_FPA_EMU3,
251 /* Cirrus Maverick floating point co-processor. */
9b66ebb1
PB
252 FPUTYPE_MAVERICK,
253 /* VFP. */
254 FPUTYPE_VFP
24f0c1b4
RE
255};
256
257/* Recast the floating point class to be the floating point attribute. */
29ad9694 258#define arm_fpu_attr ((enum attr_fpu) arm_fpu_tune)
24f0c1b4 259
71791e16 260/* What type of floating point to tune for */
29ad9694 261extern enum fputype arm_fpu_tune;
24f0c1b4 262
71791e16 263/* What type of floating point instructions are available */
29ad9694 264extern enum fputype arm_fpu_arch;
71791e16 265
9b66ebb1
PB
266enum float_abi_type
267{
268 ARM_FLOAT_ABI_SOFT,
269 ARM_FLOAT_ABI_SOFTFP,
270 ARM_FLOAT_ABI_HARD
271};
272
273extern enum float_abi_type arm_float_abi;
274
3d8532aa
PB
275#ifndef TARGET_DEFAULT_FLOAT_ABI
276#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
277#endif
278
5848830f
PB
279/* Which ABI to use. */
280enum arm_abi_type
281{
282 ARM_ABI_APCS,
283 ARM_ABI_ATPCS,
284 ARM_ABI_AAPCS,
077fc835
KH
285 ARM_ABI_IWMMXT,
286 ARM_ABI_AAPCS_LINUX
5848830f
PB
287};
288
289extern enum arm_abi_type arm_abi;
290
291#ifndef ARM_DEFAULT_ABI
292#define ARM_DEFAULT_ABI ARM_ABI_APCS
293#endif
294
d3585b76
DJ
295/* Which thread pointer access sequence to use. */
296enum arm_tp_type {
297 TP_AUTO,
298 TP_SOFT,
299 TP_CP15
300};
301
302extern enum arm_tp_type target_thread_pointer;
303
9b66ebb1
PB
304/* Nonzero if this chip supports the ARM Architecture 3M extensions. */
305extern int arm_arch3m;
11c1a207 306
9b66ebb1 307/* Nonzero if this chip supports the ARM Architecture 4 extensions. */
11c1a207
RE
308extern int arm_arch4;
309
68d560d4
RE
310/* Nonzero if this chip supports the ARM Architecture 4T extensions. */
311extern int arm_arch4t;
312
9b66ebb1 313/* Nonzero if this chip supports the ARM Architecture 5 extensions. */
62b10bbc
NC
314extern int arm_arch5;
315
9b66ebb1 316/* Nonzero if this chip supports the ARM Architecture 5E extensions. */
b15bca31
RE
317extern int arm_arch5e;
318
9b66ebb1
PB
319/* Nonzero if this chip supports the ARM Architecture 6 extensions. */
320extern int arm_arch6;
321
f5a1b0d2
NC
322/* Nonzero if this chip can benefit from load scheduling. */
323extern int arm_ld_sched;
324
0616531f
RE
325/* Nonzero if generating thumb code. */
326extern int thumb_code;
327
f5a1b0d2 328/* Nonzero if this chip is a StrongARM. */
abac3b49 329extern int arm_tune_strongarm;
f5a1b0d2 330
9b6b54e2 331/* Nonzero if this chip is a Cirrus variant. */
78011587 332extern int arm_arch_cirrus;
9b6b54e2 333
5a9335ef
NC
334/* Nonzero if this chip supports Intel XScale with Wireless MMX technology. */
335extern int arm_arch_iwmmxt;
336
d19fb8e3 337/* Nonzero if this chip is an XScale. */
4b3c2e48
PB
338extern int arm_arch_xscale;
339
abac3b49 340/* Nonzero if tuning for XScale. */
4b3c2e48 341extern int arm_tune_xscale;
d19fb8e3 342
abac3b49
RE
343/* Nonzero if tuning for stores via the write buffer. */
344extern int arm_tune_wbuf;
f5a1b0d2 345
2ad4dcf9 346/* Nonzero if we should define __THUMB_INTERWORK__ in the
f676971a 347 preprocessor.
2ad4dcf9
RE
348 XXX This is a bit of a hack, it's intended to help work around
349 problems in GLD which doesn't understand that armv5t code is
350 interworking clean. */
351extern int arm_cpp_interwork;
352
2ce9c1b9 353#ifndef TARGET_DEFAULT
c54c7322 354#define TARGET_DEFAULT (MASK_APCS_FRAME)
2ce9c1b9 355#endif
35d965d5 356
11c1a207
RE
357/* The frame pointer register used in gcc has nothing to do with debugging;
358 that is controlled by the APCS-FRAME option. */
d5b7b3ae 359#define CAN_DEBUG_WITHOUT_FP
35d965d5 360
11c1a207 361#define OVERRIDE_OPTIONS arm_override_options ()
86efdc8e
PB
362
363/* Nonzero if PIC code requires explicit qualifiers to generate
364 PLT and GOT relocs rather than the assembler doing so implicitly.
ed0e6530
PB
365 Subtargets can override these if required. */
366#ifndef NEED_GOT_RELOC
367#define NEED_GOT_RELOC 0
368#endif
369#ifndef NEED_PLT_RELOC
370#define NEED_PLT_RELOC 0
e2723c62 371#endif
84306176
PB
372
373/* Nonzero if we need to refer to the GOT with a PC-relative
374 offset. In other words, generate
375
f676971a 376 .word _GLOBAL_OFFSET_TABLE_ - [. - (.Lxx + 8)]
84306176
PB
377
378 rather than
379
380 .word _GLOBAL_OFFSET_TABLE_ - (.Lxx + 8)
381
f676971a 382 The default is true, which matches NetBSD. Subtargets can
84306176
PB
383 override this if required. */
384#ifndef GOT_PCREL
385#define GOT_PCREL 1
386#endif
35d965d5
RS
387\f
388/* Target machine storage Layout. */
389
ff9940b0
RE
390
391/* Define this macro if it is advisable to hold scalars in registers
392 in a wider mode than that declared by the program. In such cases,
393 the value is constrained to be within the bounds of the declared
394 type, but kept valid in the wider mode. The signedness of the
395 extension may differ from that of the type. */
396
397/* It is far faster to zero extend chars than to sign extend them */
398
6cfc7210 399#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
2ce9c1b9
RE
400 if (GET_MODE_CLASS (MODE) == MODE_INT \
401 && GET_MODE_SIZE (MODE) < 4) \
402 { \
403 if (MODE == QImode) \
404 UNSIGNEDP = 1; \
405 else if (MODE == HImode) \
61f0ccff 406 UNSIGNEDP = 1; \
2ce9c1b9 407 (MODE) = SImode; \
ff9940b0
RE
408 }
409
d4453b7a 410#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
866af8a9
JB
411 if ((GET_MODE_CLASS (MODE) == MODE_INT \
412 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \
413 && GET_MODE_SIZE (MODE) < 4) \
414 (MODE) = SImode; \
d4453b7a 415
35d965d5
RS
416/* Define this if most significant bit is lowest numbered
417 in instructions that operate on numbered bit-fields. */
418#define BITS_BIG_ENDIAN 0
419
f676971a 420/* Define this if most significant byte of a word is the lowest numbered.
3ada8e17
DE
421 Most ARM processors are run in little endian mode, so that is the default.
422 If you want to have it run-time selectable, change the definition in a
423 cover file to be TARGET_BIG_ENDIAN. */
11c1a207 424#define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0)
35d965d5
RS
425
426/* Define this if most significant word of a multiword number is the lowest
11c1a207
RE
427 numbered.
428 This is always false, even when in big-endian mode. */
ddee6aba
RE
429#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN && ! TARGET_LITTLE_WORDS)
430
431/* LIBGCC2_WORDS_BIG_ENDIAN has to be a constant, so we define this based
432 on processor pre-defineds when compiling libgcc2.c. */
433#if defined(__ARMEB__) && !defined(__ARMWEL__)
434#define LIBGCC2_WORDS_BIG_ENDIAN 1
435#else
436#define LIBGCC2_WORDS_BIG_ENDIAN 0
437#endif
35d965d5 438
11c1a207 439/* Define this if most significant word of doubles is the lowest numbered.
f0375c66
NC
440 The rules are different based on whether or not we use FPA-format,
441 VFP-format or some other floating point co-processor's format doubles. */
b5b620a4 442#define FLOAT_WORDS_BIG_ENDIAN (arm_float_words_big_endian ())
7fc6c9f0 443
35d965d5
RS
444#define UNITS_PER_WORD 4
445
5848830f 446/* True if natural alignment is used for doubleword types. */
b6685939
PB
447#define ARM_DOUBLEWORD_ALIGN TARGET_AAPCS_BASED
448
5848830f 449#define DOUBLEWORD_ALIGNMENT 64
35d965d5 450
5848830f 451#define PARM_BOUNDARY 32
5a9335ef 452
5848830f 453#define STACK_BOUNDARY (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
35d965d5 454
5848830f
PB
455#define PREFERRED_STACK_BOUNDARY \
456 (arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY)
0977774b 457
35d965d5
RS
458#define FUNCTION_BOUNDARY 32
459
92928d71
AO
460/* The lowest bit is used to indicate Thumb-mode functions, so the
461 vbit must go into the delta field of pointers to member
462 functions. */
463#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta
464
35d965d5
RS
465#define EMPTY_FIELD_BOUNDARY 32
466
5848830f 467#define BIGGEST_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
5a9335ef 468
27847754
NC
469/* XXX Blah -- this macro is used directly by libobjc. Since it
470 supports no vector modes, cut out the complexity and fall back
471 on BIGGEST_FIELD_ALIGNMENT. */
472#ifdef IN_TARGET_LIBS
8fca31a2 473#define BIGGEST_FIELD_ALIGNMENT 64
27847754 474#endif
5a9335ef 475
ff9940b0 476/* Make strings word-aligned so strcpy from constants will be faster. */
591af218 477#define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2)
f676971a 478
d19fb8e3 479#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
5848830f
PB
480 ((TREE_CODE (EXP) == STRING_CST \
481 && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR) \
482 ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN))
ff9940b0 483
723ae7c1
NC
484/* Setting STRUCTURE_SIZE_BOUNDARY to 32 produces more efficient code, but the
485 value set in previous versions of this toolchain was 8, which produces more
486 compact structures. The command line option -mstructure_size_boundary=<n>
f710504c 487 can be used to change this value. For compatibility with the ARM SDK
723ae7c1 488 however the value should be left at 32. ARM SDT Reference Manual (ARM DUI
5848830f
PB
489 0020D) page 2-20 says "Structures are aligned on word boundaries".
490 The AAPCS specifies a value of 8. */
6ead9ba5
NC
491#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary
492extern int arm_structure_size_boundary;
723ae7c1 493
4912a07c 494/* This is the value used to initialize arm_structure_size_boundary. If a
723ae7c1 495 particular arm target wants to change the default value it should change
6bc82793 496 the definition of this macro, not STRUCTURE_SIZE_BOUNDARY. See netbsd.h
723ae7c1
NC
497 for an example of this. */
498#ifndef DEFAULT_STRUCTURE_SIZE_BOUNDARY
499#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 32
b355a481 500#endif
2a5307b1 501
825dda42 502/* Nonzero if move instructions will actually fail to work
ff9940b0 503 when given unaligned data. */
35d965d5 504#define STRICT_ALIGNMENT 1
b6685939
PB
505
506/* wchar_t is unsigned under the AAPCS. */
507#ifndef WCHAR_TYPE
508#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "int")
509
510#define WCHAR_TYPE_SIZE BITS_PER_WORD
511#endif
512
513#ifndef SIZE_TYPE
514#define SIZE_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long unsigned int")
515#endif
d81d0bdd 516
077fc835
KH
517#ifndef PTRDIFF_TYPE
518#define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int")
519#endif
520
d81d0bdd
PB
521/* AAPCS requires that structure alignment is affected by bitfields. */
522#ifndef PCC_BITFIELD_TYPE_MATTERS
523#define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED
524#endif
525
35d965d5
RS
526\f
527/* Standard register usage. */
528
529/* Register allocation in ARM Procedure Call Standard (as used on RISCiX):
530 (S - saved over call).
531
532 r0 * argument word/integer result
533 r1-r3 argument word
534
535 r4-r8 S register variable
536 r9 S (rfp) register variable (real frame pointer)
f676971a 537
f5a1b0d2 538 r10 F S (sl) stack limit (used by -mapcs-stack-check)
35d965d5
RS
539 r11 F S (fp) argument pointer
540 r12 (ip) temp workspace
541 r13 F S (sp) lower end of current stack frame
542 r14 (lr) link address/workspace
543 r15 F (pc) program counter
544
545 f0 floating point result
546 f1-f3 floating point scratch
547
548 f4-f7 S floating point variable
549
ff9940b0
RE
550 cc This is NOT a real register, but is used internally
551 to represent things that use or set the condition
552 codes.
553 sfp This isn't either. It is used during rtl generation
554 since the offset between the frame pointer and the
555 auto's isn't known until after register allocation.
556 afp Nor this, we only need this because of non-local
557 goto. Without it fp appears to be used and the
558 elimination code won't get rid of sfp. It tracks
559 fp exactly at all times.
560
35d965d5
RS
561 *: See CONDITIONAL_REGISTER_USAGE */
562
9b6b54e2
NC
563/*
564 mvf0 Cirrus floating point result
565 mvf1-mvf3 Cirrus floating point scratch
566 mvf4-mvf15 S Cirrus floating point variable. */
567
9b66ebb1
PB
568/* s0-s15 VFP scratch (aka d0-d7).
569 s16-s31 S VFP variable (aka d8-d15).
570 vfpcc Not a real register. Represents the VFP condition
571 code flags. */
572
ff9940b0
RE
573/* The stack backtrace structure is as follows:
574 fp points to here: | save code pointer | [fp]
575 | return link value | [fp, #-4]
576 | return sp value | [fp, #-8]
577 | return fp value | [fp, #-12]
578 [| saved r10 value |]
579 [| saved r9 value |]
580 [| saved r8 value |]
581 [| saved r7 value |]
582 [| saved r6 value |]
583 [| saved r5 value |]
584 [| saved r4 value |]
585 [| saved r3 value |]
586 [| saved r2 value |]
587 [| saved r1 value |]
588 [| saved r0 value |]
589 [| saved f7 value |] three words
590 [| saved f6 value |] three words
591 [| saved f5 value |] three words
592 [| saved f4 value |] three words
593 r0-r3 are not normally saved in a C function. */
594
35d965d5
RS
595/* 1 for registers that have pervasive standard uses
596 and are not available for the register allocator. */
9b66ebb1
PB
597#define FIXED_REGISTERS \
598{ \
599 0,0,0,0,0,0,0,0, \
600 0,0,0,0,0,1,0,1, \
601 0,0,0,0,0,0,0,0, \
9b6b54e2
NC
602 1,1,1, \
603 1,1,1,1,1,1,1,1, \
9b66ebb1
PB
604 1,1,1,1,1,1,1,1, \
605 1,1,1,1,1,1,1,1, \
606 1,1,1,1,1,1,1,1, \
607 1,1,1,1, \
608 1,1,1,1,1,1,1,1, \
609 1,1,1,1,1,1,1,1, \
610 1,1,1,1,1,1,1,1, \
611 1,1,1,1,1,1,1,1, \
612 1 \
35d965d5
RS
613}
614
615/* 1 for registers not available across function calls.
616 These must include the FIXED_REGISTERS and also any
617 registers that can be used without being saved.
618 The latter must include the registers where values are returned
619 and the register where structure-value addresses are passed.
ff9940b0 620 Aside from that, you can include as many other registers as you like.
f676971a 621 The CC is not preserved over function calls on the ARM 6, so it is
d6b4baa4 622 easier to assume this for all. SFP is preserved, since FP is. */
35d965d5
RS
623#define CALL_USED_REGISTERS \
624{ \
625 1,1,1,1,0,0,0,0, \
d5b7b3ae 626 0,0,0,0,1,1,1,1, \
ff9940b0 627 1,1,1,1,0,0,0,0, \
9b6b54e2
NC
628 1,1,1, \
629 1,1,1,1,1,1,1,1, \
5a9335ef
NC
630 1,1,1,1,1,1,1,1, \
631 1,1,1,1,1,1,1,1, \
632 1,1,1,1,1,1,1,1, \
9b66ebb1
PB
633 1,1,1,1, \
634 1,1,1,1,1,1,1,1, \
635 1,1,1,1,1,1,1,1, \
636 1,1,1,1,1,1,1,1, \
637 1,1,1,1,1,1,1,1, \
638 1 \
35d965d5
RS
639}
640
6cc8c0b3
NC
641#ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE
642#define SUBTARGET_CONDITIONAL_REGISTER_USAGE
643#endif
644
d5b7b3ae
RE
645#define CONDITIONAL_REGISTER_USAGE \
646{ \
4b02997f
NC
647 int regno; \
648 \
9b66ebb1 649 if (TARGET_SOFT_FLOAT || TARGET_THUMB || !TARGET_FPA) \
d5b7b3ae 650 { \
9b66ebb1
PB
651 for (regno = FIRST_FPA_REGNUM; \
652 regno <= LAST_FPA_REGNUM; ++regno) \
d5b7b3ae
RE
653 fixed_regs[regno] = call_used_regs[regno] = 1; \
654 } \
9b6b54e2 655 \
c769a35d
RE
656 if (TARGET_THUMB && optimize_size) \
657 { \
658 /* When optimizing for size, it's better not to use \
659 the HI regs, because of the overhead of stacking \
d6b4baa4 660 them. */ \
c769a35d
RE
661 for (regno = FIRST_HI_REGNUM; \
662 regno <= LAST_HI_REGNUM; ++regno) \
663 fixed_regs[regno] = call_used_regs[regno] = 1; \
664 } \
665 \
fb14bc89
RE
666 /* The link register can be clobbered by any branch insn, \
667 but we have no way to track that at present, so mark \
668 it as unavailable. */ \
669 if (TARGET_THUMB) \
670 fixed_regs[LR_REGNUM] = call_used_regs[LR_REGNUM] = 1; \
671 \
9b66ebb1 672 if (TARGET_ARM && TARGET_HARD_FLOAT) \
9b6b54e2 673 { \
9b66ebb1 674 if (TARGET_MAVERICK) \
9b6b54e2 675 { \
9b66ebb1
PB
676 for (regno = FIRST_FPA_REGNUM; \
677 regno <= LAST_FPA_REGNUM; ++ regno) \
678 fixed_regs[regno] = call_used_regs[regno] = 1; \
679 for (regno = FIRST_CIRRUS_FP_REGNUM; \
680 regno <= LAST_CIRRUS_FP_REGNUM; ++ regno) \
681 { \
682 fixed_regs[regno] = 0; \
683 call_used_regs[regno] = regno < FIRST_CIRRUS_FP_REGNUM + 4; \
684 } \
685 } \
686 if (TARGET_VFP) \
687 { \
688 for (regno = FIRST_VFP_REGNUM; \
689 regno <= LAST_VFP_REGNUM; ++ regno) \
690 { \
691 fixed_regs[regno] = 0; \
692 call_used_regs[regno] = regno < FIRST_VFP_REGNUM + 16; \
693 } \
9b6b54e2
NC
694 } \
695 } \
696 \
5a9335ef
NC
697 if (TARGET_REALLY_IWMMXT) \
698 { \
699 regno = FIRST_IWMMXT_GR_REGNUM; \
700 /* The 2002/10/09 revision of the XScale ABI has wCG0 \
701 and wCG1 as call-preserved registers. The 2002/11/21 \
702 revision changed this so that all wCG registers are \
703 scratch registers. */ \
704 for (regno = FIRST_IWMMXT_GR_REGNUM; \
705 regno <= LAST_IWMMXT_GR_REGNUM; ++ regno) \
119bb233 706 fixed_regs[regno] = 0; \
5a9335ef
NC
707 /* The XScale ABI has wR0 - wR9 as scratch registers, \
708 the rest as call-preserved registers. */ \
709 for (regno = FIRST_IWMMXT_REGNUM; \
710 regno <= LAST_IWMMXT_REGNUM; ++ regno) \
711 { \
712 fixed_regs[regno] = 0; \
713 call_used_regs[regno] = regno < FIRST_IWMMXT_REGNUM + 10; \
714 } \
715 } \
716 \
fc555370 717 if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
d5b7b3ae
RE
718 { \
719 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
720 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
721 } \
722 else if (TARGET_APCS_STACK) \
723 { \
724 fixed_regs[10] = 1; \
725 call_used_regs[10] = 1; \
726 } \
a2503645
RS
727 /* -mcaller-super-interworking reserves r11 for calls to \
728 _interwork_r11_call_via_rN(). Making the register global \
729 is an easy way of ensuring that it remains valid for all \
730 calls. */ \
685c9c11 731 if (TARGET_APCS_FRAME || TARGET_CALLER_INTERWORKING \
c54c7322 732 || TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) \
d5b7b3ae
RE
733 { \
734 fixed_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
735 call_used_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
a2503645
RS
736 if (TARGET_CALLER_INTERWORKING) \
737 global_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
d5b7b3ae
RE
738 } \
739 SUBTARGET_CONDITIONAL_REGISTER_USAGE \
35d965d5 740}
f676971a 741
6bc82793 742/* These are a couple of extensions to the formats accepted
dd18ae56
NC
743 by asm_fprintf:
744 %@ prints out ASM_COMMENT_START
745 %r prints out REGISTER_PREFIX reg_names[arg] */
746#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \
747 case '@': \
748 fputs (ASM_COMMENT_START, FILE); \
749 break; \
750 \
751 case 'r': \
752 fputs (REGISTER_PREFIX, FILE); \
753 fputs (reg_names [va_arg (ARGS, int)], FILE); \
754 break;
755
d5b7b3ae 756/* Round X up to the nearest word. */
0c2ca901 757#define ROUND_UP_WORD(X) (((X) + 3) & ~3)
d5b7b3ae 758
6cfc7210 759/* Convert fron bytes to ints. */
e9d7b180 760#define ARM_NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
6cfc7210 761
9b66ebb1
PB
762/* The number of (integer) registers required to hold a quantity of type MODE.
763 Also used for VFP registers. */
e9d7b180
JD
764#define ARM_NUM_REGS(MODE) \
765 ARM_NUM_INTS (GET_MODE_SIZE (MODE))
6cfc7210
NC
766
767/* The number of (integer) registers required to hold a quantity of TYPE MODE. */
e9d7b180
JD
768#define ARM_NUM_REGS2(MODE, TYPE) \
769 ARM_NUM_INTS ((MODE) == BLKmode ? \
d5b7b3ae 770 int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE))
6cfc7210
NC
771
772/* The number of (integer) argument register available. */
d5b7b3ae 773#define NUM_ARG_REGS 4
6cfc7210 774
093354e0 775/* Return the register number of the N'th (integer) argument. */
d5b7b3ae 776#define ARG_REGISTER(N) (N - 1)
6cfc7210 777
d5b7b3ae
RE
778/* Specify the registers used for certain standard purposes.
779 The values of these macros are register numbers. */
35d965d5 780
d5b7b3ae
RE
781/* The number of the last argument register. */
782#define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS)
35d965d5 783
c769a35d
RE
784/* The numbers of the Thumb register ranges. */
785#define FIRST_LO_REGNUM 0
6d3d9133 786#define LAST_LO_REGNUM 7
c769a35d
RE
787#define FIRST_HI_REGNUM 8
788#define LAST_HI_REGNUM 11
6d3d9133 789
617a1b71 790#ifndef TARGET_UNWIND_INFO
c9ca9b88
PB
791/* We use sjlj exceptions for backwards compatibility. */
792#define MUST_USE_SJLJ_EXCEPTIONS 1
617a1b71
PB
793#endif
794
c9ca9b88
PB
795/* We can generate DWARF2 Unwind info, even though we don't use it. */
796#define DWARF2_UNWIND_INFO 1
f676971a 797
c9ca9b88
PB
798/* Use r0 and r1 to pass exception handling information. */
799#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? N : INVALID_REGNUM)
800
6d3d9133 801/* The register that holds the return address in exception handlers. */
c9ca9b88
PB
802#define ARM_EH_STACKADJ_REGNUM 2
803#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM)
35d965d5 804
d5b7b3ae
RE
805/* The native (Norcroft) Pascal compiler for the ARM passes the static chain
806 as an invisible last argument (possible since varargs don't exist in
807 Pascal), so the following is not true. */
68dfd979 808#define STATIC_CHAIN_REGNUM (TARGET_ARM ? 12 : 9)
35d965d5 809
d5b7b3ae
RE
810/* Define this to be where the real frame pointer is if it is not possible to
811 work out the offset between the frame pointer and the automatic variables
812 until after register allocation has taken place. FRAME_POINTER_REGNUM
813 should point to a special register that we will make sure is eliminated.
814
815 For the Thumb we have another problem. The TPCS defines the frame pointer
6bc82793 816 as r11, and GCC believes that it is always possible to use the frame pointer
d5b7b3ae
RE
817 as base register for addressing purposes. (See comments in
818 find_reloads_address()). But - the Thumb does not allow high registers,
819 including r11, to be used as base address registers. Hence our problem.
820
821 The solution used here, and in the old thumb port is to use r7 instead of
822 r11 as the hard frame pointer and to have special code to generate
823 backtrace structures on the stack (if required to do so via a command line
6bc82793 824 option) using r11. This is the only 'user visible' use of r11 as a frame
d5b7b3ae
RE
825 pointer. */
826#define ARM_HARD_FRAME_POINTER_REGNUM 11
827#define THUMB_HARD_FRAME_POINTER_REGNUM 7
35d965d5 828
b15bca31
RE
829#define HARD_FRAME_POINTER_REGNUM \
830 (TARGET_ARM \
831 ? ARM_HARD_FRAME_POINTER_REGNUM \
832 : THUMB_HARD_FRAME_POINTER_REGNUM)
d5b7b3ae 833
b15bca31 834#define FP_REGNUM HARD_FRAME_POINTER_REGNUM
d5b7b3ae 835
b15bca31
RE
836/* Register to use for pushing function arguments. */
837#define STACK_POINTER_REGNUM SP_REGNUM
d5b7b3ae
RE
838
839/* ARM floating pointer registers. */
9b66ebb1
PB
840#define FIRST_FPA_REGNUM 16
841#define LAST_FPA_REGNUM 23
2fa330b2
PB
842#define IS_FPA_REGNUM(REGNUM) \
843 (((REGNUM) >= FIRST_FPA_REGNUM) && ((REGNUM) <= LAST_FPA_REGNUM))
d5b7b3ae 844
5a9335ef
NC
845#define FIRST_IWMMXT_GR_REGNUM 43
846#define LAST_IWMMXT_GR_REGNUM 46
847#define FIRST_IWMMXT_REGNUM 47
848#define LAST_IWMMXT_REGNUM 62
849#define IS_IWMMXT_REGNUM(REGNUM) \
850 (((REGNUM) >= FIRST_IWMMXT_REGNUM) && ((REGNUM) <= LAST_IWMMXT_REGNUM))
851#define IS_IWMMXT_GR_REGNUM(REGNUM) \
852 (((REGNUM) >= FIRST_IWMMXT_GR_REGNUM) && ((REGNUM) <= LAST_IWMMXT_GR_REGNUM))
853
35d965d5 854/* Base register for access to local variables of the function. */
ff9940b0
RE
855#define FRAME_POINTER_REGNUM 25
856
d5b7b3ae
RE
857/* Base register for access to arguments of the function. */
858#define ARG_POINTER_REGNUM 26
62b10bbc 859
9b6b54e2
NC
860#define FIRST_CIRRUS_FP_REGNUM 27
861#define LAST_CIRRUS_FP_REGNUM 42
862#define IS_CIRRUS_REGNUM(REGNUM) \
863 (((REGNUM) >= FIRST_CIRRUS_FP_REGNUM) && ((REGNUM) <= LAST_CIRRUS_FP_REGNUM))
864
9b66ebb1
PB
865#define FIRST_VFP_REGNUM 63
866#define LAST_VFP_REGNUM 94
867#define IS_VFP_REGNUM(REGNUM) \
868 (((REGNUM) >= FIRST_VFP_REGNUM) && ((REGNUM) <= LAST_VFP_REGNUM))
869
6f8c9bd1
NC
870/* The number of hard registers is 16 ARM + 8 FPA + 1 CC + 1 SFP + 1 AFP. */
871/* + 16 Cirrus registers take us up to 43. */
5a9335ef 872/* Intel Wireless MMX Technology registers add 16 + 4 more. */
9b66ebb1
PB
873/* VFP adds 32 + 1 more. */
874#define FIRST_PSEUDO_REGISTER 96
62b10bbc 875
2fa330b2
PB
876#define DBX_REGISTER_NUMBER(REGNO) arm_dbx_register_number (REGNO)
877
35d965d5
RS
878/* Value should be nonzero if functions must have frame pointers.
879 Zero means the frame pointer need not be set up (and parms may be accessed
f676971a 880 via the stack pointer) in functions that seem suitable.
ff9940b0
RE
881 If we have to have a frame pointer we might as well make use of it.
882 APCS says that the frame pointer does not need to be pushed in leaf
2a5307b1 883 functions, or simple tail call functions. */
a15900b5
DJ
884
885#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
886#define SUBTARGET_FRAME_POINTER_REQUIRED 0
887#endif
888
7b8b8ade
NC
889#define FRAME_POINTER_REQUIRED \
890 (current_function_has_nonlocal_label \
a15900b5 891 || SUBTARGET_FRAME_POINTER_REQUIRED \
d5b7b3ae 892 || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()))
35d965d5 893
d5b7b3ae
RE
894/* Return number of consecutive hard regs needed starting at reg REGNO
895 to hold something of mode MODE.
896 This is ordinarily the length in words of a value of mode MODE
897 but can be less for certain modes in special long registers.
35d965d5 898
3b684012 899 On the ARM regs are UNITS_PER_WORD bits wide; FPA regs can hold any FP
d5b7b3ae
RE
900 mode. */
901#define HARD_REGNO_NREGS(REGNO, MODE) \
902 ((TARGET_ARM \
9b66ebb1 903 && REGNO >= FIRST_FPA_REGNUM \
d5b7b3ae
RE
904 && REGNO != FRAME_POINTER_REGNUM \
905 && REGNO != ARG_POINTER_REGNUM) \
9b66ebb1 906 && !IS_VFP_REGNUM (REGNO) \
e9d7b180 907 ? 1 : ARM_NUM_REGS (MODE))
35d965d5 908
4b02997f 909/* Return true if REGNO is suitable for holding a quantity of type MODE. */
d5b7b3ae 910#define HARD_REGNO_MODE_OK(REGNO, MODE) \
4b02997f 911 arm_hard_regno_mode_ok ((REGNO), (MODE))
35d965d5 912
d5b7b3ae
RE
913/* Value is 1 if it is a good idea to tie two pseudo registers
914 when one has mode MODE1 and one has mode MODE2.
915 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
916 for any hard reg, then this must be 0 for correct output. */
917#define MODES_TIEABLE_P(MODE1, MODE2) \
918 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
ff9940b0 919
5a9335ef 920#define VALID_IWMMXT_REG_MODE(MODE) \
f676971a 921 (arm_vector_mode_supported_p (MODE) || (MODE) == DImode)
5a9335ef 922
35d965d5 923/* The order in which register should be allocated. It is good to use ip
ff9940b0
RE
924 since no saving is required (though calls clobber it) and it never contains
925 function parameters. It is quite good to use lr since other calls may
f676971a 926 clobber it anyway. Allocate r0 through r3 in reverse order since r3 is
ff9940b0 927 least likely to contain a function parameter; in addition results are
d5b7b3ae 928 returned in r0. */
9b66ebb1 929
ff73fb53 930#define REG_ALLOC_ORDER \
35d965d5 931{ \
ff73fb53
NC
932 3, 2, 1, 0, 12, 14, 4, 5, \
933 6, 7, 8, 10, 9, 11, 13, 15, \
ff9940b0 934 16, 17, 18, 19, 20, 21, 22, 23, \
9b6b54e2
NC
935 27, 28, 29, 30, 31, 32, 33, 34, \
936 35, 36, 37, 38, 39, 40, 41, 42, \
5a9335ef
NC
937 43, 44, 45, 46, 47, 48, 49, 50, \
938 51, 52, 53, 54, 55, 56, 57, 58, \
939 59, 60, 61, 62, \
9b66ebb1
PB
940 24, 25, 26, \
941 78, 77, 76, 75, 74, 73, 72, 71, \
942 70, 69, 68, 67, 66, 65, 64, 63, \
943 79, 80, 81, 82, 83, 84, 85, 86, \
944 87, 88, 89, 90, 91, 92, 93, 94, \
945 95 \
35d965d5 946}
9338ffe6
PB
947
948/* Interrupt functions can only use registers that have already been
949 saved by the prologue, even if they would normally be
950 call-clobbered. */
951#define HARD_REGNO_RENAME_OK(SRC, DST) \
952 (! IS_INTERRUPT (cfun->machine->func_type) || \
953 regs_ever_live[DST])
35d965d5
RS
954\f
955/* Register and constant classes. */
956
3b684012 957/* Register classes: used to be simple, just all ARM regs or all FPA regs
d6a7951f 958 Now that the Thumb is involved it has become more complicated. */
35d965d5
RS
959enum reg_class
960{
961 NO_REGS,
3b684012 962 FPA_REGS,
9b6b54e2 963 CIRRUS_REGS,
9b66ebb1 964 VFP_REGS,
5a9335ef
NC
965 IWMMXT_GR_REGS,
966 IWMMXT_REGS,
d5b7b3ae
RE
967 LO_REGS,
968 STACK_REG,
969 BASE_REGS,
970 HI_REGS,
971 CC_REG,
9b66ebb1 972 VFPCC_REG,
35d965d5
RS
973 GENERAL_REGS,
974 ALL_REGS,
975 LIM_REG_CLASSES
976};
977
978#define N_REG_CLASSES (int) LIM_REG_CLASSES
979
d6b4baa4 980/* Give names of register classes as strings for dump file. */
35d965d5
RS
981#define REG_CLASS_NAMES \
982{ \
983 "NO_REGS", \
3b684012 984 "FPA_REGS", \
9b6b54e2 985 "CIRRUS_REGS", \
9b66ebb1 986 "VFP_REGS", \
5a9335ef
NC
987 "IWMMXT_GR_REGS", \
988 "IWMMXT_REGS", \
d5b7b3ae
RE
989 "LO_REGS", \
990 "STACK_REG", \
991 "BASE_REGS", \
992 "HI_REGS", \
993 "CC_REG", \
5384443a 994 "VFPCC_REG", \
35d965d5
RS
995 "GENERAL_REGS", \
996 "ALL_REGS", \
997}
998
999/* Define which registers fit in which classes.
1000 This is an initializer for a vector of HARD_REG_SET
1001 of length N_REG_CLASSES. */
9b66ebb1
PB
1002#define REG_CLASS_CONTENTS \
1003{ \
1004 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
1005 { 0x00FF0000, 0x00000000, 0x00000000 }, /* FPA_REGS */ \
1006 { 0xF8000000, 0x000007FF, 0x00000000 }, /* CIRRUS_REGS */ \
1007 { 0x00000000, 0x80000000, 0x7FFFFFFF }, /* VFP_REGS */ \
1008 { 0x00000000, 0x00007800, 0x00000000 }, /* IWMMXT_GR_REGS */ \
1009 { 0x00000000, 0x7FFF8000, 0x00000000 }, /* IWMMXT_REGS */ \
1010 { 0x000000FF, 0x00000000, 0x00000000 }, /* LO_REGS */ \
1011 { 0x00002000, 0x00000000, 0x00000000 }, /* STACK_REG */ \
1012 { 0x000020FF, 0x00000000, 0x00000000 }, /* BASE_REGS */ \
1013 { 0x0000FF00, 0x00000000, 0x00000000 }, /* HI_REGS */ \
1014 { 0x01000000, 0x00000000, 0x00000000 }, /* CC_REG */ \
1015 { 0x00000000, 0x00000000, 0x80000000 }, /* VFPCC_REG */ \
1016 { 0x0200FFFF, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \
1017 { 0xFAFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF } /* ALL_REGS */ \
35d965d5 1018}
4b02997f 1019
35d965d5
RS
1020/* The same information, inverted:
1021 Return the class number of the smallest class containing
1022 reg number REGNO. This could be a conditional expression
1023 or could index an array. */
d5b7b3ae 1024#define REGNO_REG_CLASS(REGNO) arm_regno_class (REGNO)
35d965d5 1025
9b66ebb1 1026/* FPA registers can't do subreg as all values are reformatted to internal
59b9a953 1027 precision. VFP registers may only be accessed in the mode they
9b66ebb1 1028 were set. */
75d2580c
RE
1029#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
1030 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
9b66ebb1
PB
1031 ? reg_classes_intersect_p (FPA_REGS, (CLASS)) \
1032 || reg_classes_intersect_p (VFP_REGS, (CLASS)) \
1033 : 0)
75d2580c 1034
cc81dde8
PB
1035/* We need to define this for LO_REGS on thumb. Otherwise we can end up
1036 using r0-r4 for function arguments, r7 for the stack frame and don't
1037 have enough left over to do doubleword arithmetic. */
1038#define CLASS_LIKELY_SPILLED_P(CLASS) \
1039 ((TARGET_THUMB && (CLASS) == LO_REGS) \
1040 || (CLASS) == CC_REG)
f676971a 1041
35d965d5 1042/* The class value for index registers, and the one for base regs. */
d5b7b3ae 1043#define INDEX_REG_CLASS (TARGET_THUMB ? LO_REGS : GENERAL_REGS)
b93a0fe6 1044#define BASE_REG_CLASS (TARGET_THUMB ? LO_REGS : GENERAL_REGS)
d5b7b3ae 1045
b93a0fe6 1046/* For the Thumb the high registers cannot be used as base registers
6bc82793 1047 when addressing quantities in QI or HI mode; if we don't know the
888d2cd6 1048 mode, then we must be conservative. */
3dcc68a4 1049#define MODE_BASE_REG_CLASS(MODE) \
b93a0fe6 1050 (TARGET_ARM ? GENERAL_REGS : \
888d2cd6
DJ
1051 (((MODE) == SImode) ? BASE_REGS : LO_REGS))
1052
1053/* For Thumb we can not support SP+reg addressing, so we return LO_REGS
1054 instead of BASE_REGS. */
1055#define MODE_BASE_REG_REG_CLASS(MODE) BASE_REG_CLASS
3dcc68a4 1056
d5b7b3ae
RE
1057/* When SMALL_REGISTER_CLASSES is nonzero, the compiler allows
1058 registers explicitly used in the rtl to be used as spill registers
1059 but prevents the compiler from extending the lifetime of these
d6b4baa4 1060 registers. */
d5b7b3ae 1061#define SMALL_REGISTER_CLASSES TARGET_THUMB
35d965d5
RS
1062
1063/* Get reg_class from a letter such as appears in the machine description.
3b684012 1064 We only need constraint `f' for FPA_REGS (`r' == GENERAL_REGS) for the
d5b7b3ae
RE
1065 ARM, but several more letters for the Thumb. */
1066#define REG_CLASS_FROM_LETTER(C) \
3b684012 1067 ( (C) == 'f' ? FPA_REGS \
9b6b54e2 1068 : (C) == 'v' ? CIRRUS_REGS \
9b66ebb1 1069 : (C) == 'w' ? VFP_REGS \
5a9335ef
NC
1070 : (C) == 'y' ? IWMMXT_REGS \
1071 : (C) == 'z' ? IWMMXT_GR_REGS \
d5b7b3ae
RE
1072 : (C) == 'l' ? (TARGET_ARM ? GENERAL_REGS : LO_REGS) \
1073 : TARGET_ARM ? NO_REGS \
1074 : (C) == 'h' ? HI_REGS \
1075 : (C) == 'b' ? BASE_REGS \
1076 : (C) == 'k' ? STACK_REG \
1077 : (C) == 'c' ? CC_REG \
1078 : NO_REGS)
35d965d5
RS
1079
1080/* The letters I, J, K, L and M in a register constraint string
1081 can be used to stand for particular ranges of immediate operands.
1082 This macro defines what the ranges are.
1083 C is the letter, and VALUE is a constant value.
1084 Return 1 if VALUE is in the range specified by C.
b4ac57ab 1085 I: immediate arithmetic operand (i.e. 8 bits shifted as required).
f676971a 1086 J: valid indexing constants.
aef1764c 1087 K: ~value ok in rhs argument of data operand.
f676971a 1088 L: -value ok in rhs argument of data operand.
3967692c 1089 M: 0..32, or a power of 2 (for shifts, or mult done by shift). */
d5b7b3ae 1090#define CONST_OK_FOR_ARM_LETTER(VALUE, C) \
aef1764c
RE
1091 ((C) == 'I' ? const_ok_for_arm (VALUE) : \
1092 (C) == 'J' ? ((VALUE) < 4096 && (VALUE) > -4096) : \
1093 (C) == 'K' ? (const_ok_for_arm (~(VALUE))) : \
3967692c
RE
1094 (C) == 'L' ? (const_ok_for_arm (-(VALUE))) : \
1095 (C) == 'M' ? (((VALUE >= 0 && VALUE <= 32)) \
1096 || (((VALUE) & ((VALUE) - 1)) == 0)) \
1097 : 0)
ff9940b0 1098
d5b7b3ae
RE
1099#define CONST_OK_FOR_THUMB_LETTER(VAL, C) \
1100 ((C) == 'I' ? (unsigned HOST_WIDE_INT) (VAL) < 256 : \
1101 (C) == 'J' ? (VAL) > -256 && (VAL) < 0 : \
1102 (C) == 'K' ? thumb_shiftable_const (VAL) : \
1103 (C) == 'L' ? (VAL) > -8 && (VAL) < 8 : \
1104 (C) == 'M' ? ((unsigned HOST_WIDE_INT) (VAL) < 1024 \
1105 && ((VAL) & 3) == 0) : \
1106 (C) == 'N' ? ((unsigned HOST_WIDE_INT) (VAL) < 32) : \
1107 (C) == 'O' ? ((VAL) >= -508 && (VAL) <= 508) \
1108 : 0)
1109
1110#define CONST_OK_FOR_LETTER_P(VALUE, C) \
1111 (TARGET_ARM ? \
1112 CONST_OK_FOR_ARM_LETTER (VALUE, C) : CONST_OK_FOR_THUMB_LETTER (VALUE, C))
f676971a 1113
9b66ebb1 1114/* Constant letter 'G' for the FP immediate constants.
d5b7b3ae
RE
1115 'H' means the same constant negated. */
1116#define CONST_DOUBLE_OK_FOR_ARM_LETTER(X, C) \
9b66ebb1 1117 ((C) == 'G' ? arm_const_double_rtx (X) : \
3b684012 1118 (C) == 'H' ? neg_const_double_rtx_ok_for_fpa (X) : 0)
d5b7b3ae
RE
1119
1120#define CONST_DOUBLE_OK_FOR_LETTER_P(X, C) \
1121 (TARGET_ARM ? \
1122 CONST_DOUBLE_OK_FOR_ARM_LETTER (X, C) : 0)
1123
ff9940b0 1124/* For the ARM, `Q' means that this is a memory operand that is just
f676971a 1125 an offset from a register.
ff9940b0
RE
1126 `S' means any symbol that has the SYMBOL_REF_FLAG set or a CONSTANT_POOL
1127 address. This means that the symbol is in the text segment and can be
9b66ebb1 1128 accessed without using a load.
2075b05d
RE
1129 'D' Prefixes a number of const_double operands where:
1130 'Da' is a constant that takes two ARM insns to load.
1131 'Db' takes three ARM insns.
1132 'Dc' takes four ARM insns, if we allow that in this compilation.
edc62122 1133 'U' Prefixes an extended memory constraint where:
f676971a
EC
1134 'Uv' is an address valid for VFP load/store insns.
1135 'Uy' is an address valid for iwmmxt load/store insns.
edc62122 1136 'Uq' is an address valid for ldrsb. */
ff9940b0 1137
2075b05d 1138#define EXTRA_CONSTRAINT_STR_ARM(OP, C, STR) \
9b901d50
RE
1139 (((C) == 'D') ? ((GET_CODE (OP) == CONST_DOUBLE \
1140 || GET_CODE (OP) == CONST_INT \
1141 || GET_CODE (OP) == CONST_VECTOR) \
2075b05d
RE
1142 && (((STR)[1] == 'a' \
1143 && arm_const_double_inline_cost (OP) == 2) \
1144 || ((STR)[1] == 'b' \
1145 && arm_const_double_inline_cost (OP) == 3) \
1146 || ((STR)[1] == 'c' \
1147 && arm_const_double_inline_cost (OP) == 4 \
1148 && !(optimize_size || arm_ld_sched)))) : \
1149 ((C) == 'Q') ? (GET_CODE (OP) == MEM \
1150 && GET_CODE (XEXP (OP, 0)) == REG) : \
1151 ((C) == 'R') ? (GET_CODE (OP) == MEM \
1152 && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
1153 && CONSTANT_POOL_ADDRESS_P (XEXP (OP, 0))) : \
1154 ((C) == 'S') ? (optimize > 0 && CONSTANT_ADDRESS_P (OP)) : \
1155 ((C) == 'T') ? cirrus_memory_offset (OP) : \
fdd695fd
PB
1156 ((C) == 'U' && (STR)[1] == 'v') ? arm_coproc_mem_operand (OP, FALSE) : \
1157 ((C) == 'U' && (STR)[1] == 'y') ? arm_coproc_mem_operand (OP, TRUE) : \
2075b05d
RE
1158 ((C) == 'U' && (STR)[1] == 'q') \
1159 ? arm_extendqisi_mem_op (OP, GET_MODE (OP)) \
1160 : 0)
1e1ab407
RE
1161
1162#define CONSTRAINT_LEN(C,STR) \
2075b05d 1163 (((C) == 'U' || (C) == 'D') ? 2 : DEFAULT_CONSTRAINT_LEN (C, STR))
ff9940b0 1164
d5b7b3ae
RE
1165#define EXTRA_CONSTRAINT_THUMB(X, C) \
1166 ((C) == 'Q' ? (GET_CODE (X) == MEM \
1167 && GET_CODE (XEXP (X, 0)) == LABEL_REF) : 0)
1168
1e1ab407
RE
1169#define EXTRA_CONSTRAINT_STR(X, C, STR) \
1170 (TARGET_ARM \
1171 ? EXTRA_CONSTRAINT_STR_ARM (X, C, STR) \
1172 : EXTRA_CONSTRAINT_THUMB (X, C))
35d965d5 1173
9b66ebb1
PB
1174#define EXTRA_MEMORY_CONSTRAINT(C, STR) ((C) == 'U')
1175
35d965d5
RS
1176/* Given an rtx X being reloaded into a reg required to be
1177 in class CLASS, return the class of reg to actually use.
d5b7b3ae
RE
1178 In general this is just CLASS, but for the Thumb we prefer
1179 a LO_REGS class or a subset. */
1180#define PREFERRED_RELOAD_CLASS(X, CLASS) \
1181 (TARGET_ARM ? (CLASS) : \
1182 ((CLASS) == BASE_REGS ? (CLASS) : LO_REGS))
1183
1184/* Must leave BASE_REGS reloads alone */
1185#define THUMB_SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
1186 ((CLASS) != LO_REGS && (CLASS) != BASE_REGS \
1187 ? ((true_regnum (X) == -1 ? LO_REGS \
1188 : (true_regnum (X) + HARD_REGNO_NREGS (0, MODE) > 8) ? LO_REGS \
1189 : NO_REGS)) \
1190 : NO_REGS)
1191
1192#define THUMB_SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
97358092 1193 ((CLASS) != LO_REGS && (CLASS) != BASE_REGS \
d5b7b3ae
RE
1194 ? ((true_regnum (X) == -1 ? LO_REGS \
1195 : (true_regnum (X) + HARD_REGNO_NREGS (0, MODE) > 8) ? LO_REGS \
1196 : NO_REGS)) \
1197 : NO_REGS)
35d965d5 1198
ff9940b0
RE
1199/* Return the register class of a scratch register needed to copy IN into
1200 or out of a register in CLASS in MODE. If it can be done directly,
1201 NO_REGS is returned. */
d5b7b3ae 1202#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
9b66ebb1
PB
1203 /* Restrict which direct reloads are allowed for VFP regs. */ \
1204 ((TARGET_VFP && TARGET_HARD_FLOAT \
1205 && (CLASS) == VFP_REGS) \
1206 ? vfp_secondary_reload_class (MODE, X) \
1207 : TARGET_ARM \
1208 ? (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \
d5b7b3ae
RE
1209 ? GENERAL_REGS : NO_REGS) \
1210 : THUMB_SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X))
f676971a 1211
d6b4baa4 1212/* If we need to load shorts byte-at-a-time, then we need a scratch. */
d5b7b3ae 1213#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
9b66ebb1
PB
1214 /* Restrict which direct reloads are allowed for VFP regs. */ \
1215 ((TARGET_VFP && TARGET_HARD_FLOAT \
1216 && (CLASS) == VFP_REGS) \
1217 ? vfp_secondary_reload_class (MODE, X) : \
9b6b54e2 1218 /* Cannot load constants into Cirrus registers. */ \
9b66ebb1 1219 (TARGET_MAVERICK && TARGET_HARD_FLOAT \
9b6b54e2
NC
1220 && (CLASS) == CIRRUS_REGS \
1221 && (CONSTANT_P (X) || GET_CODE (X) == SYMBOL_REF)) \
1222 ? GENERAL_REGS : \
d5b7b3ae 1223 (TARGET_ARM ? \
5a9335ef
NC
1224 (((CLASS) == IWMMXT_REGS || (CLASS) == IWMMXT_GR_REGS) \
1225 && CONSTANT_P (X)) \
1226 ? GENERAL_REGS : \
61f0ccff 1227 (((MODE) == HImode && ! arm_arch4 \
d5b7b3ae
RE
1228 && (GET_CODE (X) == MEM \
1229 || ((GET_CODE (X) == REG || GET_CODE (X) == SUBREG) \
1230 && true_regnum (X) == -1))) \
1231 ? GENERAL_REGS : NO_REGS) \
9b6b54e2 1232 : THUMB_SECONDARY_INPUT_RELOAD_CLASS (CLASS, MODE, X)))
2ce9c1b9 1233
6f734908
RE
1234/* Try a machine-dependent way of reloading an illegitimate address
1235 operand. If we find one, push the reload and jump to WIN. This
1236 macro is used in only one place: `find_reloads_address' in reload.c.
1237
1238 For the ARM, we wish to handle large displacements off a base
1239 register by splitting the addend across a MOV and the mem insn.
d5b7b3ae
RE
1240 This can cut the number of reloads needed. */
1241#define ARM_LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND, WIN) \
1242 do \
1243 { \
1244 if (GET_CODE (X) == PLUS \
1245 && GET_CODE (XEXP (X, 0)) == REG \
1246 && REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \
1247 && REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \
1248 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1249 { \
1250 HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
1251 HOST_WIDE_INT low, high; \
1252 \
de6f27a8 1253 if (MODE == DImode || (MODE == DFmode && TARGET_SOFT_FLOAT)) \
d5b7b3ae 1254 low = ((val & 0xf) ^ 0x8) - 0x8; \
9b66ebb1 1255 else if (TARGET_MAVERICK && TARGET_HARD_FLOAT) \
9b6b54e2
NC
1256 /* Need to be careful, -256 is not a valid offset. */ \
1257 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
d5b7b3ae 1258 else if (MODE == SImode \
de6f27a8 1259 || (MODE == SFmode && TARGET_SOFT_FLOAT) \
d5b7b3ae
RE
1260 || ((MODE == HImode || MODE == QImode) && ! arm_arch4)) \
1261 /* Need to be careful, -4096 is not a valid offset. */ \
1262 low = val >= 0 ? (val & 0xfff) : -((-val) & 0xfff); \
1263 else if ((MODE == HImode || MODE == QImode) && arm_arch4) \
1264 /* Need to be careful, -256 is not a valid offset. */ \
1265 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
1266 else if (GET_MODE_CLASS (MODE) == MODE_FLOAT \
9b66ebb1 1267 && TARGET_HARD_FLOAT && TARGET_FPA) \
d5b7b3ae
RE
1268 /* Need to be careful, -1024 is not a valid offset. */ \
1269 low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff); \
1270 else \
1271 break; \
1272 \
30cf4896
KG
1273 high = ((((val - low) & (unsigned HOST_WIDE_INT) 0xffffffff) \
1274 ^ (unsigned HOST_WIDE_INT) 0x80000000) \
1275 - (unsigned HOST_WIDE_INT) 0x80000000); \
d5b7b3ae
RE
1276 /* Check for overflow or zero */ \
1277 if (low == 0 || high == 0 || (high + low != val)) \
1278 break; \
1279 \
1280 /* Reload the high part into a base reg; leave the low part \
1281 in the mem. */ \
1282 X = gen_rtx_PLUS (GET_MODE (X), \
1283 gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \
1284 GEN_INT (high)), \
1285 GEN_INT (low)); \
df4ae160 1286 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
4a692617
NC
1287 MODE_BASE_REG_CLASS (MODE), GET_MODE (X), \
1288 VOIDmode, 0, 0, OPNUM, TYPE); \
d5b7b3ae
RE
1289 goto WIN; \
1290 } \
1291 } \
62b10bbc 1292 while (0)
6f734908 1293
27847754 1294/* XXX If an HImode FP+large_offset address is converted to an HImode
d5b7b3ae
RE
1295 SP+large_offset address, then reload won't know how to fix it. It sees
1296 only that SP isn't valid for HImode, and so reloads the SP into an index
1297 register, but the resulting address is still invalid because the offset
1298 is too big. We fix it here instead by reloading the entire address. */
1299/* We could probably achieve better results by defining PROMOTE_MODE to help
1300 cope with the variances between the Thumb's signed and unsigned byte and
1301 halfword load instructions. */
a132dad6
RE
1302#define THUMB_LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_L, WIN) \
1303do { \
1304 rtx new_x = thumb_legitimize_reload_address (&X, MODE, OPNUM, TYPE, IND_L); \
1305 if (new_x) \
1306 { \
1307 X = new_x; \
1308 goto WIN; \
1309 } \
1310} while (0)
d5b7b3ae
RE
1311
1312#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
1313 if (TARGET_ARM) \
1314 ARM_LEGITIMIZE_RELOAD_ADDRESS (X, MODE, OPNUM, TYPE, IND_LEVELS, WIN); \
1315 else \
1316 THUMB_LEGITIMIZE_RELOAD_ADDRESS (X, MODE, OPNUM, TYPE, IND_LEVELS, WIN)
f676971a 1317
35d965d5
RS
1318/* Return the maximum number of consecutive registers
1319 needed to represent mode MODE in a register of class CLASS.
3b684012 1320 ARM regs are UNITS_PER_WORD bits while FPA regs can hold any FP mode */
35d965d5 1321#define CLASS_MAX_NREGS(CLASS, MODE) \
3b684012 1322 (((CLASS) == FPA_REGS || (CLASS) == CIRRUS_REGS) ? 1 : ARM_NUM_REGS (MODE))
9b6b54e2
NC
1323
1324/* If defined, gives a class of registers that cannot be used as the
1325 operand of a SUBREG that changes the mode of the object illegally. */
35d965d5 1326
3b684012 1327/* Moves between FPA_REGS and GENERAL_REGS are two memory insns. */
cf011243 1328#define REGISTER_MOVE_COST(MODE, FROM, TO) \
d5b7b3ae 1329 (TARGET_ARM ? \
3b684012
RE
1330 ((FROM) == FPA_REGS && (TO) != FPA_REGS ? 20 : \
1331 (FROM) != FPA_REGS && (TO) == FPA_REGS ? 20 : \
9b66ebb1
PB
1332 (FROM) == VFP_REGS && (TO) != VFP_REGS ? 10 : \
1333 (FROM) != VFP_REGS && (TO) == VFP_REGS ? 10 : \
5a9335ef
NC
1334 (FROM) == IWMMXT_REGS && (TO) != IWMMXT_REGS ? 4 : \
1335 (FROM) != IWMMXT_REGS && (TO) == IWMMXT_REGS ? 4 : \
1336 (FROM) == IWMMXT_GR_REGS || (TO) == IWMMXT_GR_REGS ? 20 : \
9b6b54e2
NC
1337 (FROM) == CIRRUS_REGS && (TO) != CIRRUS_REGS ? 20 : \
1338 (FROM) != CIRRUS_REGS && (TO) == CIRRUS_REGS ? 20 : \
1339 2) \
d5b7b3ae
RE
1340 : \
1341 ((FROM) == HI_REGS || (TO) == HI_REGS) ? 4 : 2)
35d965d5
RS
1342\f
1343/* Stack layout; function entry, exit and calling. */
1344
1345/* Define this if pushing a word on the stack
1346 makes the stack pointer a smaller address. */
1347#define STACK_GROWS_DOWNWARD 1
1348
a4d05547 1349/* Define this to nonzero if the nominal address of the stack frame
35d965d5
RS
1350 is at the high-address end of the local variables;
1351 that is, each additional local variable allocated
1352 goes at a more negative offset in the frame. */
1353#define FRAME_GROWS_DOWNWARD 1
1354
a2503645
RS
1355/* The amount of scratch space needed by _interwork_{r7,r11}_call_via_rN().
1356 When present, it is one word in size, and sits at the top of the frame,
1357 between the soft frame pointer and either r7 or r11.
1358
1359 We only need _interwork_rM_call_via_rN() for -mcaller-super-interworking,
1360 and only then if some outgoing arguments are passed on the stack. It would
1361 be tempting to also check whether the stack arguments are passed by indirect
1362 calls, but there seems to be no reason in principle why a post-reload pass
1363 couldn't convert a direct call into an indirect one. */
1364#define CALLER_INTERWORKING_SLOT_SIZE \
1365 (TARGET_CALLER_INTERWORKING \
1366 && current_function_outgoing_args_size != 0 \
1367 ? UNITS_PER_WORD : 0)
1368
35d965d5
RS
1369/* Offset within stack frame to start allocating local variables at.
1370 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1371 first local allocated. Otherwise, it is the offset to the BEGINNING
1372 of the first local allocated. */
1373#define STARTING_FRAME_OFFSET 0
1374
1375/* If we generate an insn to push BYTES bytes,
1376 this says how many the stack pointer really advances by. */
d5b7b3ae 1377/* The push insns do not do this rounding implicitly.
d6b4baa4 1378 So don't define this. */
0c2ca901 1379/* #define PUSH_ROUNDING(NPUSHED) ROUND_UP_WORD (NPUSHED) */
18543a22
ILT
1380
1381/* Define this if the maximum size of all the outgoing args is to be
1382 accumulated and pushed during the prologue. The amount can be
1383 found in the variable current_function_outgoing_args_size. */
6cfc7210 1384#define ACCUMULATE_OUTGOING_ARGS 1
35d965d5
RS
1385
1386/* Offset of first parameter from the argument pointer register value. */
d5b7b3ae 1387#define FIRST_PARM_OFFSET(FNDECL) (TARGET_ARM ? 4 : 0)
35d965d5
RS
1388
1389/* Value is the number of byte of arguments automatically
1390 popped when returning from a subroutine call.
8b109b37 1391 FUNDECL is the declaration node of the function (as a tree),
35d965d5
RS
1392 FUNTYPE is the data type of the function (as a tree),
1393 or for a library call it is an identifier node for the subroutine name.
1394 SIZE is the number of bytes of arguments passed on the stack.
1395
1396 On the ARM, the caller does not pop any of its arguments that were passed
1397 on the stack. */
6cfc7210 1398#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
35d965d5
RS
1399
1400/* Define how to find the value returned by a library function
1401 assuming the value has mode MODE. */
1402#define LIBCALL_VALUE(MODE) \
72cdc543 1403 (TARGET_ARM && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
9b66ebb1
PB
1404 && GET_MODE_CLASS (MODE) == MODE_FLOAT \
1405 ? gen_rtx_REG (MODE, FIRST_FPA_REGNUM) \
72cdc543 1406 : TARGET_ARM && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK \
9b66ebb1 1407 && GET_MODE_CLASS (MODE) == MODE_FLOAT \
9b6b54e2 1408 ? gen_rtx_REG (MODE, FIRST_CIRRUS_FP_REGNUM) \
f676971a 1409 : TARGET_IWMMXT_ABI && arm_vector_mode_supported_p (MODE) \
5a9335ef 1410 ? gen_rtx_REG (MODE, FIRST_IWMMXT_REGNUM) \
d5b7b3ae 1411 : gen_rtx_REG (MODE, ARG_REGISTER (1)))
35d965d5 1412
6cfc7210
NC
1413/* Define how to find the value returned by a function.
1414 VALTYPE is the data type of the value (as a tree).
1415 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1416 otherwise, FUNC is 0. */
d5b7b3ae 1417#define FUNCTION_VALUE(VALTYPE, FUNC) \
d4453b7a 1418 arm_function_value (VALTYPE, FUNC);
6cfc7210 1419
35d965d5
RS
1420/* 1 if N is a possible register number for a function value.
1421 On the ARM, only r0 and f0 can return results. */
9b6b54e2 1422/* On a Cirrus chip, mvf0 can return results. */
35d965d5 1423#define FUNCTION_VALUE_REGNO_P(REGNO) \
d5b7b3ae 1424 ((REGNO) == ARG_REGISTER (1) \
9b66ebb1 1425 || (TARGET_ARM && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
72cdc543 1426 && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
5848830f 1427 || ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
9b66ebb1 1428 || (TARGET_ARM && ((REGNO) == FIRST_FPA_REGNUM) \
72cdc543 1429 && TARGET_HARD_FLOAT_ABI && TARGET_FPA))
35d965d5 1430
9f7bf991
RE
1431/* Amount of memory needed for an untyped call to save all possible return
1432 registers. */
1433#define APPLY_RESULT_SIZE arm_apply_result_size()
1434
11c1a207
RE
1435/* How large values are returned */
1436/* A C expression which can inhibit the returning of certain function values
d6b4baa4 1437 in registers, based on the type of value. */
f5a1b0d2 1438#define RETURN_IN_MEMORY(TYPE) arm_return_in_memory (TYPE)
11c1a207
RE
1439
1440/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
1441 values must be in memory. On the ARM, they need only do so if larger
d6b4baa4 1442 than a word, or if they contain elements offset from zero in the struct. */
11c1a207
RE
1443#define DEFAULT_PCC_STRUCT_RETURN 0
1444
d5b7b3ae
RE
1445/* Flags for the call/call_value rtl operations set up by function_arg. */
1446#define CALL_NORMAL 0x00000000 /* No special processing. */
1447#define CALL_LONG 0x00000001 /* Always call indirect. */
1448#define CALL_SHORT 0x00000002 /* Never call indirect. */
1449
6d3d9133 1450/* These bits describe the different types of function supported
112cdef5 1451 by the ARM backend. They are exclusive. i.e. a function cannot be both a
6d3d9133
NC
1452 normal function and an interworked function, for example. Knowing the
1453 type of a function is important for determining its prologue and
1454 epilogue sequences.
1455 Note value 7 is currently unassigned. Also note that the interrupt
1456 function types all have bit 2 set, so that they can be tested for easily.
1457 Note that 0 is deliberately chosen for ARM_FT_UNKNOWN so that when the
4912a07c 1458 machine_function structure is initialized (to zero) func_type will
6d3d9133
NC
1459 default to unknown. This will force the first use of arm_current_func_type
1460 to call arm_compute_func_type. */
1461#define ARM_FT_UNKNOWN 0 /* Type has not yet been determined. */
1462#define ARM_FT_NORMAL 1 /* Your normal, straightforward function. */
1463#define ARM_FT_INTERWORKED 2 /* A function that supports interworking. */
6d3d9133
NC
1464#define ARM_FT_ISR 4 /* An interrupt service routine. */
1465#define ARM_FT_FIQ 5 /* A fast interrupt service routine. */
1466#define ARM_FT_EXCEPTION 6 /* An ARM exception handler (subcase of ISR). */
1467
1468#define ARM_FT_TYPE_MASK ((1 << 3) - 1)
1469
1470/* In addition functions can have several type modifiers,
1471 outlined by these bit masks: */
1472#define ARM_FT_INTERRUPT (1 << 2) /* Note overlap with FT_ISR and above. */
1473#define ARM_FT_NAKED (1 << 3) /* No prologue or epilogue. */
1474#define ARM_FT_VOLATILE (1 << 4) /* Does not return. */
d6b4baa4 1475#define ARM_FT_NESTED (1 << 5) /* Embedded inside another func. */
6d3d9133
NC
1476
1477/* Some macros to test these flags. */
1478#define ARM_FUNC_TYPE(t) (t & ARM_FT_TYPE_MASK)
1479#define IS_INTERRUPT(t) (t & ARM_FT_INTERRUPT)
1480#define IS_VOLATILE(t) (t & ARM_FT_VOLATILE)
1481#define IS_NAKED(t) (t & ARM_FT_NAKED)
1482#define IS_NESTED(t) (t & ARM_FT_NESTED)
1483
5848830f
PB
1484
1485/* Structure used to hold the function stack frame layout. Offsets are
1486 relative to the stack pointer on function entry. Positive offsets are
1487 in the direction of stack growth.
1488 Only soft_frame is used in thumb mode. */
1489
1490typedef struct arm_stack_offsets GTY(())
1491{
1492 int saved_args; /* ARG_POINTER_REGNUM. */
1493 int frame; /* ARM_HARD_FRAME_POINTER_REGNUM. */
1494 int saved_regs;
1495 int soft_frame; /* FRAME_POINTER_REGNUM. */
2591db65 1496 int locals_base; /* THUMB_HARD_FRAME_POINTER_REGNUM. */
5848830f
PB
1497 int outgoing_args; /* STACK_POINTER_REGNUM. */
1498}
1499arm_stack_offsets;
1500
6d3d9133
NC
1501/* A C structure for machine-specific, per-function data.
1502 This is added to the cfun structure. */
e2500fed 1503typedef struct machine_function GTY(())
d5b7b3ae 1504{
6bc82793 1505 /* Additional stack adjustment in __builtin_eh_throw. */
e2500fed 1506 rtx eh_epilogue_sp_ofs;
d5b7b3ae
RE
1507 /* Records if LR has to be saved for far jumps. */
1508 int far_jump_used;
1509 /* Records if ARG_POINTER was ever live. */
1510 int arg_pointer_live;
6f7ebcbb
NC
1511 /* Records if the save of LR has been eliminated. */
1512 int lr_save_eliminated;
0977774b 1513 /* The size of the stack frame. Only valid after reload. */
5848830f 1514 arm_stack_offsets stack_offsets;
6d3d9133
NC
1515 /* Records the type of the current function. */
1516 unsigned long func_type;
3cb66fd7
NC
1517 /* Record if the function has a variable argument list. */
1518 int uses_anonymous_args;
5a9335ef
NC
1519 /* Records if sibcalls are blocked because an argument
1520 register is needed to preserve stack alignment. */
1521 int sibcall_blocked;
020a4035
RE
1522 /* The PIC register for this function. This might be a pseudo. */
1523 rtx pic_reg;
b12a00f1 1524 /* Labels for per-function Thumb call-via stubs. One per potential calling
57ecec57
PB
1525 register. We can never call via LR or PC. We can call via SP if a
1526 trampoline happens to be on the top of the stack. */
1527 rtx call_via[14];
6d3d9133
NC
1528}
1529machine_function;
d5b7b3ae 1530
b12a00f1 1531/* As in the machine_function, a global set of call-via labels, for code
d6b5193b 1532 that is in text_section. */
57ecec57 1533extern GTY(()) rtx thumb_call_via_label[14];
b12a00f1 1534
82e9d970
PB
1535/* A C type for declaring a variable that is used as the first argument of
1536 `FUNCTION_ARG' and other related values. For some target machines, the
1537 type `int' suffices and can hold the number of bytes of argument so far. */
1538typedef struct
1539{
d5b7b3ae 1540 /* This is the number of registers of arguments scanned so far. */
82e9d970 1541 int nregs;
5a9335ef
NC
1542 /* This is the number of iWMMXt register arguments scanned so far. */
1543 int iwmmxt_nregs;
1544 int named_count;
1545 int nargs;
d6b4baa4 1546 /* One of CALL_NORMAL, CALL_LONG or CALL_SHORT. */
82e9d970 1547 int call_cookie;
5848830f 1548 int can_split;
d5b7b3ae 1549} CUMULATIVE_ARGS;
82e9d970 1550
35d965d5
RS
1551/* Define where to put the arguments to a function.
1552 Value is zero to push the argument on the stack,
1553 or a hard register in which to store the argument.
1554
1555 MODE is the argument's machine mode.
1556 TYPE is the data type of the argument (as a tree).
1557 This is null for libcalls where that information may
1558 not be available.
1559 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1560 the preceding args and about the function being called.
1561 NAMED is nonzero if this argument is a named parameter
1562 (otherwise it is an extra parameter matching an ellipsis).
1563
1564 On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
1565 other arguments are passed on the stack. If (NAMED == 0) (which happens
1cc9f5f5
KH
1566 only in assign_parms, since TARGET_SETUP_INCOMING_VARARGS is
1567 defined), say it is passed in the stack (function_prologue will
1568 indeed make it pass in the stack if necessary). */
82e9d970
PB
1569#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1570 arm_function_arg (&(CUM), (MODE), (TYPE), (NAMED))
35d965d5 1571
866af8a9
JB
1572#define FUNCTION_ARG_PADDING(MODE, TYPE) \
1573 (arm_pad_arg_upward (MODE, TYPE) ? upward : downward)
1574
1575#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
1576 (arm_pad_reg_upward (MODE, TYPE, FIRST) ? upward : downward)
1577
1578/* For AAPCS, padding should never be below the argument. For other ABIs,
1579 * mimic the default. */
1580#define PAD_VARARGS_DOWN \
1581 ((TARGET_AAPCS_BASED) ? 0 : BYTES_BIG_ENDIAN)
1582
35d965d5
RS
1583/* Initialize a variable CUM of type CUMULATIVE_ARGS
1584 for a call to a function whose data type is FNTYPE.
1585 For a library call, FNTYPE is 0.
1586 On the ARM, the offset starts at 0. */
0f6937fe 1587#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
563a317a 1588 arm_init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL))
35d965d5
RS
1589
1590/* Update the data in CUM to advance over an argument
1591 of mode MODE and data type TYPE.
1592 (TYPE is null for libcalls where that information may not be available.) */
6cfc7210 1593#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
5a9335ef 1594 (CUM).nargs += 1; \
f676971a 1595 if (arm_vector_mode_supported_p (MODE) \
5848830f
PB
1596 && (CUM).named_count > (CUM).nargs) \
1597 (CUM).iwmmxt_nregs += 1; \
5a9335ef 1598 else \
5848830f 1599 (CUM).nregs += ARM_NUM_REGS2 (MODE, TYPE)
35d965d5 1600
5a9335ef
NC
1601/* If defined, a C expression that gives the alignment boundary, in bits, of an
1602 argument with the specified mode and type. If it is not defined,
1603 `PARM_BOUNDARY' is used for all arguments. */
1604#define FUNCTION_ARG_BOUNDARY(MODE,TYPE) \
5848830f
PB
1605 ((ARM_DOUBLEWORD_ALIGN && arm_needs_doubleword_align (MODE, TYPE)) \
1606 ? DOUBLEWORD_ALIGNMENT \
1607 : PARM_BOUNDARY )
5a9335ef 1608
35d965d5
RS
1609/* 1 if N is a possible register number for function argument passing.
1610 On the ARM, r0-r3 are used to pass args. */
5a9335ef
NC
1611#define FUNCTION_ARG_REGNO_P(REGNO) \
1612 (IN_RANGE ((REGNO), 0, 3) \
5848830f
PB
1613 || (TARGET_IWMMXT_ABI \
1614 && IN_RANGE ((REGNO), FIRST_IWMMXT_REGNUM, FIRST_IWMMXT_REGNUM + 9)))
35d965d5 1615
f99fce0c 1616\f
afef3d7a
NC
1617/* If your target environment doesn't prefix user functions with an
1618 underscore, you may wish to re-define this to prevent any conflicts.
1619 e.g. AOF may prefix mcount with an underscore. */
1620#ifndef ARM_MCOUNT_NAME
1621#define ARM_MCOUNT_NAME "*mcount"
1622#endif
1623
1624/* Call the function profiler with a given profile label. The Acorn
1625 compiler puts this BEFORE the prolog but gcc puts it afterwards.
1626 On the ARM the full profile code will look like:
1627 .data
1628 LP1
1629 .word 0
1630 .text
1631 mov ip, lr
1632 bl mcount
1633 .word LP1
1634
1635 profile_function() in final.c outputs the .data section, FUNCTION_PROFILER
1636 will output the .text section.
1637
1638 The ``mov ip,lr'' seems like a good idea to stick with cc convention.
59be6073
AN
1639 ``prof'' doesn't seem to mind about this!
1640
1641 Note - this version of the code is designed to work in both ARM and
1642 Thumb modes. */
be393ecf 1643#ifndef ARM_FUNCTION_PROFILER
d5b7b3ae 1644#define ARM_FUNCTION_PROFILER(STREAM, LABELNO) \
6cfc7210
NC
1645{ \
1646 char temp[20]; \
1647 rtx sym; \
1648 \
dd18ae56 1649 asm_fprintf (STREAM, "\tmov\t%r, %r\n\tbl\t", \
d5b7b3ae 1650 IP_REGNUM, LR_REGNUM); \
6cfc7210
NC
1651 assemble_name (STREAM, ARM_MCOUNT_NAME); \
1652 fputc ('\n', STREAM); \
1653 ASM_GENERATE_INTERNAL_LABEL (temp, "LP", LABELNO); \
f1c25d3b 1654 sym = gen_rtx_SYMBOL_REF (Pmode, temp); \
301d03af 1655 assemble_aligned_integer (UNITS_PER_WORD, sym); \
35d965d5 1656}
be393ecf 1657#endif
35d965d5 1658
59be6073 1659#ifdef THUMB_FUNCTION_PROFILER
d5b7b3ae
RE
1660#define FUNCTION_PROFILER(STREAM, LABELNO) \
1661 if (TARGET_ARM) \
1662 ARM_FUNCTION_PROFILER (STREAM, LABELNO) \
1663 else \
1664 THUMB_FUNCTION_PROFILER (STREAM, LABELNO)
59be6073
AN
1665#else
1666#define FUNCTION_PROFILER(STREAM, LABELNO) \
1667 ARM_FUNCTION_PROFILER (STREAM, LABELNO)
1668#endif
d5b7b3ae 1669
35d965d5
RS
1670/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1671 the stack pointer does not matter. The value is tested only in
1672 functions that have frame pointers.
1673 No definition is equivalent to always zero.
1674
1675 On the ARM, the function epilogue recovers the stack pointer from the
1676 frame. */
1677#define EXIT_IGNORE_STACK 1
1678
c7861455
RE
1679#define EPILOGUE_USES(REGNO) (reload_completed && (REGNO) == LR_REGNUM)
1680
35d965d5
RS
1681/* Determine if the epilogue should be output as RTL.
1682 You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
d5b7b3ae 1683#define USE_RETURN_INSN(ISCOND) \
a72d4945 1684 (TARGET_ARM ? use_return_insn (ISCOND, NULL) : 0)
ff9940b0
RE
1685
1686/* Definitions for register eliminations.
1687
1688 This is an array of structures. Each structure initializes one pair
1689 of eliminable registers. The "from" register number is given first,
1690 followed by "to". Eliminations of the same "from" register are listed
1691 in order of preference.
1692
1693 We have two registers that can be eliminated on the ARM. First, the
1694 arg pointer register can often be eliminated in favor of the stack
1695 pointer register. Secondly, the pseudo frame pointer register can always
1696 be eliminated; it is replaced with either the stack or the real frame
d5b7b3ae 1697 pointer. Note we have to use {ARM|THUMB}_HARD_FRAME_POINTER_REGNUM
d6a7951f 1698 because the definition of HARD_FRAME_POINTER_REGNUM is not a constant. */
ff9940b0 1699
d5b7b3ae
RE
1700#define ELIMINABLE_REGS \
1701{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },\
1702 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },\
1703 { ARG_POINTER_REGNUM, ARM_HARD_FRAME_POINTER_REGNUM },\
1704 { ARG_POINTER_REGNUM, THUMB_HARD_FRAME_POINTER_REGNUM },\
1705 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },\
1706 { FRAME_POINTER_REGNUM, ARM_HARD_FRAME_POINTER_REGNUM },\
1707 { FRAME_POINTER_REGNUM, THUMB_HARD_FRAME_POINTER_REGNUM }}
ff9940b0 1708
d5b7b3ae
RE
1709/* Given FROM and TO register numbers, say whether this elimination is
1710 allowed. Frame pointer elimination is automatically handled.
ff9940b0
RE
1711
1712 All eliminations are permissible. Note that ARG_POINTER_REGNUM and
abc95ed3 1713 HARD_FRAME_POINTER_REGNUM are in fact the same thing. If we need a frame
ff9940b0 1714 pointer, we must eliminate FRAME_POINTER_REGNUM into
d5b7b3ae
RE
1715 HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM or
1716 ARG_POINTER_REGNUM. */
1717#define CAN_ELIMINATE(FROM, TO) \
1718 (((TO) == FRAME_POINTER_REGNUM && (FROM) == ARG_POINTER_REGNUM) ? 0 : \
1719 ((TO) == STACK_POINTER_REGNUM && frame_pointer_needed) ? 0 : \
1720 ((TO) == ARM_HARD_FRAME_POINTER_REGNUM && TARGET_THUMB) ? 0 : \
1721 ((TO) == THUMB_HARD_FRAME_POINTER_REGNUM && TARGET_ARM) ? 0 : \
1722 1)
aeaf4d25 1723
d5b7b3ae
RE
1724/* Define the offset between two registers, one to be eliminated, and the
1725 other its replacement, at the start of a routine. */
d5b7b3ae
RE
1726#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1727 if (TARGET_ARM) \
5848830f 1728 (OFFSET) = arm_compute_initial_elimination_offset (FROM, TO); \
d5b7b3ae 1729 else \
5848830f
PB
1730 (OFFSET) = thumb_compute_initial_elimination_offset (FROM, TO)
1731
d5b7b3ae
RE
1732/* Special case handling of the location of arguments passed on the stack. */
1733#define DEBUGGER_ARG_OFFSET(value, addr) value ? value : arm_debugger_arg_offset (value, addr)
f676971a 1734
d5b7b3ae
RE
1735/* Initialize data used by insn expanders. This is called from insn_emit,
1736 once for every function before code is generated. */
1737#define INIT_EXPANDERS arm_init_expanders ()
1738
35d965d5
RS
1739/* Output assembler code for a block containing the constant parts
1740 of a trampoline, leaving space for the variable parts.
1741
1742 On the ARM, (if r8 is the static chain regnum, and remembering that
1743 referencing pc adds an offset of 8) the trampoline looks like:
1744 ldr r8, [pc, #0]
1745 ldr pc, [pc]
1746 .word static chain value
11c1a207 1747 .word function's address
27847754 1748 XXX FIXME: When the trampoline returns, r8 will be clobbered. */
301d03af
RS
1749#define ARM_TRAMPOLINE_TEMPLATE(FILE) \
1750{ \
1751 asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \
1752 STATIC_CHAIN_REGNUM, PC_REGNUM); \
1753 asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \
1754 PC_REGNUM, PC_REGNUM); \
1755 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
1756 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
d5b7b3ae
RE
1757}
1758
1759/* On the Thumb we always switch into ARM mode to execute the trampoline.
1760 Why - because it is easier. This code will always be branched to via
1761 a BX instruction and since the compiler magically generates the address
1762 of the function the linker has no opportunity to ensure that the
1763 bottom bit is set. Thus the processor will be in ARM mode when it
1764 reaches this code. So we duplicate the ARM trampoline code and add
1765 a switch into Thumb mode as well. */
1766#define THUMB_TRAMPOLINE_TEMPLATE(FILE) \
1767{ \
1768 fprintf (FILE, "\t.code 32\n"); \
1769 fprintf (FILE, ".Ltrampoline_start:\n"); \
1770 asm_fprintf (FILE, "\tldr\t%r, [%r, #8]\n", \
1771 STATIC_CHAIN_REGNUM, PC_REGNUM); \
1772 asm_fprintf (FILE, "\tldr\t%r, [%r, #8]\n", \
1773 IP_REGNUM, PC_REGNUM); \
1774 asm_fprintf (FILE, "\torr\t%r, %r, #1\n", \
1775 IP_REGNUM, IP_REGNUM); \
1776 asm_fprintf (FILE, "\tbx\t%r\n", IP_REGNUM); \
1777 fprintf (FILE, "\t.word\t0\n"); \
1778 fprintf (FILE, "\t.word\t0\n"); \
1779 fprintf (FILE, "\t.code 16\n"); \
35d965d5
RS
1780}
1781
d5b7b3ae
RE
1782#define TRAMPOLINE_TEMPLATE(FILE) \
1783 if (TARGET_ARM) \
1784 ARM_TRAMPOLINE_TEMPLATE (FILE) \
1785 else \
1786 THUMB_TRAMPOLINE_TEMPLATE (FILE)
f676971a 1787
35d965d5 1788/* Length in units of the trampoline for entering a nested function. */
d5b7b3ae 1789#define TRAMPOLINE_SIZE (TARGET_ARM ? 16 : 24)
35d965d5 1790
006946e4
JM
1791/* Alignment required for a trampoline in bits. */
1792#define TRAMPOLINE_ALIGNMENT 32
35d965d5 1793
2a86f515 1794
35d965d5
RS
1795/* Emit RTL insns to initialize the variable parts of a trampoline.
1796 FNADDR is an RTX for the address of the function's pure code.
1797 CXT is an RTX for the static chain value for the function. */
192c8d78
RE
1798#ifndef INITIALIZE_TRAMPOLINE
1799#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1800{ \
1801 emit_move_insn (gen_rtx_MEM (SImode, \
1802 plus_constant (TRAMP, \
1803 TARGET_ARM ? 8 : 16)), \
1804 CXT); \
1805 emit_move_insn (gen_rtx_MEM (SImode, \
1806 plus_constant (TRAMP, \
1807 TARGET_ARM ? 12 : 20)), \
1808 FNADDR); \
49755603
RE
1809 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
1810 0, VOIDmode, 2, TRAMP, Pmode, \
1811 plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode); \
35d965d5 1812}
192c8d78 1813#endif
35d965d5 1814
35d965d5
RS
1815\f
1816/* Addressing modes, and classification of registers for them. */
3cd45774
RE
1817#define HAVE_POST_INCREMENT 1
1818#define HAVE_PRE_INCREMENT TARGET_ARM
1819#define HAVE_POST_DECREMENT TARGET_ARM
1820#define HAVE_PRE_DECREMENT TARGET_ARM
1821#define HAVE_PRE_MODIFY_DISP TARGET_ARM
1822#define HAVE_POST_MODIFY_DISP TARGET_ARM
1823#define HAVE_PRE_MODIFY_REG TARGET_ARM
1824#define HAVE_POST_MODIFY_REG TARGET_ARM
35d965d5
RS
1825
1826/* Macros to check register numbers against specific register classes. */
1827
1828/* These assume that REGNO is a hard or pseudo reg number.
1829 They give nonzero only if REGNO is a hard reg of the suitable class
1830 or a pseudo reg currently allocated to a suitable hard reg.
1831 Since they use reg_renumber, they are safe only once reg_renumber
d6b4baa4 1832 has been allocated, which happens in local-alloc.c. */
d5b7b3ae
RE
1833#define TEST_REGNO(R, TEST, VALUE) \
1834 ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
1835
1836/* On the ARM, don't allow the pc to be used. */
f1008e52
RE
1837#define ARM_REGNO_OK_FOR_BASE_P(REGNO) \
1838 (TEST_REGNO (REGNO, <, PC_REGNUM) \
1839 || TEST_REGNO (REGNO, ==, FRAME_POINTER_REGNUM) \
1840 || TEST_REGNO (REGNO, ==, ARG_POINTER_REGNUM))
1841
1842#define THUMB_REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \
1843 (TEST_REGNO (REGNO, <=, LAST_LO_REGNUM) \
1844 || (GET_MODE_SIZE (MODE) >= 4 \
1845 && TEST_REGNO (REGNO, ==, STACK_POINTER_REGNUM)))
1846
1847#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \
1848 (TARGET_THUMB \
1849 ? THUMB_REGNO_MODE_OK_FOR_BASE_P (REGNO, MODE) \
1850 : ARM_REGNO_OK_FOR_BASE_P (REGNO))
1851
888d2cd6
DJ
1852/* Nonzero if X can be the base register in a reg+reg addressing mode.
1853 For Thumb, we can not use SP + reg, so reject SP. */
1854#define REGNO_MODE_OK_FOR_REG_BASE_P(X, MODE) \
1855 REGNO_OK_FOR_INDEX_P (X)
1856
f1008e52
RE
1857/* For ARM code, we don't care about the mode, but for Thumb, the index
1858 must be suitable for use in a QImode load. */
d5b7b3ae
RE
1859#define REGNO_OK_FOR_INDEX_P(REGNO) \
1860 REGNO_MODE_OK_FOR_BASE_P (REGNO, QImode)
35d965d5
RS
1861
1862/* Maximum number of registers that can appear in a valid memory address.
d6b4baa4 1863 Shifts in addresses can't be by a register. */
ff9940b0 1864#define MAX_REGS_PER_ADDRESS 2
35d965d5
RS
1865
1866/* Recognize any constant value that is a valid address. */
1867/* XXX We can address any constant, eventually... */
11c1a207
RE
1868
1869#ifdef AOF_ASSEMBLER
1870
1871#define CONSTANT_ADDRESS_P(X) \
d5b7b3ae 1872 (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X))
11c1a207
RE
1873
1874#else
35d965d5 1875
008cf58a
RE
1876#define CONSTANT_ADDRESS_P(X) \
1877 (GET_CODE (X) == SYMBOL_REF \
1878 && (CONSTANT_POOL_ADDRESS_P (X) \
d5b7b3ae 1879 || (TARGET_ARM && optimize > 0 && SYMBOL_REF_FLAG (X))))
35d965d5 1880
11c1a207
RE
1881#endif /* AOF_ASSEMBLER */
1882
35d965d5
RS
1883/* Nonzero if the constant value X is a legitimate general operand.
1884 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1885
1886 On the ARM, allow any integer (invalid ones are removed later by insn
1887 patterns), nice doubles and symbol_refs which refer to the function's
d5b7b3ae 1888 constant pool XXX.
f676971a 1889
82e9d970 1890 When generating pic allow anything. */
d5b7b3ae
RE
1891#define ARM_LEGITIMATE_CONSTANT_P(X) (flag_pic || ! label_mentioned_p (X))
1892
1893#define THUMB_LEGITIMATE_CONSTANT_P(X) \
1894 ( GET_CODE (X) == CONST_INT \
1895 || GET_CODE (X) == CONST_DOUBLE \
7b8781c8
PB
1896 || CONSTANT_ADDRESS_P (X) \
1897 || flag_pic)
d5b7b3ae 1898
d3585b76
DJ
1899#define LEGITIMATE_CONSTANT_P(X) \
1900 (!arm_tls_referenced_p (X) \
1901 && (TARGET_ARM ? ARM_LEGITIMATE_CONSTANT_P (X) \
1902 : THUMB_LEGITIMATE_CONSTANT_P (X)))
d5b7b3ae 1903
c27ba912
DM
1904/* Special characters prefixed to function names
1905 in order to encode attribute like information.
1906 Note, '@' and '*' have already been taken. */
1907#define SHORT_CALL_FLAG_CHAR '^'
1908#define LONG_CALL_FLAG_CHAR '#'
1909
1910#define ENCODED_SHORT_CALL_ATTR_P(SYMBOL_NAME) \
1911 (*(SYMBOL_NAME) == SHORT_CALL_FLAG_CHAR)
1912
1913#define ENCODED_LONG_CALL_ATTR_P(SYMBOL_NAME) \
1914 (*(SYMBOL_NAME) == LONG_CALL_FLAG_CHAR)
1915
1916#ifndef SUBTARGET_NAME_ENCODING_LENGTHS
1917#define SUBTARGET_NAME_ENCODING_LENGTHS
1918#endif
1919
6bc82793 1920/* This is a C fragment for the inside of a switch statement.
c27ba912
DM
1921 Each case label should return the number of characters to
1922 be stripped from the start of a function's name, if that
1923 name starts with the indicated character. */
1924#define ARM_NAME_ENCODING_LENGTHS \
1925 case SHORT_CALL_FLAG_CHAR: return 1; \
1926 case LONG_CALL_FLAG_CHAR: return 1; \
00fdafef 1927 case '*': return 1; \
f676971a 1928 SUBTARGET_NAME_ENCODING_LENGTHS
c27ba912 1929
c27ba912
DM
1930/* This is how to output a reference to a user-level label named NAME.
1931 `assemble_name' uses this. */
e5951263 1932#undef ASM_OUTPUT_LABELREF
c27ba912 1933#define ASM_OUTPUT_LABELREF(FILE, NAME) \
e1944073 1934 arm_asm_output_labelref (FILE, NAME)
c27ba912 1935
7abc66b1
JB
1936/* The EABI specifies that constructors should go in .init_array.
1937 Other targets use .ctors for compatibility. */
88c6057f 1938#ifndef ARM_EABI_CTORS_SECTION_OP
7abc66b1
JB
1939#define ARM_EABI_CTORS_SECTION_OP \
1940 "\t.section\t.init_array,\"aw\",%init_array"
88c6057f
MM
1941#endif
1942#ifndef ARM_EABI_DTORS_SECTION_OP
7abc66b1
JB
1943#define ARM_EABI_DTORS_SECTION_OP \
1944 "\t.section\t.fini_array,\"aw\",%fini_array"
88c6057f 1945#endif
7abc66b1
JB
1946#define ARM_CTORS_SECTION_OP \
1947 "\t.section\t.ctors,\"aw\",%progbits"
1948#define ARM_DTORS_SECTION_OP \
1949 "\t.section\t.dtors,\"aw\",%progbits"
1950
1951/* Define CTORS_SECTION_ASM_OP. */
1952#undef CTORS_SECTION_ASM_OP
1953#undef DTORS_SECTION_ASM_OP
1954#ifndef IN_LIBGCC2
1955# define CTORS_SECTION_ASM_OP \
1956 (TARGET_AAPCS_BASED ? ARM_EABI_CTORS_SECTION_OP : ARM_CTORS_SECTION_OP)
1957# define DTORS_SECTION_ASM_OP \
1958 (TARGET_AAPCS_BASED ? ARM_EABI_DTORS_SECTION_OP : ARM_DTORS_SECTION_OP)
1959#else /* !defined (IN_LIBGCC2) */
1960/* In libgcc, CTORS_SECTION_ASM_OP must be a compile-time constant,
1961 so we cannot use the definition above. */
1962# ifdef __ARM_EABI__
1963/* The .ctors section is not part of the EABI, so we do not define
1964 CTORS_SECTION_ASM_OP when in libgcc; that prevents crtstuff
1965 from trying to use it. We do define it when doing normal
1966 compilation, as .init_array can be used instead of .ctors. */
1967/* There is no need to emit begin or end markers when using
1968 init_array; the dynamic linker will compute the size of the
1969 array itself based on special symbols created by the static
1970 linker. However, we do need to arrange to set up
1971 exception-handling here. */
1972# define CTOR_LIST_BEGIN asm (ARM_EABI_CTORS_SECTION_OP)
1973# define CTOR_LIST_END /* empty */
1974# define DTOR_LIST_BEGIN asm (ARM_EABI_DTORS_SECTION_OP)
1975# define DTOR_LIST_END /* empty */
1976# else /* !defined (__ARM_EABI__) */
1977# define CTORS_SECTION_ASM_OP ARM_CTORS_SECTION_OP
1978# define DTORS_SECTION_ASM_OP ARM_DTORS_SECTION_OP
1979# endif /* !defined (__ARM_EABI__) */
1980#endif /* !defined (IN_LIBCC2) */
1981
1e731102
MM
1982/* True if the operating system can merge entities with vague linkage
1983 (e.g., symbols in COMDAT group) during dynamic linking. */
1984#ifndef TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P
1985#define TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P true
1986#endif
1987
a77655b1
NC
1988/* Set the short-call flag for any function compiled in the current
1989 compilation unit. We skip this for functions with the section
c112cf2b 1990 attribute when long-calls are in effect as this tells the compiler
a77655b1
NC
1991 that the section might be placed a long way from the caller.
1992 See arm_is_longcall_p() for more information. */
c27ba912 1993#define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
a77655b1
NC
1994 if (!TARGET_LONG_CALLS || ! DECL_SECTION_NAME (DECL)) \
1995 arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR)
c27ba912 1996
617a1b71
PB
1997#define ARM_OUTPUT_FN_UNWIND(F, PROLOGUE) arm_output_fn_unwind (F, PROLOGUE)
1998
1999#ifdef TARGET_UNWIND_INFO
2000#define ARM_EABI_UNWIND_TABLES \
2001 ((!USING_SJLJ_EXCEPTIONS && flag_exceptions) || flag_unwind_tables)
2002#else
2003#define ARM_EABI_UNWIND_TABLES 0
2004#endif
2005
35d965d5
RS
2006/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
2007 and check its validity for a certain class.
2008 We have two alternate definitions for each of them.
2009 The usual definition accepts all pseudo regs; the other rejects
2010 them unless they have been allocated suitable hard regs.
2011 The symbol REG_OK_STRICT causes the latter definition to be used. */
2012#ifndef REG_OK_STRICT
ff9940b0 2013
f1008e52
RE
2014#define ARM_REG_OK_FOR_BASE_P(X) \
2015 (REGNO (X) <= LAST_ARM_REGNUM \
2016 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
2017 || REGNO (X) == FRAME_POINTER_REGNUM \
2018 || REGNO (X) == ARG_POINTER_REGNUM)
ff9940b0 2019
f1008e52
RE
2020#define THUMB_REG_MODE_OK_FOR_BASE_P(X, MODE) \
2021 (REGNO (X) <= LAST_LO_REGNUM \
2022 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
2023 || (GET_MODE_SIZE (MODE) >= 4 \
2024 && (REGNO (X) == STACK_POINTER_REGNUM \
2025 || (X) == hard_frame_pointer_rtx \
2026 || (X) == arg_pointer_rtx)))
ff9940b0 2027
76a318e9
RE
2028#define REG_STRICT_P 0
2029
d5b7b3ae 2030#else /* REG_OK_STRICT */
ff9940b0 2031
f1008e52
RE
2032#define ARM_REG_OK_FOR_BASE_P(X) \
2033 ARM_REGNO_OK_FOR_BASE_P (REGNO (X))
ff9940b0 2034
f1008e52
RE
2035#define THUMB_REG_MODE_OK_FOR_BASE_P(X, MODE) \
2036 THUMB_REGNO_MODE_OK_FOR_BASE_P (REGNO (X), MODE)
ff9940b0 2037
76a318e9
RE
2038#define REG_STRICT_P 1
2039
d5b7b3ae 2040#endif /* REG_OK_STRICT */
f1008e52
RE
2041
2042/* Now define some helpers in terms of the above. */
2043
2044#define REG_MODE_OK_FOR_BASE_P(X, MODE) \
2045 (TARGET_THUMB \
2046 ? THUMB_REG_MODE_OK_FOR_BASE_P (X, MODE) \
2047 : ARM_REG_OK_FOR_BASE_P (X))
2048
2049#define ARM_REG_OK_FOR_INDEX_P(X) ARM_REG_OK_FOR_BASE_P (X)
2050
2051/* For Thumb, a valid index register is anything that can be used in
2052 a byte load instruction. */
2053#define THUMB_REG_OK_FOR_INDEX_P(X) THUMB_REG_MODE_OK_FOR_BASE_P (X, QImode)
2054
2055/* Nonzero if X is a hard reg that can be used as an index
2056 or if it is a pseudo reg. On the Thumb, the stack pointer
2057 is not suitable. */
2058#define REG_OK_FOR_INDEX_P(X) \
2059 (TARGET_THUMB \
2060 ? THUMB_REG_OK_FOR_INDEX_P (X) \
2061 : ARM_REG_OK_FOR_INDEX_P (X))
2062
888d2cd6
DJ
2063/* Nonzero if X can be the base register in a reg+reg addressing mode.
2064 For Thumb, we can not use SP + reg, so reject SP. */
2065#define REG_MODE_OK_FOR_REG_BASE_P(X, MODE) \
2066 REG_OK_FOR_INDEX_P (X)
35d965d5
RS
2067\f
2068/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
2069 that is a valid memory address for an instruction.
2070 The MODE argument is the machine mode for the MEM expression
76a318e9 2071 that wants to use this address. */
f676971a 2072
f1008e52
RE
2073#define ARM_BASE_REGISTER_RTX_P(X) \
2074 (GET_CODE (X) == REG && ARM_REG_OK_FOR_BASE_P (X))
35d965d5 2075
f1008e52
RE
2076#define ARM_INDEX_REGISTER_RTX_P(X) \
2077 (GET_CODE (X) == REG && ARM_REG_OK_FOR_INDEX_P (X))
35d965d5 2078
76a318e9
RE
2079#define ARM_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \
2080 { \
1e1ab407 2081 if (arm_legitimate_address_p (MODE, X, SET, REG_STRICT_P)) \
76a318e9 2082 goto WIN; \
6b990f6b 2083 }
d5b7b3ae 2084
76a318e9
RE
2085#define THUMB_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \
2086 { \
2087 if (thumb_legitimate_address_p (MODE, X, REG_STRICT_P)) \
2088 goto WIN; \
2089 }
d5b7b3ae 2090
d5b7b3ae
RE
2091#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
2092 if (TARGET_ARM) \
2093 ARM_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN) \
2094 else /* if (TARGET_THUMB) */ \
f676971a 2095 THUMB_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN)
76a318e9 2096
35d965d5
RS
2097\f
2098/* Try machine-dependent ways of modifying an illegitimate address
ccf4d512
RE
2099 to be legitimate. If we find one, return the new, valid address. */
2100#define ARM_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2101do { \
2102 X = arm_legitimize_address (X, OLDX, MODE); \
ccf4d512
RE
2103} while (0)
2104
6f5b4f3e
RE
2105#define THUMB_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2106do { \
2107 X = thumb_legitimize_address (X, OLDX, MODE); \
ccf4d512
RE
2108} while (0)
2109
2110#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2111do { \
2112 if (TARGET_ARM) \
2113 ARM_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
2114 else \
2115 THUMB_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
6f5b4f3e
RE
2116 \
2117 if (memory_address_p (MODE, X)) \
2118 goto WIN; \
ccf4d512 2119} while (0)
f676971a 2120
35d965d5
RS
2121/* Go to LABEL if ADDR (a legitimate address expression)
2122 has an effect that depends on the machine mode it is used for. */
d5b7b3ae 2123#define ARM_GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
35d965d5 2124{ \
d5b7b3ae
RE
2125 if ( GET_CODE (ADDR) == PRE_DEC || GET_CODE (ADDR) == POST_DEC \
2126 || GET_CODE (ADDR) == PRE_INC || GET_CODE (ADDR) == POST_INC) \
35d965d5
RS
2127 goto LABEL; \
2128}
d5b7b3ae
RE
2129
2130/* Nothing helpful to do for the Thumb */
2131#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
2132 if (TARGET_ARM) \
f676971a 2133 ARM_GO_IF_MODE_DEPENDENT_ADDRESS (ADDR, LABEL)
35d965d5 2134\f
d5b7b3ae 2135
35d965d5
RS
2136/* Specify the machine mode that this machine uses
2137 for the index in the tablejump instruction. */
d5b7b3ae 2138#define CASE_VECTOR_MODE Pmode
35d965d5 2139
ff9940b0
RE
2140/* signed 'char' is most compatible, but RISC OS wants it unsigned.
2141 unsigned is probably best, but may break some code. */
2142#ifndef DEFAULT_SIGNED_CHAR
3967692c 2143#define DEFAULT_SIGNED_CHAR 0
35d965d5
RS
2144#endif
2145
35d965d5 2146/* Max number of bytes we can move from memory to memory
d17ce9af
TG
2147 in one reasonably fast instruction. */
2148#define MOVE_MAX 4
35d965d5 2149
d19fb8e3 2150#undef MOVE_RATIO
591af218 2151#define MOVE_RATIO (arm_tune_xscale ? 4 : 2)
d19fb8e3 2152
ff9940b0
RE
2153/* Define if operations between registers always perform the operation
2154 on the full register even if a narrower mode is specified. */
2155#define WORD_REGISTER_OPERATIONS
2156
2157/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2158 will either zero-extend or sign-extend. The value of this macro should
2159 be the code that says which one of the two operations is implicitly
f822d252 2160 done, UNKNOWN if none. */
9c872872 2161#define LOAD_EXTEND_OP(MODE) \
d5b7b3ae
RE
2162 (TARGET_THUMB ? ZERO_EXTEND : \
2163 ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \
f822d252 2164 : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : UNKNOWN)))
ff9940b0 2165
35d965d5
RS
2166/* Nonzero if access to memory by bytes is slow and undesirable. */
2167#define SLOW_BYTE_ACCESS 0
2168
d5b7b3ae 2169#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1
f676971a 2170
35d965d5
RS
2171/* Immediate shift counts are truncated by the output routines (or was it
2172 the assembler?). Shift counts in a register are truncated by ARM. Note
2173 that the native compiler puts too large (> 32) immediate shift counts
2174 into a register and shifts by the register, letting the ARM decide what
2175 to do instead of doing that itself. */
ff9940b0
RE
2176/* This is all wrong. Defining SHIFT_COUNT_TRUNCATED tells combine that
2177 code like (X << (Y % 32)) for register X, Y is equivalent to (X << Y).
2178 On the arm, Y in a register is used modulo 256 for the shift. Only for
d6b4baa4 2179 rotates is modulo 32 used. */
ff9940b0 2180/* #define SHIFT_COUNT_TRUNCATED 1 */
35d965d5 2181
35d965d5 2182/* All integers have the same format so truncation is easy. */
d5b7b3ae 2183#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
35d965d5
RS
2184
2185/* Calling from registers is a massive pain. */
2186#define NO_FUNCTION_CSE 1
2187
35d965d5
RS
2188/* The machine modes of pointers and functions */
2189#define Pmode SImode
2190#define FUNCTION_MODE Pmode
2191
d5b7b3ae
RE
2192#define ARM_FRAME_RTX(X) \
2193 ( (X) == frame_pointer_rtx || (X) == stack_pointer_rtx \
3967692c
RE
2194 || (X) == arg_pointer_rtx)
2195
ff9940b0 2196/* Moves to and from memory are quite expensive */
d5b7b3ae
RE
2197#define MEMORY_MOVE_COST(M, CLASS, IN) \
2198 (TARGET_ARM ? 10 : \
2199 ((GET_MODE_SIZE (M) < 4 ? 8 : 2 * GET_MODE_SIZE (M)) \
2200 * (CLASS == LO_REGS ? 1 : 2)))
f676971a 2201
ff9940b0
RE
2202/* Try to generate sequences that don't involve branches, we can then use
2203 conditional instructions */
d5b7b3ae
RE
2204#define BRANCH_COST \
2205 (TARGET_ARM ? 4 : (optimize > 1 ? 1 : 0))
7a801826
RE
2206\f
2207/* Position Independent Code. */
2208/* We decide which register to use based on the compilation options and
2209 the assembler in use; this is more general than the APCS restriction of
2210 using sb (r9) all the time. */
020a4035 2211extern unsigned arm_pic_register;
7a801826
RE
2212
2213/* The register number of the register used to address a table of static
2214 data addresses in memory. */
2215#define PIC_OFFSET_TABLE_REGNUM arm_pic_register
2216
f5a1b0d2 2217/* We can't directly access anything that contains a symbol,
d3585b76
DJ
2218 nor can we indirect via the constant pool. One exception is
2219 UNSPEC_TLS, which is always PIC. */
82e9d970 2220#define LEGITIMATE_PIC_OPERAND_P(X) \
1575c31e
JD
2221 (!(symbol_mentioned_p (X) \
2222 || label_mentioned_p (X) \
2223 || (GET_CODE (X) == SYMBOL_REF \
2224 && CONSTANT_POOL_ADDRESS_P (X) \
2225 && (symbol_mentioned_p (get_pool_constant (X)) \
d3585b76
DJ
2226 || label_mentioned_p (get_pool_constant (X))))) \
2227 || tls_mentioned_p (X))
1575c31e 2228
13bd191d
PB
2229/* We need to know when we are making a constant pool; this determines
2230 whether data needs to be in the GOT or can be referenced via a GOT
2231 offset. */
2232extern int making_const_table;
82e9d970 2233\f
c27ba912 2234/* Handle pragmas for compatibility with Intel's compilers. */
c58b209a
NB
2235#define REGISTER_TARGET_PRAGMAS() do { \
2236 c_register_pragma (0, "long_calls", arm_pr_long_calls); \
2237 c_register_pragma (0, "no_long_calls", arm_pr_no_long_calls); \
2238 c_register_pragma (0, "long_calls_off", arm_pr_long_calls_off); \
8b97c5f8
ZW
2239} while (0)
2240
d6b4baa4 2241/* Condition code information. */
ff9940b0 2242/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
a5381466 2243 return the mode to be used for the comparison. */
d5b7b3ae
RE
2244
2245#define SELECT_CC_MODE(OP, X, Y) arm_select_cc_mode (OP, X, Y)
ff9940b0 2246
880873be
RE
2247#define REVERSIBLE_CC_MODE(MODE) 1
2248
2249#define REVERSE_CONDITION(CODE,MODE) \
2250 (((MODE) == CCFPmode || (MODE) == CCFPEmode) \
2251 ? reverse_condition_maybe_unordered (code) \
2252 : reverse_condition (code))
008cf58a 2253
62b10bbc
NC
2254#define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \
2255 do \
2256 { \
2257 if (GET_CODE (OP1) == CONST_INT \
2258 && ! (const_ok_for_arm (INTVAL (OP1)) \
2259 || (const_ok_for_arm (- INTVAL (OP1))))) \
2260 { \
2261 rtx const_op = OP1; \
a14b88bb
PB
2262 CODE = arm_canonicalize_comparison ((CODE), GET_MODE (OP0), \
2263 &const_op); \
62b10bbc
NC
2264 OP1 = const_op; \
2265 } \
2266 } \
2267 while (0)
62dd06ea 2268
7dba8395
RH
2269/* The arm5 clz instruction returns 32. */
2270#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
35d965d5 2271\f
d5b7b3ae
RE
2272#undef ASM_APP_OFF
2273#define ASM_APP_OFF (TARGET_THUMB ? "\t.code\t16\n" : "")
35d965d5 2274
35d965d5 2275/* Output a push or a pop instruction (only used when profiling). */
d5b7b3ae 2276#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
8a81cc45
RE
2277 do \
2278 { \
2279 if (TARGET_ARM) \
2280 asm_fprintf (STREAM,"\tstmfd\t%r!,{%r}\n", \
2281 STACK_POINTER_REGNUM, REGNO); \
2282 else \
2283 asm_fprintf (STREAM, "\tpush {%r}\n", REGNO); \
2284 } while (0)
d5b7b3ae
RE
2285
2286
2287#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
8a81cc45
RE
2288 do \
2289 { \
2290 if (TARGET_ARM) \
2291 asm_fprintf (STREAM, "\tldmfd\t%r!,{%r}\n", \
2292 STACK_POINTER_REGNUM, REGNO); \
2293 else \
2294 asm_fprintf (STREAM, "\tpop {%r}\n", REGNO); \
2295 } while (0)
d5b7b3ae
RE
2296
2297/* This is how to output a label which precedes a jumptable. Since
2298 Thumb instructions are 2 bytes, we may need explicit alignment here. */
be393ecf 2299#undef ASM_OUTPUT_CASE_LABEL
d5b7b3ae
RE
2300#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
2301 do \
2302 { \
2303 if (TARGET_THUMB) \
2304 ASM_OUTPUT_ALIGN (FILE, 2); \
8a81cc45 2305 (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \
d5b7b3ae
RE
2306 } \
2307 while (0)
35d965d5 2308
6cfc7210
NC
2309#define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
2310 do \
2311 { \
d5b7b3ae
RE
2312 if (TARGET_THUMB) \
2313 { \
9b66ebb1
PB
2314 if (is_called_in_ARM_mode (DECL) \
2315 || current_function_is_thunk) \
d5b7b3ae
RE
2316 fprintf (STREAM, "\t.code 32\n") ; \
2317 else \
9b66ebb1 2318 fprintf (STREAM, "\t.code 16\n\t.thumb_func\n") ; \
d5b7b3ae 2319 } \
6cfc7210 2320 if (TARGET_POKE_FUNCTION_NAME) \
6354dc9b 2321 arm_poke_function_name (STREAM, (char *) NAME); \
6cfc7210
NC
2322 } \
2323 while (0)
35d965d5 2324
d5b7b3ae
RE
2325/* For aliases of functions we use .thumb_set instead. */
2326#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL1, DECL2) \
2327 do \
2328 { \
91ea4f8d
KG
2329 const char *const LABEL1 = XSTR (XEXP (DECL_RTL (decl), 0), 0); \
2330 const char *const LABEL2 = IDENTIFIER_POINTER (DECL2); \
d5b7b3ae
RE
2331 \
2332 if (TARGET_THUMB && TREE_CODE (DECL1) == FUNCTION_DECL) \
2333 { \
2334 fprintf (FILE, "\t.thumb_set "); \
2335 assemble_name (FILE, LABEL1); \
2336 fprintf (FILE, ","); \
2337 assemble_name (FILE, LABEL2); \
2338 fprintf (FILE, "\n"); \
2339 } \
2340 else \
2341 ASM_OUTPUT_DEF (FILE, LABEL1, LABEL2); \
2342 } \
2343 while (0)
2344
fdc2d3b0
NC
2345#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
2346/* To support -falign-* switches we need to use .p2align so
2347 that alignment directives in code sections will be padded
2348 with no-op instructions, rather than zeroes. */
5a9335ef 2349#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
fdc2d3b0
NC
2350 if ((LOG) != 0) \
2351 { \
2352 if ((MAX_SKIP) == 0) \
5a9335ef 2353 fprintf ((FILE), "\t.p2align %d\n", (int) (LOG)); \
fdc2d3b0
NC
2354 else \
2355 fprintf ((FILE), "\t.p2align %d,,%d\n", \
5a9335ef 2356 (int) (LOG), (int) (MAX_SKIP)); \
fdc2d3b0
NC
2357 }
2358#endif
35d965d5 2359\f
35d965d5 2360/* Only perform branch elimination (by making instructions conditional) if
72ac76be 2361 we're optimizing. Otherwise it's of no use anyway. */
d5b7b3ae
RE
2362#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
2363 if (TARGET_ARM && optimize) \
2364 arm_final_prescan_insn (INSN); \
2365 else if (TARGET_THUMB) \
2366 thumb_final_prescan_insn (INSN)
35d965d5 2367
7bc7696c 2368#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
d5b7b3ae
RE
2369 (CODE == '@' || CODE == '|' \
2370 || (TARGET_ARM && (CODE == '?')) \
2371 || (TARGET_THUMB && (CODE == '_')))
6cfc7210 2372
7bc7696c 2373/* Output an operand of an instruction. */
35d965d5 2374#define PRINT_OPERAND(STREAM, X, CODE) \
7bc7696c
RE
2375 arm_print_operand (STREAM, X, CODE)
2376
7b8b8ade
NC
2377#define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \
2378 (HOST_BITS_PER_WIDE_INT <= 32 ? (unsigned HOST_WIDE_INT) (x) \
30cf4896
KG
2379 : ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0xffffffff) |\
2380 ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0x80000000) \
2381 ? ((~ (unsigned HOST_WIDE_INT) 0) \
2382 & ~ (unsigned HOST_WIDE_INT) 0xffffffff) \
7bc7696c 2383 : 0))))
35d965d5
RS
2384
2385/* Output the address of an operand. */
3cd45774
RE
2386#define ARM_PRINT_OPERAND_ADDRESS(STREAM, X) \
2387{ \
2388 int is_minus = GET_CODE (X) == MINUS; \
2389 \
2390 if (GET_CODE (X) == REG) \
2391 asm_fprintf (STREAM, "[%r, #0]", REGNO (X)); \
2392 else if (GET_CODE (X) == PLUS || is_minus) \
2393 { \
2394 rtx base = XEXP (X, 0); \
2395 rtx index = XEXP (X, 1); \
2396 HOST_WIDE_INT offset = 0; \
2397 if (GET_CODE (base) != REG) \
2398 { \
d6b4baa4
KH
2399 /* Ensure that BASE is a register. */ \
2400 /* (one of them must be). */ \
3cd45774
RE
2401 rtx temp = base; \
2402 base = index; \
2403 index = temp; \
2404 } \
2405 switch (GET_CODE (index)) \
2406 { \
2407 case CONST_INT: \
2408 offset = INTVAL (index); \
2409 if (is_minus) \
2410 offset = -offset; \
c53dddc2 2411 asm_fprintf (STREAM, "[%r, #%wd]", \
3cd45774
RE
2412 REGNO (base), offset); \
2413 break; \
2414 \
2415 case REG: \
2416 asm_fprintf (STREAM, "[%r, %s%r]", \
2417 REGNO (base), is_minus ? "-" : "", \
2418 REGNO (index)); \
2419 break; \
2420 \
2421 case MULT: \
2422 case ASHIFTRT: \
2423 case LSHIFTRT: \
2424 case ASHIFT: \
2425 case ROTATERT: \
2426 { \
2427 asm_fprintf (STREAM, "[%r, %s%r", \
2428 REGNO (base), is_minus ? "-" : "", \
2429 REGNO (XEXP (index, 0))); \
2430 arm_print_operand (STREAM, index, 'S'); \
2431 fputs ("]", STREAM); \
2432 break; \
2433 } \
2434 \
2435 default: \
e6d29d15 2436 gcc_unreachable (); \
3cd45774
RE
2437 } \
2438 } \
2439 else if (GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC \
2440 || GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC) \
2441 { \
2442 extern enum machine_mode output_memory_reference_mode; \
2443 \
e6d29d15 2444 gcc_assert (GET_CODE (XEXP (X, 0)) == REG); \
3cd45774
RE
2445 \
2446 if (GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
2447 asm_fprintf (STREAM, "[%r, #%s%d]!", \
2448 REGNO (XEXP (X, 0)), \
2449 GET_CODE (X) == PRE_DEC ? "-" : "", \
2450 GET_MODE_SIZE (output_memory_reference_mode)); \
2451 else \
2452 asm_fprintf (STREAM, "[%r], #%s%d", \
2453 REGNO (XEXP (X, 0)), \
2454 GET_CODE (X) == POST_DEC ? "-" : "", \
2455 GET_MODE_SIZE (output_memory_reference_mode)); \
2456 } \
2457 else if (GET_CODE (X) == PRE_MODIFY) \
2458 { \
2459 asm_fprintf (STREAM, "[%r, ", REGNO (XEXP (X, 0))); \
2460 if (GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT) \
c53dddc2 2461 asm_fprintf (STREAM, "#%wd]!", \
3cd45774
RE
2462 INTVAL (XEXP (XEXP (X, 1), 1))); \
2463 else \
2464 asm_fprintf (STREAM, "%r]!", \
2465 REGNO (XEXP (XEXP (X, 1), 1))); \
2466 } \
2467 else if (GET_CODE (X) == POST_MODIFY) \
2468 { \
2469 asm_fprintf (STREAM, "[%r], ", REGNO (XEXP (X, 0))); \
2470 if (GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT) \
c53dddc2 2471 asm_fprintf (STREAM, "#%wd", \
3cd45774
RE
2472 INTVAL (XEXP (XEXP (X, 1), 1))); \
2473 else \
2474 asm_fprintf (STREAM, "%r", \
2475 REGNO (XEXP (XEXP (X, 1), 1))); \
2476 } \
2477 else output_addr_const (STREAM, X); \
35d965d5 2478}
62dd06ea 2479
d5b7b3ae
RE
2480#define THUMB_PRINT_OPERAND_ADDRESS(STREAM, X) \
2481{ \
2482 if (GET_CODE (X) == REG) \
2483 asm_fprintf (STREAM, "[%r]", REGNO (X)); \
2484 else if (GET_CODE (X) == POST_INC) \
2485 asm_fprintf (STREAM, "%r!", REGNO (XEXP (X, 0))); \
2486 else if (GET_CODE (X) == PLUS) \
2487 { \
e6d29d15 2488 gcc_assert (GET_CODE (XEXP (X, 0)) == REG); \
d5b7b3ae 2489 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
659bdc68 2490 asm_fprintf (STREAM, "[%r, #%wd]", \
d5b7b3ae 2491 REGNO (XEXP (X, 0)), \
659bdc68 2492 INTVAL (XEXP (X, 1))); \
d5b7b3ae
RE
2493 else \
2494 asm_fprintf (STREAM, "[%r, %r]", \
2495 REGNO (XEXP (X, 0)), \
2496 REGNO (XEXP (X, 1))); \
2497 } \
2498 else \
2499 output_addr_const (STREAM, X); \
2500}
2501
2502#define PRINT_OPERAND_ADDRESS(STREAM, X) \
2503 if (TARGET_ARM) \
2504 ARM_PRINT_OPERAND_ADDRESS (STREAM, X) \
2505 else \
2506 THUMB_PRINT_OPERAND_ADDRESS (STREAM, X)
5a9335ef 2507
d3585b76
DJ
2508#define OUTPUT_ADDR_CONST_EXTRA(file, x, fail) \
2509 if (arm_output_addr_const_extra (file, x) == FALSE) \
2510 goto fail
5a9335ef 2511
6a5d7526
MS
2512/* A C expression whose value is RTL representing the value of the return
2513 address for the frame COUNT steps up from the current frame. */
2514
d5b7b3ae
RE
2515#define RETURN_ADDR_RTX(COUNT, FRAME) \
2516 arm_return_addr (COUNT, FRAME)
2517
f676971a 2518/* Mask of the bits in the PC that contain the real return address
d5b7b3ae
RE
2519 when running in 26-bit mode. */
2520#define RETURN_ADDR_MASK26 (0x03fffffc)
6a5d7526 2521
2c849145
JM
2522/* Pick up the return address upon entry to a procedure. Used for
2523 dwarf2 unwind information. This also enables the table driven
2524 mechanism. */
2c849145
JM
2525#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LR_REGNUM)
2526#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LR_REGNUM)
2527
39950dff
MS
2528/* Used to mask out junk bits from the return address, such as
2529 processor state, interrupt status, condition codes and the like. */
2530#define MASK_RETURN_ADDR \
2531 /* If we are generating code for an ARM2/ARM3 machine or for an ARM6 \
2532 in 26 bit mode, the condition codes must be masked out of the \
2533 return address. This does not apply to ARM6 and later processors \
2534 when running in 32 bit mode. */ \
61f0ccff
RE
2535 ((arm_arch4 || TARGET_THUMB) \
2536 ? (gen_int_mode ((unsigned long)0xffffffff, Pmode)) \
fcd53748 2537 : arm_gen_return_addr_mask ())
d5b7b3ae
RE
2538
2539\f
5a9335ef
NC
2540enum arm_builtins
2541{
2542 ARM_BUILTIN_GETWCX,
2543 ARM_BUILTIN_SETWCX,
2544
2545 ARM_BUILTIN_WZERO,
2546
2547 ARM_BUILTIN_WAVG2BR,
2548 ARM_BUILTIN_WAVG2HR,
2549 ARM_BUILTIN_WAVG2B,
2550 ARM_BUILTIN_WAVG2H,
2551
2552 ARM_BUILTIN_WACCB,
2553 ARM_BUILTIN_WACCH,
2554 ARM_BUILTIN_WACCW,
2555
2556 ARM_BUILTIN_WMACS,
2557 ARM_BUILTIN_WMACSZ,
2558 ARM_BUILTIN_WMACU,
2559 ARM_BUILTIN_WMACUZ,
2560
2561 ARM_BUILTIN_WSADB,
2562 ARM_BUILTIN_WSADBZ,
2563 ARM_BUILTIN_WSADH,
2564 ARM_BUILTIN_WSADHZ,
2565
2566 ARM_BUILTIN_WALIGN,
2567
2568 ARM_BUILTIN_TMIA,
2569 ARM_BUILTIN_TMIAPH,
2570 ARM_BUILTIN_TMIABB,
2571 ARM_BUILTIN_TMIABT,
2572 ARM_BUILTIN_TMIATB,
2573 ARM_BUILTIN_TMIATT,
2574
2575 ARM_BUILTIN_TMOVMSKB,
2576 ARM_BUILTIN_TMOVMSKH,
2577 ARM_BUILTIN_TMOVMSKW,
2578
2579 ARM_BUILTIN_TBCSTB,
2580 ARM_BUILTIN_TBCSTH,
2581 ARM_BUILTIN_TBCSTW,
2582
2583 ARM_BUILTIN_WMADDS,
2584 ARM_BUILTIN_WMADDU,
2585
2586 ARM_BUILTIN_WPACKHSS,
2587 ARM_BUILTIN_WPACKWSS,
2588 ARM_BUILTIN_WPACKDSS,
2589 ARM_BUILTIN_WPACKHUS,
2590 ARM_BUILTIN_WPACKWUS,
2591 ARM_BUILTIN_WPACKDUS,
2592
2593 ARM_BUILTIN_WADDB,
2594 ARM_BUILTIN_WADDH,
2595 ARM_BUILTIN_WADDW,
2596 ARM_BUILTIN_WADDSSB,
2597 ARM_BUILTIN_WADDSSH,
2598 ARM_BUILTIN_WADDSSW,
2599 ARM_BUILTIN_WADDUSB,
2600 ARM_BUILTIN_WADDUSH,
2601 ARM_BUILTIN_WADDUSW,
2602 ARM_BUILTIN_WSUBB,
2603 ARM_BUILTIN_WSUBH,
2604 ARM_BUILTIN_WSUBW,
2605 ARM_BUILTIN_WSUBSSB,
2606 ARM_BUILTIN_WSUBSSH,
2607 ARM_BUILTIN_WSUBSSW,
2608 ARM_BUILTIN_WSUBUSB,
2609 ARM_BUILTIN_WSUBUSH,
2610 ARM_BUILTIN_WSUBUSW,
2611
2612 ARM_BUILTIN_WAND,
2613 ARM_BUILTIN_WANDN,
2614 ARM_BUILTIN_WOR,
2615 ARM_BUILTIN_WXOR,
2616
2617 ARM_BUILTIN_WCMPEQB,
2618 ARM_BUILTIN_WCMPEQH,
2619 ARM_BUILTIN_WCMPEQW,
2620 ARM_BUILTIN_WCMPGTUB,
2621 ARM_BUILTIN_WCMPGTUH,
2622 ARM_BUILTIN_WCMPGTUW,
2623 ARM_BUILTIN_WCMPGTSB,
2624 ARM_BUILTIN_WCMPGTSH,
2625 ARM_BUILTIN_WCMPGTSW,
2626
2627 ARM_BUILTIN_TEXTRMSB,
2628 ARM_BUILTIN_TEXTRMSH,
2629 ARM_BUILTIN_TEXTRMSW,
2630 ARM_BUILTIN_TEXTRMUB,
2631 ARM_BUILTIN_TEXTRMUH,
2632 ARM_BUILTIN_TEXTRMUW,
2633 ARM_BUILTIN_TINSRB,
2634 ARM_BUILTIN_TINSRH,
2635 ARM_BUILTIN_TINSRW,
2636
2637 ARM_BUILTIN_WMAXSW,
2638 ARM_BUILTIN_WMAXSH,
2639 ARM_BUILTIN_WMAXSB,
2640 ARM_BUILTIN_WMAXUW,
2641 ARM_BUILTIN_WMAXUH,
2642 ARM_BUILTIN_WMAXUB,
2643 ARM_BUILTIN_WMINSW,
2644 ARM_BUILTIN_WMINSH,
2645 ARM_BUILTIN_WMINSB,
2646 ARM_BUILTIN_WMINUW,
2647 ARM_BUILTIN_WMINUH,
2648 ARM_BUILTIN_WMINUB,
2649
f07a6b21
BE
2650 ARM_BUILTIN_WMULUM,
2651 ARM_BUILTIN_WMULSM,
5a9335ef
NC
2652 ARM_BUILTIN_WMULUL,
2653
2654 ARM_BUILTIN_PSADBH,
2655 ARM_BUILTIN_WSHUFH,
2656
2657 ARM_BUILTIN_WSLLH,
2658 ARM_BUILTIN_WSLLW,
2659 ARM_BUILTIN_WSLLD,
2660 ARM_BUILTIN_WSRAH,
2661 ARM_BUILTIN_WSRAW,
2662 ARM_BUILTIN_WSRAD,
2663 ARM_BUILTIN_WSRLH,
2664 ARM_BUILTIN_WSRLW,
2665 ARM_BUILTIN_WSRLD,
2666 ARM_BUILTIN_WRORH,
2667 ARM_BUILTIN_WRORW,
2668 ARM_BUILTIN_WRORD,
2669 ARM_BUILTIN_WSLLHI,
2670 ARM_BUILTIN_WSLLWI,
2671 ARM_BUILTIN_WSLLDI,
2672 ARM_BUILTIN_WSRAHI,
2673 ARM_BUILTIN_WSRAWI,
2674 ARM_BUILTIN_WSRADI,
2675 ARM_BUILTIN_WSRLHI,
2676 ARM_BUILTIN_WSRLWI,
2677 ARM_BUILTIN_WSRLDI,
2678 ARM_BUILTIN_WRORHI,
2679 ARM_BUILTIN_WRORWI,
2680 ARM_BUILTIN_WRORDI,
2681
2682 ARM_BUILTIN_WUNPCKIHB,
2683 ARM_BUILTIN_WUNPCKIHH,
2684 ARM_BUILTIN_WUNPCKIHW,
2685 ARM_BUILTIN_WUNPCKILB,
2686 ARM_BUILTIN_WUNPCKILH,
2687 ARM_BUILTIN_WUNPCKILW,
2688
2689 ARM_BUILTIN_WUNPCKEHSB,
2690 ARM_BUILTIN_WUNPCKEHSH,
2691 ARM_BUILTIN_WUNPCKEHSW,
2692 ARM_BUILTIN_WUNPCKEHUB,
2693 ARM_BUILTIN_WUNPCKEHUH,
2694 ARM_BUILTIN_WUNPCKEHUW,
2695 ARM_BUILTIN_WUNPCKELSB,
2696 ARM_BUILTIN_WUNPCKELSH,
2697 ARM_BUILTIN_WUNPCKELSW,
2698 ARM_BUILTIN_WUNPCKELUB,
2699 ARM_BUILTIN_WUNPCKELUH,
2700 ARM_BUILTIN_WUNPCKELUW,
2701
d3585b76
DJ
2702 ARM_BUILTIN_THREAD_POINTER,
2703
5a9335ef
NC
2704 ARM_BUILTIN_MAX
2705};
88657302 2706#endif /* ! GCC_ARM_H */