]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/s390/s390.h
fold-const.c (maybe_canonicalize_comparison_1): Move A code CST canonicalization ...
[thirdparty/gcc.git] / gcc / config / s390 / s390.h
CommitLineData
9db1d521 1/* Definitions of target machine for GNU compiler, for IBM S/390
5624e564 2 Copyright (C) 1999-2015 Free Software Foundation, Inc.
9db1d521 3 Contributed by Hartmut Penner (hpenner@de.ibm.com) and
f314b9b1 4 Ulrich Weigand (uweigand@de.ibm.com).
963fc8d0 5 Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
9db1d521 6
58add37a 7This file is part of GCC.
9db1d521 8
58add37a
UW
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
2f83c7d6 11Software Foundation; either version 3, or (at your option) any later
58add37a
UW
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17for more details.
9db1d521
HP
18
19You should have received a copy of the GNU General Public License
2f83c7d6
NC
20along with GCC; see the file COPYING3. If not see
21<http://www.gnu.org/licenses/>. */
9db1d521
HP
22
23#ifndef _S390_H
24#define _S390_H
25
f13e0d4e
UW
26/* Optional architectural facilities supported by the processor. */
27
28enum processor_flags
29{
30 PF_IEEE_FLOAT = 1,
31 PF_ZARCH = 2,
ec24698e 32 PF_LONG_DISPLACEMENT = 4,
85dae55a 33 PF_EXTIMM = 8,
93538e8e 34 PF_DFP = 16,
65b1d8ea 35 PF_Z10 = 32,
22ac2c2f 36 PF_Z196 = 64,
5a3fe9b6 37 PF_ZEC12 = 128,
55ac540c
AK
38 PF_TX = 256,
39 PF_Z13 = 512,
40 PF_VX = 1024
f13e0d4e
UW
41};
42
90c6fd8a
AK
43/* This is necessary to avoid a warning about comparing different enum
44 types. */
45#define s390_tune_attr ((enum attr_cpu)s390_tune)
46
963fc8d0
AK
47/* These flags indicate that the generated code should run on a cpu
48 providing the respective hardware facility regardless of the
49 current cpu mode (ESA or z/Architecture). */
50
f13e0d4e
UW
51#define TARGET_CPU_IEEE_FLOAT \
52 (s390_arch_flags & PF_IEEE_FLOAT)
53#define TARGET_CPU_ZARCH \
54 (s390_arch_flags & PF_ZARCH)
55#define TARGET_CPU_LONG_DISPLACEMENT \
56 (s390_arch_flags & PF_LONG_DISPLACEMENT)
ec24698e
UW
57#define TARGET_CPU_EXTIMM \
58 (s390_arch_flags & PF_EXTIMM)
85dae55a
AK
59#define TARGET_CPU_DFP \
60 (s390_arch_flags & PF_DFP)
93538e8e
AK
61#define TARGET_CPU_Z10 \
62 (s390_arch_flags & PF_Z10)
65b1d8ea
AK
63#define TARGET_CPU_Z196 \
64 (s390_arch_flags & PF_Z196)
22ac2c2f
AK
65#define TARGET_CPU_ZEC12 \
66 (s390_arch_flags & PF_ZEC12)
5a3fe9b6
AK
67#define TARGET_CPU_HTM \
68 (s390_arch_flags & PF_TX)
55ac540c
AK
69#define TARGET_CPU_Z13 \
70 (s390_arch_flags & PF_Z13)
71#define TARGET_CPU_VX \
72 (s390_arch_flags & PF_VX)
f13e0d4e 73
963fc8d0
AK
74/* These flags indicate that the generated code should run on a cpu
75 providing the respective hardware facility when run in
76 z/Architecture mode. */
77
f13e0d4e
UW
78#define TARGET_LONG_DISPLACEMENT \
79 (TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT)
ec24698e
UW
80#define TARGET_EXTIMM \
81 (TARGET_ZARCH && TARGET_CPU_EXTIMM)
85dae55a 82#define TARGET_DFP \
fb068247 83 (TARGET_ZARCH && TARGET_CPU_DFP && TARGET_HARD_FLOAT)
93538e8e
AK
84#define TARGET_Z10 \
85 (TARGET_ZARCH && TARGET_CPU_Z10)
65b1d8ea
AK
86#define TARGET_Z196 \
87 (TARGET_ZARCH && TARGET_CPU_Z196)
22ac2c2f
AK
88#define TARGET_ZEC12 \
89 (TARGET_ZARCH && TARGET_CPU_ZEC12)
167f68ed 90#define TARGET_HTM (TARGET_OPT_HTM)
55ac540c
AK
91#define TARGET_Z13 \
92 (TARGET_ZARCH && TARGET_CPU_Z13)
93#define TARGET_VX \
94 (TARGET_ZARCH && TARGET_CPU_VX && TARGET_OPT_VX && TARGET_HARD_FLOAT)
65b1d8ea 95
55ac540c
AK
96/* Use the ABI introduced with IBM z13:
97 - pass vector arguments <= 16 bytes in VRs
98 - align *all* vector types to 8 bytes */
99#define TARGET_VX_ABI TARGET_VX
65b1d8ea
AK
100
101#define TARGET_AVOID_CMP_AND_BRANCH (s390_tune == PROCESSOR_2817_Z196)
42c78618 102
862a2d83 103/* Run-time target specification. */
9db1d521 104
a771c4b3
UW
105/* Defaults for option flags defined only on some subtargets. */
106#ifndef TARGET_TPF_PROFILING
107#define TARGET_TPF_PROFILING 0
108#endif
109
4798630c
D
110/* This will be overridden by OS headers. */
111#define TARGET_TPF 0
112
862a2d83 113/* Target CPU builtins. */
3af82a61 114#define TARGET_CPU_CPP_BUILTINS() s390_cpu_cpp_builtins (pfile)
9db1d521 115
58d10f89 116#ifdef DEFAULT_TARGET_64BIT
55ac540c
AK
117#define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP \
118 | MASK_OPT_HTM | MASK_OPT_VX)
58d10f89 119#else
85dae55a 120#define TARGET_DEFAULT 0
58d10f89
UW
121#endif
122
f13e0d4e
UW
123/* Support for configure-time defaults. */
124#define OPTION_DEFAULT_SPECS \
125 { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \
126 { "arch", "%{!march=*:-march=%(VALUE)}" }, \
127 { "tune", "%{!mtune=*:-mtune=%(VALUE)}" }
128
cb0edc39
DV
129extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
130# define EXTRA_SPEC_FUNCTIONS \
131 { "local_cpu_detect", s390_host_detect_local_cpu },
132
133# define MARCH_MTUNE_NATIVE_SPECS \
134 " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
135 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
136
f13e0d4e
UW
137/* Defaulting rules. */
138#ifdef DEFAULT_TARGET_64BIT
139#define DRIVER_SELF_SPECS \
140 "%{!m31:%{!m64:-m64}}", \
141 "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \
cb0edc39
DV
142 "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}", \
143 MARCH_MTUNE_NATIVE_SPECS
f13e0d4e
UW
144#else
145#define DRIVER_SELF_SPECS \
146 "%{!m31:%{!m64:-m31}}", \
147 "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \
cb0edc39
DV
148 "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}", \
149 MARCH_MTUNE_NATIVE_SPECS
f13e0d4e
UW
150#endif
151
638e37c2 152/* Constants needed to control the TEST DATA CLASS (TDC) instruction. */
0387c142
WG
153#define S390_TDC_POSITIVE_ZERO (1 << 11)
154#define S390_TDC_NEGATIVE_ZERO (1 << 10)
155#define S390_TDC_POSITIVE_NORMALIZED_BFP_NUMBER (1 << 9)
156#define S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER (1 << 8)
157#define S390_TDC_POSITIVE_DENORMALIZED_BFP_NUMBER (1 << 7)
158#define S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER (1 << 6)
159#define S390_TDC_POSITIVE_INFINITY (1 << 5)
160#define S390_TDC_NEGATIVE_INFINITY (1 << 4)
161#define S390_TDC_POSITIVE_QUIET_NAN (1 << 3)
162#define S390_TDC_NEGATIVE_QUIET_NAN (1 << 2)
163#define S390_TDC_POSITIVE_SIGNALING_NAN (1 << 1)
164#define S390_TDC_NEGATIVE_SIGNALING_NAN (1 << 0)
165
166/* The following values are different for DFP. */
167#define S390_TDC_POSITIVE_DENORMALIZED_DFP_NUMBER (1 << 9)
168#define S390_TDC_NEGATIVE_DENORMALIZED_DFP_NUMBER (1 << 8)
169#define S390_TDC_POSITIVE_NORMALIZED_DFP_NUMBER (1 << 7)
170#define S390_TDC_NEGATIVE_NORMALIZED_DFP_NUMBER (1 << 6)
171
f4aa3848 172/* For signbit, the BFP-DFP-difference makes no difference. */
0f67fa83 173#define S390_TDC_SIGNBIT_SET (S390_TDC_NEGATIVE_ZERO \
0387c142
WG
174 | S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER \
175 | S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER\
0f67fa83
WG
176 | S390_TDC_NEGATIVE_INFINITY \
177 | S390_TDC_NEGATIVE_QUIET_NAN \
178 | S390_TDC_NEGATIVE_SIGNALING_NAN )
179
638e37c2
WG
180#define S390_TDC_INFINITY (S390_TDC_POSITIVE_INFINITY \
181 | S390_TDC_NEGATIVE_INFINITY )
9db1d521 182
a5ba7b92
AK
183/* This is used by float.h to define the float_t and double_t data
184 types. For historical reasons both are double on s390 what cannot
185 be changed anymore. */
186#define TARGET_FLT_EVAL_METHOD 1
187
9db1d521
HP
188/* Target machine storage layout. */
189
862a2d83 190/* Everything is big-endian. */
9db1d521 191#define BITS_BIG_ENDIAN 1
9db1d521 192#define BYTES_BIG_ENDIAN 1
9db1d521
HP
193#define WORDS_BIG_ENDIAN 1
194
9602b6a1
AK
195#define STACK_SIZE_MODE (Pmode)
196
085261c8
AK
197/* Vector arguments are left-justified when placed on the stack during
198 parameter passing. */
199#define FUNCTION_ARG_PADDING(MODE, TYPE) \
200 (s390_function_arg_vector ((MODE), (TYPE)) \
201 ? upward \
202 : DEFAULT_FUNCTION_ARG_PADDING ((MODE), (TYPE)))
203
fe86047c 204#ifndef IN_LIBGCC2
9602b6a1
AK
205
206/* Width of a word, in units (bytes). */
207 #define UNITS_PER_WORD (TARGET_ZARCH ? 8 : 4)
208
209/* Width of a pointer. To be used instead of UNITS_PER_WORD in
210 ABI-relevant contexts. This always matches
211 GET_MODE_SIZE (Pmode). */
212 #define UNITS_PER_LONG (TARGET_64BIT ? 8 : 4)
213 #define MIN_UNITS_PER_WORD 4
214 #define MAX_BITS_PER_WORD 64
215#else
216
217 /* In libgcc, UNITS_PER_WORD has ABI-relevant effects, e.g. whether
218 the library should export TImode functions or not. Thus, we have
219 to redefine UNITS_PER_WORD depending on __s390x__ for libgcc. */
220 #ifdef __s390x__
221 #define UNITS_PER_WORD 8
222 #else
223 #define UNITS_PER_WORD 4
224 #endif
fe86047c 225#endif
9602b6a1
AK
226
227/* Width of a pointer, in bits. */
228#define POINTER_SIZE (TARGET_64BIT ? 64 : 32)
9db1d521 229
9db1d521 230/* Allocation boundary (in *bits*) for storing arguments in argument list. */
9db1d521
HP
231#define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)
232
233/* Boundary (in *bits*) on which stack pointer should be aligned. */
9db1d521
HP
234#define STACK_BOUNDARY 64
235
236/* Allocation boundary (in *bits*) for the code of a function. */
d0de9e13 237#define FUNCTION_BOUNDARY 64
9db1d521
HP
238
239/* There is no point aligning anything to a rounder boundary than this. */
9db1d521
HP
240#define BIGGEST_ALIGNMENT 64
241
242/* Alignment of field after `int : 0' in a structure. */
9db1d521
HP
243#define EMPTY_FIELD_BOUNDARY 32
244
f710504c 245/* Alignment on even addresses for LARL instruction. */
9db1d521 246#define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)
df8a1d28 247#define DATA_ABI_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)
9db1d521 248
862a2d83 249/* Alignment is not required by the hardware. */
9db1d521
HP
250#define STRICT_ALIGNMENT 0
251
862a2d83
UW
252/* Mode of stack savearea.
253 FUNCTION is VOIDmode because calling convention maintains SP.
254 BLOCK needs Pmode for SP.
255 NONLOCAL needs twice Pmode to maintain both backchain and SP. */
256#define STACK_SAVEAREA_MODE(LEVEL) \
257 (LEVEL == SAVE_FUNCTION ? VOIDmode \
43ab026f 258 : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? OImode : TImode) : Pmode)
862a2d83 259
9db1d521 260
862a2d83 261/* Type layout. */
9db1d521 262
862a2d83
UW
263/* Sizes in bits of the source language data types. */
264#define SHORT_TYPE_SIZE 16
265#define INT_TYPE_SIZE 32
266#define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
862a2d83
UW
267#define LONG_LONG_TYPE_SIZE 64
268#define FLOAT_TYPE_SIZE 32
269#define DOUBLE_TYPE_SIZE 64
f61a2c7d
AK
270#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
271
f61a2c7d
AK
272/* Work around target_flags dependency in ada/targtyps.c. */
273#define WIDEST_HARDWARE_FP_SIZE 64
862a2d83
UW
274
275/* We use "unsigned char" as default. */
276#define DEFAULT_SIGNED_CHAR 0
277
278
279/* Register usage. */
280
281/* We have 16 general purpose registers (registers 0-15),
282 and 16 floating point registers (registers 16-31).
283 (On non-IEEE machines, we have only 4 fp registers.)
c7453384 284
862a2d83
UW
285 Amongst the general purpose registers, some are used
286 for specific purposes:
287 GPR 11: Hard frame pointer (if needed)
288 GPR 12: Global offset table pointer (if needed)
289 GPR 13: Literal pool base register
290 GPR 14: Return address register
291 GPR 15: Stack pointer
c7453384 292
c5aa1d12 293 Registers 32-35 are 'fake' hard registers that do not
862a2d83
UW
294 correspond to actual hardware:
295 Reg 32: Argument pointer
296 Reg 33: Condition code
f4aa3848 297 Reg 34: Frame pointer
c5aa1d12 298 Reg 35: Return address pointer
862a2d83 299
f4aa3848 300 Registers 36 and 37 are mapped to access registers
085261c8
AK
301 0 and 1, used to implement thread-local storage.
302
303 Reg 38-53: Vector registers v16-v31 */
c5aa1d12 304
085261c8 305#define FIRST_PSEUDO_REGISTER 54
862a2d83
UW
306
307/* Standard register usage. */
8e509cf9
UW
308#define GENERAL_REGNO_P(N) ((int)(N) >= 0 && (N) < 16)
309#define ADDR_REGNO_P(N) ((N) >= 1 && (N) < 16)
142cd70f 310#define FP_REGNO_P(N) ((N) >= 16 && (N) < 32)
8e509cf9 311#define CC_REGNO_P(N) ((N) == 33)
a38e09bc 312#define FRAME_REGNO_P(N) ((N) == 32 || (N) == 34 || (N) == 35)
c5aa1d12 313#define ACCESS_REGNO_P(N) ((N) == 36 || (N) == 37)
085261c8
AK
314#define VECTOR_NOFP_REGNO_P(N) ((N) >= 38 && (N) <= 53)
315#define VECTOR_REGNO_P(N) (FP_REGNO_P (N) || VECTOR_NOFP_REGNO_P (N))
8e509cf9
UW
316
317#define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X)))
318#define ADDR_REG_P(X) (REG_P (X) && ADDR_REGNO_P (REGNO (X)))
319#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
320#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
4888ec5d 321#define FRAME_REG_P(X) (REG_P (X) && FRAME_REGNO_P (REGNO (X)))
c5aa1d12 322#define ACCESS_REG_P(X) (REG_P (X) && ACCESS_REGNO_P (REGNO (X)))
085261c8
AK
323#define VECTOR_NOFP_REG_P(X) (REG_P (X) && VECTOR_NOFP_REGNO_P (REGNO (X)))
324#define VECTOR_REG_P(X) (REG_P (X) && VECTOR_REGNO_P (REGNO (X)))
9db1d521 325
862a2d83 326/* Set up fixed registers and calling convention:
9db1d521 327
862a2d83
UW
328 GPRs 0-5 are always call-clobbered,
329 GPRs 6-15 are always call-saved.
330 GPR 12 is fixed if used as GOT pointer.
331 GPR 13 is always fixed (as literal pool pointer).
545d16ff 332 GPR 14 is always fixed on S/390 machines (as return address).
862a2d83
UW
333 GPR 15 is always fixed (as stack pointer).
334 The 'fake' hard registers are call-clobbered and fixed.
c5aa1d12 335 The access registers are call-saved and fixed.
9db1d521 336
862a2d83
UW
337 On 31-bit, FPRs 18-19 are call-clobbered;
338 on 64-bit, FPRs 24-31 are call-clobbered.
085261c8
AK
339 The remaining FPRs are call-saved.
340
341 All non-FP vector registers are call-clobbered v16-v31. */
9db1d521
HP
342
343#define FIXED_REGISTERS \
344{ 0, 0, 0, 0, \
345 0, 0, 0, 0, \
346 0, 0, 0, 0, \
347 0, 1, 1, 1, \
348 0, 0, 0, 0, \
349 0, 0, 0, 0, \
350 0, 0, 0, 0, \
351 0, 0, 0, 0, \
c5aa1d12 352 1, 1, 1, 1, \
085261c8
AK
353 1, 1, \
354 0, 0, 0, 0, \
355 0, 0, 0, 0, \
356 0, 0, 0, 0, \
357 0, 0, 0, 0 }
9db1d521 358
9db1d521
HP
359#define CALL_USED_REGISTERS \
360{ 1, 1, 1, 1, \
361 1, 1, 0, 0, \
362 0, 0, 0, 0, \
363 0, 1, 1, 1, \
4023fb28
UW
364 1, 1, 1, 1, \
365 1, 1, 1, 1, \
366 1, 1, 1, 1, \
367 1, 1, 1, 1, \
c5aa1d12 368 1, 1, 1, 1, \
085261c8
AK
369 1, 1, \
370 1, 1, 1, 1, \
371 1, 1, 1, 1, \
372 1, 1, 1, 1, \
373 1, 1, 1, 1 }
4023fb28 374
4023fb28 375#define CALL_REALLY_USED_REGISTERS \
085261c8 376{ 1, 1, 1, 1, /* r0 - r15 */ \
9db1d521 377 1, 1, 0, 0, \
4023fb28
UW
378 0, 0, 0, 0, \
379 0, 0, 0, 0, \
085261c8 380 1, 1, 1, 1, /* f0 (16) - f15 (31) */ \
9db1d521
HP
381 1, 1, 1, 1, \
382 1, 1, 1, 1, \
383 1, 1, 1, 1, \
085261c8
AK
384 1, 1, 1, 1, /* arg, cc, fp, ret addr */ \
385 0, 0, /* a0 (36), a1 (37) */ \
386 1, 1, 1, 1, /* v16 (38) - v23 (45) */ \
c5aa1d12 387 1, 1, 1, 1, \
085261c8
AK
388 1, 1, 1, 1, /* v24 (46) - v31 (53) */ \
389 1, 1, 1, 1 }
9db1d521 390
862a2d83 391/* Preferred register allocation order. */
085261c8
AK
392#define REG_ALLOC_ORDER \
393 { 1, 2, 3, 4, 5, 0, 12, 11, 10, 9, 8, 7, 6, 14, 13, \
394 16, 17, 18, 19, 20, 21, 22, 23, \
395 24, 25, 26, 27, 28, 29, 30, 31, \
396 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, \
397 15, 32, 33, 34, 35, 36, 37 }
9db1d521 398
9db1d521 399
862a2d83 400/* Fitting values into registers. */
c7453384 401
862a2d83
UW
402/* Integer modes <= word size fit into any GPR.
403 Integer modes > word size fit into successive GPRs, starting with
404 an even-numbered register.
405 SImode and DImode fit into FPRs as well.
c7453384 406
862a2d83
UW
407 Floating point modes <= word size fit into any FPR or GPR.
408 Floating point modes > word size (i.e. DFmode on 32-bit) fit
409 into any FPR, or an even-odd GPR pair.
f61a2c7d 410 TFmode fits only into an even-odd FPR pair.
c7453384 411
862a2d83
UW
412 Complex floating point modes fit either into two FPRs, or into
413 successive GPRs (again starting with an even number).
f61a2c7d 414 TCmode fits only into two successive even-odd FPR pairs.
c7453384 415
862a2d83 416 Condition code modes fit only into the CC register. */
9db1d521 417
74aa8b4b
AK
418/* Because all registers in a class have the same size HARD_REGNO_NREGS
419 is equivalent to CLASS_MAX_NREGS. */
9db1d521 420#define HARD_REGNO_NREGS(REGNO, MODE) \
74aa8b4b
AK
421 s390_class_max_nregs (REGNO_REG_CLASS (REGNO), (MODE))
422
423#define HARD_REGNO_MODE_OK(REGNO, MODE) \
424 s390_hard_regno_mode_ok ((REGNO), (MODE))
425
426#define HARD_REGNO_RENAME_OK(FROM, TO) \
7633f08e
UW
427 s390_hard_regno_rename_ok (FROM, TO)
428
9db1d521
HP
429#define MODES_TIEABLE_P(MODE1, MODE2) \
430 (((MODE1) == SFmode || (MODE1) == DFmode) \
431 == ((MODE2) == SFmode || (MODE2) == DFmode))
432
9602b6a1
AK
433/* When generating code that runs in z/Architecture mode,
434 but conforms to the 31-bit ABI, GPRs can hold 8 bytes;
435 the ABI guarantees only that the lower 4 bytes are
436 saved across calls, however. */
085261c8
AK
437#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \
438 ((!TARGET_64BIT && TARGET_ZARCH \
439 && GET_MODE_SIZE (MODE) > 4 \
440 && (((REGNO) >= 6 && (REGNO) <= 15) || (REGNO) == 32)) \
441 || (TARGET_VX \
442 && GET_MODE_SIZE (MODE) > 8 \
443 && (((TARGET_64BIT && (REGNO) >= 24 && (REGNO) <= 31)) \
444 || (!TARGET_64BIT && ((REGNO) == 18 || (REGNO) == 19)))))
9602b6a1 445
862a2d83
UW
446/* Maximum number of registers to represent a value of mode MODE
447 in a register of class CLASS. */
448#define CLASS_MAX_NREGS(CLASS, MODE) \
74aa8b4b 449 s390_class_max_nregs ((CLASS), (MODE))
4023fb28 450
f61a2c7d 451#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
085261c8 452 s390_cannot_change_mode_class ((FROM), (TO), (CLASS))
9db1d521 453
862a2d83 454/* Register classes. */
c7453384 455
862a2d83
UW
456/* We use the following register classes:
457 GENERAL_REGS All general purpose registers
458 ADDR_REGS All general purpose registers except %r0
459 (These registers can be used in address generation)
460 FP_REGS All floating point registers
c5aa1d12
UW
461 CC_REGS The condition code register
462 ACCESS_REGS The access registers
c7453384 463
862a2d83
UW
464 GENERAL_FP_REGS Union of GENERAL_REGS and FP_REGS
465 ADDR_FP_REGS Union of ADDR_REGS and FP_REGS
c5aa1d12
UW
466 GENERAL_CC_REGS Union of GENERAL_REGS and CC_REGS
467 ADDR_CC_REGS Union of ADDR_REGS and CC_REGS
c7453384 468
862a2d83
UW
469 NO_REGS No registers
470 ALL_REGS All registers
c7453384 471
862a2d83 472 Note that the 'fake' frame pointer and argument pointer registers
c5aa1d12 473 are included amongst the address registers here. */
9db1d521
HP
474
475enum reg_class
476{
c5aa1d12 477 NO_REGS, CC_REGS, ADDR_REGS, GENERAL_REGS, ACCESS_REGS,
f4aa3848 478 ADDR_CC_REGS, GENERAL_CC_REGS,
4023fb28 479 FP_REGS, ADDR_FP_REGS, GENERAL_FP_REGS,
085261c8 480 VEC_REGS, ADDR_VEC_REGS, GENERAL_VEC_REGS,
4023fb28 481 ALL_REGS, LIM_REG_CLASSES
9db1d521 482};
9db1d521
HP
483#define N_REG_CLASSES (int) LIM_REG_CLASSES
484
c5aa1d12
UW
485#define REG_CLASS_NAMES \
486{ "NO_REGS", "CC_REGS", "ADDR_REGS", "GENERAL_REGS", "ACCESS_REGS", \
487 "ADDR_CC_REGS", "GENERAL_CC_REGS", \
085261c8
AK
488 "FP_REGS", "ADDR_FP_REGS", "GENERAL_FP_REGS", \
489 "VEC_REGS", "ADDR_VEC_REGS", "GENERAL_VEC_REGS", \
490 "ALL_REGS" }
9db1d521 491
862a2d83 492/* Class -> register mapping. */
085261c8
AK
493#define REG_CLASS_CONTENTS \
494{ \
9db1d521 495 { 0x00000000, 0x00000000 }, /* NO_REGS */ \
9dc62c00 496 { 0x00000000, 0x00000002 }, /* CC_REGS */ \
a38e09bc
AK
497 { 0x0000fffe, 0x0000000d }, /* ADDR_REGS */ \
498 { 0x0000ffff, 0x0000000d }, /* GENERAL_REGS */ \
c5aa1d12 499 { 0x00000000, 0x00000030 }, /* ACCESS_REGS */ \
9dc62c00
AK
500 { 0x0000fffe, 0x0000000f }, /* ADDR_CC_REGS */ \
501 { 0x0000ffff, 0x0000000f }, /* GENERAL_CC_REGS */ \
9db1d521 502 { 0xffff0000, 0x00000000 }, /* FP_REGS */ \
a38e09bc
AK
503 { 0xfffffffe, 0x0000000d }, /* ADDR_FP_REGS */ \
504 { 0xffffffff, 0x0000000d }, /* GENERAL_FP_REGS */ \
085261c8
AK
505 { 0xffff0000, 0x003fffc0 }, /* VEC_REGS */ \
506 { 0xfffffffe, 0x003fffcd }, /* ADDR_VEC_REGS */ \
507 { 0xffffffff, 0x003fffcd }, /* GENERAL_VEC_REGS */ \
508 { 0xffffffff, 0x003fffff }, /* ALL_REGS */ \
9db1d521
HP
509}
510
058e97ec
VM
511/* In some case register allocation order is not enough for IRA to
512 generate a good code. The following macro (if defined) increases
513 cost of REGNO for a pseudo approximately by pseudo usage frequency
514 multiplied by the macro value.
515
516 We avoid usage of BASE_REGNUM by nonzero macro value because the
517 reload can decide not to use the hard register because some
518 constant was forced to be in memory. */
519#define IRA_HARD_REGNO_ADD_COST_MULTIPLIER(regno) \
dba0dd68 520 (regno != BASE_REGNUM ? 0.0 : 0.5)
058e97ec 521
862a2d83
UW
522/* Register -> class mapping. */
523extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
524#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
9db1d521 525
862a2d83
UW
526/* ADDR_REGS can be used as base or index register. */
527#define INDEX_REG_CLASS ADDR_REGS
528#define BASE_REG_CLASS ADDR_REGS
9db1d521 529
862a2d83
UW
530/* Check whether REGNO is a hard register of the suitable class
531 or a pseudo register currently allocated to one such. */
532#define REGNO_OK_FOR_INDEX_P(REGNO) \
533 (((REGNO) < FIRST_PSEUDO_REGISTER \
93fa8428
AK
534 && REGNO_REG_CLASS ((REGNO)) == ADDR_REGS) \
535 || ADDR_REGNO_P (reg_renumber[REGNO]))
862a2d83 536#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P (REGNO)
9db1d521 537
9db1d521 538
085261c8
AK
539/* We need secondary memory to move data between GPRs and FPRs.
540
541 - With DFP the ldgr lgdr instructions are available. Due to the
542 different alignment we cannot use them for SFmode. For 31 bit a
543 64 bit value in GPR would be a register pair so here we still
544 need to go via memory.
545
546 - With z13 we can do the SF/SImode moves with vlgvf. Due to the
547 overlapping of FPRs and VRs we still disallow TF/TD modes to be
548 in full VRs so as before also on z13 we do these moves via
549 memory.
550
551 FIXME: Should we try splitting it into two vlgvg's/vlvg's instead? */
552#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
553 (((reg_classes_intersect_p (CLASS1, VEC_REGS) \
554 && reg_classes_intersect_p (CLASS2, GENERAL_REGS)) \
555 || (reg_classes_intersect_p (CLASS1, GENERAL_REGS) \
556 && reg_classes_intersect_p (CLASS2, VEC_REGS))) \
557 && (!TARGET_DFP || !TARGET_64BIT || GET_MODE_SIZE (MODE) != 8) \
558 && (!TARGET_VX || (SCALAR_FLOAT_MODE_P (MODE) \
559 && GET_MODE_SIZE (MODE) > 8)))
862a2d83
UW
560
561/* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on 64bit
562 because the movsi and movsf patterns don't handle r/f moves. */
563#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
564 (GET_MODE_BITSIZE (MODE) < 32 \
565 ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \
566 : MODE)
567
568
862a2d83 569/* Stack layout and calling conventions. */
c7453384 570
862a2d83
UW
571/* Our stack grows from higher to lower addresses. However, local variables
572 are accessed by positive offsets, and function arguments are stored at
573 increasing addresses. */
62f9f30b 574#define STACK_GROWS_DOWNWARD 1
63296cb1 575#define FRAME_GROWS_DOWNWARD 1
862a2d83 576/* #undef ARGS_GROW_DOWNWARD */
9db1d521 577
862a2d83
UW
578/* The basic stack layout looks like this: the stack pointer points
579 to the register save area for called functions. Above that area
580 is the location to place outgoing arguments. Above those follow
581 dynamic allocations (alloca), and finally the local variables. */
9db1d521 582
862a2d83
UW
583/* Offset from stack-pointer to first location of outgoing args. */
584#define STACK_POINTER_OFFSET (TARGET_64BIT ? 160 : 96)
9db1d521 585
862a2d83 586/* Offset within stack frame to start allocating local variables at. */
63296cb1 587#define STARTING_FRAME_OFFSET 0
9db1d521 588
862a2d83
UW
589/* Offset from the stack pointer register to an item dynamically
590 allocated on the stack, e.g., by `alloca'. */
63296cb1 591#define STACK_DYNAMIC_OFFSET(FUNDECL) \
38173d38 592 (STACK_POINTER_OFFSET + crtl->outgoing_args_size)
9db1d521 593
862a2d83
UW
594/* Offset of first parameter from the argument pointer register value.
595 We have a fake argument pointer register that points directly to
596 the argument area. */
597#define FIRST_PARM_OFFSET(FNDECL) 0
9db1d521 598
f4aa3848 599/* Defining this macro makes __builtin_frame_address(0) and
c6d01079
AK
600 __builtin_return_address(0) work with -fomit-frame-pointer. */
601#define INITIAL_FRAME_ADDRESS_RTX \
0a81f074 602 (plus_constant (Pmode, arg_pointer_rtx, -STACK_POINTER_OFFSET))
c6d01079 603
c7453384 604/* The return address of the current frame is retrieved
4023fb28
UW
605 from the initial value of register RETURN_REGNUM.
606 For frames farther back, we use the stack slot where
607 the corresponding RETURN_REGNUM register was saved. */
c6d01079
AK
608#define DYNAMIC_CHAIN_ADDRESS(FRAME) \
609 (TARGET_PACKED_STACK ? \
0a81f074
RS
610 plus_constant (Pmode, (FRAME), \
611 STACK_POINTER_OFFSET - UNITS_PER_LONG) : (FRAME))
4023fb28 612
78791a80
AK
613/* For -mpacked-stack this adds 160 - 8 (96 - 4) to the output of
614 builtin_frame_address. Otherwise arg pointer -
615 STACK_POINTER_OFFSET would be returned for
616 __builtin_frame_address(0) what might result in an address pointing
617 somewhere into the middle of the local variables since the packed
618 stack layout generally does not need all the bytes in the register
619 save area. */
620#define FRAME_ADDR_RTX(FRAME) \
621 DYNAMIC_CHAIN_ADDRESS ((FRAME))
622
c6d01079 623#define RETURN_ADDR_RTX(COUNT, FRAME) \
5d4d885c 624 s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
9db1d521 625
862a2d83 626/* In 31-bit mode, we need to mask off the high bit of return addresses. */
a556fd39 627#define MASK_RETURN_ADDR (TARGET_64BIT ? constm1_rtx : GEN_INT (0x7fffffff))
9db1d521 628
4023fb28 629
862a2d83 630/* Exception handling. */
c7453384 631
862a2d83
UW
632/* Describe calling conventions for DWARF-2 exception handling. */
633#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_REGNUM)
4023fb28 634#define INCOMING_FRAME_SP_OFFSET STACK_POINTER_OFFSET
9db1d521
HP
635#define DWARF_FRAME_RETURN_COLUMN 14
636
637/* Describe how we implement __builtin_eh_return. */
638#define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 6 : INVALID_REGNUM)
a38e09bc 639#define EH_RETURN_HANDLER_RTX gen_rtx_MEM (Pmode, return_address_pointer_rtx)
f4aa3848 640
18789f4e
UW
641/* Select a format to encode pointers in exception handling data. */
642#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
643 (flag_pic \
644 ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
645 : DW_EH_PE_absptr)
646
9602b6a1
AK
647/* Register save slot alignment. */
648#define DWARF_CIE_DATA_ALIGNMENT (-UNITS_PER_LONG)
649
f276b762
AK
650/* Let the assembler generate debug line info. */
651#define DWARF2_ASM_LINE_DEBUG_INFO 1
652
085261c8
AK
653/* Define the dwarf register mapping.
654 v16-v31 -> 68-83
655 rX -> X otherwise */
656#define DBX_REGISTER_NUMBER(regno) \
657 ((regno >= 38 && regno <= 53) ? regno + 30 : regno)
9db1d521 658
862a2d83 659/* Frame registers. */
9db1d521 660
862a2d83
UW
661#define STACK_POINTER_REGNUM 15
662#define FRAME_POINTER_REGNUM 34
663#define HARD_FRAME_POINTER_REGNUM 11
664#define ARG_POINTER_REGNUM 32
a38e09bc 665#define RETURN_ADDRESS_POINTER_REGNUM 35
9db1d521 666
c7453384
EC
667/* The static chain must be call-clobbered, but not used for
668 function argument passing. As register 1 is clobbered by
862a2d83
UW
669 the trampoline code, we only have one option. */
670#define STATIC_CHAIN_REGNUM 0
9db1d521 671
862a2d83
UW
672/* Number of hardware registers that go into the DWARF-2 unwind info.
673 To avoid ABI incompatibility, this number must not change even as
674 'fake' hard registers are added or removed. */
675#define DWARF_FRAME_REGISTERS 34
9db1d521 676
9db1d521 677
862a2d83 678/* Frame pointer and argument pointer elimination. */
9db1d521 679
7633f08e
UW
680#define ELIMINABLE_REGS \
681{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
682 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
683 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
684 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
685 { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
686 { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
687 { BASE_REGNUM, BASE_REGNUM }}
9db1d521 688
91086990
UW
689#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
690 (OFFSET) = s390_initial_elimination_offset ((FROM), (TO))
9db1d521 691
9db1d521 692
862a2d83 693/* Stack arguments. */
c7453384 694
862a2d83
UW
695/* We need current_function_outgoing_args to be valid. */
696#define ACCUMULATE_OUTGOING_ARGS 1
9db1d521 697
9db1d521 698
862a2d83 699/* Register arguments. */
c7453384 700
9db1d521
HP
701typedef struct s390_arg_structure
702{
703 int gprs; /* gpr so far */
704 int fprs; /* fpr so far */
085261c8 705 int vrs; /* vr so far */
9db1d521
HP
706}
707CUMULATIVE_ARGS;
708
07711f53 709#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, NN, N_NAMED_ARGS) \
085261c8
AK
710 ((CUM).gprs=0, (CUM).fprs=0, (CUM).vrs=0)
711
712#define FIRST_VEC_ARG_REGNO 46
713#define LAST_VEC_ARG_REGNO 53
9db1d521 714
96e2afa8
AK
715/* Arguments can be placed in general registers 2 to 6, or in floating
716 point registers 0 and 2 for 31 bit and fprs 0, 2, 4 and 6 for 64
717 bit. */
085261c8
AK
718#define FUNCTION_ARG_REGNO_P(N) \
719 (((N) >=2 && (N) < 7) || (N) == 16 || (N) == 17 \
720 || (TARGET_64BIT && ((N) == 18 || (N) == 19)) \
721 || (TARGET_VX && ((N) >= FIRST_VEC_ARG_REGNO && (N) <= LAST_VEC_ARG_REGNO)))
9db1d521 722
9db1d521 723
085261c8
AK
724/* Only gpr 2, fpr 0, and v24 are ever used as return registers. */
725#define FUNCTION_VALUE_REGNO_P(N) \
726 ((N) == 2 || (N) == 16 \
727 || (TARGET_VX && (N) == FIRST_VEC_ARG_REGNO))
9db1d521 728
9db1d521 729
862a2d83 730/* Function entry and exit. */
c7453384 731
862a2d83
UW
732/* When returning from a function, the stack pointer does not matter. */
733#define EXIT_IGNORE_STACK 1
9db1d521 734
9db1d521 735
862a2d83 736/* Profiling. */
9db1d521
HP
737
738#define FUNCTION_PROFILER(FILE, LABELNO) \
862a2d83 739 s390_function_profiler ((FILE), ((LABELNO)))
9db1d521 740
c52a375d 741#define PROFILE_BEFORE_PROLOGUE 1
9db1d521 742
9db1d521 743
862a2d83 744/* Trampolines for nested functions. */
9db1d521 745
b81ecf6f
RH
746#define TRAMPOLINE_SIZE (TARGET_64BIT ? 32 : 16)
747#define TRAMPOLINE_ALIGNMENT BITS_PER_WORD
9db1d521 748
862a2d83 749/* Addressing modes, and classification of registers for them. */
9db1d521 750
862a2d83
UW
751/* Recognize any constant value that is a valid address. */
752#define CONSTANT_ADDRESS_P(X) 0
9db1d521 753
862a2d83
UW
754/* Maximum number of registers that can appear in a valid memory address. */
755#define MAX_REGS_PER_ADDRESS 2
9db1d521 756
963fc8d0 757/* This definition replaces the formerly used 'm' constraint with a
c6c3dba9
PB
758 different constraint letter in order to avoid changing semantics of
759 the 'm' constraint when accepting new address formats in
760 TARGET_LEGITIMATE_ADDRESS_P. The constraint letter defined here
761 must not be used in insn definitions or inline assemblies. */
963fc8d0
AK
762#define TARGET_MEM_CONSTRAINT 'e'
763
0b540f12
UW
764/* Try a machine-dependent way of reloading an illegitimate address
765 operand. If we find one, push the reload and jump to WIN. This
766 macro is used in only one place: `find_reloads_address' in reload.c. */
767#define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \
768do { \
0a2aaacc
KG
769 rtx new_rtx = legitimize_reload_address (AD, MODE, OPNUM, (int)(TYPE)); \
770 if (new_rtx) \
0b540f12 771 { \
0a2aaacc 772 (AD) = new_rtx; \
0b540f12
UW
773 goto WIN; \
774 } \
775} while (0)
776
862a2d83
UW
777/* Helper macro for s390.c and s390.md to check for symbolic constants. */
778#define SYMBOLIC_CONST(X) \
779(GET_CODE (X) == SYMBOL_REF \
780 || GET_CODE (X) == LABEL_REF \
781 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
9db1d521 782
fd3cd001
UW
783#define TLS_SYMBOLIC_CONST(X) \
784((GET_CODE (X) == SYMBOL_REF && tls_symbolic_operand (X)) \
785 || (GET_CODE (X) == CONST && tls_symbolic_reference_mentioned_p (X)))
786
9db1d521 787
862a2d83 788/* Condition codes. */
9db1d521 789
862a2d83
UW
790/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
791 return the mode to be used for the comparison. */
792#define SELECT_CC_MODE(OP, X, Y) s390_select_ccmode ((OP), (X), (Y))
c7453384 793
862a2d83 794/* Relative costs of operations. */
9db1d521 795
9db1d521
HP
796/* A C expression for the cost of a branch instruction. A value of 1
797 is the default; other values are interpreted relative to that. */
3d427cc1 798#define BRANCH_COST(speed_p, predictable_p) s390_branch_cost
9db1d521 799
862a2d83
UW
800/* Nonzero if access to memory by bytes is slow and undesirable. */
801#define SLOW_BYTE_ACCESS 1
802
c5443745 803/* An integer expression for the size in bits of the largest integer machine
f4aa3848 804 mode that should actually be used. We allow pairs of registers. */
c5443745
UW
805#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode)
806
862a2d83 807/* The maximum number of bytes that a single instruction can move quickly
ff482c8d 808 between memory and registers or between two memory locations. */
9602b6a1
AK
809#define MOVE_MAX (TARGET_ZARCH ? 16 : 8)
810#define MOVE_MAX_PIECES (TARGET_ZARCH ? 8 : 4)
862a2d83 811#define MAX_MOVE_MAX 16
9db1d521 812
862a2d83 813/* Don't perform CSE on function addresses. */
1e8552c2 814#define NO_FUNCTION_CSE 1
862a2d83 815
5f1b2ee6
AK
816/* This value is used in tree-sra to decide whether it might benefical
817 to split a struct move into several word-size moves. For S/390
818 only small values make sense here since struct moves are relatively
073a8998 819 cheap thanks to mvc so the small default value chosen for archs
5f1b2ee6
AK
820 with memmove patterns should be ok. But this value is multiplied
821 in tree-sra with UNITS_PER_WORD to make a decision so we adjust it
822 here to compensate for that factor since mvc costs exactly the same
823 on 31 and 64 bit. */
e04ad03d 824#define MOVE_RATIO(speed) (TARGET_64BIT? 2 : 4)
5f1b2ee6 825
862a2d83
UW
826
827/* Sections. */
828
829/* Output before read-only data. */
830#define TEXT_SECTION_ASM_OP ".text"
831
832/* Output before writable (initialized) data. */
833#define DATA_SECTION_ASM_OP ".data"
834
835/* Output before writable (uninitialized) data. */
836#define BSS_SECTION_ASM_OP ".bss"
837
838/* S/390 constant pool breaks the devices in crtstuff.c to control section
839 in where code resides. We have to write it as asm code. */
840#ifndef __s390x__
841#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
842 asm (SECTION_OP "\n\
843 bras\t%r2,1f\n\
8440: .long\t" USER_LABEL_PREFIX #FUNC " - 0b\n\
8451: l\t%r3,0(%r2)\n\
846 bas\t%r14,0(%r3,%r2)\n\
847 .previous");
848#endif
63a1ff86 849
862a2d83
UW
850
851/* Position independent code. */
852
862a2d83
UW
853#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM)
854
855#define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X)
63a1ff86
UW
856
857
858/* Assembler file format. */
859
860/* Character to start a comment. */
861#define ASM_COMMENT_START "#"
862
863/* Declare an uninitialized external linkage data object. */
864#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
865 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
866
867/* Globalizing directive for a label. */
868#define GLOBAL_ASM_OP ".globl "
869
870/* Advance the location counter to a multiple of 2**LOG bytes. */
871#define ASM_OUTPUT_ALIGN(FILE, LOG) \
872 if ((LOG)) fprintf ((FILE), "\t.align\t%d\n", 1 << (LOG))
873
874/* Advance the location counter by SIZE bytes. */
875#define ASM_OUTPUT_SKIP(FILE, SIZE) \
16998094 876 fprintf ((FILE), "\t.set\t.,.+" HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
63a1ff86 877
63a1ff86
UW
878/* The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
879#define LOCAL_LABEL_PREFIX "."
9db1d521 880
5d304e47
AK
881#define LABEL_ALIGN(LABEL) \
882 s390_label_align (LABEL)
883
9db1d521
HP
884/* How to refer to registers in assembler output. This sequence is
885 indexed by compiler's hard-register-number (see above). */
9db1d521 886#define REGISTER_NAMES \
085261c8
AK
887 { "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", \
888 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", \
889 "%f0", "%f2", "%f4", "%f6", "%f1", "%f3", "%f5", "%f7", \
890 "%f8", "%f10", "%f12", "%f14", "%f9", "%f11", "%f13", "%f15", \
891 "%ap", "%cc", "%fp", "%rp", "%a0", "%a1", \
892 "%v16", "%v18", "%v20", "%v22", "%v17", "%v19", "%v21", "%v23", \
893 "%v24", "%v26", "%v28", "%v30", "%v25", "%v27", "%v29", "%v31" \
894 }
895
896#define ADDITIONAL_REGISTER_NAMES \
897 { { "v0", 16 }, { "v2", 17 }, { "v4", 18 }, { "v6", 19 }, \
898 { "v1", 20 }, { "v3", 21 }, { "v5", 22 }, { "v7", 23 }, \
899 { "v8", 24 }, { "v10", 25 }, { "v12", 26 }, { "v14", 27 }, \
900 { "v9", 28 }, { "v11", 29 }, { "v13", 30 }, { "v15", 31 } };
9db1d521 901
63a1ff86 902/* Print operand X (an rtx) in assembler syntax to file FILE. */
9db1d521 903#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
9db1d521
HP
904#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
905
63a1ff86
UW
906/* Output an element of a case-vector that is absolute. */
907#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
908do { \
909 char buf[32]; \
9602b6a1 910 fputs (integer_asm_op (UNITS_PER_LONG, TRUE), (FILE)); \
63a1ff86
UW
911 ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE)); \
912 assemble_name ((FILE), buf); \
913 fputc ('\n', (FILE)); \
914} while (0)
915
916/* Output an element of a case-vector that is relative. */
917#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
918do { \
919 char buf[32]; \
9602b6a1 920 fputs (integer_asm_op (UNITS_PER_LONG, TRUE), (FILE)); \
63a1ff86
UW
921 ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE)); \
922 assemble_name ((FILE), buf); \
923 fputc ('-', (FILE)); \
924 ASM_GENERATE_INTERNAL_LABEL (buf, "L", (REL)); \
925 assemble_name ((FILE), buf); \
926 fputc ('\n', (FILE)); \
927} while (0)
928
177bc204
RS
929/* Mark the return register as used by the epilogue so that we can
930 use it in unadorned (return) and (simple_return) instructions. */
931#define EPILOGUE_USES(REGNO) ((REGNO) == RETURN_REGNUM)
932
d0de9e13
DV
933#undef ASM_OUTPUT_FUNCTION_LABEL
934#define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \
935 s390_asm_output_function_label (FILE, NAME, DECL)
9db1d521 936
862a2d83
UW
937/* Miscellaneous parameters. */
938
862a2d83
UW
939/* Specify the machine mode that this machine uses for the index in the
940 tablejump instruction. */
941#define CASE_VECTOR_MODE (TARGET_64BIT ? DImode : SImode)
942
862a2d83
UW
943/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
944 is done just by pretending it is already truncated. */
945#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
946
947/* Specify the machine mode that pointers have.
948 After generation of rtl, the compiler makes no further distinction
949 between pointers and any other objects of this machine mode. */
ef4bddc2 950#define Pmode ((machine_mode) (TARGET_64BIT ? DImode : SImode))
862a2d83 951
c7453384
EC
952/* This is -1 for "pointer mode" extend. See ptr_extend in s390.md. */
953#define POINTERS_EXTEND_UNSIGNED -1
954
862a2d83
UW
955/* A function address in a call instruction is a byte address (for
956 indexing purposes) so give the MEM rtx a byte's mode. */
957#define FUNCTION_MODE QImode
958
ec24698e
UW
959/* Specify the value which is used when clz operand is zero. */
960#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 64, 1)
961
0bfc3f69 962/* Machine-specific symbol_ref flags. */
963fc8d0
AK
963#define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0)
964#define SYMBOL_REF_ALIGN1_P(X) \
965 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_ALIGN1))
966#define SYMBOL_FLAG_NOT_NATURALLY_ALIGNED (SYMBOL_FLAG_MACH_DEP << 1)
967#define SYMBOL_REF_NOT_NATURALLY_ALIGNED_P(X) \
968 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_NOT_NATURALLY_ALIGNED))
0bfc3f69 969
085261c8
AK
970/* Check whether integer displacement is in range for a short displacement. */
971#define SHORT_DISP_IN_RANGE(d) ((d) >= 0 && (d) <= 4095)
972
0bfc3f69
AS
973/* Check whether integer displacement is in range. */
974#define DISP_IN_RANGE(d) \
975 (TARGET_LONG_DISPLACEMENT? ((d) >= -524288 && (d) <= 524287) \
085261c8 976 : SHORT_DISP_IN_RANGE(d))
0bfc3f69 977
24a235c8
CB
978/* Reads can reuse write prefetches, used by tree-ssa-prefetch-loops.c. */
979#define READ_CAN_USE_WRITE_PREFETCH 1
677f3fa8
JM
980
981extern const int processor_flags_table[];
085261c8
AK
982
983/* The truth element value for vector comparisons. Our instructions
984 always generate -1 in that case. */
985#define VECTOR_STORE_FLAG_VALUE(MODE) CONSTM1_RTX (GET_MODE_INNER (MODE))
986
3af82a61
AK
987/* Target pragma. */
988
989/* resolve_overloaded_builtin can not be defined the normal way since
990 it is defined in code which technically belongs to the
991 front-end. */
992#define REGISTER_TARGET_PRAGMAS() \
993 do { \
994 s390_register_target_pragmas (); \
995 } while (0)
996
085261c8 997#endif /* S390_H */