1 /* Subroutines used for code generation on IBM RS/6000.
2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 Free Software Foundation, Inc.
5 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 3, or (at your
12 option) any later version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
29 #include "hard-reg-set.h"
31 #include "insn-config.h"
32 #include "conditions.h"
33 #include "insn-attr.h"
43 #include "basic-block.h"
44 #include "integrate.h"
50 #include "target-def.h"
51 #include "langhooks.h"
53 #include "cfglayout.h"
54 #include "sched-int.h"
55 #include "tree-gimple.h"
56 #include "tree-flow.h"
59 #include "tm-constrs.h"
61 #include "xcoffout.h" /* get declarations of xcoff_*_section_name */
64 #include "gstab.h" /* for N_SLINE */
67 #ifndef TARGET_NO_PROTOTYPE
68 #define TARGET_NO_PROTOTYPE 0
71 #define min(A,B) ((A) < (B) ? (A) : (B))
72 #define max(A,B) ((A) > (B) ? (A) : (B))
74 /* Structure used to define the rs6000 stack */
75 typedef struct rs6000_stack {
76 int first_gp_reg_save; /* first callee saved GP register used */
77 int first_fp_reg_save; /* first callee saved FP register used */
78 int first_altivec_reg_save; /* first callee saved AltiVec register used */
79 int lr_save_p; /* true if the link reg needs to be saved */
80 int cr_save_p; /* true if the CR reg needs to be saved */
81 unsigned int vrsave_mask; /* mask of vec registers to save */
82 int push_p; /* true if we need to allocate stack space */
83 int calls_p; /* true if the function makes any calls */
84 int world_save_p; /* true if we're saving *everything*:
85 r13-r31, cr, f14-f31, vrsave, v20-v31 */
86 enum rs6000_abi abi; /* which ABI to use */
87 int gp_save_offset; /* offset to save GP regs from initial SP */
88 int fp_save_offset; /* offset to save FP regs from initial SP */
89 int altivec_save_offset; /* offset to save AltiVec regs from initial SP */
90 int lr_save_offset; /* offset to save LR from initial SP */
91 int cr_save_offset; /* offset to save CR from initial SP */
92 int vrsave_save_offset; /* offset to save VRSAVE from initial SP */
93 int spe_gp_save_offset; /* offset to save spe 64-bit gprs */
94 int varargs_save_offset; /* offset to save the varargs registers */
95 int ehrd_offset; /* offset to EH return data */
96 int reg_size; /* register size (4 or 8) */
97 HOST_WIDE_INT vars_size; /* variable save area size */
98 int parm_size; /* outgoing parameter size */
99 int save_size; /* save area size */
100 int fixed_size; /* fixed size of stack frame */
101 int gp_size; /* size of saved GP registers */
102 int fp_size; /* size of saved FP registers */
103 int altivec_size; /* size of saved AltiVec registers */
104 int cr_size; /* size to hold CR if not in save_size */
105 int vrsave_size; /* size to hold VRSAVE if not in save_size */
106 int altivec_padding_size; /* size of altivec alignment padding if
108 int spe_gp_size; /* size of 64-bit GPR save size for SPE */
109 int spe_padding_size;
110 HOST_WIDE_INT total_size; /* total bytes allocated for stack */
111 int spe_64bit_regs_used;
114 /* A C structure for machine-specific, per-function data.
115 This is added to the cfun structure. */
116 typedef struct machine_function GTY(())
118 /* Flags if __builtin_return_address (n) with n >= 1 was used. */
119 int ra_needs_full_frame;
120 /* Some local-dynamic symbol. */
121 const char *some_ld_name;
122 /* Whether the instruction chain has been scanned already. */
123 int insn_chain_scanned_p;
124 /* Flags if __builtin_return_address (0) was used. */
126 /* Offset from virtual_stack_vars_rtx to the start of the ABI_V4
127 varargs save area. */
128 HOST_WIDE_INT varargs_save_offset;
129 /* Temporary stack slot to use for SDmode copies. This slot is
130 64-bits wide and is allocated early enough so that the offset
131 does not overflow the 16-bit load/store offset field. */
132 rtx sdmode_stack_slot;
135 /* Target cpu type */
137 enum processor_type rs6000_cpu;
138 struct rs6000_cpu_select rs6000_select[3] =
140 /* switch name, tune arch */
141 { (const char *)0, "--with-cpu=", 1, 1 },
142 { (const char *)0, "-mcpu=", 1, 1 },
143 { (const char *)0, "-mtune=", 1, 0 },
146 static GTY(()) bool rs6000_cell_dont_microcode;
148 /* Always emit branch hint bits. */
149 static GTY(()) bool rs6000_always_hint;
151 /* Schedule instructions for group formation. */
152 static GTY(()) bool rs6000_sched_groups;
154 /* Align branch targets. */
155 static GTY(()) bool rs6000_align_branch_targets;
157 /* Support for -msched-costly-dep option. */
158 const char *rs6000_sched_costly_dep_str;
159 enum rs6000_dependence_cost rs6000_sched_costly_dep;
161 /* Support for -minsert-sched-nops option. */
162 const char *rs6000_sched_insert_nops_str;
163 enum rs6000_nop_insertion rs6000_sched_insert_nops;
165 /* Support targetm.vectorize.builtin_mask_for_load. */
166 static GTY(()) tree altivec_builtin_mask_for_load;
168 /* Size of long double. */
169 int rs6000_long_double_type_size;
171 /* IEEE quad extended precision long double. */
174 /* Nonzero to use AltiVec ABI. */
175 int rs6000_altivec_abi;
177 /* Nonzero if we want SPE ABI extensions. */
180 /* Nonzero if floating point operations are done in the GPRs. */
181 int rs6000_float_gprs = 0;
183 /* Nonzero if we want Darwin's struct-by-value-in-regs ABI. */
184 int rs6000_darwin64_abi;
186 /* Set to nonzero once AIX common-mode calls have been defined. */
187 static GTY(()) int common_mode_defined;
189 /* Save information from a "cmpxx" operation until the branch or scc is
191 rtx rs6000_compare_op0, rs6000_compare_op1;
192 int rs6000_compare_fp_p;
194 /* Label number of label created for -mrelocatable, to call to so we can
195 get the address of the GOT section */
196 int rs6000_pic_labelno;
199 /* Which abi to adhere to */
200 const char *rs6000_abi_name;
202 /* Semantics of the small data area */
203 enum rs6000_sdata_type rs6000_sdata = SDATA_DATA;
205 /* Which small data model to use */
206 const char *rs6000_sdata_name = (char *)0;
208 /* Counter for labels which are to be placed in .fixup. */
209 int fixuplabelno = 0;
212 /* Bit size of immediate TLS offsets and string from which it is decoded. */
213 int rs6000_tls_size = 32;
214 const char *rs6000_tls_size_string;
216 /* ABI enumeration available for subtarget to use. */
217 enum rs6000_abi rs6000_current_abi;
219 /* Whether to use variant of AIX ABI for PowerPC64 Linux. */
223 const char *rs6000_debug_name;
224 int rs6000_debug_stack; /* debug stack applications */
225 int rs6000_debug_arg; /* debug argument handling */
227 /* Value is TRUE if register/mode pair is acceptable. */
228 bool rs6000_hard_regno_mode_ok_p[NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
230 /* Built in types. */
232 tree rs6000_builtin_types[RS6000_BTI_MAX];
233 tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT];
235 const char *rs6000_traceback_name;
237 traceback_default = 0,
243 /* Flag to say the TOC is initialized */
245 char toc_label_name[10];
247 /* Cached value of rs6000_variable_issue. This is cached in
248 rs6000_variable_issue hook and returned from rs6000_sched_reorder2. */
249 static short cached_can_issue_more;
251 static GTY(()) section *read_only_data_section;
252 static GTY(()) section *private_data_section;
253 static GTY(()) section *read_only_private_data_section;
254 static GTY(()) section *sdata2_section;
255 static GTY(()) section *toc_section;
257 /* Control alignment for fields within structures. */
258 /* String from -malign-XXXXX. */
259 int rs6000_alignment_flags;
261 /* True for any options that were explicitly set. */
263 bool aix_struct_ret; /* True if -maix-struct-ret was used. */
264 bool alignment; /* True if -malign- was used. */
265 bool spe_abi; /* True if -mabi=spe/no-spe was used. */
266 bool altivec_abi; /* True if -mabi=altivec/no-altivec used. */
267 bool spe; /* True if -mspe= was used. */
268 bool float_gprs; /* True if -mfloat-gprs= was used. */
269 bool isel; /* True if -misel was used. */
270 bool long_double; /* True if -mlong-double- was used. */
271 bool ieee; /* True if -mabi=ieee/ibmlongdouble used. */
272 bool vrsave; /* True if -mvrsave was used. */
273 } rs6000_explicit_options;
275 struct builtin_description
277 /* mask is not const because we're going to alter it below. This
278 nonsense will go away when we rewrite the -march infrastructure
279 to give us more target flag bits. */
281 const enum insn_code icode;
282 const char *const name;
283 const enum rs6000_builtins code;
286 /* Target cpu costs. */
288 struct processor_costs {
289 const int mulsi; /* cost of SImode multiplication. */
290 const int mulsi_const; /* cost of SImode multiplication by constant. */
291 const int mulsi_const9; /* cost of SImode mult by short constant. */
292 const int muldi; /* cost of DImode multiplication. */
293 const int divsi; /* cost of SImode division. */
294 const int divdi; /* cost of DImode division. */
295 const int fp; /* cost of simple SFmode and DFmode insns. */
296 const int dmul; /* cost of DFmode multiplication (and fmadd). */
297 const int sdiv; /* cost of SFmode division (fdivs). */
298 const int ddiv; /* cost of DFmode division (fdiv). */
299 const int cache_line_size; /* cache line size in bytes. */
300 const int l1_cache_size; /* size of l1 cache, in kilobytes. */
301 const int l2_cache_size; /* size of l2 cache, in kilobytes. */
302 const int simultaneous_prefetches; /* number of parallel prefetch
306 const struct processor_costs *rs6000_cost;
308 /* Processor costs (relative to an add) */
310 /* Instruction size costs on 32bit processors. */
312 struct processor_costs size32_cost = {
313 COSTS_N_INSNS (1), /* mulsi */
314 COSTS_N_INSNS (1), /* mulsi_const */
315 COSTS_N_INSNS (1), /* mulsi_const9 */
316 COSTS_N_INSNS (1), /* muldi */
317 COSTS_N_INSNS (1), /* divsi */
318 COSTS_N_INSNS (1), /* divdi */
319 COSTS_N_INSNS (1), /* fp */
320 COSTS_N_INSNS (1), /* dmul */
321 COSTS_N_INSNS (1), /* sdiv */
322 COSTS_N_INSNS (1), /* ddiv */
329 /* Instruction size costs on 64bit processors. */
331 struct processor_costs size64_cost = {
332 COSTS_N_INSNS (1), /* mulsi */
333 COSTS_N_INSNS (1), /* mulsi_const */
334 COSTS_N_INSNS (1), /* mulsi_const9 */
335 COSTS_N_INSNS (1), /* muldi */
336 COSTS_N_INSNS (1), /* divsi */
337 COSTS_N_INSNS (1), /* divdi */
338 COSTS_N_INSNS (1), /* fp */
339 COSTS_N_INSNS (1), /* dmul */
340 COSTS_N_INSNS (1), /* sdiv */
341 COSTS_N_INSNS (1), /* ddiv */
348 /* Instruction costs on RIOS1 processors. */
350 struct processor_costs rios1_cost = {
351 COSTS_N_INSNS (5), /* mulsi */
352 COSTS_N_INSNS (4), /* mulsi_const */
353 COSTS_N_INSNS (3), /* mulsi_const9 */
354 COSTS_N_INSNS (5), /* muldi */
355 COSTS_N_INSNS (19), /* divsi */
356 COSTS_N_INSNS (19), /* divdi */
357 COSTS_N_INSNS (2), /* fp */
358 COSTS_N_INSNS (2), /* dmul */
359 COSTS_N_INSNS (19), /* sdiv */
360 COSTS_N_INSNS (19), /* ddiv */
367 /* Instruction costs on RIOS2 processors. */
369 struct processor_costs rios2_cost = {
370 COSTS_N_INSNS (2), /* mulsi */
371 COSTS_N_INSNS (2), /* mulsi_const */
372 COSTS_N_INSNS (2), /* mulsi_const9 */
373 COSTS_N_INSNS (2), /* muldi */
374 COSTS_N_INSNS (13), /* divsi */
375 COSTS_N_INSNS (13), /* divdi */
376 COSTS_N_INSNS (2), /* fp */
377 COSTS_N_INSNS (2), /* dmul */
378 COSTS_N_INSNS (17), /* sdiv */
379 COSTS_N_INSNS (17), /* ddiv */
386 /* Instruction costs on RS64A processors. */
388 struct processor_costs rs64a_cost = {
389 COSTS_N_INSNS (20), /* mulsi */
390 COSTS_N_INSNS (12), /* mulsi_const */
391 COSTS_N_INSNS (8), /* mulsi_const9 */
392 COSTS_N_INSNS (34), /* muldi */
393 COSTS_N_INSNS (65), /* divsi */
394 COSTS_N_INSNS (67), /* divdi */
395 COSTS_N_INSNS (4), /* fp */
396 COSTS_N_INSNS (4), /* dmul */
397 COSTS_N_INSNS (31), /* sdiv */
398 COSTS_N_INSNS (31), /* ddiv */
405 /* Instruction costs on MPCCORE processors. */
407 struct processor_costs mpccore_cost = {
408 COSTS_N_INSNS (2), /* mulsi */
409 COSTS_N_INSNS (2), /* mulsi_const */
410 COSTS_N_INSNS (2), /* mulsi_const9 */
411 COSTS_N_INSNS (2), /* muldi */
412 COSTS_N_INSNS (6), /* divsi */
413 COSTS_N_INSNS (6), /* divdi */
414 COSTS_N_INSNS (4), /* fp */
415 COSTS_N_INSNS (5), /* dmul */
416 COSTS_N_INSNS (10), /* sdiv */
417 COSTS_N_INSNS (17), /* ddiv */
424 /* Instruction costs on PPC403 processors. */
426 struct processor_costs ppc403_cost = {
427 COSTS_N_INSNS (4), /* mulsi */
428 COSTS_N_INSNS (4), /* mulsi_const */
429 COSTS_N_INSNS (4), /* mulsi_const9 */
430 COSTS_N_INSNS (4), /* muldi */
431 COSTS_N_INSNS (33), /* divsi */
432 COSTS_N_INSNS (33), /* divdi */
433 COSTS_N_INSNS (11), /* fp */
434 COSTS_N_INSNS (11), /* dmul */
435 COSTS_N_INSNS (11), /* sdiv */
436 COSTS_N_INSNS (11), /* ddiv */
443 /* Instruction costs on PPC405 processors. */
445 struct processor_costs ppc405_cost = {
446 COSTS_N_INSNS (5), /* mulsi */
447 COSTS_N_INSNS (4), /* mulsi_const */
448 COSTS_N_INSNS (3), /* mulsi_const9 */
449 COSTS_N_INSNS (5), /* muldi */
450 COSTS_N_INSNS (35), /* divsi */
451 COSTS_N_INSNS (35), /* divdi */
452 COSTS_N_INSNS (11), /* fp */
453 COSTS_N_INSNS (11), /* dmul */
454 COSTS_N_INSNS (11), /* sdiv */
455 COSTS_N_INSNS (11), /* ddiv */
462 /* Instruction costs on PPC440 processors. */
464 struct processor_costs ppc440_cost = {
465 COSTS_N_INSNS (3), /* mulsi */
466 COSTS_N_INSNS (2), /* mulsi_const */
467 COSTS_N_INSNS (2), /* mulsi_const9 */
468 COSTS_N_INSNS (3), /* muldi */
469 COSTS_N_INSNS (34), /* divsi */
470 COSTS_N_INSNS (34), /* divdi */
471 COSTS_N_INSNS (5), /* fp */
472 COSTS_N_INSNS (5), /* dmul */
473 COSTS_N_INSNS (19), /* sdiv */
474 COSTS_N_INSNS (33), /* ddiv */
481 /* Instruction costs on PPC601 processors. */
483 struct processor_costs ppc601_cost = {
484 COSTS_N_INSNS (5), /* mulsi */
485 COSTS_N_INSNS (5), /* mulsi_const */
486 COSTS_N_INSNS (5), /* mulsi_const9 */
487 COSTS_N_INSNS (5), /* muldi */
488 COSTS_N_INSNS (36), /* divsi */
489 COSTS_N_INSNS (36), /* divdi */
490 COSTS_N_INSNS (4), /* fp */
491 COSTS_N_INSNS (5), /* dmul */
492 COSTS_N_INSNS (17), /* sdiv */
493 COSTS_N_INSNS (31), /* ddiv */
500 /* Instruction costs on PPC603 processors. */
502 struct processor_costs ppc603_cost = {
503 COSTS_N_INSNS (5), /* mulsi */
504 COSTS_N_INSNS (3), /* mulsi_const */
505 COSTS_N_INSNS (2), /* mulsi_const9 */
506 COSTS_N_INSNS (5), /* muldi */
507 COSTS_N_INSNS (37), /* divsi */
508 COSTS_N_INSNS (37), /* divdi */
509 COSTS_N_INSNS (3), /* fp */
510 COSTS_N_INSNS (4), /* dmul */
511 COSTS_N_INSNS (18), /* sdiv */
512 COSTS_N_INSNS (33), /* ddiv */
519 /* Instruction costs on PPC604 processors. */
521 struct processor_costs ppc604_cost = {
522 COSTS_N_INSNS (4), /* mulsi */
523 COSTS_N_INSNS (4), /* mulsi_const */
524 COSTS_N_INSNS (4), /* mulsi_const9 */
525 COSTS_N_INSNS (4), /* muldi */
526 COSTS_N_INSNS (20), /* divsi */
527 COSTS_N_INSNS (20), /* divdi */
528 COSTS_N_INSNS (3), /* fp */
529 COSTS_N_INSNS (3), /* dmul */
530 COSTS_N_INSNS (18), /* sdiv */
531 COSTS_N_INSNS (32), /* ddiv */
538 /* Instruction costs on PPC604e processors. */
540 struct processor_costs ppc604e_cost = {
541 COSTS_N_INSNS (2), /* mulsi */
542 COSTS_N_INSNS (2), /* mulsi_const */
543 COSTS_N_INSNS (2), /* mulsi_const9 */
544 COSTS_N_INSNS (2), /* muldi */
545 COSTS_N_INSNS (20), /* divsi */
546 COSTS_N_INSNS (20), /* divdi */
547 COSTS_N_INSNS (3), /* fp */
548 COSTS_N_INSNS (3), /* dmul */
549 COSTS_N_INSNS (18), /* sdiv */
550 COSTS_N_INSNS (32), /* ddiv */
557 /* Instruction costs on PPC620 processors. */
559 struct processor_costs ppc620_cost = {
560 COSTS_N_INSNS (5), /* mulsi */
561 COSTS_N_INSNS (4), /* mulsi_const */
562 COSTS_N_INSNS (3), /* mulsi_const9 */
563 COSTS_N_INSNS (7), /* muldi */
564 COSTS_N_INSNS (21), /* divsi */
565 COSTS_N_INSNS (37), /* divdi */
566 COSTS_N_INSNS (3), /* fp */
567 COSTS_N_INSNS (3), /* dmul */
568 COSTS_N_INSNS (18), /* sdiv */
569 COSTS_N_INSNS (32), /* ddiv */
576 /* Instruction costs on PPC630 processors. */
578 struct processor_costs ppc630_cost = {
579 COSTS_N_INSNS (5), /* mulsi */
580 COSTS_N_INSNS (4), /* mulsi_const */
581 COSTS_N_INSNS (3), /* mulsi_const9 */
582 COSTS_N_INSNS (7), /* muldi */
583 COSTS_N_INSNS (21), /* divsi */
584 COSTS_N_INSNS (37), /* divdi */
585 COSTS_N_INSNS (3), /* fp */
586 COSTS_N_INSNS (3), /* dmul */
587 COSTS_N_INSNS (17), /* sdiv */
588 COSTS_N_INSNS (21), /* ddiv */
595 /* Instruction costs on Cell processor. */
596 /* COSTS_N_INSNS (1) ~ one add. */
598 struct processor_costs ppccell_cost = {
599 COSTS_N_INSNS (9/2)+2, /* mulsi */
600 COSTS_N_INSNS (6/2), /* mulsi_const */
601 COSTS_N_INSNS (6/2), /* mulsi_const9 */
602 COSTS_N_INSNS (15/2)+2, /* muldi */
603 COSTS_N_INSNS (38/2), /* divsi */
604 COSTS_N_INSNS (70/2), /* divdi */
605 COSTS_N_INSNS (10/2), /* fp */
606 COSTS_N_INSNS (10/2), /* dmul */
607 COSTS_N_INSNS (74/2), /* sdiv */
608 COSTS_N_INSNS (74/2), /* ddiv */
615 /* Instruction costs on PPC750 and PPC7400 processors. */
617 struct processor_costs ppc750_cost = {
618 COSTS_N_INSNS (5), /* mulsi */
619 COSTS_N_INSNS (3), /* mulsi_const */
620 COSTS_N_INSNS (2), /* mulsi_const9 */
621 COSTS_N_INSNS (5), /* muldi */
622 COSTS_N_INSNS (17), /* divsi */
623 COSTS_N_INSNS (17), /* divdi */
624 COSTS_N_INSNS (3), /* fp */
625 COSTS_N_INSNS (3), /* dmul */
626 COSTS_N_INSNS (17), /* sdiv */
627 COSTS_N_INSNS (31), /* ddiv */
634 /* Instruction costs on PPC7450 processors. */
636 struct processor_costs ppc7450_cost = {
637 COSTS_N_INSNS (4), /* mulsi */
638 COSTS_N_INSNS (3), /* mulsi_const */
639 COSTS_N_INSNS (3), /* mulsi_const9 */
640 COSTS_N_INSNS (4), /* muldi */
641 COSTS_N_INSNS (23), /* divsi */
642 COSTS_N_INSNS (23), /* divdi */
643 COSTS_N_INSNS (5), /* fp */
644 COSTS_N_INSNS (5), /* dmul */
645 COSTS_N_INSNS (21), /* sdiv */
646 COSTS_N_INSNS (35), /* ddiv */
653 /* Instruction costs on PPC8540 processors. */
655 struct processor_costs ppc8540_cost = {
656 COSTS_N_INSNS (4), /* mulsi */
657 COSTS_N_INSNS (4), /* mulsi_const */
658 COSTS_N_INSNS (4), /* mulsi_const9 */
659 COSTS_N_INSNS (4), /* muldi */
660 COSTS_N_INSNS (19), /* divsi */
661 COSTS_N_INSNS (19), /* divdi */
662 COSTS_N_INSNS (4), /* fp */
663 COSTS_N_INSNS (4), /* dmul */
664 COSTS_N_INSNS (29), /* sdiv */
665 COSTS_N_INSNS (29), /* ddiv */
669 1, /* prefetch streams /*/
672 /* Instruction costs on POWER4 and POWER5 processors. */
674 struct processor_costs power4_cost = {
675 COSTS_N_INSNS (3), /* mulsi */
676 COSTS_N_INSNS (2), /* mulsi_const */
677 COSTS_N_INSNS (2), /* mulsi_const9 */
678 COSTS_N_INSNS (4), /* muldi */
679 COSTS_N_INSNS (18), /* divsi */
680 COSTS_N_INSNS (34), /* divdi */
681 COSTS_N_INSNS (3), /* fp */
682 COSTS_N_INSNS (3), /* dmul */
683 COSTS_N_INSNS (17), /* sdiv */
684 COSTS_N_INSNS (17), /* ddiv */
688 8, /* prefetch streams /*/
691 /* Instruction costs on POWER6 processors. */
693 struct processor_costs power6_cost = {
694 COSTS_N_INSNS (8), /* mulsi */
695 COSTS_N_INSNS (8), /* mulsi_const */
696 COSTS_N_INSNS (8), /* mulsi_const9 */
697 COSTS_N_INSNS (8), /* muldi */
698 COSTS_N_INSNS (22), /* divsi */
699 COSTS_N_INSNS (28), /* divdi */
700 COSTS_N_INSNS (3), /* fp */
701 COSTS_N_INSNS (3), /* dmul */
702 COSTS_N_INSNS (13), /* sdiv */
703 COSTS_N_INSNS (16), /* ddiv */
707 16, /* prefetch streams */
711 static bool rs6000_function_ok_for_sibcall (tree, tree);
712 static const char *rs6000_invalid_within_doloop (const_rtx);
713 static rtx rs6000_generate_compare (enum rtx_code);
714 static void rs6000_emit_stack_tie (void);
715 static void rs6000_frame_related (rtx, rtx, HOST_WIDE_INT, rtx, rtx);
716 static rtx spe_synthesize_frame_save (rtx);
717 static bool spe_func_has_64bit_regs_p (void);
718 static void emit_frame_save (rtx, rtx, enum machine_mode, unsigned int,
720 static rtx gen_frame_mem_offset (enum machine_mode, rtx, int);
721 static void rs6000_emit_allocate_stack (HOST_WIDE_INT, int);
722 static unsigned rs6000_hash_constant (rtx);
723 static unsigned toc_hash_function (const void *);
724 static int toc_hash_eq (const void *, const void *);
725 static int constant_pool_expr_1 (rtx, int *, int *);
726 static bool constant_pool_expr_p (rtx);
727 static bool legitimate_small_data_p (enum machine_mode, rtx);
728 static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int);
729 static struct machine_function * rs6000_init_machine_status (void);
730 static bool rs6000_assemble_integer (rtx, unsigned int, int);
731 static bool no_global_regs_above (int);
732 #ifdef HAVE_GAS_HIDDEN
733 static void rs6000_assemble_visibility (tree, int);
735 static int rs6000_ra_ever_killed (void);
736 static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
737 static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
738 static bool rs6000_ms_bitfield_layout_p (const_tree);
739 static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *);
740 static void rs6000_eliminate_indexed_memrefs (rtx operands[2]);
741 static const char *rs6000_mangle_type (const_tree);
742 extern const struct attribute_spec rs6000_attribute_table[];
743 static void rs6000_set_default_type_attributes (tree);
744 static bool rs6000_reg_live_or_pic_offset_p (int);
745 static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT);
746 static void rs6000_output_function_epilogue (FILE *, HOST_WIDE_INT);
747 static void rs6000_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
749 static rtx rs6000_emit_set_long_const (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
750 static bool rs6000_return_in_memory (const_tree, const_tree);
751 static void rs6000_file_start (void);
753 static int rs6000_elf_reloc_rw_mask (void);
754 static void rs6000_elf_asm_out_constructor (rtx, int);
755 static void rs6000_elf_asm_out_destructor (rtx, int);
756 static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED;
757 static void rs6000_elf_asm_init_sections (void);
758 static section *rs6000_elf_select_rtx_section (enum machine_mode, rtx,
759 unsigned HOST_WIDE_INT);
760 static void rs6000_elf_encode_section_info (tree, rtx, int)
763 static bool rs6000_use_blocks_for_constant_p (enum machine_mode, const_rtx);
764 static void rs6000_alloc_sdmode_stack_slot (void);
765 static void rs6000_instantiate_decls (void);
767 static void rs6000_xcoff_asm_output_anchor (rtx);
768 static void rs6000_xcoff_asm_globalize_label (FILE *, const char *);
769 static void rs6000_xcoff_asm_init_sections (void);
770 static int rs6000_xcoff_reloc_rw_mask (void);
771 static void rs6000_xcoff_asm_named_section (const char *, unsigned int, tree);
772 static section *rs6000_xcoff_select_section (tree, int,
773 unsigned HOST_WIDE_INT);
774 static void rs6000_xcoff_unique_section (tree, int);
775 static section *rs6000_xcoff_select_rtx_section
776 (enum machine_mode, rtx, unsigned HOST_WIDE_INT);
777 static const char * rs6000_xcoff_strip_name_encoding (const char *);
778 static unsigned int rs6000_xcoff_section_type_flags (tree, const char *, int);
779 static void rs6000_xcoff_file_start (void);
780 static void rs6000_xcoff_file_end (void);
782 static int rs6000_variable_issue (FILE *, int, rtx, int);
783 static bool rs6000_rtx_costs (rtx, int, int, int *);
784 static int rs6000_adjust_cost (rtx, rtx, rtx, int);
785 static void rs6000_sched_init (FILE *, int, int);
786 static bool is_microcoded_insn (rtx);
787 static bool is_nonpipeline_insn (rtx);
788 static bool is_cracked_insn (rtx);
789 static bool is_branch_slot_insn (rtx);
790 static bool is_load_insn (rtx);
791 static rtx get_store_dest (rtx pat);
792 static bool is_store_insn (rtx);
793 static bool set_to_load_agen (rtx,rtx);
794 static bool adjacent_mem_locations (rtx,rtx);
795 static int rs6000_adjust_priority (rtx, int);
796 static int rs6000_issue_rate (void);
797 static bool rs6000_is_costly_dependence (dep_t, int, int);
798 static rtx get_next_active_insn (rtx, rtx);
799 static bool insn_terminates_group_p (rtx , enum group_termination);
800 static bool insn_must_be_first_in_group (rtx);
801 static bool insn_must_be_last_in_group (rtx);
802 static bool is_costly_group (rtx *, rtx);
803 static int force_new_group (int, FILE *, rtx *, rtx, bool *, int, int *);
804 static int redefine_groups (FILE *, int, rtx, rtx);
805 static int pad_groups (FILE *, int, rtx, rtx);
806 static void rs6000_sched_finish (FILE *, int);
807 static int rs6000_sched_reorder (FILE *, int, rtx *, int *, int);
808 static int rs6000_sched_reorder2 (FILE *, int, rtx *, int *, int);
809 static int rs6000_use_sched_lookahead (void);
810 static int rs6000_use_sched_lookahead_guard (rtx);
811 static tree rs6000_builtin_reciprocal (unsigned int, bool, bool);
812 static tree rs6000_builtin_mask_for_load (void);
813 static tree rs6000_builtin_mul_widen_even (tree);
814 static tree rs6000_builtin_mul_widen_odd (tree);
815 static tree rs6000_builtin_conversion (enum tree_code, tree);
817 static void def_builtin (int, const char *, tree, int);
818 static bool rs6000_vector_alignment_reachable (const_tree, bool);
819 static void rs6000_init_builtins (void);
820 static rtx rs6000_expand_unop_builtin (enum insn_code, tree, rtx);
821 static rtx rs6000_expand_binop_builtin (enum insn_code, tree, rtx);
822 static rtx rs6000_expand_ternop_builtin (enum insn_code, tree, rtx);
823 static rtx rs6000_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
824 static void altivec_init_builtins (void);
825 static void rs6000_common_init_builtins (void);
826 static void rs6000_init_libfuncs (void);
828 static void paired_init_builtins (void);
829 static rtx paired_expand_builtin (tree, rtx, bool *);
830 static rtx paired_expand_lv_builtin (enum insn_code, tree, rtx);
831 static rtx paired_expand_stv_builtin (enum insn_code, tree);
832 static rtx paired_expand_predicate_builtin (enum insn_code, tree, rtx);
834 static void enable_mask_for_builtins (struct builtin_description *, int,
835 enum rs6000_builtins,
836 enum rs6000_builtins);
837 static tree build_opaque_vector_type (tree, int);
838 static void spe_init_builtins (void);
839 static rtx spe_expand_builtin (tree, rtx, bool *);
840 static rtx spe_expand_stv_builtin (enum insn_code, tree);
841 static rtx spe_expand_predicate_builtin (enum insn_code, tree, rtx);
842 static rtx spe_expand_evsel_builtin (enum insn_code, tree, rtx);
843 static int rs6000_emit_int_cmove (rtx, rtx, rtx, rtx);
844 static rs6000_stack_t *rs6000_stack_info (void);
845 static void debug_stack_info (rs6000_stack_t *);
847 static rtx altivec_expand_builtin (tree, rtx, bool *);
848 static rtx altivec_expand_ld_builtin (tree, rtx, bool *);
849 static rtx altivec_expand_st_builtin (tree, rtx, bool *);
850 static rtx altivec_expand_dst_builtin (tree, rtx, bool *);
851 static rtx altivec_expand_abs_builtin (enum insn_code, tree, rtx);
852 static rtx altivec_expand_predicate_builtin (enum insn_code,
853 const char *, tree, rtx);
854 static rtx altivec_expand_lv_builtin (enum insn_code, tree, rtx);
855 static rtx altivec_expand_stv_builtin (enum insn_code, tree);
856 static rtx altivec_expand_vec_init_builtin (tree, tree, rtx);
857 static rtx altivec_expand_vec_set_builtin (tree);
858 static rtx altivec_expand_vec_ext_builtin (tree, rtx);
859 static int get_element_number (tree, tree);
860 static bool rs6000_handle_option (size_t, const char *, int);
861 static void rs6000_parse_tls_size_option (void);
862 static void rs6000_parse_yes_no_option (const char *, const char *, int *);
863 static int first_altivec_reg_to_save (void);
864 static unsigned int compute_vrsave_mask (void);
865 static void compute_save_world_info (rs6000_stack_t *info_ptr);
866 static void is_altivec_return_reg (rtx, void *);
867 static rtx generate_set_vrsave (rtx, rs6000_stack_t *, int);
868 int easy_vector_constant (rtx, enum machine_mode);
869 static bool rs6000_is_opaque_type (const_tree);
870 static rtx rs6000_dwarf_register_span (rtx);
871 static void rs6000_init_dwarf_reg_sizes_extra (tree);
872 static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
873 static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
874 static rtx rs6000_tls_get_addr (void);
875 static rtx rs6000_got_sym (void);
876 static int rs6000_tls_symbol_ref_1 (rtx *, void *);
877 static const char *rs6000_get_some_local_dynamic_name (void);
878 static int rs6000_get_some_local_dynamic_name_1 (rtx *, void *);
879 static rtx rs6000_complex_function_value (enum machine_mode);
880 static rtx rs6000_spe_function_arg (CUMULATIVE_ARGS *,
881 enum machine_mode, tree);
882 static void rs6000_darwin64_record_arg_advance_flush (CUMULATIVE_ARGS *,
884 static void rs6000_darwin64_record_arg_advance_recurse (CUMULATIVE_ARGS *,
885 tree, HOST_WIDE_INT);
886 static void rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *,
889 static void rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *,
890 const_tree, HOST_WIDE_INT,
892 static rtx rs6000_darwin64_record_arg (CUMULATIVE_ARGS *, const_tree, int, bool);
893 static rtx rs6000_mixed_function_arg (enum machine_mode, tree, int);
894 static void rs6000_move_block_from_reg (int regno, rtx x, int nregs);
895 static void setup_incoming_varargs (CUMULATIVE_ARGS *,
896 enum machine_mode, tree,
898 static bool rs6000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
900 static int rs6000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
902 static const char *invalid_arg_for_unprototyped_fn (const_tree, const_tree, const_tree);
904 static void macho_branch_islands (void);
905 static int no_previous_def (tree function_name);
906 static tree get_prev_label (tree function_name);
907 static void rs6000_darwin_file_start (void);
910 static tree rs6000_build_builtin_va_list (void);
911 static void rs6000_va_start (tree, rtx);
912 static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *);
913 static bool rs6000_must_pass_in_stack (enum machine_mode, const_tree);
914 static bool rs6000_scalar_mode_supported_p (enum machine_mode);
915 static bool rs6000_vector_mode_supported_p (enum machine_mode);
916 static int get_vec_cmp_insn (enum rtx_code, enum machine_mode,
918 static rtx rs6000_emit_vector_compare (enum rtx_code, rtx, rtx,
920 static int get_vsel_insn (enum machine_mode);
921 static void rs6000_emit_vector_select (rtx, rtx, rtx, rtx);
922 static tree rs6000_stack_protect_fail (void);
924 const int INSN_NOT_AVAILABLE = -1;
925 static enum machine_mode rs6000_eh_return_filter_mode (void);
927 /* Hash table stuff for keeping track of TOC entries. */
929 struct toc_hash_struct GTY(())
931 /* `key' will satisfy CONSTANT_P; in fact, it will satisfy
932 ASM_OUTPUT_SPECIAL_POOL_ENTRY_P. */
934 enum machine_mode key_mode;
938 static GTY ((param_is (struct toc_hash_struct))) htab_t toc_hash_table;
940 /* Default register names. */
941 char rs6000_reg_names[][8] =
943 "0", "1", "2", "3", "4", "5", "6", "7",
944 "8", "9", "10", "11", "12", "13", "14", "15",
945 "16", "17", "18", "19", "20", "21", "22", "23",
946 "24", "25", "26", "27", "28", "29", "30", "31",
947 "0", "1", "2", "3", "4", "5", "6", "7",
948 "8", "9", "10", "11", "12", "13", "14", "15",
949 "16", "17", "18", "19", "20", "21", "22", "23",
950 "24", "25", "26", "27", "28", "29", "30", "31",
951 "mq", "lr", "ctr","ap",
952 "0", "1", "2", "3", "4", "5", "6", "7",
954 /* AltiVec registers. */
955 "0", "1", "2", "3", "4", "5", "6", "7",
956 "8", "9", "10", "11", "12", "13", "14", "15",
957 "16", "17", "18", "19", "20", "21", "22", "23",
958 "24", "25", "26", "27", "28", "29", "30", "31",
961 "spe_acc", "spefscr",
962 /* Soft frame pointer. */
966 #ifdef TARGET_REGNAMES
967 static const char alt_reg_names[][8] =
969 "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
970 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
971 "%r16", "%r17", "%r18", "%r19", "%r20", "%r21", "%r22", "%r23",
972 "%r24", "%r25", "%r26", "%r27", "%r28", "%r29", "%r30", "%r31",
973 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
974 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
975 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
976 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
977 "mq", "lr", "ctr", "ap",
978 "%cr0", "%cr1", "%cr2", "%cr3", "%cr4", "%cr5", "%cr6", "%cr7",
980 /* AltiVec registers. */
981 "%v0", "%v1", "%v2", "%v3", "%v4", "%v5", "%v6", "%v7",
982 "%v8", "%v9", "%v10", "%v11", "%v12", "%v13", "%v14", "%v15",
983 "%v16", "%v17", "%v18", "%v19", "%v20", "%v21", "%v22", "%v23",
984 "%v24", "%v25", "%v26", "%v27", "%v28", "%v29", "%v30", "%v31",
987 "spe_acc", "spefscr",
988 /* Soft frame pointer. */
993 #ifndef MASK_STRICT_ALIGN
994 #define MASK_STRICT_ALIGN 0
996 #ifndef TARGET_PROFILE_KERNEL
997 #define TARGET_PROFILE_KERNEL 0
1000 /* The VRSAVE bitmask puts bit %v0 as the most significant bit. */
1001 #define ALTIVEC_REG_BIT(REGNO) (0x80000000 >> ((REGNO) - FIRST_ALTIVEC_REGNO))
1003 /* Initialize the GCC target structure. */
1004 #undef TARGET_ATTRIBUTE_TABLE
1005 #define TARGET_ATTRIBUTE_TABLE rs6000_attribute_table
1006 #undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
1007 #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES rs6000_set_default_type_attributes
1009 #undef TARGET_ASM_ALIGNED_DI_OP
1010 #define TARGET_ASM_ALIGNED_DI_OP DOUBLE_INT_ASM_OP
1012 /* Default unaligned ops are only provided for ELF. Find the ops needed
1013 for non-ELF systems. */
1014 #ifndef OBJECT_FORMAT_ELF
1016 /* For XCOFF. rs6000_assemble_integer will handle unaligned DIs on
1018 #undef TARGET_ASM_UNALIGNED_HI_OP
1019 #define TARGET_ASM_UNALIGNED_HI_OP "\t.vbyte\t2,"
1020 #undef TARGET_ASM_UNALIGNED_SI_OP
1021 #define TARGET_ASM_UNALIGNED_SI_OP "\t.vbyte\t4,"
1022 #undef TARGET_ASM_UNALIGNED_DI_OP
1023 #define TARGET_ASM_UNALIGNED_DI_OP "\t.vbyte\t8,"
1026 #undef TARGET_ASM_UNALIGNED_HI_OP
1027 #define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t"
1028 #undef TARGET_ASM_UNALIGNED_SI_OP
1029 #define TARGET_ASM_UNALIGNED_SI_OP "\t.long\t"
1030 #undef TARGET_ASM_UNALIGNED_DI_OP
1031 #define TARGET_ASM_UNALIGNED_DI_OP "\t.quad\t"
1032 #undef TARGET_ASM_ALIGNED_DI_OP
1033 #define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t"
1037 /* This hook deals with fixups for relocatable code and DI-mode objects
1039 #undef TARGET_ASM_INTEGER
1040 #define TARGET_ASM_INTEGER rs6000_assemble_integer
1042 #ifdef HAVE_GAS_HIDDEN
1043 #undef TARGET_ASM_ASSEMBLE_VISIBILITY
1044 #define TARGET_ASM_ASSEMBLE_VISIBILITY rs6000_assemble_visibility
1047 #undef TARGET_HAVE_TLS
1048 #define TARGET_HAVE_TLS HAVE_AS_TLS
1050 #undef TARGET_CANNOT_FORCE_CONST_MEM
1051 #define TARGET_CANNOT_FORCE_CONST_MEM rs6000_tls_referenced_p
1053 #undef TARGET_ASM_FUNCTION_PROLOGUE
1054 #define TARGET_ASM_FUNCTION_PROLOGUE rs6000_output_function_prologue
1055 #undef TARGET_ASM_FUNCTION_EPILOGUE
1056 #define TARGET_ASM_FUNCTION_EPILOGUE rs6000_output_function_epilogue
1058 #undef TARGET_SCHED_VARIABLE_ISSUE
1059 #define TARGET_SCHED_VARIABLE_ISSUE rs6000_variable_issue
1061 #undef TARGET_SCHED_ISSUE_RATE
1062 #define TARGET_SCHED_ISSUE_RATE rs6000_issue_rate
1063 #undef TARGET_SCHED_ADJUST_COST
1064 #define TARGET_SCHED_ADJUST_COST rs6000_adjust_cost
1065 #undef TARGET_SCHED_ADJUST_PRIORITY
1066 #define TARGET_SCHED_ADJUST_PRIORITY rs6000_adjust_priority
1067 #undef TARGET_SCHED_IS_COSTLY_DEPENDENCE
1068 #define TARGET_SCHED_IS_COSTLY_DEPENDENCE rs6000_is_costly_dependence
1069 #undef TARGET_SCHED_INIT
1070 #define TARGET_SCHED_INIT rs6000_sched_init
1071 #undef TARGET_SCHED_FINISH
1072 #define TARGET_SCHED_FINISH rs6000_sched_finish
1073 #undef TARGET_SCHED_REORDER
1074 #define TARGET_SCHED_REORDER rs6000_sched_reorder
1075 #undef TARGET_SCHED_REORDER2
1076 #define TARGET_SCHED_REORDER2 rs6000_sched_reorder2
1078 #undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
1079 #define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD rs6000_use_sched_lookahead
1081 #undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD
1082 #define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD rs6000_use_sched_lookahead_guard
1084 #undef TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
1085 #define TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD rs6000_builtin_mask_for_load
1086 #undef TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN
1087 #define TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN rs6000_builtin_mul_widen_even
1088 #undef TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD
1089 #define TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD rs6000_builtin_mul_widen_odd
1090 #undef TARGET_VECTORIZE_BUILTIN_CONVERSION
1091 #define TARGET_VECTORIZE_BUILTIN_CONVERSION rs6000_builtin_conversion
1093 #undef TARGET_VECTOR_ALIGNMENT_REACHABLE
1094 #define TARGET_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
1096 #undef TARGET_INIT_BUILTINS
1097 #define TARGET_INIT_BUILTINS rs6000_init_builtins
1099 #undef TARGET_EXPAND_BUILTIN
1100 #define TARGET_EXPAND_BUILTIN rs6000_expand_builtin
1102 #undef TARGET_MANGLE_TYPE
1103 #define TARGET_MANGLE_TYPE rs6000_mangle_type
1105 #undef TARGET_INIT_LIBFUNCS
1106 #define TARGET_INIT_LIBFUNCS rs6000_init_libfuncs
1109 #undef TARGET_BINDS_LOCAL_P
1110 #define TARGET_BINDS_LOCAL_P darwin_binds_local_p
1113 #undef TARGET_MS_BITFIELD_LAYOUT_P
1114 #define TARGET_MS_BITFIELD_LAYOUT_P rs6000_ms_bitfield_layout_p
1116 #undef TARGET_ASM_OUTPUT_MI_THUNK
1117 #define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk
1119 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
1120 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
1122 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
1123 #define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall
1125 #undef TARGET_INVALID_WITHIN_DOLOOP
1126 #define TARGET_INVALID_WITHIN_DOLOOP rs6000_invalid_within_doloop
1128 #undef TARGET_RTX_COSTS
1129 #define TARGET_RTX_COSTS rs6000_rtx_costs
1130 #undef TARGET_ADDRESS_COST
1131 #define TARGET_ADDRESS_COST hook_int_rtx_0
1133 #undef TARGET_VECTOR_OPAQUE_P
1134 #define TARGET_VECTOR_OPAQUE_P rs6000_is_opaque_type
1136 #undef TARGET_DWARF_REGISTER_SPAN
1137 #define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span
1139 #undef TARGET_INIT_DWARF_REG_SIZES_EXTRA
1140 #define TARGET_INIT_DWARF_REG_SIZES_EXTRA rs6000_init_dwarf_reg_sizes_extra
1142 /* On rs6000, function arguments are promoted, as are function return
1144 #undef TARGET_PROMOTE_FUNCTION_ARGS
1145 #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
1146 #undef TARGET_PROMOTE_FUNCTION_RETURN
1147 #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
1149 #undef TARGET_RETURN_IN_MEMORY
1150 #define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory
1152 #undef TARGET_SETUP_INCOMING_VARARGS
1153 #define TARGET_SETUP_INCOMING_VARARGS setup_incoming_varargs
1155 /* Always strict argument naming on rs6000. */
1156 #undef TARGET_STRICT_ARGUMENT_NAMING
1157 #define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
1158 #undef TARGET_PRETEND_OUTGOING_VARARGS_NAMED
1159 #define TARGET_PRETEND_OUTGOING_VARARGS_NAMED hook_bool_CUMULATIVE_ARGS_true
1160 #undef TARGET_SPLIT_COMPLEX_ARG
1161 #define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true
1162 #undef TARGET_MUST_PASS_IN_STACK
1163 #define TARGET_MUST_PASS_IN_STACK rs6000_must_pass_in_stack
1164 #undef TARGET_PASS_BY_REFERENCE
1165 #define TARGET_PASS_BY_REFERENCE rs6000_pass_by_reference
1166 #undef TARGET_ARG_PARTIAL_BYTES
1167 #define TARGET_ARG_PARTIAL_BYTES rs6000_arg_partial_bytes
1169 #undef TARGET_BUILD_BUILTIN_VA_LIST
1170 #define TARGET_BUILD_BUILTIN_VA_LIST rs6000_build_builtin_va_list
1172 #undef TARGET_EXPAND_BUILTIN_VA_START
1173 #define TARGET_EXPAND_BUILTIN_VA_START rs6000_va_start
1175 #undef TARGET_GIMPLIFY_VA_ARG_EXPR
1176 #define TARGET_GIMPLIFY_VA_ARG_EXPR rs6000_gimplify_va_arg
1178 #undef TARGET_EH_RETURN_FILTER_MODE
1179 #define TARGET_EH_RETURN_FILTER_MODE rs6000_eh_return_filter_mode
1181 #undef TARGET_SCALAR_MODE_SUPPORTED_P
1182 #define TARGET_SCALAR_MODE_SUPPORTED_P rs6000_scalar_mode_supported_p
1184 #undef TARGET_VECTOR_MODE_SUPPORTED_P
1185 #define TARGET_VECTOR_MODE_SUPPORTED_P rs6000_vector_mode_supported_p
1187 #undef TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN
1188 #define TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN invalid_arg_for_unprototyped_fn
1190 #undef TARGET_HANDLE_OPTION
1191 #define TARGET_HANDLE_OPTION rs6000_handle_option
1193 #undef TARGET_DEFAULT_TARGET_FLAGS
1194 #define TARGET_DEFAULT_TARGET_FLAGS \
1197 #undef TARGET_STACK_PROTECT_FAIL
1198 #define TARGET_STACK_PROTECT_FAIL rs6000_stack_protect_fail
1200 /* MPC604EUM 3.5.2 Weak Consistency between Multiple Processors
1201 The PowerPC architecture requires only weak consistency among
1202 processors--that is, memory accesses between processors need not be
1203 sequentially consistent and memory accesses among processors can occur
1204 in any order. The ability to order memory accesses weakly provides
1205 opportunities for more efficient use of the system bus. Unless a
1206 dependency exists, the 604e allows read operations to precede store
1208 #undef TARGET_RELAXED_ORDERING
1209 #define TARGET_RELAXED_ORDERING true
1212 #undef TARGET_ASM_OUTPUT_DWARF_DTPREL
1213 #define TARGET_ASM_OUTPUT_DWARF_DTPREL rs6000_output_dwarf_dtprel
1216 /* Use a 32-bit anchor range. This leads to sequences like:
1218 addis tmp,anchor,high
1221 where tmp itself acts as an anchor, and can be shared between
1222 accesses to the same 64k page. */
1223 #undef TARGET_MIN_ANCHOR_OFFSET
1224 #define TARGET_MIN_ANCHOR_OFFSET -0x7fffffff - 1
1225 #undef TARGET_MAX_ANCHOR_OFFSET
1226 #define TARGET_MAX_ANCHOR_OFFSET 0x7fffffff
1227 #undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
1228 #define TARGET_USE_BLOCKS_FOR_CONSTANT_P rs6000_use_blocks_for_constant_p
1230 #undef TARGET_BUILTIN_RECIPROCAL
1231 #define TARGET_BUILTIN_RECIPROCAL rs6000_builtin_reciprocal
1233 #undef TARGET_EXPAND_TO_RTL_HOOK
1234 #define TARGET_EXPAND_TO_RTL_HOOK rs6000_alloc_sdmode_stack_slot
1236 #undef TARGET_INSTANTIATE_DECLS
1237 #define TARGET_INSTANTIATE_DECLS rs6000_instantiate_decls
1239 struct gcc_target targetm = TARGET_INITIALIZER;
1242 /* Value is 1 if hard register REGNO can hold a value of machine-mode
1245 rs6000_hard_regno_mode_ok (int regno, enum machine_mode mode)
1247 /* The GPRs can hold any mode, but values bigger than one register
1248 cannot go past R31. */
1249 if (INT_REGNO_P (regno))
1250 return INT_REGNO_P (regno + HARD_REGNO_NREGS (regno, mode) - 1);
1252 /* The float registers can only hold floating modes and DImode.
1253 This excludes the 32-bit decimal float mode for now. */
1254 if (FP_REGNO_P (regno))
1256 ((SCALAR_FLOAT_MODE_P (mode)
1257 && (mode != TDmode || (regno % 2) == 0)
1258 && FP_REGNO_P (regno + HARD_REGNO_NREGS (regno, mode) - 1))
1259 || (GET_MODE_CLASS (mode) == MODE_INT
1260 && GET_MODE_SIZE (mode) == UNITS_PER_FP_WORD)
1261 || (PAIRED_SIMD_REGNO_P (regno) && TARGET_PAIRED_FLOAT
1262 && PAIRED_VECTOR_MODE (mode)));
1264 /* The CR register can only hold CC modes. */
1265 if (CR_REGNO_P (regno))
1266 return GET_MODE_CLASS (mode) == MODE_CC;
1268 if (XER_REGNO_P (regno))
1269 return mode == PSImode;
1271 /* AltiVec only in AldyVec registers. */
1272 if (ALTIVEC_REGNO_P (regno))
1273 return ALTIVEC_VECTOR_MODE (mode);
1275 /* ...but GPRs can hold SIMD data on the SPE in one register. */
1276 if (SPE_SIMD_REGNO_P (regno) && TARGET_SPE && SPE_VECTOR_MODE (mode))
1279 /* We cannot put TImode anywhere except general register and it must be
1280 able to fit within the register set. */
1282 return GET_MODE_SIZE (mode) <= UNITS_PER_WORD;
1285 /* Initialize rs6000_hard_regno_mode_ok_p table. */
1287 rs6000_init_hard_regno_mode_ok (void)
1291 for (r = 0; r < FIRST_PSEUDO_REGISTER; ++r)
1292 for (m = 0; m < NUM_MACHINE_MODES; ++m)
1293 if (rs6000_hard_regno_mode_ok (r, m))
1294 rs6000_hard_regno_mode_ok_p[m][r] = true;
1298 /* The Darwin version of SUBTARGET_OVERRIDE_OPTIONS. */
1301 darwin_rs6000_override_options (void)
1303 /* The Darwin ABI always includes AltiVec, can't be (validly) turned
1305 rs6000_altivec_abi = 1;
1306 TARGET_ALTIVEC_VRSAVE = 1;
1307 if (DEFAULT_ABI == ABI_DARWIN)
1309 if (MACHO_DYNAMIC_NO_PIC_P)
1312 warning (0, "-mdynamic-no-pic overrides -fpic or -fPIC");
1315 else if (flag_pic == 1)
1320 if (TARGET_64BIT && ! TARGET_POWERPC64)
1322 target_flags |= MASK_POWERPC64;
1323 warning (0, "-m64 requires PowerPC64 architecture, enabling");
1327 rs6000_default_long_calls = 1;
1328 target_flags |= MASK_SOFT_FLOAT;
1331 /* Make -m64 imply -maltivec. Darwin's 64-bit ABI includes
1333 if (!flag_mkernel && !flag_apple_kext
1335 && ! (target_flags_explicit & MASK_ALTIVEC))
1336 target_flags |= MASK_ALTIVEC;
1338 /* Unless the user (not the configurer) has explicitly overridden
1339 it with -mcpu=G3 or -mno-altivec, then 10.5+ targets default to
1340 G4 unless targetting the kernel. */
1343 && strverscmp (darwin_macosx_version_min, "10.5") >= 0
1344 && ! (target_flags_explicit & MASK_ALTIVEC)
1345 && ! rs6000_select[1].string)
1347 target_flags |= MASK_ALTIVEC;
1352 /* If not otherwise specified by a target, make 'long double' equivalent to
1355 #ifndef RS6000_DEFAULT_LONG_DOUBLE_SIZE
1356 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64
1359 /* Override command line options. Mostly we process the processor
1360 type and sometimes adjust other TARGET_ options. */
1363 rs6000_override_options (const char *default_cpu)
1366 struct rs6000_cpu_select *ptr;
1369 /* Simplifications for entries below. */
1372 POWERPC_BASE_MASK = MASK_POWERPC | MASK_NEW_MNEMONICS,
1373 POWERPC_7400_MASK = POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_ALTIVEC
1376 /* This table occasionally claims that a processor does not support
1377 a particular feature even though it does, but the feature is slower
1378 than the alternative. Thus, it shouldn't be relied on as a
1379 complete description of the processor's support.
1381 Please keep this list in order, and don't forget to update the
1382 documentation in invoke.texi when adding a new processor or
1386 const char *const name; /* Canonical processor name. */
1387 const enum processor_type processor; /* Processor type enum value. */
1388 const int target_enable; /* Target flags to enable. */
1389 } const processor_target_table[]
1390 = {{"401", PROCESSOR_PPC403, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
1391 {"403", PROCESSOR_PPC403,
1392 POWERPC_BASE_MASK | MASK_SOFT_FLOAT | MASK_STRICT_ALIGN},
1393 {"405", PROCESSOR_PPC405,
1394 POWERPC_BASE_MASK | MASK_SOFT_FLOAT | MASK_MULHW | MASK_DLMZB},
1395 {"405fp", PROCESSOR_PPC405,
1396 POWERPC_BASE_MASK | MASK_MULHW | MASK_DLMZB},
1397 {"440", PROCESSOR_PPC440,
1398 POWERPC_BASE_MASK | MASK_SOFT_FLOAT | MASK_MULHW | MASK_DLMZB},
1399 {"440fp", PROCESSOR_PPC440,
1400 POWERPC_BASE_MASK | MASK_MULHW | MASK_DLMZB},
1401 {"505", PROCESSOR_MPCCORE, POWERPC_BASE_MASK},
1402 {"601", PROCESSOR_PPC601,
1403 MASK_POWER | POWERPC_BASE_MASK | MASK_MULTIPLE | MASK_STRING},
1404 {"602", PROCESSOR_PPC603, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1405 {"603", PROCESSOR_PPC603, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1406 {"603e", PROCESSOR_PPC603, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1407 {"604", PROCESSOR_PPC604, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1408 {"604e", PROCESSOR_PPC604e, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1409 {"620", PROCESSOR_PPC620,
1410 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
1411 {"630", PROCESSOR_PPC630,
1412 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
1413 {"740", PROCESSOR_PPC750, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1414 {"7400", PROCESSOR_PPC7400, POWERPC_7400_MASK},
1415 {"7450", PROCESSOR_PPC7450, POWERPC_7400_MASK},
1416 {"750", PROCESSOR_PPC750, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1417 {"801", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
1418 {"821", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
1419 {"823", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
1420 {"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN},
1421 /* 8548 has a dummy entry for now. */
1422 {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN},
1423 {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
1424 {"970", PROCESSOR_POWER4,
1425 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
1426 {"cell", PROCESSOR_CELL,
1427 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
1428 {"common", PROCESSOR_COMMON, MASK_NEW_MNEMONICS},
1429 {"ec603e", PROCESSOR_PPC603, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
1430 {"G3", PROCESSOR_PPC750, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
1431 {"G4", PROCESSOR_PPC7450, POWERPC_7400_MASK},
1432 {"G5", PROCESSOR_POWER4,
1433 POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
1434 {"power", PROCESSOR_POWER, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
1435 {"power2", PROCESSOR_POWER,
1436 MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING},
1437 {"power3", PROCESSOR_PPC630,
1438 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
1439 {"power4", PROCESSOR_POWER4,
1440 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_MFCRF | MASK_POWERPC64},
1441 {"power5", PROCESSOR_POWER5,
1442 POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT
1443 | MASK_MFCRF | MASK_POPCNTB},
1444 {"power5+", PROCESSOR_POWER5,
1445 POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT
1446 | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND},
1447 {"power6", PROCESSOR_POWER6,
1448 POWERPC_7400_MASK | MASK_POWERPC64 | MASK_MFCRF | MASK_POPCNTB
1449 | MASK_FPRND | MASK_CMPB | MASK_DFP },
1450 {"power6x", PROCESSOR_POWER6,
1451 POWERPC_7400_MASK | MASK_POWERPC64 | MASK_MFCRF | MASK_POPCNTB
1452 | MASK_FPRND | MASK_CMPB | MASK_MFPGPR | MASK_DFP },
1453 {"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK},
1454 {"powerpc64", PROCESSOR_POWERPC64,
1455 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
1456 {"rios", PROCESSOR_RIOS1, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
1457 {"rios1", PROCESSOR_RIOS1, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
1458 {"rios2", PROCESSOR_RIOS2,
1459 MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING},
1460 {"rsc", PROCESSOR_PPC601, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
1461 {"rsc1", PROCESSOR_PPC601, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
1462 {"rs64", PROCESSOR_RS64A,
1463 POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64}
1466 const size_t ptt_size = ARRAY_SIZE (processor_target_table);
1468 /* Some OSs don't support saving the high part of 64-bit registers on
1469 context switch. Other OSs don't support saving Altivec registers.
1470 On those OSs, we don't touch the MASK_POWERPC64 or MASK_ALTIVEC
1471 settings; if the user wants either, the user must explicitly specify
1472 them and we won't interfere with the user's specification. */
1475 POWER_MASKS = MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING,
1476 POWERPC_MASKS = (POWERPC_BASE_MASK | MASK_PPC_GPOPT | MASK_STRICT_ALIGN
1477 | MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_ALTIVEC
1478 | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_MULHW
1479 | MASK_DLMZB | MASK_CMPB | MASK_MFPGPR | MASK_DFP)
1482 rs6000_init_hard_regno_mode_ok ();
1484 set_masks = POWER_MASKS | POWERPC_MASKS | MASK_SOFT_FLOAT;
1485 #ifdef OS_MISSING_POWERPC64
1486 if (OS_MISSING_POWERPC64)
1487 set_masks &= ~MASK_POWERPC64;
1489 #ifdef OS_MISSING_ALTIVEC
1490 if (OS_MISSING_ALTIVEC)
1491 set_masks &= ~MASK_ALTIVEC;
1494 /* Don't override by the processor default if given explicitly. */
1495 set_masks &= ~target_flags_explicit;
1497 /* Identify the processor type. */
1498 rs6000_select[0].string = default_cpu;
1499 rs6000_cpu = TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT;
1501 for (i = 0; i < ARRAY_SIZE (rs6000_select); i++)
1503 ptr = &rs6000_select[i];
1504 if (ptr->string != (char *)0 && ptr->string[0] != '\0')
1506 for (j = 0; j < ptt_size; j++)
1507 if (! strcmp (ptr->string, processor_target_table[j].name))
1509 if (ptr->set_tune_p)
1510 rs6000_cpu = processor_target_table[j].processor;
1512 if (ptr->set_arch_p)
1514 target_flags &= ~set_masks;
1515 target_flags |= (processor_target_table[j].target_enable
1522 error ("bad value (%s) for %s switch", ptr->string, ptr->name);
1529 /* If we are optimizing big endian systems for space, use the load/store
1530 multiple and string instructions. */
1531 if (BYTES_BIG_ENDIAN && optimize_size)
1532 target_flags |= ~target_flags_explicit & (MASK_MULTIPLE | MASK_STRING);
1534 /* Don't allow -mmultiple or -mstring on little endian systems
1535 unless the cpu is a 750, because the hardware doesn't support the
1536 instructions used in little endian mode, and causes an alignment
1537 trap. The 750 does not cause an alignment trap (except when the
1538 target is unaligned). */
1540 if (!BYTES_BIG_ENDIAN && rs6000_cpu != PROCESSOR_PPC750)
1542 if (TARGET_MULTIPLE)
1544 target_flags &= ~MASK_MULTIPLE;
1545 if ((target_flags_explicit & MASK_MULTIPLE) != 0)
1546 warning (0, "-mmultiple is not supported on little endian systems");
1551 target_flags &= ~MASK_STRING;
1552 if ((target_flags_explicit & MASK_STRING) != 0)
1553 warning (0, "-mstring is not supported on little endian systems");
1557 /* Set debug flags */
1558 if (rs6000_debug_name)
1560 if (! strcmp (rs6000_debug_name, "all"))
1561 rs6000_debug_stack = rs6000_debug_arg = 1;
1562 else if (! strcmp (rs6000_debug_name, "stack"))
1563 rs6000_debug_stack = 1;
1564 else if (! strcmp (rs6000_debug_name, "arg"))
1565 rs6000_debug_arg = 1;
1567 error ("unknown -mdebug-%s switch", rs6000_debug_name);
1570 if (rs6000_traceback_name)
1572 if (! strncmp (rs6000_traceback_name, "full", 4))
1573 rs6000_traceback = traceback_full;
1574 else if (! strncmp (rs6000_traceback_name, "part", 4))
1575 rs6000_traceback = traceback_part;
1576 else if (! strncmp (rs6000_traceback_name, "no", 2))
1577 rs6000_traceback = traceback_none;
1579 error ("unknown -mtraceback arg %qs; expecting %<full%>, %<partial%> or %<none%>",
1580 rs6000_traceback_name);
1583 if (!rs6000_explicit_options.long_double)
1584 rs6000_long_double_type_size = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
1586 #ifndef POWERPC_LINUX
1587 if (!rs6000_explicit_options.ieee)
1588 rs6000_ieeequad = 1;
1591 /* Enable Altivec ABI for AIX -maltivec. */
1592 if (TARGET_XCOFF && TARGET_ALTIVEC)
1593 rs6000_altivec_abi = 1;
1595 /* The AltiVec ABI is the default for PowerPC-64 GNU/Linux. For
1596 PowerPC-32 GNU/Linux, -maltivec implies the AltiVec ABI. It can
1597 be explicitly overridden in either case. */
1600 if (!rs6000_explicit_options.altivec_abi
1601 && (TARGET_64BIT || TARGET_ALTIVEC))
1602 rs6000_altivec_abi = 1;
1604 /* Enable VRSAVE for AltiVec ABI, unless explicitly overridden. */
1605 if (!rs6000_explicit_options.vrsave)
1606 TARGET_ALTIVEC_VRSAVE = rs6000_altivec_abi;
1609 /* Set the Darwin64 ABI as default for 64-bit Darwin. */
1610 if (DEFAULT_ABI == ABI_DARWIN && TARGET_64BIT)
1612 rs6000_darwin64_abi = 1;
1614 darwin_one_byte_bool = 1;
1616 /* Default to natural alignment, for better performance. */
1617 rs6000_alignment_flags = MASK_ALIGN_NATURAL;
1620 /* Place FP constants in the constant pool instead of TOC
1621 if section anchors enabled. */
1622 if (flag_section_anchors)
1623 TARGET_NO_FP_IN_TOC = 1;
1625 /* Handle -mtls-size option. */
1626 rs6000_parse_tls_size_option ();
1628 #ifdef SUBTARGET_OVERRIDE_OPTIONS
1629 SUBTARGET_OVERRIDE_OPTIONS;
1631 #ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
1632 SUBSUBTARGET_OVERRIDE_OPTIONS;
1634 #ifdef SUB3TARGET_OVERRIDE_OPTIONS
1635 SUB3TARGET_OVERRIDE_OPTIONS;
1640 /* The e500 does not have string instructions, and we set
1641 MASK_STRING above when optimizing for size. */
1642 if ((target_flags & MASK_STRING) != 0)
1643 target_flags = target_flags & ~MASK_STRING;
1645 else if (rs6000_select[1].string != NULL)
1647 /* For the powerpc-eabispe configuration, we set all these by
1648 default, so let's unset them if we manually set another
1649 CPU that is not the E500. */
1650 if (!rs6000_explicit_options.spe_abi)
1652 if (!rs6000_explicit_options.spe)
1654 if (!rs6000_explicit_options.float_gprs)
1655 rs6000_float_gprs = 0;
1656 if (!rs6000_explicit_options.isel)
1660 /* Detect invalid option combinations with E500. */
1663 rs6000_always_hint = (rs6000_cpu != PROCESSOR_POWER4
1664 && rs6000_cpu != PROCESSOR_POWER5
1665 && rs6000_cpu != PROCESSOR_POWER6
1666 && rs6000_cpu != PROCESSOR_CELL);
1667 rs6000_sched_groups = (rs6000_cpu == PROCESSOR_POWER4
1668 || rs6000_cpu == PROCESSOR_POWER5);
1669 rs6000_align_branch_targets = (rs6000_cpu == PROCESSOR_POWER4
1670 || rs6000_cpu == PROCESSOR_POWER5
1671 || rs6000_cpu == PROCESSOR_POWER6);
1673 rs6000_sched_restricted_insns_priority
1674 = (rs6000_sched_groups ? 1 : 0);
1676 /* Handle -msched-costly-dep option. */
1677 rs6000_sched_costly_dep
1678 = (rs6000_sched_groups ? store_to_load_dep_costly : no_dep_costly);
1680 if (rs6000_sched_costly_dep_str)
1682 if (! strcmp (rs6000_sched_costly_dep_str, "no"))
1683 rs6000_sched_costly_dep = no_dep_costly;
1684 else if (! strcmp (rs6000_sched_costly_dep_str, "all"))
1685 rs6000_sched_costly_dep = all_deps_costly;
1686 else if (! strcmp (rs6000_sched_costly_dep_str, "true_store_to_load"))
1687 rs6000_sched_costly_dep = true_store_to_load_dep_costly;
1688 else if (! strcmp (rs6000_sched_costly_dep_str, "store_to_load"))
1689 rs6000_sched_costly_dep = store_to_load_dep_costly;
1691 rs6000_sched_costly_dep = atoi (rs6000_sched_costly_dep_str);
1694 /* Handle -minsert-sched-nops option. */
1695 rs6000_sched_insert_nops
1696 = (rs6000_sched_groups ? sched_finish_regroup_exact : sched_finish_none);
1698 if (rs6000_sched_insert_nops_str)
1700 if (! strcmp (rs6000_sched_insert_nops_str, "no"))
1701 rs6000_sched_insert_nops = sched_finish_none;
1702 else if (! strcmp (rs6000_sched_insert_nops_str, "pad"))
1703 rs6000_sched_insert_nops = sched_finish_pad_groups;
1704 else if (! strcmp (rs6000_sched_insert_nops_str, "regroup_exact"))
1705 rs6000_sched_insert_nops = sched_finish_regroup_exact;
1707 rs6000_sched_insert_nops = atoi (rs6000_sched_insert_nops_str);
1710 #ifdef TARGET_REGNAMES
1711 /* If the user desires alternate register names, copy in the
1712 alternate names now. */
1713 if (TARGET_REGNAMES)
1714 memcpy (rs6000_reg_names, alt_reg_names, sizeof (rs6000_reg_names));
1717 /* Set aix_struct_return last, after the ABI is determined.
1718 If -maix-struct-return or -msvr4-struct-return was explicitly
1719 used, don't override with the ABI default. */
1720 if (!rs6000_explicit_options.aix_struct_ret)
1721 aix_struct_return = (DEFAULT_ABI != ABI_V4 || DRAFT_V4_STRUCT_RET);
1723 if (TARGET_LONG_DOUBLE_128 && !TARGET_IEEEQUAD)
1724 REAL_MODE_FORMAT (TFmode) = &ibm_extended_format;
1727 ASM_GENERATE_INTERNAL_LABEL (toc_label_name, "LCTOC", 1);
1729 /* We can only guarantee the availability of DI pseudo-ops when
1730 assembling for 64-bit targets. */
1733 targetm.asm_out.aligned_op.di = NULL;
1734 targetm.asm_out.unaligned_op.di = NULL;
1737 /* Set branch target alignment, if not optimizing for size. */
1740 /* Cell wants to be aligned 8byte for dual issue. */
1741 if (rs6000_cpu == PROCESSOR_CELL)
1743 if (align_functions <= 0)
1744 align_functions = 8;
1745 if (align_jumps <= 0)
1747 if (align_loops <= 0)
1750 if (rs6000_align_branch_targets)
1752 if (align_functions <= 0)
1753 align_functions = 16;
1754 if (align_jumps <= 0)
1756 if (align_loops <= 0)
1759 if (align_jumps_max_skip <= 0)
1760 align_jumps_max_skip = 15;
1761 if (align_loops_max_skip <= 0)
1762 align_loops_max_skip = 15;
1765 /* Arrange to save and restore machine status around nested functions. */
1766 init_machine_status = rs6000_init_machine_status;
1768 /* We should always be splitting complex arguments, but we can't break
1769 Linux and Darwin ABIs at the moment. For now, only AIX is fixed. */
1770 if (DEFAULT_ABI != ABI_AIX)
1771 targetm.calls.split_complex_arg = NULL;
1773 /* Initialize rs6000_cost with the appropriate target costs. */
1775 rs6000_cost = TARGET_POWERPC64 ? &size64_cost : &size32_cost;
1779 case PROCESSOR_RIOS1:
1780 rs6000_cost = &rios1_cost;
1783 case PROCESSOR_RIOS2:
1784 rs6000_cost = &rios2_cost;
1787 case PROCESSOR_RS64A:
1788 rs6000_cost = &rs64a_cost;
1791 case PROCESSOR_MPCCORE:
1792 rs6000_cost = &mpccore_cost;
1795 case PROCESSOR_PPC403:
1796 rs6000_cost = &ppc403_cost;
1799 case PROCESSOR_PPC405:
1800 rs6000_cost = &ppc405_cost;
1803 case PROCESSOR_PPC440:
1804 rs6000_cost = &ppc440_cost;
1807 case PROCESSOR_PPC601:
1808 rs6000_cost = &ppc601_cost;
1811 case PROCESSOR_PPC603:
1812 rs6000_cost = &ppc603_cost;
1815 case PROCESSOR_PPC604:
1816 rs6000_cost = &ppc604_cost;
1819 case PROCESSOR_PPC604e:
1820 rs6000_cost = &ppc604e_cost;
1823 case PROCESSOR_PPC620:
1824 rs6000_cost = &ppc620_cost;
1827 case PROCESSOR_PPC630:
1828 rs6000_cost = &ppc630_cost;
1831 case PROCESSOR_CELL:
1832 rs6000_cost = &ppccell_cost;
1835 case PROCESSOR_PPC750:
1836 case PROCESSOR_PPC7400:
1837 rs6000_cost = &ppc750_cost;
1840 case PROCESSOR_PPC7450:
1841 rs6000_cost = &ppc7450_cost;
1844 case PROCESSOR_PPC8540:
1845 rs6000_cost = &ppc8540_cost;
1848 case PROCESSOR_POWER4:
1849 case PROCESSOR_POWER5:
1850 rs6000_cost = &power4_cost;
1853 case PROCESSOR_POWER6:
1854 rs6000_cost = &power6_cost;
1861 if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES))
1862 set_param_value ("simultaneous-prefetches",
1863 rs6000_cost->simultaneous_prefetches);
1864 if (!PARAM_SET_P (PARAM_L1_CACHE_SIZE))
1865 set_param_value ("l1-cache-size", rs6000_cost->l1_cache_size);
1866 if (!PARAM_SET_P (PARAM_L1_CACHE_LINE_SIZE))
1867 set_param_value ("l1-cache-line-size", rs6000_cost->cache_line_size);
1868 if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE))
1869 set_param_value ("l2-cache-size", rs6000_cost->l2_cache_size);
1871 /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
1872 can be optimized to ap = __builtin_next_arg (0). */
1873 if (DEFAULT_ABI != ABI_V4)
1874 targetm.expand_builtin_va_start = NULL;
1877 /* Implement targetm.vectorize.builtin_mask_for_load. */
1879 rs6000_builtin_mask_for_load (void)
1882 return altivec_builtin_mask_for_load;
1887 /* Implement targetm.vectorize.builtin_conversion. */
1889 rs6000_builtin_conversion (enum tree_code code, tree type)
1891 if (!TARGET_ALTIVEC)
1897 switch (TYPE_MODE (type))
1900 return TYPE_UNSIGNED (type) ?
1901 rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFUX] :
1902 rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFSX];
1911 /* Implement targetm.vectorize.builtin_mul_widen_even. */
1913 rs6000_builtin_mul_widen_even (tree type)
1915 if (!TARGET_ALTIVEC)
1918 switch (TYPE_MODE (type))
1921 return TYPE_UNSIGNED (type) ?
1922 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUH] :
1923 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESH];
1926 return TYPE_UNSIGNED (type) ?
1927 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUB] :
1928 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESB];
1934 /* Implement targetm.vectorize.builtin_mul_widen_odd. */
1936 rs6000_builtin_mul_widen_odd (tree type)
1938 if (!TARGET_ALTIVEC)
1941 switch (TYPE_MODE (type))
1944 return TYPE_UNSIGNED (type) ?
1945 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUH] :
1946 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSH];
1949 return TYPE_UNSIGNED (type) ?
1950 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUB] :
1951 rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSB];
1958 /* Return true iff, data reference of TYPE can reach vector alignment (16)
1959 after applying N number of iterations. This routine does not determine
1960 how may iterations are required to reach desired alignment. */
1963 rs6000_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed)
1970 if (rs6000_alignment_flags == MASK_ALIGN_NATURAL)
1973 if (rs6000_alignment_flags == MASK_ALIGN_POWER)
1983 /* Assuming that all other types are naturally aligned. CHECKME! */
1988 /* Handle generic options of the form -mfoo=yes/no.
1989 NAME is the option name.
1990 VALUE is the option value.
1991 FLAG is the pointer to the flag where to store a 1 or 0, depending on
1992 whether the option value is 'yes' or 'no' respectively. */
1994 rs6000_parse_yes_no_option (const char *name, const char *value, int *flag)
1998 else if (!strcmp (value, "yes"))
2000 else if (!strcmp (value, "no"))
2003 error ("unknown -m%s= option specified: '%s'", name, value);
2006 /* Validate and record the size specified with the -mtls-size option. */
2009 rs6000_parse_tls_size_option (void)
2011 if (rs6000_tls_size_string == 0)
2013 else if (strcmp (rs6000_tls_size_string, "16") == 0)
2014 rs6000_tls_size = 16;
2015 else if (strcmp (rs6000_tls_size_string, "32") == 0)
2016 rs6000_tls_size = 32;
2017 else if (strcmp (rs6000_tls_size_string, "64") == 0)
2018 rs6000_tls_size = 64;
2020 error ("bad value %qs for -mtls-size switch", rs6000_tls_size_string);
2024 optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
2026 if (DEFAULT_ABI == ABI_DARWIN)
2027 /* The Darwin libraries never set errno, so we might as well
2028 avoid calling them when that's the only reason we would. */
2029 flag_errno_math = 0;
2031 /* Double growth factor to counter reduced min jump length. */
2032 set_param_value ("max-grow-copy-bb-insns", 16);
2034 /* Enable section anchors by default.
2035 Skip section anchors for Objective C and Objective C++
2036 until front-ends fixed. */
2037 if (!TARGET_MACHO && lang_hooks.name[4] != 'O')
2038 flag_section_anchors = 1;
2041 /* Implement TARGET_HANDLE_OPTION. */
2044 rs6000_handle_option (size_t code, const char *arg, int value)
2049 target_flags &= ~(MASK_POWER | MASK_POWER2
2050 | MASK_MULTIPLE | MASK_STRING);
2051 target_flags_explicit |= (MASK_POWER | MASK_POWER2
2052 | MASK_MULTIPLE | MASK_STRING);
2054 case OPT_mno_powerpc:
2055 target_flags &= ~(MASK_POWERPC | MASK_PPC_GPOPT
2056 | MASK_PPC_GFXOPT | MASK_POWERPC64);
2057 target_flags_explicit |= (MASK_POWERPC | MASK_PPC_GPOPT
2058 | MASK_PPC_GFXOPT | MASK_POWERPC64);
2061 target_flags &= ~MASK_MINIMAL_TOC;
2062 TARGET_NO_FP_IN_TOC = 0;
2063 TARGET_NO_SUM_IN_TOC = 0;
2064 target_flags_explicit |= MASK_MINIMAL_TOC;
2065 #ifdef TARGET_USES_SYSV4_OPT
2066 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be
2067 just the same as -mminimal-toc. */
2068 target_flags |= MASK_MINIMAL_TOC;
2069 target_flags_explicit |= MASK_MINIMAL_TOC;
2073 #ifdef TARGET_USES_SYSV4_OPT
2075 /* Make -mtoc behave like -mminimal-toc. */
2076 target_flags |= MASK_MINIMAL_TOC;
2077 target_flags_explicit |= MASK_MINIMAL_TOC;
2081 #ifdef TARGET_USES_AIX64_OPT
2086 target_flags |= MASK_POWERPC64 | MASK_POWERPC;
2087 target_flags |= ~target_flags_explicit & MASK_PPC_GFXOPT;
2088 target_flags_explicit |= MASK_POWERPC64 | MASK_POWERPC;
2091 #ifdef TARGET_USES_AIX64_OPT
2096 target_flags &= ~MASK_POWERPC64;
2097 target_flags_explicit |= MASK_POWERPC64;
2100 case OPT_minsert_sched_nops_:
2101 rs6000_sched_insert_nops_str = arg;
2104 case OPT_mminimal_toc:
2107 TARGET_NO_FP_IN_TOC = 0;
2108 TARGET_NO_SUM_IN_TOC = 0;
2115 target_flags |= (MASK_MULTIPLE | MASK_STRING);
2116 target_flags_explicit |= (MASK_MULTIPLE | MASK_STRING);
2123 target_flags |= (MASK_POWER | MASK_MULTIPLE | MASK_STRING);
2124 target_flags_explicit |= (MASK_POWER | MASK_MULTIPLE | MASK_STRING);
2128 case OPT_mpowerpc_gpopt:
2129 case OPT_mpowerpc_gfxopt:
2132 target_flags |= MASK_POWERPC;
2133 target_flags_explicit |= MASK_POWERPC;
2137 case OPT_maix_struct_return:
2138 case OPT_msvr4_struct_return:
2139 rs6000_explicit_options.aix_struct_ret = true;
2143 rs6000_explicit_options.vrsave = true;
2144 rs6000_parse_yes_no_option ("vrsave", arg, &(TARGET_ALTIVEC_VRSAVE));
2148 rs6000_explicit_options.isel = true;
2149 rs6000_parse_yes_no_option ("isel", arg, &(rs6000_isel));
2153 rs6000_explicit_options.spe = true;
2154 rs6000_parse_yes_no_option ("spe", arg, &(rs6000_spe));
2158 rs6000_debug_name = arg;
2161 #ifdef TARGET_USES_SYSV4_OPT
2163 rs6000_abi_name = arg;
2167 rs6000_sdata_name = arg;
2170 case OPT_mtls_size_:
2171 rs6000_tls_size_string = arg;
2174 case OPT_mrelocatable:
2177 target_flags |= MASK_MINIMAL_TOC;
2178 target_flags_explicit |= MASK_MINIMAL_TOC;
2179 TARGET_NO_FP_IN_TOC = 1;
2183 case OPT_mrelocatable_lib:
2186 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;
2187 target_flags_explicit |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;
2188 TARGET_NO_FP_IN_TOC = 1;
2192 target_flags &= ~MASK_RELOCATABLE;
2193 target_flags_explicit |= MASK_RELOCATABLE;
2199 if (!strcmp (arg, "altivec"))
2201 rs6000_explicit_options.altivec_abi = true;
2202 rs6000_altivec_abi = 1;
2204 /* Enabling the AltiVec ABI turns off the SPE ABI. */
2207 else if (! strcmp (arg, "no-altivec"))
2209 rs6000_explicit_options.altivec_abi = true;
2210 rs6000_altivec_abi = 0;
2212 else if (! strcmp (arg, "spe"))
2214 rs6000_explicit_options.spe_abi = true;
2216 rs6000_altivec_abi = 0;
2217 if (!TARGET_SPE_ABI)
2218 error ("not configured for ABI: '%s'", arg);
2220 else if (! strcmp (arg, "no-spe"))
2222 rs6000_explicit_options.spe_abi = true;
2226 /* These are here for testing during development only, do not
2227 document in the manual please. */
2228 else if (! strcmp (arg, "d64"))
2230 rs6000_darwin64_abi = 1;
2231 warning (0, "Using darwin64 ABI");
2233 else if (! strcmp (arg, "d32"))
2235 rs6000_darwin64_abi = 0;
2236 warning (0, "Using old darwin ABI");
2239 else if (! strcmp (arg, "ibmlongdouble"))
2241 rs6000_explicit_options.ieee = true;
2242 rs6000_ieeequad = 0;
2243 warning (0, "Using IBM extended precision long double");
2245 else if (! strcmp (arg, "ieeelongdouble"))
2247 rs6000_explicit_options.ieee = true;
2248 rs6000_ieeequad = 1;
2249 warning (0, "Using IEEE extended precision long double");
2254 error ("unknown ABI specified: '%s'", arg);
2260 rs6000_select[1].string = arg;
2264 rs6000_select[2].string = arg;
2267 case OPT_mtraceback_:
2268 rs6000_traceback_name = arg;
2271 case OPT_mfloat_gprs_:
2272 rs6000_explicit_options.float_gprs = true;
2273 if (! strcmp (arg, "yes") || ! strcmp (arg, "single"))
2274 rs6000_float_gprs = 1;
2275 else if (! strcmp (arg, "double"))
2276 rs6000_float_gprs = 2;
2277 else if (! strcmp (arg, "no"))
2278 rs6000_float_gprs = 0;
2281 error ("invalid option for -mfloat-gprs: '%s'", arg);
2286 case OPT_mlong_double_:
2287 rs6000_explicit_options.long_double = true;
2288 rs6000_long_double_type_size = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
2289 if (value != 64 && value != 128)
2291 error ("Unknown switch -mlong-double-%s", arg);
2292 rs6000_long_double_type_size = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
2296 rs6000_long_double_type_size = value;
2299 case OPT_msched_costly_dep_:
2300 rs6000_sched_costly_dep_str = arg;
2304 rs6000_explicit_options.alignment = true;
2305 if (! strcmp (arg, "power"))
2307 /* On 64-bit Darwin, power alignment is ABI-incompatible with
2308 some C library functions, so warn about it. The flag may be
2309 useful for performance studies from time to time though, so
2310 don't disable it entirely. */
2311 if (DEFAULT_ABI == ABI_DARWIN && TARGET_64BIT)
2312 warning (0, "-malign-power is not supported for 64-bit Darwin;"
2313 " it is incompatible with the installed C and C++ libraries");
2314 rs6000_alignment_flags = MASK_ALIGN_POWER;
2316 else if (! strcmp (arg, "natural"))
2317 rs6000_alignment_flags = MASK_ALIGN_NATURAL;
2320 error ("unknown -malign-XXXXX option specified: '%s'", arg);
2328 /* Do anything needed at the start of the asm file. */
2331 rs6000_file_start (void)
2335 const char *start = buffer;
2336 struct rs6000_cpu_select *ptr;
2337 const char *default_cpu = TARGET_CPU_DEFAULT;
2338 FILE *file = asm_out_file;
2340 default_file_start ();
2342 #ifdef TARGET_BI_ARCH
2343 if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT)
2347 if (flag_verbose_asm)
2349 sprintf (buffer, "\n%s rs6000/powerpc options:", ASM_COMMENT_START);
2350 rs6000_select[0].string = default_cpu;
2352 for (i = 0; i < ARRAY_SIZE (rs6000_select); i++)
2354 ptr = &rs6000_select[i];
2355 if (ptr->string != (char *)0 && ptr->string[0] != '\0')
2357 fprintf (file, "%s %s%s", start, ptr->name, ptr->string);
2362 if (PPC405_ERRATUM77)
2364 fprintf (file, "%s PPC405CR_ERRATUM77", start);
2368 #ifdef USING_ELFOS_H
2369 switch (rs6000_sdata)
2371 case SDATA_NONE: fprintf (file, "%s -msdata=none", start); start = ""; break;
2372 case SDATA_DATA: fprintf (file, "%s -msdata=data", start); start = ""; break;
2373 case SDATA_SYSV: fprintf (file, "%s -msdata=sysv", start); start = ""; break;
2374 case SDATA_EABI: fprintf (file, "%s -msdata=eabi", start); start = ""; break;
2377 if (rs6000_sdata && g_switch_value)
2379 fprintf (file, "%s -G " HOST_WIDE_INT_PRINT_UNSIGNED, start,
2389 #ifdef HAVE_AS_GNU_ATTRIBUTE
2390 if (TARGET_32BIT && DEFAULT_ABI == ABI_V4)
2392 fprintf (file, "\t.gnu_attribute 4, %d\n",
2393 (TARGET_HARD_FLOAT && TARGET_FPRS) ? 1 : 2);
2394 fprintf (file, "\t.gnu_attribute 8, %d\n",
2395 (TARGET_ALTIVEC_ABI ? 2
2396 : TARGET_SPE_ABI ? 3
2401 if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
2403 switch_to_section (toc_section);
2404 switch_to_section (text_section);
2409 /* Return nonzero if this function is known to have a null epilogue. */
2412 direct_return (void)
2414 if (reload_completed)
2416 rs6000_stack_t *info = rs6000_stack_info ();
2418 if (info->first_gp_reg_save == 32
2419 && info->first_fp_reg_save == 64
2420 && info->first_altivec_reg_save == LAST_ALTIVEC_REGNO + 1
2421 && ! info->lr_save_p
2422 && ! info->cr_save_p
2423 && info->vrsave_mask == 0
2431 /* Return the number of instructions it takes to form a constant in an
2432 integer register. */
2435 num_insns_constant_wide (HOST_WIDE_INT value)
2437 /* signed constant loadable with {cal|addi} */
2438 if ((unsigned HOST_WIDE_INT) (value + 0x8000) < 0x10000)
2441 /* constant loadable with {cau|addis} */
2442 else if ((value & 0xffff) == 0
2443 && (value >> 31 == -1 || value >> 31 == 0))
2446 #if HOST_BITS_PER_WIDE_INT == 64
2447 else if (TARGET_POWERPC64)
2449 HOST_WIDE_INT low = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
2450 HOST_WIDE_INT high = value >> 31;
2452 if (high == 0 || high == -1)
2458 return num_insns_constant_wide (high) + 1;
2460 return (num_insns_constant_wide (high)
2461 + num_insns_constant_wide (low) + 1);
2470 num_insns_constant (rtx op, enum machine_mode mode)
2472 HOST_WIDE_INT low, high;
2474 switch (GET_CODE (op))
2477 #if HOST_BITS_PER_WIDE_INT == 64
2478 if ((INTVAL (op) >> 31) != 0 && (INTVAL (op) >> 31) != -1
2479 && mask64_operand (op, mode))
2483 return num_insns_constant_wide (INTVAL (op));
2486 if (mode == SFmode || mode == SDmode)
2491 REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
2492 if (DECIMAL_FLOAT_MODE_P (mode))
2493 REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l);
2495 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
2496 return num_insns_constant_wide ((HOST_WIDE_INT) l);
2499 if (mode == VOIDmode || mode == DImode)
2501 high = CONST_DOUBLE_HIGH (op);
2502 low = CONST_DOUBLE_LOW (op);
2509 REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
2510 if (DECIMAL_FLOAT_MODE_P (mode))
2511 REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
2513 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
2514 high = l[WORDS_BIG_ENDIAN == 0];
2515 low = l[WORDS_BIG_ENDIAN != 0];
2519 return (num_insns_constant_wide (low)
2520 + num_insns_constant_wide (high));
2523 if ((high == 0 && low >= 0)
2524 || (high == -1 && low < 0))
2525 return num_insns_constant_wide (low);
2527 else if (mask64_operand (op, mode))
2531 return num_insns_constant_wide (high) + 1;
2534 return (num_insns_constant_wide (high)
2535 + num_insns_constant_wide (low) + 1);
2543 /* Interpret element ELT of the CONST_VECTOR OP as an integer value.
2544 If the mode of OP is MODE_VECTOR_INT, this simply returns the
2545 corresponding element of the vector, but for V4SFmode and V2SFmode,
2546 the corresponding "float" is interpreted as an SImode integer. */
2548 static HOST_WIDE_INT
2549 const_vector_elt_as_int (rtx op, unsigned int elt)
2551 rtx tmp = CONST_VECTOR_ELT (op, elt);
2552 if (GET_MODE (op) == V4SFmode
2553 || GET_MODE (op) == V2SFmode)
2554 tmp = gen_lowpart (SImode, tmp);
2555 return INTVAL (tmp);
2558 /* Return true if OP can be synthesized with a particular vspltisb, vspltish
2559 or vspltisw instruction. OP is a CONST_VECTOR. Which instruction is used
2560 depends on STEP and COPIES, one of which will be 1. If COPIES > 1,
2561 all items are set to the same value and contain COPIES replicas of the
2562 vsplt's operand; if STEP > 1, one in STEP elements is set to the vsplt's
2563 operand and the others are set to the value of the operand's msb. */
2566 vspltis_constant (rtx op, unsigned step, unsigned copies)
2568 enum machine_mode mode = GET_MODE (op);
2569 enum machine_mode inner = GET_MODE_INNER (mode);
2572 unsigned nunits = GET_MODE_NUNITS (mode);
2573 unsigned bitsize = GET_MODE_BITSIZE (inner);
2574 unsigned mask = GET_MODE_MASK (inner);
2576 HOST_WIDE_INT val = const_vector_elt_as_int (op, nunits - 1);
2577 HOST_WIDE_INT splat_val = val;
2578 HOST_WIDE_INT msb_val = val > 0 ? 0 : -1;
2580 /* Construct the value to be splatted, if possible. If not, return 0. */
2581 for (i = 2; i <= copies; i *= 2)
2583 HOST_WIDE_INT small_val;
2585 small_val = splat_val >> bitsize;
2587 if (splat_val != ((small_val << bitsize) | (small_val & mask)))
2589 splat_val = small_val;
2592 /* Check if SPLAT_VAL can really be the operand of a vspltis[bhw]. */
2593 if (EASY_VECTOR_15 (splat_val))
2596 /* Also check if we can splat, and then add the result to itself. Do so if
2597 the value is positive, of if the splat instruction is using OP's mode;
2598 for splat_val < 0, the splat and the add should use the same mode. */
2599 else if (EASY_VECTOR_15_ADD_SELF (splat_val)
2600 && (splat_val >= 0 || (step == 1 && copies == 1)))
2606 /* Check if VAL is present in every STEP-th element, and the
2607 other elements are filled with its most significant bit. */
2608 for (i = 0; i < nunits - 1; ++i)
2610 HOST_WIDE_INT desired_val;
2611 if (((i + 1) & (step - 1)) == 0)
2614 desired_val = msb_val;
2616 if (desired_val != const_vector_elt_as_int (op, i))
2624 /* Return true if OP is of the given MODE and can be synthesized
2625 with a vspltisb, vspltish or vspltisw. */
2628 easy_altivec_constant (rtx op, enum machine_mode mode)
2630 unsigned step, copies;
2632 if (mode == VOIDmode)
2633 mode = GET_MODE (op);
2634 else if (mode != GET_MODE (op))
2637 /* Start with a vspltisw. */
2638 step = GET_MODE_NUNITS (mode) / 4;
2641 if (vspltis_constant (op, step, copies))
2644 /* Then try with a vspltish. */
2650 if (vspltis_constant (op, step, copies))
2653 /* And finally a vspltisb. */
2659 if (vspltis_constant (op, step, copies))
2665 /* Generate a VEC_DUPLICATE representing a vspltis[bhw] instruction whose
2666 result is OP. Abort if it is not possible. */
2669 gen_easy_altivec_constant (rtx op)
2671 enum machine_mode mode = GET_MODE (op);
2672 int nunits = GET_MODE_NUNITS (mode);
2673 rtx last = CONST_VECTOR_ELT (op, nunits - 1);
2674 unsigned step = nunits / 4;
2675 unsigned copies = 1;
2677 /* Start with a vspltisw. */
2678 if (vspltis_constant (op, step, copies))
2679 return gen_rtx_VEC_DUPLICATE (V4SImode, gen_lowpart (SImode, last));
2681 /* Then try with a vspltish. */
2687 if (vspltis_constant (op, step, copies))
2688 return gen_rtx_VEC_DUPLICATE (V8HImode, gen_lowpart (HImode, last));
2690 /* And finally a vspltisb. */
2696 if (vspltis_constant (op, step, copies))
2697 return gen_rtx_VEC_DUPLICATE (V16QImode, gen_lowpart (QImode, last));
2703 output_vec_const_move (rtx *operands)
2706 enum machine_mode mode;
2711 mode = GET_MODE (dest);
2716 if (zero_constant (vec, mode))
2717 return "vxor %0,%0,%0";
2719 splat_vec = gen_easy_altivec_constant (vec);
2720 gcc_assert (GET_CODE (splat_vec) == VEC_DUPLICATE);
2721 operands[1] = XEXP (splat_vec, 0);
2722 if (!EASY_VECTOR_15 (INTVAL (operands[1])))
2725 switch (GET_MODE (splat_vec))
2728 return "vspltisw %0,%1";
2731 return "vspltish %0,%1";
2734 return "vspltisb %0,%1";
2741 gcc_assert (TARGET_SPE);
2743 /* Vector constant 0 is handled as a splitter of V2SI, and in the
2744 pattern of V1DI, V4HI, and V2SF.
2746 FIXME: We should probably return # and add post reload
2747 splitters for these, but this way is so easy ;-). */
2748 cst = INTVAL (CONST_VECTOR_ELT (vec, 0));
2749 cst2 = INTVAL (CONST_VECTOR_ELT (vec, 1));
2750 operands[1] = CONST_VECTOR_ELT (vec, 0);
2751 operands[2] = CONST_VECTOR_ELT (vec, 1);
2753 return "li %0,%1\n\tevmergelo %0,%0,%0";
2755 return "li %0,%1\n\tevmergelo %0,%0,%0\n\tli %0,%2";
2758 /* Initialize TARGET of vector PAIRED to VALS. */
2761 paired_expand_vector_init (rtx target, rtx vals)
2763 enum machine_mode mode = GET_MODE (target);
2764 int n_elts = GET_MODE_NUNITS (mode);
2766 rtx x, new, tmp, constant_op, op1, op2;
2769 for (i = 0; i < n_elts; ++i)
2771 x = XVECEXP (vals, 0, i);
2772 if (!CONSTANT_P (x))
2777 /* Load from constant pool. */
2778 emit_move_insn (target, gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0)));
2784 /* The vector is initialized only with non-constants. */
2785 new = gen_rtx_VEC_CONCAT (V2SFmode, XVECEXP (vals, 0, 0),
2786 XVECEXP (vals, 0, 1));
2788 emit_move_insn (target, new);
2792 /* One field is non-constant and the other one is a constant. Load the
2793 constant from the constant pool and use ps_merge instruction to
2794 construct the whole vector. */
2795 op1 = XVECEXP (vals, 0, 0);
2796 op2 = XVECEXP (vals, 0, 1);
2798 constant_op = (CONSTANT_P (op1)) ? op1 : op2;
2800 tmp = gen_reg_rtx (GET_MODE (constant_op));
2801 emit_move_insn (tmp, constant_op);
2803 if (CONSTANT_P (op1))
2804 new = gen_rtx_VEC_CONCAT (V2SFmode, tmp, op2);
2806 new = gen_rtx_VEC_CONCAT (V2SFmode, op1, tmp);
2808 emit_move_insn (target, new);
2812 paired_expand_vector_move (rtx operands[])
2814 rtx op0 = operands[0], op1 = operands[1];
2816 emit_move_insn (op0, op1);
2819 /* Emit vector compare for code RCODE. DEST is destination, OP1 and
2820 OP2 are two VEC_COND_EXPR operands, CC_OP0 and CC_OP1 are the two
2821 operands for the relation operation COND. This is a recursive
2825 paired_emit_vector_compare (enum rtx_code rcode,
2826 rtx dest, rtx op0, rtx op1,
2827 rtx cc_op0, rtx cc_op1)
2829 rtx tmp = gen_reg_rtx (V2SFmode);
2830 rtx tmp1, max, min, equal_zero;
2832 gcc_assert (TARGET_PAIRED_FLOAT);
2833 gcc_assert (GET_MODE (op0) == GET_MODE (op1));
2839 paired_emit_vector_compare (GE, dest, op1, op0, cc_op0, cc_op1);
2843 emit_insn (gen_subv2sf3 (tmp, cc_op0, cc_op1));
2844 emit_insn (gen_selv2sf4 (dest, tmp, op0, op1, CONST0_RTX (SFmode)));
2848 paired_emit_vector_compare (GE, dest, op0, op1, cc_op1, cc_op0);
2851 paired_emit_vector_compare (LE, dest, op1, op0, cc_op0, cc_op1);
2854 tmp1 = gen_reg_rtx (V2SFmode);
2855 max = gen_reg_rtx (V2SFmode);
2856 min = gen_reg_rtx (V2SFmode);
2857 equal_zero = gen_reg_rtx (V2SFmode);
2859 emit_insn (gen_subv2sf3 (tmp, cc_op0, cc_op1));
2860 emit_insn (gen_selv2sf4
2861 (max, tmp, cc_op0, cc_op1, CONST0_RTX (SFmode)));
2862 emit_insn (gen_subv2sf3 (tmp, cc_op1, cc_op0));
2863 emit_insn (gen_selv2sf4
2864 (min, tmp, cc_op0, cc_op1, CONST0_RTX (SFmode)));
2865 emit_insn (gen_subv2sf3 (tmp1, min, max));
2866 emit_insn (gen_selv2sf4 (dest, tmp1, op0, op1, CONST0_RTX (SFmode)));
2869 paired_emit_vector_compare (EQ, dest, op1, op0, cc_op0, cc_op1);
2872 paired_emit_vector_compare (LE, dest, op1, op0, cc_op0, cc_op1);
2875 paired_emit_vector_compare (LT, dest, op1, op0, cc_op0, cc_op1);
2878 paired_emit_vector_compare (GE, dest, op1, op0, cc_op0, cc_op1);
2881 paired_emit_vector_compare (GT, dest, op1, op0, cc_op0, cc_op1);
2890 /* Emit vector conditional expression.
2891 DEST is destination. OP1 and OP2 are two VEC_COND_EXPR operands.
2892 CC_OP0 and CC_OP1 are the two operands for the relation operation COND. */
2895 paired_emit_vector_cond_expr (rtx dest, rtx op1, rtx op2,
2896 rtx cond, rtx cc_op0, rtx cc_op1)
2898 enum rtx_code rcode = GET_CODE (cond);
2900 if (!TARGET_PAIRED_FLOAT)
2903 paired_emit_vector_compare (rcode, dest, op1, op2, cc_op0, cc_op1);
2908 /* Initialize vector TARGET to VALS. */
2911 rs6000_expand_vector_init (rtx target, rtx vals)
2913 enum machine_mode mode = GET_MODE (target);
2914 enum machine_mode inner_mode = GET_MODE_INNER (mode);
2915 int n_elts = GET_MODE_NUNITS (mode);
2916 int n_var = 0, one_var = -1;
2917 bool all_same = true, all_const_zero = true;
2921 for (i = 0; i < n_elts; ++i)
2923 x = XVECEXP (vals, 0, i);
2924 if (!CONSTANT_P (x))
2925 ++n_var, one_var = i;
2926 else if (x != CONST0_RTX (inner_mode))
2927 all_const_zero = false;
2929 if (i > 0 && !rtx_equal_p (x, XVECEXP (vals, 0, 0)))
2935 if (mode != V4SFmode && all_const_zero)
2937 /* Zero register. */
2938 emit_insn (gen_rtx_SET (VOIDmode, target,
2939 gen_rtx_XOR (mode, target, target)));
2942 else if (mode != V4SFmode && easy_vector_constant (vals, mode))
2944 /* Splat immediate. */
2945 emit_insn (gen_rtx_SET (VOIDmode, target, vals));
2949 ; /* Splat vector element. */
2952 /* Load from constant pool. */
2953 emit_move_insn (target, gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0)));
2958 /* Store value to stack temp. Load vector element. Splat. */
2961 mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode), 0);
2962 emit_move_insn (adjust_address_nv (mem, inner_mode, 0),
2963 XVECEXP (vals, 0, 0));
2964 x = gen_rtx_UNSPEC (VOIDmode,
2965 gen_rtvec (1, const0_rtx), UNSPEC_LVE);
2966 emit_insn (gen_rtx_PARALLEL (VOIDmode,
2968 gen_rtx_SET (VOIDmode,
2971 x = gen_rtx_VEC_SELECT (inner_mode, target,
2972 gen_rtx_PARALLEL (VOIDmode,
2973 gen_rtvec (1, const0_rtx)));
2974 emit_insn (gen_rtx_SET (VOIDmode, target,
2975 gen_rtx_VEC_DUPLICATE (mode, x)));
2979 /* One field is non-constant. Load constant then overwrite
2983 rtx copy = copy_rtx (vals);
2985 /* Load constant part of vector, substitute neighboring value for
2987 XVECEXP (copy, 0, one_var) = XVECEXP (vals, 0, (one_var + 1) % n_elts);
2988 rs6000_expand_vector_init (target, copy);
2990 /* Insert variable. */
2991 rs6000_expand_vector_set (target, XVECEXP (vals, 0, one_var), one_var);
2995 /* Construct the vector in memory one field at a time
2996 and load the whole vector. */
2997 mem = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
2998 for (i = 0; i < n_elts; i++)
2999 emit_move_insn (adjust_address_nv (mem, inner_mode,
3000 i * GET_MODE_SIZE (inner_mode)),
3001 XVECEXP (vals, 0, i));
3002 emit_move_insn (target, mem);
3005 /* Set field ELT of TARGET to VAL. */
3008 rs6000_expand_vector_set (rtx target, rtx val, int elt)
3010 enum machine_mode mode = GET_MODE (target);
3011 enum machine_mode inner_mode = GET_MODE_INNER (mode);
3012 rtx reg = gen_reg_rtx (mode);
3014 int width = GET_MODE_SIZE (inner_mode);
3017 /* Load single variable value. */
3018 mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode), 0);
3019 emit_move_insn (adjust_address_nv (mem, inner_mode, 0), val);
3020 x = gen_rtx_UNSPEC (VOIDmode,
3021 gen_rtvec (1, const0_rtx), UNSPEC_LVE);
3022 emit_insn (gen_rtx_PARALLEL (VOIDmode,
3024 gen_rtx_SET (VOIDmode,
3028 /* Linear sequence. */
3029 mask = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
3030 for (i = 0; i < 16; ++i)
3031 XVECEXP (mask, 0, i) = GEN_INT (i);
3033 /* Set permute mask to insert element into target. */
3034 for (i = 0; i < width; ++i)
3035 XVECEXP (mask, 0, elt*width + i)
3036 = GEN_INT (i + 0x10);
3037 x = gen_rtx_CONST_VECTOR (V16QImode, XVEC (mask, 0));
3038 x = gen_rtx_UNSPEC (mode,
3039 gen_rtvec (3, target, reg,
3040 force_reg (V16QImode, x)),
3042 emit_insn (gen_rtx_SET (VOIDmode, target, x));
3045 /* Extract field ELT from VEC into TARGET. */
3048 rs6000_expand_vector_extract (rtx target, rtx vec, int elt)
3050 enum machine_mode mode = GET_MODE (vec);
3051 enum machine_mode inner_mode = GET_MODE_INNER (mode);
3054 /* Allocate mode-sized buffer. */
3055 mem = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
3057 /* Add offset to field within buffer matching vector element. */
3058 mem = adjust_address_nv (mem, mode, elt * GET_MODE_SIZE (inner_mode));
3060 /* Store single field into mode-sized buffer. */
3061 x = gen_rtx_UNSPEC (VOIDmode,
3062 gen_rtvec (1, const0_rtx), UNSPEC_STVE);
3063 emit_insn (gen_rtx_PARALLEL (VOIDmode,
3065 gen_rtx_SET (VOIDmode,
3068 emit_move_insn (target, adjust_address_nv (mem, inner_mode, 0));
3071 /* Generates shifts and masks for a pair of rldicl or rldicr insns to
3072 implement ANDing by the mask IN. */
3074 build_mask64_2_operands (rtx in, rtx *out)
3076 #if HOST_BITS_PER_WIDE_INT >= 64
3077 unsigned HOST_WIDE_INT c, lsb, m1, m2;
3080 gcc_assert (GET_CODE (in) == CONST_INT);
3085 /* Assume c initially something like 0x00fff000000fffff. The idea
3086 is to rotate the word so that the middle ^^^^^^ group of zeros
3087 is at the MS end and can be cleared with an rldicl mask. We then
3088 rotate back and clear off the MS ^^ group of zeros with a
3090 c = ~c; /* c == 0xff000ffffff00000 */
3091 lsb = c & -c; /* lsb == 0x0000000000100000 */
3092 m1 = -lsb; /* m1 == 0xfffffffffff00000 */
3093 c = ~c; /* c == 0x00fff000000fffff */
3094 c &= -lsb; /* c == 0x00fff00000000000 */
3095 lsb = c & -c; /* lsb == 0x0000100000000000 */
3096 c = ~c; /* c == 0xff000fffffffffff */
3097 c &= -lsb; /* c == 0xff00000000000000 */
3099 while ((lsb >>= 1) != 0)
3100 shift++; /* shift == 44 on exit from loop */
3101 m1 <<= 64 - shift; /* m1 == 0xffffff0000000000 */
3102 m1 = ~m1; /* m1 == 0x000000ffffffffff */
3103 m2 = ~c; /* m2 == 0x00ffffffffffffff */
3107 /* Assume c initially something like 0xff000f0000000000. The idea
3108 is to rotate the word so that the ^^^ middle group of zeros
3109 is at the LS end and can be cleared with an rldicr mask. We then
3110 rotate back and clear off the LS group of ^^^^^^^^^^ zeros with
3112 lsb = c & -c; /* lsb == 0x0000010000000000 */
3113 m2 = -lsb; /* m2 == 0xffffff0000000000 */
3114 c = ~c; /* c == 0x00fff0ffffffffff */
3115 c &= -lsb; /* c == 0x00fff00000000000 */
3116 lsb = c & -c; /* lsb == 0x0000100000000000 */
3117 c = ~c; /* c == 0xff000fffffffffff */
3118 c &= -lsb; /* c == 0xff00000000000000 */
3120 while ((lsb >>= 1) != 0)
3121 shift++; /* shift == 44 on exit from loop */
3122 m1 = ~c; /* m1 == 0x00ffffffffffffff */
3123 m1 >>= shift; /* m1 == 0x0000000000000fff */
3124 m1 = ~m1; /* m1 == 0xfffffffffffff000 */
3127 /* Note that when we only have two 0->1 and 1->0 transitions, one of the
3128 masks will be all 1's. We are guaranteed more than one transition. */
3129 out[0] = GEN_INT (64 - shift);
3130 out[1] = GEN_INT (m1);
3131 out[2] = GEN_INT (shift);
3132 out[3] = GEN_INT (m2);
3140 /* Return TRUE if OP is an invalid SUBREG operation on the e500. */
3143 invalid_e500_subreg (rtx op, enum machine_mode mode)
3145 if (TARGET_E500_DOUBLE)
3147 /* Reject (subreg:SI (reg:DF)); likewise with subreg:DI or
3148 subreg:TI and reg:TF. */
3149 if (GET_CODE (op) == SUBREG
3150 && (mode == SImode || mode == DImode || mode == TImode)
3151 && REG_P (SUBREG_REG (op))
3152 && (GET_MODE (SUBREG_REG (op)) == DFmode
3153 || GET_MODE (SUBREG_REG (op)) == TFmode
3154 || GET_MODE (SUBREG_REG (op)) == DDmode
3155 || GET_MODE (SUBREG_REG (op)) == TDmode))
3158 /* Reject (subreg:DF (reg:DI)); likewise with subreg:TF and
3160 if (GET_CODE (op) == SUBREG
3161 && (mode == DFmode || mode == TFmode
3162 || mode == DDmode || mode == TDmode)
3163 && REG_P (SUBREG_REG (op))
3164 && (GET_MODE (SUBREG_REG (op)) == DImode
3165 || GET_MODE (SUBREG_REG (op)) == TImode))
3170 && GET_CODE (op) == SUBREG
3172 && REG_P (SUBREG_REG (op))
3173 && SPE_VECTOR_MODE (GET_MODE (SUBREG_REG (op))))
3179 /* AIX increases natural record alignment to doubleword if the first
3180 field is an FP double while the FP fields remain word aligned. */
3183 rs6000_special_round_type_align (tree type, unsigned int computed,
3184 unsigned int specified)
3186 unsigned int align = MAX (computed, specified);
3187 tree field = TYPE_FIELDS (type);
3189 /* Skip all non field decls */
3190 while (field != NULL && TREE_CODE (field) != FIELD_DECL)
3191 field = TREE_CHAIN (field);
3193 if (field != NULL && field != type)
3195 type = TREE_TYPE (field);
3196 while (TREE_CODE (type) == ARRAY_TYPE)
3197 type = TREE_TYPE (type);
3199 if (type != error_mark_node && TYPE_MODE (type) == DFmode)
3200 align = MAX (align, 64);
3206 /* Darwin increases record alignment to the natural alignment of
3210 darwin_rs6000_special_round_type_align (tree type, unsigned int computed,
3211 unsigned int specified)
3213 unsigned int align = MAX (computed, specified);
3215 if (TYPE_PACKED (type))
3218 /* Find the first field, looking down into aggregates. */
3220 tree field = TYPE_FIELDS (type);
3221 /* Skip all non field decls */
3222 while (field != NULL && TREE_CODE (field) != FIELD_DECL)
3223 field = TREE_CHAIN (field);
3226 type = TREE_TYPE (field);
3227 while (TREE_CODE (type) == ARRAY_TYPE)
3228 type = TREE_TYPE (type);
3229 } while (AGGREGATE_TYPE_P (type));
3231 if (! AGGREGATE_TYPE_P (type) && type != error_mark_node)
3232 align = MAX (align, TYPE_ALIGN (type));
3237 /* Return 1 for an operand in small memory on V.4/eabi. */
3240 small_data_operand (rtx op ATTRIBUTE_UNUSED,
3241 enum machine_mode mode ATTRIBUTE_UNUSED)
3246 if (rs6000_sdata == SDATA_NONE || rs6000_sdata == SDATA_DATA)
3249 if (DEFAULT_ABI != ABI_V4)
3252 /* Vector and float memory instructions have a limited offset on the
3253 SPE, so using a vector or float variable directly as an operand is
3256 && (SPE_VECTOR_MODE (mode) || FLOAT_MODE_P (mode)))
3259 if (GET_CODE (op) == SYMBOL_REF)
3262 else if (GET_CODE (op) != CONST
3263 || GET_CODE (XEXP (op, 0)) != PLUS
3264 || GET_CODE (XEXP (XEXP (op, 0), 0)) != SYMBOL_REF
3265 || GET_CODE (XEXP (XEXP (op, 0), 1)) != CONST_INT)
3270 rtx sum = XEXP (op, 0);
3271 HOST_WIDE_INT summand;
3273 /* We have to be careful here, because it is the referenced address
3274 that must be 32k from _SDA_BASE_, not just the symbol. */
3275 summand = INTVAL (XEXP (sum, 1));
3276 if (summand < 0 || (unsigned HOST_WIDE_INT) summand > g_switch_value)
3279 sym_ref = XEXP (sum, 0);
3282 return SYMBOL_REF_SMALL_P (sym_ref);
3288 /* Return true if either operand is a general purpose register. */
3291 gpr_or_gpr_p (rtx op0, rtx op1)
3293 return ((REG_P (op0) && INT_REGNO_P (REGNO (op0)))
3294 || (REG_P (op1) && INT_REGNO_P (REGNO (op1))));
3298 /* Subroutines of rs6000_legitimize_address and rs6000_legitimate_address. */
3301 constant_pool_expr_1 (rtx op, int *have_sym, int *have_toc)
3303 switch (GET_CODE (op))
3306 if (RS6000_SYMBOL_REF_TLS_P (op))
3308 else if (CONSTANT_POOL_ADDRESS_P (op))
3310 if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (op), Pmode))
3318 else if (! strcmp (XSTR (op, 0), toc_label_name))
3327 return (constant_pool_expr_1 (XEXP (op, 0), have_sym, have_toc)
3328 && constant_pool_expr_1 (XEXP (op, 1), have_sym, have_toc));
3330 return constant_pool_expr_1 (XEXP (op, 0), have_sym, have_toc);
3339 constant_pool_expr_p (rtx op)
3343 return constant_pool_expr_1 (op, &have_sym, &have_toc) && have_sym;
3347 toc_relative_expr_p (rtx op)
3351 return constant_pool_expr_1 (op, &have_sym, &have_toc) && have_toc;
3355 legitimate_constant_pool_address_p (rtx x)
3358 && GET_CODE (x) == PLUS
3359 && GET_CODE (XEXP (x, 0)) == REG
3360 && (TARGET_MINIMAL_TOC || REGNO (XEXP (x, 0)) == TOC_REGISTER)
3361 && constant_pool_expr_p (XEXP (x, 1)));
3365 legitimate_small_data_p (enum machine_mode mode, rtx x)
3367 return (DEFAULT_ABI == ABI_V4
3368 && !flag_pic && !TARGET_TOC
3369 && (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == CONST)
3370 && small_data_operand (x, mode));
3373 /* SPE offset addressing is limited to 5-bits worth of double words. */
3374 #define SPE_CONST_OFFSET_OK(x) (((x) & ~0xf8) == 0)
3377 rs6000_legitimate_offset_address_p (enum machine_mode mode, rtx x, int strict)
3379 unsigned HOST_WIDE_INT offset, extra;
3381 if (GET_CODE (x) != PLUS)
3383 if (GET_CODE (XEXP (x, 0)) != REG)
3385 if (!INT_REG_OK_FOR_BASE_P (XEXP (x, 0), strict))
3387 if (legitimate_constant_pool_address_p (x))
3389 if (GET_CODE (XEXP (x, 1)) != CONST_INT)
3392 offset = INTVAL (XEXP (x, 1));
3400 /* AltiVec vector modes. Only reg+reg addressing is valid and
3401 constant offset zero should not occur due to canonicalization. */
3408 /* Paired vector modes. Only reg+reg addressing is valid and
3409 constant offset zero should not occur due to canonicalization. */
3410 if (TARGET_PAIRED_FLOAT)
3412 /* SPE vector modes. */
3413 return SPE_CONST_OFFSET_OK (offset);
3417 if (TARGET_E500_DOUBLE)
3418 return SPE_CONST_OFFSET_OK (offset);
3421 /* On e500v2, we may have:
3423 (subreg:DF (mem:DI (plus (reg) (const_int))) 0).
3425 Which gets addressed with evldd instructions. */
3426 if (TARGET_E500_DOUBLE)
3427 return SPE_CONST_OFFSET_OK (offset);
3429 if (mode == DFmode || mode == DDmode || !TARGET_POWERPC64)
3431 else if (offset & 3)
3437 if (TARGET_E500_DOUBLE)
3438 return (SPE_CONST_OFFSET_OK (offset)
3439 && SPE_CONST_OFFSET_OK (offset + 8));
3442 if (mode == TFmode || mode == TDmode || !TARGET_POWERPC64)
3444 else if (offset & 3)
3455 return (offset < 0x10000) && (offset + extra < 0x10000);
3459 legitimate_indexed_address_p (rtx x, int strict)
3463 if (GET_CODE (x) != PLUS)
3469 /* Recognize the rtl generated by reload which we know will later be
3470 replaced with proper base and index regs. */
3472 && reload_in_progress
3473 && (REG_P (op0) || GET_CODE (op0) == PLUS)
3477 return (REG_P (op0) && REG_P (op1)
3478 && ((INT_REG_OK_FOR_BASE_P (op0, strict)
3479 && INT_REG_OK_FOR_INDEX_P (op1, strict))
3480 || (INT_REG_OK_FOR_BASE_P (op1, strict)
3481 && INT_REG_OK_FOR_INDEX_P (op0, strict))));
3485 legitimate_indirect_address_p (rtx x, int strict)
3487 return GET_CODE (x) == REG && INT_REG_OK_FOR_BASE_P (x, strict);
3491 macho_lo_sum_memory_operand (rtx x, enum machine_mode mode)
3493 if (!TARGET_MACHO || !flag_pic
3494 || mode != SImode || GET_CODE (x) != MEM)
3498 if (GET_CODE (x) != LO_SUM)
3500 if (GET_CODE (XEXP (x, 0)) != REG)
3502 if (!INT_REG_OK_FOR_BASE_P (XEXP (x, 0), 0))
3506 return CONSTANT_P (x);
3510 legitimate_lo_sum_address_p (enum machine_mode mode, rtx x, int strict)
3512 if (GET_CODE (x) != LO_SUM)
3514 if (GET_CODE (XEXP (x, 0)) != REG)
3516 if (!INT_REG_OK_FOR_BASE_P (XEXP (x, 0), strict))
3518 /* Restrict addressing for DI because of our SUBREG hackery. */
3519 if (TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
3520 || mode == DDmode || mode == TDmode
3525 if (TARGET_ELF || TARGET_MACHO)
3527 if (DEFAULT_ABI != ABI_AIX && DEFAULT_ABI != ABI_DARWIN && flag_pic)
3531 if (GET_MODE_NUNITS (mode) != 1)
3533 if (GET_MODE_BITSIZE (mode) > 64
3534 || (GET_MODE_BITSIZE (mode) > 32 && !TARGET_POWERPC64
3535 && !(TARGET_HARD_FLOAT && TARGET_FPRS
3536 && (mode == DFmode || mode == DDmode))))
3539 return CONSTANT_P (x);
3546 /* Try machine-dependent ways of modifying an illegitimate address
3547 to be legitimate. If we find one, return the new, valid address.
3548 This is used from only one place: `memory_address' in explow.c.
3550 OLDX is the address as it was before break_out_memory_refs was
3551 called. In some cases it is useful to look at this to decide what
3554 MODE is passed so that this function can use GO_IF_LEGITIMATE_ADDRESS.
3556 It is always safe for this function to do nothing. It exists to
3557 recognize opportunities to optimize the output.
3559 On RS/6000, first check for the sum of a register with a constant
3560 integer that is out of range. If so, generate code to add the
3561 constant with the low-order 16 bits masked to the register and force
3562 this result into another register (this can be done with `cau').
3563 Then generate an address of REG+(CONST&0xffff), allowing for the
3564 possibility of bit 16 being a one.
3566 Then check for the sum of a register and something not constant, try to
3567 load the other things into a register and return the sum. */
3570 rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
3571 enum machine_mode mode)
3573 if (GET_CODE (x) == SYMBOL_REF)
3575 enum tls_model model = SYMBOL_REF_TLS_MODEL (x);
3577 return rs6000_legitimize_tls_address (x, model);
3580 if (GET_CODE (x) == PLUS
3581 && GET_CODE (XEXP (x, 0)) == REG
3582 && GET_CODE (XEXP (x, 1)) == CONST_INT
3583 && (unsigned HOST_WIDE_INT) (INTVAL (XEXP (x, 1)) + 0x8000) >= 0x10000
3584 && !(SPE_VECTOR_MODE (mode)
3585 || (TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
3586 || mode == DImode))))
3588 HOST_WIDE_INT high_int, low_int;
3590 low_int = ((INTVAL (XEXP (x, 1)) & 0xffff) ^ 0x8000) - 0x8000;
3591 high_int = INTVAL (XEXP (x, 1)) - low_int;
3592 sum = force_operand (gen_rtx_PLUS (Pmode, XEXP (x, 0),
3593 GEN_INT (high_int)), 0);
3594 return gen_rtx_PLUS (Pmode, sum, GEN_INT (low_int));
3596 else if (GET_CODE (x) == PLUS
3597 && GET_CODE (XEXP (x, 0)) == REG
3598 && GET_CODE (XEXP (x, 1)) != CONST_INT
3599 && GET_MODE_NUNITS (mode) == 1
3600 && ((TARGET_HARD_FLOAT && TARGET_FPRS)
3602 || (((mode != DImode && mode != DFmode && mode != DDmode)
3603 || TARGET_E500_DOUBLE)
3604 && mode != TFmode && mode != TDmode))
3605 && (TARGET_POWERPC64 || mode != DImode)
3608 return gen_rtx_PLUS (Pmode, XEXP (x, 0),
3609 force_reg (Pmode, force_operand (XEXP (x, 1), 0)));
3611 else if (ALTIVEC_VECTOR_MODE (mode))
3615 /* Make sure both operands are registers. */
3616 if (GET_CODE (x) == PLUS)
3617 return gen_rtx_PLUS (Pmode, force_reg (Pmode, XEXP (x, 0)),
3618 force_reg (Pmode, XEXP (x, 1)));
3620 reg = force_reg (Pmode, x);
3623 else if (SPE_VECTOR_MODE (mode)
3624 || (TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
3625 || mode == DDmode || mode == TDmode
3626 || mode == DImode)))
3630 /* We accept [reg + reg] and [reg + OFFSET]. */
3632 if (GET_CODE (x) == PLUS)
3634 rtx op1 = XEXP (x, 0);
3635 rtx op2 = XEXP (x, 1);
3637 op1 = force_reg (Pmode, op1);
3639 if (GET_CODE (op2) != REG
3640 && (GET_CODE (op2) != CONST_INT
3641 || !SPE_CONST_OFFSET_OK (INTVAL (op2))))
3642 op2 = force_reg (Pmode, op2);
3644 return gen_rtx_PLUS (Pmode, op1, op2);
3647 return force_reg (Pmode, x);
3653 && GET_CODE (x) != CONST_INT
3654 && GET_CODE (x) != CONST_DOUBLE
3656 && GET_MODE_NUNITS (mode) == 1
3657 && (GET_MODE_BITSIZE (mode) <= 32
3658 || ((TARGET_HARD_FLOAT && TARGET_FPRS)
3659 && (mode == DFmode || mode == DDmode))))
3661 rtx reg = gen_reg_rtx (Pmode);
3662 emit_insn (gen_elf_high (reg, x));
3663 return gen_rtx_LO_SUM (Pmode, reg, x);
3665 else if (TARGET_MACHO && TARGET_32BIT && TARGET_NO_TOC
3668 && ! MACHO_DYNAMIC_NO_PIC_P
3670 && GET_CODE (x) != CONST_INT
3671 && GET_CODE (x) != CONST_DOUBLE
3673 && ((TARGET_HARD_FLOAT && TARGET_FPRS)
3674 || (mode != DFmode && mode != DDmode))
3678 rtx reg = gen_reg_rtx (Pmode);
3679 emit_insn (gen_macho_high (reg, x));
3680 return gen_rtx_LO_SUM (Pmode, reg, x);
3683 && constant_pool_expr_p (x)
3684 && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (x), Pmode))
3686 return create_TOC_reference (x);
3692 /* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
3693 We need to emit DTP-relative relocations. */
3696 rs6000_output_dwarf_dtprel (FILE *file, int size, rtx x)
3701 fputs ("\t.long\t", file);
3704 fputs (DOUBLE_INT_ASM_OP, file);
3709 output_addr_const (file, x);
3710 fputs ("@dtprel+0x8000", file);
3713 /* Construct the SYMBOL_REF for the tls_get_addr function. */
3715 static GTY(()) rtx rs6000_tls_symbol;
3717 rs6000_tls_get_addr (void)
3719 if (!rs6000_tls_symbol)
3720 rs6000_tls_symbol = init_one_libfunc ("__tls_get_addr");
3722 return rs6000_tls_symbol;
3725 /* Construct the SYMBOL_REF for TLS GOT references. */
3727 static GTY(()) rtx rs6000_got_symbol;
3729 rs6000_got_sym (void)
3731 if (!rs6000_got_symbol)
3733 rs6000_got_symbol = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
3734 SYMBOL_REF_FLAGS (rs6000_got_symbol) |= SYMBOL_FLAG_LOCAL;
3735 SYMBOL_REF_FLAGS (rs6000_got_symbol) |= SYMBOL_FLAG_EXTERNAL;
3738 return rs6000_got_symbol;
3741 /* ADDR contains a thread-local SYMBOL_REF. Generate code to compute
3742 this (thread-local) address. */
3745 rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
3749 dest = gen_reg_rtx (Pmode);
3750 if (model == TLS_MODEL_LOCAL_EXEC && rs6000_tls_size == 16)
3756 tlsreg = gen_rtx_REG (Pmode, 13);
3757 insn = gen_tls_tprel_64 (dest, tlsreg, addr);
3761 tlsreg = gen_rtx_REG (Pmode, 2);
3762 insn = gen_tls_tprel_32 (dest, tlsreg, addr);
3766 else if (model == TLS_MODEL_LOCAL_EXEC && rs6000_tls_size == 32)
3770 tmp = gen_reg_rtx (Pmode);
3773 tlsreg = gen_rtx_REG (Pmode, 13);
3774 insn = gen_tls_tprel_ha_64 (tmp, tlsreg, addr);
3778 tlsreg = gen_rtx_REG (Pmode, 2);
3779 insn = gen_tls_tprel_ha_32 (tmp, tlsreg, addr);
3783 insn = gen_tls_tprel_lo_64 (dest, tmp, addr);
3785 insn = gen_tls_tprel_lo_32 (dest, tmp, addr);
3790 rtx r3, got, tga, tmp1, tmp2, eqv;
3792 /* We currently use relocations like @got@tlsgd for tls, which
3793 means the linker will handle allocation of tls entries, placing
3794 them in the .got section. So use a pointer to the .got section,
3795 not one to secondary TOC sections used by 64-bit -mminimal-toc,
3796 or to secondary GOT sections used by 32-bit -fPIC. */
3798 got = gen_rtx_REG (Pmode, 2);
3802 got = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
3805 rtx gsym = rs6000_got_sym ();
3806 got = gen_reg_rtx (Pmode);
3808 rs6000_emit_move (got, gsym, Pmode);
3814 tmp1 = gen_reg_rtx (Pmode);
3815 tmp2 = gen_reg_rtx (Pmode);
3816 tmp3 = gen_reg_rtx (Pmode);
3817 mem = gen_const_mem (Pmode, tmp1);
3819 first = emit_insn (gen_load_toc_v4_PIC_1b (gsym));
3820 emit_move_insn (tmp1,
3821 gen_rtx_REG (Pmode, LR_REGNO));
3822 emit_move_insn (tmp2, mem);
3823 emit_insn (gen_addsi3 (tmp3, tmp1, tmp2));
3824 last = emit_move_insn (got, tmp3);
3825 set_unique_reg_note (last, REG_EQUAL, gsym);
3826 maybe_encapsulate_block (first, last, gsym);
3831 if (model == TLS_MODEL_GLOBAL_DYNAMIC)
3833 r3 = gen_rtx_REG (Pmode, 3);
3835 insn = gen_tls_gd_64 (r3, got, addr);
3837 insn = gen_tls_gd_32 (r3, got, addr);
3840 tga = gen_rtx_MEM (Pmode, rs6000_tls_get_addr ());
3841 insn = gen_call_value (r3, tga, const0_rtx, const0_rtx);
3842 insn = emit_call_insn (insn);
3843 CONST_OR_PURE_CALL_P (insn) = 1;
3844 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), r3);
3845 insn = get_insns ();
3847 emit_libcall_block (insn, dest, r3, addr);
3849 else if (model == TLS_MODEL_LOCAL_DYNAMIC)
3851 r3 = gen_rtx_REG (Pmode, 3);
3853 insn = gen_tls_ld_64 (r3, got);
3855 insn = gen_tls_ld_32 (r3, got);
3858 tga = gen_rtx_MEM (Pmode, rs6000_tls_get_addr ());
3859 insn = gen_call_value (r3, tga, const0_rtx, const0_rtx);
3860 insn = emit_call_insn (insn);
3861 CONST_OR_PURE_CALL_P (insn) = 1;
3862 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), r3);
3863 insn = get_insns ();
3865 tmp1 = gen_reg_rtx (Pmode);
3866 eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
3868 emit_libcall_block (insn, tmp1, r3, eqv);
3869 if (rs6000_tls_size == 16)
3872 insn = gen_tls_dtprel_64 (dest, tmp1, addr);
3874 insn = gen_tls_dtprel_32 (dest, tmp1, addr);
3876 else if (rs6000_tls_size == 32)
3878 tmp2 = gen_reg_rtx (Pmode);
3880 insn = gen_tls_dtprel_ha_64 (tmp2, tmp1, addr);
3882 insn = gen_tls_dtprel_ha_32 (tmp2, tmp1, addr);
3885 insn = gen_tls_dtprel_lo_64 (dest, tmp2, addr);
3887 insn = gen_tls_dtprel_lo_32 (dest, tmp2, addr);
3891 tmp2 = gen_reg_rtx (Pmode);
3893 insn = gen_tls_got_dtprel_64 (tmp2, got, addr);
3895 insn = gen_tls_got_dtprel_32 (tmp2, got, addr);
3897 insn = gen_rtx_SET (Pmode, dest,
3898 gen_rtx_PLUS (Pmode, tmp2, tmp1));
3904 /* IE, or 64-bit offset LE. */
3905 tmp2 = gen_reg_rtx (Pmode);
3907 insn = gen_tls_got_tprel_64 (tmp2, got, addr);
3909 insn = gen_tls_got_tprel_32 (tmp2, got, addr);
3912 insn = gen_tls_tls_64 (dest, tmp2, addr);
3914 insn = gen_tls_tls_32 (dest, tmp2, addr);
3922 /* Return 1 if X contains a thread-local symbol. */
3925 rs6000_tls_referenced_p (rtx x)
3927 if (! TARGET_HAVE_TLS)
3930 return for_each_rtx (&x, &rs6000_tls_symbol_ref_1, 0);
3933 /* Return 1 if *X is a thread-local symbol. This is the same as
3934 rs6000_tls_symbol_ref except for the type of the unused argument. */
3937 rs6000_tls_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
3939 return RS6000_SYMBOL_REF_TLS_P (*x);
3942 /* The convention appears to be to define this wherever it is used.
3943 With legitimize_reload_address now defined here, REG_MODE_OK_FOR_BASE_P
3944 is now used here. */
3945 #ifndef REG_MODE_OK_FOR_BASE_P
3946 #define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO)
3949 /* Our implementation of LEGITIMIZE_RELOAD_ADDRESS. Returns a value to
3950 replace the input X, or the original X if no replacement is called for.
3951 The output parameter *WIN is 1 if the calling macro should goto WIN,
3954 For RS/6000, we wish to handle large displacements off a base
3955 register by splitting the addend across an addiu/addis and the mem insn.
3956 This cuts number of extra insns needed from 3 to 1.
3958 On Darwin, we use this to generate code for floating point constants.
3959 A movsf_low is generated so we wind up with 2 instructions rather than 3.
3960 The Darwin code is inside #if TARGET_MACHO because only then is
3961 machopic_function_base_name() defined. */
3963 rs6000_legitimize_reload_address (rtx x, enum machine_mode mode,
3964 int opnum, int type,
3965 int ind_levels ATTRIBUTE_UNUSED, int *win)
3967 /* We must recognize output that we have already generated ourselves. */
3968 if (GET_CODE (x) == PLUS
3969 && GET_CODE (XEXP (x, 0)) == PLUS
3970 && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
3971 && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
3972 && GET_CODE (XEXP (x, 1)) == CONST_INT)
3974 push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
3975 BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
3976 opnum, (enum reload_type)type);
3982 if (DEFAULT_ABI == ABI_DARWIN && flag_pic
3983 && GET_CODE (x) == LO_SUM
3984 && GET_CODE (XEXP (x, 0)) == PLUS
3985 && XEXP (XEXP (x, 0), 0) == pic_offset_table_rtx
3986 && GET_CODE (XEXP (XEXP (x, 0), 1)) == HIGH
3987 && GET_CODE (XEXP (XEXP (XEXP (x, 0), 1), 0)) == CONST
3988 && XEXP (XEXP (XEXP (x, 0), 1), 0) == XEXP (x, 1)
3989 && GET_CODE (XEXP (XEXP (x, 1), 0)) == MINUS
3990 && GET_CODE (XEXP (XEXP (XEXP (x, 1), 0), 0)) == SYMBOL_REF
3991 && GET_CODE (XEXP (XEXP (XEXP (x, 1), 0), 1)) == SYMBOL_REF)
3993 /* Result of previous invocation of this function on Darwin
3994 floating point constant. */
3995 push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
3996 BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
3997 opnum, (enum reload_type)type);
4003 /* Force ld/std non-word aligned offset into base register by wrapping
4005 if (GET_CODE (x) == PLUS
4006 && GET_CODE (XEXP (x, 0)) == REG
4007 && REGNO (XEXP (x, 0)) < 32
4008 && REG_MODE_OK_FOR_BASE_P (XEXP (x, 0), mode)
4009 && GET_CODE (XEXP (x, 1)) == CONST_INT
4010 && (INTVAL (XEXP (x, 1)) & 3) != 0
4011 && !ALTIVEC_VECTOR_MODE (mode)
4012 && GET_MODE_SIZE (mode) >= UNITS_PER_WORD
4013 && TARGET_POWERPC64)
4015 x = gen_rtx_PLUS (GET_MODE (x), x, GEN_INT (0));
4016 push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
4017 BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
4018 opnum, (enum reload_type) type);
4023 if (GET_CODE (x) == PLUS