1 Index: gcc-4.2.3/configure.in
2 ===================================================================
3 --- gcc-4.2.3.orig/configure.in 2007-09-15 02:42:24.000000000 +0200
4 +++ gcc-4.2.3/configure.in 2008-05-21 13:45:54.101287819 +0200
7 noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
10 + noconfigdirs="$noconfigdirs target-libiberty target-libmudflap target-libffi ${libgcj}"
13 noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
15 Index: gcc-4.2.3/gcc/builtins.c
16 ===================================================================
17 --- gcc-4.2.3.orig/gcc/builtins.c 2008-01-23 11:38:21.000000000 +0100
18 +++ gcc-4.2.3/gcc/builtins.c 2008-05-21 13:45:54.109288559 +0200
23 - code = va_arg (ap, enum tree_code);
24 + code = va_arg (ap, int);
28 Index: gcc-4.2.3/gcc/calls.c
29 ===================================================================
30 --- gcc-4.2.3.orig/gcc/calls.c 2007-09-01 17:28:30.000000000 +0200
31 +++ gcc-4.2.3/gcc/calls.c 2008-05-21 13:45:54.117288181 +0200
33 for (; count < nargs; count++)
35 rtx val = va_arg (p, rtx);
36 - enum machine_mode mode = va_arg (p, enum machine_mode);
37 + enum machine_mode mode = va_arg (p, int);
39 /* We cannot convert the arg value to the mode the library wants here;
40 must do it earlier where we know the signedness of the arg. */
41 Index: gcc-4.2.3/gcc/config/avr32/avr32.c
42 ===================================================================
43 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
44 +++ gcc-4.2.3/gcc/config/avr32/avr32.c 2008-05-21 13:45:54.145288116 +0200
47 + Target hooks and helper functions for AVR32.
48 + Copyright 2003-2006 Atmel Corporation.
50 + Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
51 + Initial porting by Anders �dland.
53 + This file is part of GCC.
55 + This program is free software; you can redistribute it and/or modify
56 + it under the terms of the GNU General Public License as published by
57 + the Free Software Foundation; either version 2 of the License, or
58 + (at your option) any later version.
60 + This program is distributed in the hope that it will be useful,
61 + but WITHOUT ANY WARRANTY; without even the implied warranty of
62 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63 + GNU General Public License for more details.
65 + You should have received a copy of the GNU General Public License
66 + along with this program; if not, write to the Free Software
67 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
71 +#include "coretypes.h"
77 +#include "hard-reg-set.h"
79 +#include "insn-config.h"
80 +#include "conditions.h"
82 +#include "insn-attr.h"
85 +#include "function.h"
92 +#include "c-pragma.h"
93 +#include "integrate.h"
95 +#include "langhooks.h"
98 +#include "target-def.h"
102 +/* Forward definitions of types. */
103 +typedef struct minipool_node Mnode;
104 +typedef struct minipool_fixup Mfix;
106 +/* Obstack for minipool constant handling. */
107 +static struct obstack minipool_obstack;
108 +static char *minipool_startobj;
109 +static rtx minipool_vector_label;
111 +/* True if we are currently building a constant table. */
112 +int making_const_table;
114 +/* Some forward function declarations */
115 +static unsigned long avr32_isr_value (tree);
116 +static unsigned long avr32_compute_func_type (void);
117 +static tree avr32_handle_isr_attribute (tree *, tree, tree, int, bool *);
118 +static tree avr32_handle_acall_attribute (tree *, tree, tree, int, bool *);
119 +static tree avr32_handle_fndecl_attribute (tree * node, tree name, tree args,
120 + int flags, bool * no_add_attrs);
121 +static void avr32_reorg (void);
122 +bool avr32_return_in_msb (tree type);
123 +bool avr32_vector_mode_supported (enum machine_mode mode);
124 +static void avr32_init_libfuncs (void);
128 +avr32_add_gc_roots (void)
130 + gcc_obstack_init (&minipool_obstack);
131 + minipool_startobj = (char *) obstack_alloc (&minipool_obstack, 0);
135 +/* List of all known AVR32 parts */
136 +static const struct part_type_s avr32_part_types[] = {
137 + /* name, part_type, architecture type, macro */
138 + {"none", PART_TYPE_AVR32_NONE, ARCH_TYPE_AVR32_AP, "__AVR32__"},
139 + {"ap7000", PART_TYPE_AVR32_AP7000, ARCH_TYPE_AVR32_AP, "__AVR32_AP7000__"},
140 + {"ap7010", PART_TYPE_AVR32_AP7010, ARCH_TYPE_AVR32_AP, "__AVR32_AP7010__"},
141 + {"ap7020", PART_TYPE_AVR32_AP7020, ARCH_TYPE_AVR32_AP, "__AVR32_AP7020__"},
142 + {"uc3a0256", PART_TYPE_AVR32_UC3A0256, ARCH_TYPE_AVR32_UC,
143 + "__AVR32_UC3A0256__"},
144 + {"uc3a0512", PART_TYPE_AVR32_UC3A0512, ARCH_TYPE_AVR32_UC,
145 + "__AVR32_UC3A0512__"},
146 + {"uc3a1128", PART_TYPE_AVR32_UC3A1128, ARCH_TYPE_AVR32_UC,
147 + "__AVR32_UC3A1128__"},
148 + {"uc3a1256", PART_TYPE_AVR32_UC3A1256, ARCH_TYPE_AVR32_UC,
149 + "__AVR32_UC3A1256__"},
150 + {"uc3a1512", PART_TYPE_AVR32_UC3A1512, ARCH_TYPE_AVR32_UC,
151 + "__AVR32_UC3A1512__"},
152 + {"uc3b064", PART_TYPE_AVR32_UC3B064, ARCH_TYPE_AVR32_UC,
153 + "__AVR32_UC3B064__"},
154 + {"uc3b0128", PART_TYPE_AVR32_UC3B0128, ARCH_TYPE_AVR32_UC,
155 + "__AVR32_UC3B0128__"},
156 + {"uc3b0256", PART_TYPE_AVR32_UC3B0256, ARCH_TYPE_AVR32_UC,
157 + "__AVR32_UC3B0256__"},
158 + {"uc3b164", PART_TYPE_AVR32_UC3B164, ARCH_TYPE_AVR32_UC,
159 + "__AVR32_UC3B164__"},
160 + {"uc3b1128", PART_TYPE_AVR32_UC3B1128, ARCH_TYPE_AVR32_UC,
161 + "__AVR32_UC3B1128__"},
162 + {"uc3b1256", PART_TYPE_AVR32_UC3B1256, ARCH_TYPE_AVR32_UC,
163 + "__AVR32_UC3B1256__"},
167 +/* List of all known AVR32 architectures */
168 +static const struct arch_type_s avr32_arch_types[] = {
169 + /* name, architecture type, microarchitecture type, feature flags, macro */
170 + {"ap", ARCH_TYPE_AVR32_AP, UARCH_TYPE_AVR32B,
171 + (FLAG_AVR32_HAS_DSP
172 + | FLAG_AVR32_HAS_SIMD
173 + | FLAG_AVR32_HAS_UNALIGNED_WORD
174 + | FLAG_AVR32_HAS_CACHES
175 + | FLAG_AVR32_HAS_BRANCH_PRED
176 + | FLAG_AVR32_HAS_RETURN_STACK),
178 + {"uc", ARCH_TYPE_AVR32_UC, UARCH_TYPE_AVR32A,
179 + (FLAG_AVR32_HAS_DSP | FLAG_AVR32_HAS_RMW),
181 + {NULL, 0, 0, 0, NULL}
184 +/* Default arch name */
185 +const char *avr32_arch_name = "ap";
186 +const char *avr32_part_name = "none";
188 +const struct part_type_s *avr32_part;
189 +const struct arch_type_s *avr32_arch;
191 +/* Set default target_flags. */
192 +#undef TARGET_DEFAULT_TARGET_FLAGS
193 +#define TARGET_DEFAULT_TARGET_FLAGS \
194 + (MASK_HAS_ASM_ADDR_PSEUDOS | MASK_MD_REORG_OPTIMIZATION)
197 +avr32_optimization_options (int level,
199 + if (AVR32_ALWAYS_PIC)
202 + /* Enable section anchors if optimization is enabled. */
203 + if (level > 0 || size)
204 + flag_section_anchors = 1;
207 +/* Override command line options */
209 +avr32_override_options (void)
211 + const struct part_type_s *part;
212 + const struct arch_type_s *arch;
214 + /* Check if part type is set. */
215 + for (part = avr32_part_types; part->name; part++)
216 + if (strcmp (part->name, avr32_part_name) == 0)
223 + fprintf (stderr, "Unknown part `%s' specified\nKnown part names:\n",
225 + for (part = avr32_part_types; part->name; part++)
226 + fprintf (stderr, "\t%s\n", part->name);
227 + avr32_part = &avr32_part_types[PART_TYPE_AVR32_NONE];
230 + avr32_arch = &avr32_arch_types[avr32_part->arch_type];
232 + /* If part was set to "none" then check if arch was set. */
233 + if (strcmp (avr32_part->name, "none") == 0)
235 + /* Check if arch type is set. */
236 + for (arch = avr32_arch_types; arch->name; arch++)
237 + if (strcmp (arch->name, avr32_arch_name) == 0)
244 + fprintf (stderr, "Unknown arch `%s' specified\nKnown arch names:\n",
246 + for (arch = avr32_arch_types; arch->name; arch++)
247 + fprintf (stderr, "\t%s\n", arch->name);
248 + avr32_arch = &avr32_arch_types[ARCH_TYPE_AVR32_AP];
252 + /* If optimization level is two or greater, then align start of loops to a
253 + word boundary since this will allow folding the first insn of the loop.
254 + Do this only for targets supporting branch prediction. */
255 + if (optimize >= 2 && TARGET_BRANCH_PRED)
259 + /* Enable section anchors if optimization is enabled. */
260 + if (optimize > 0 || optimize_size)
261 + flag_section_anchors = 1;
263 + /* Enable fast-float library if unsafe math optimizations
265 + if (flag_unsafe_math_optimizations)
266 + target_flags |= MASK_FAST_FLOAT;
268 + /* Check if we should set avr32_imm_in_const_pool
269 + based on if caches are present or not. */
270 + if ( avr32_imm_in_const_pool == -1 )
272 + if ( TARGET_CACHES )
273 + avr32_imm_in_const_pool = 1;
275 + avr32_imm_in_const_pool = 0;
278 + avr32_add_gc_roots ();
283 +If defined, a function that outputs the assembler code for entry to a
284 +function. The prologue is responsible for setting up the stack frame,
285 +initializing the frame pointer register, saving registers that must be
286 +saved, and allocating size additional bytes of storage for the
287 +local variables. size is an integer. file is a stdio
288 +stream to which the assembler code should be output.
290 +The label for the beginning of the function need not be output by this
291 +macro. That has already been done when the macro is run.
293 +To determine which registers to save, the macro can refer to the array
294 +regs_ever_live: element r is nonzero if hard register
295 +r is used anywhere within the function. This implies the function
296 +prologue should save register r, provided it is not one of the
297 +call-used registers. (TARGET_ASM_FUNCTION_EPILOGUE must likewise use
300 +On machines that have ``register windows'', the function entry code does
301 +not save on the stack the registers that are in the windows, even if
302 +they are supposed to be preserved by function calls; instead it takes
303 +appropriate steps to ``push'' the register stack, if any non-call-used
304 +registers are used in the function.
306 +On machines where functions may or may not have frame-pointers, the
307 +function entry code must vary accordingly; it must set up the frame
308 +pointer if one is wanted, and not otherwise. To determine whether a
309 +frame pointer is in wanted, the macro can refer to the variable
310 +frame_pointer_needed. The variable's value will be 1 at run
311 +time in a function that needs a frame pointer. (see Elimination).
313 +The function entry code is responsible for allocating any stack space
314 +required for the function. This stack space consists of the regions
315 +listed below. In most cases, these regions are allocated in the
316 +order listed, with the last listed region closest to the top of the
317 +stack (the lowest address if STACK_GROWS_DOWNWARD is defined, and
318 +the highest address if it is not defined). You can use a different order
319 +for a machine if doing so is more convenient or required for
320 +compatibility reasons. Except in cases where required by standard
321 +or by a debugger, there is no reason why the stack layout used by GCC
322 +need agree with that used by other compilers for a machine.
325 +#undef TARGET_ASM_FUNCTION_PROLOGUE
326 +#define TARGET_ASM_FUNCTION_PROLOGUE avr32_target_asm_function_prologue
329 +#undef TARGET_DEFAULT_SHORT_ENUMS
330 +#define TARGET_DEFAULT_SHORT_ENUMS hook_bool_void_false
332 +#undef TARGET_PROMOTE_FUNCTION_ARGS
333 +#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
335 +#undef TARGET_PROMOTE_FUNCTION_RETURN
336 +#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
338 +#undef TARGET_PROMOTE_PROTOTYPES
339 +#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
341 +#undef TARGET_MUST_PASS_IN_STACK
342 +#define TARGET_MUST_PASS_IN_STACK avr32_must_pass_in_stack
344 +#undef TARGET_PASS_BY_REFERENCE
345 +#define TARGET_PASS_BY_REFERENCE avr32_pass_by_reference
347 +#undef TARGET_STRICT_ARGUMENT_NAMING
348 +#define TARGET_STRICT_ARGUMENT_NAMING avr32_strict_argument_naming
350 +#undef TARGET_VECTOR_MODE_SUPPORTED_P
351 +#define TARGET_VECTOR_MODE_SUPPORTED_P avr32_vector_mode_supported
353 +#undef TARGET_RETURN_IN_MEMORY
354 +#define TARGET_RETURN_IN_MEMORY avr32_return_in_memory
356 +#undef TARGET_RETURN_IN_MSB
357 +#define TARGET_RETURN_IN_MSB avr32_return_in_msb
359 +#undef TARGET_ARG_PARTIAL_BYTES
360 +#define TARGET_ARG_PARTIAL_BYTES avr32_arg_partial_bytes
362 +#undef TARGET_STRIP_NAME_ENCODING
363 +#define TARGET_STRIP_NAME_ENCODING avr32_strip_name_encoding
365 +#define streq(string1, string2) (strcmp (string1, string2) == 0)
367 +#undef TARGET_NARROW_VOLATILE_BITFIELD
368 +#define TARGET_NARROW_VOLATILE_BITFIELD hook_bool_void_false
370 +#undef TARGET_ATTRIBUTE_TABLE
371 +#define TARGET_ATTRIBUTE_TABLE avr32_attribute_table
373 +#undef TARGET_COMP_TYPE_ATTRIBUTES
374 +#define TARGET_COMP_TYPE_ATTRIBUTES avr32_comp_type_attributes
377 +#undef TARGET_RTX_COSTS
378 +#define TARGET_RTX_COSTS avr32_rtx_costs
380 +#undef TARGET_CANNOT_FORCE_CONST_MEM
381 +#define TARGET_CANNOT_FORCE_CONST_MEM avr32_cannot_force_const_mem
383 +#undef TARGET_ASM_INTEGER
384 +#define TARGET_ASM_INTEGER avr32_assemble_integer
386 +#undef TARGET_FUNCTION_VALUE
387 +#define TARGET_FUNCTION_VALUE avr32_function_value
389 +#undef TARGET_MIN_ANCHOR_OFFSET
390 +#define TARGET_MIN_ANCHOR_OFFSET (0)
392 +#undef TARGET_MAX_ANCHOR_OFFSET
393 +#define TARGET_MAX_ANCHOR_OFFSET ((1 << 15) - 1)
397 + * Switches to the appropriate section for output of constant pool
398 + * entry x in mode. You can assume that x is some kind of constant in
399 + * RTL. The argument mode is redundant except in the case of a
400 + * const_int rtx. Select the section by calling readonly_data_ section
401 + * or one of the alternatives for other sections. align is the
402 + * constant alignment in bits.
404 + * The default version of this function takes care of putting symbolic
405 + * constants in flag_ pic mode in data_section and everything else in
406 + * readonly_data_section.
408 +//#undef TARGET_ASM_SELECT_RTX_SECTION
409 +//#define TARGET_ASM_SELECT_RTX_SECTION avr32_select_rtx_section
413 + * If non-null, this hook performs a target-specific pass over the
414 + * instruction stream. The compiler will run it at all optimization
415 + * levels, just before the point at which it normally does
416 + * delayed-branch scheduling.
418 + * The exact purpose of the hook varies from target to target. Some
419 + * use it to do transformations that are necessary for correctness,
420 + * such as laying out in-function constant pools or avoiding hardware
421 + * hazards. Others use it as an opportunity to do some
422 + * machine-dependent optimizations.
424 + * You need not implement the hook if it has nothing to do. The
425 + * default definition is null.
427 +#undef TARGET_MACHINE_DEPENDENT_REORG
428 +#define TARGET_MACHINE_DEPENDENT_REORG avr32_reorg
430 +/* Target hook for assembling integer objects.
431 + Need to handle integer vectors */
433 +avr32_assemble_integer (rtx x, unsigned int size, int aligned_p)
435 + if (avr32_vector_mode_supported (GET_MODE (x)))
439 + if (GET_CODE (x) != CONST_VECTOR)
442 + units = CONST_VECTOR_NUNITS (x);
444 + switch (GET_MODE (x))
456 + for (i = 0; i < units; i++)
460 + elt = CONST_VECTOR_ELT (x, i);
461 + assemble_integer (elt, size, i == 0 ? 32 : size * BITS_PER_UNIT, 1);
467 + return default_assemble_integer (x, size, aligned_p);
471 + * This target hook describes the relative costs of RTL expressions.
473 + * The cost may depend on the precise form of the expression, which is
474 + * available for examination in x, and the rtx code of the expression
475 + * in which it is contained, found in outer_code. code is the
476 + * expression code--redundant, since it can be obtained with GET_CODE
479 + * In implementing this hook, you can use the construct COSTS_N_INSNS
480 + * (n) to specify a cost equal to n fast instructions.
482 + * On entry to the hook, *total contains a default estimate for the
483 + * cost of the expression. The hook should modify this value as
484 + * necessary. Traditionally, the default costs are COSTS_N_INSNS (5)
485 + * for multiplications, COSTS_N_INSNS (7) for division and modulus
486 + * operations, and COSTS_N_INSNS (1) for all other operations.
488 + * When optimizing for code size, i.e. when optimize_size is non-zero,
489 + * this target hook should be used to estimate the relative size cost
490 + * of an expression, again relative to COSTS_N_INSNS.
492 + * The hook returns true when all subexpressions of x have been
493 + * processed, and false when rtx_cost should recurse.
496 +/* Worker routine for avr32_rtx_costs. */
498 +avr32_rtx_costs_1 (rtx x, enum rtx_code code ATTRIBUTE_UNUSED,
499 + enum rtx_code outer ATTRIBUTE_UNUSED)
501 + enum machine_mode mode = GET_MODE (x);
503 + switch (GET_CODE (x))
506 + /* Using pre decrement / post increment memory operations on the
507 + avr32_uc architecture means that two writebacks must be performed
508 + and hence two cycles are needed. */
510 + && GET_MODE_SIZE (mode) <= 2 * UNITS_PER_WORD
511 + && avr32_arch->arch_type == ARCH_TYPE_AVR32_UC
512 + && (GET_CODE (XEXP (x, 0)) == PRE_DEC
513 + || GET_CODE (XEXP (x, 0)) == POST_INC))
514 + return COSTS_N_INSNS (5);
516 + /* Memory costs quite a lot for the first word, but subsequent words
517 + load at the equivalent of a single insn each. */
518 + if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
519 + return COSTS_N_INSNS (3 + (GET_MODE_SIZE (mode) / UNITS_PER_WORD));
521 + return COSTS_N_INSNS (4);
524 + /* These are valid for the pseudo insns: lda.w and call which operates
525 + on direct addresses. We assume that the cost of a lda.w is the same
526 + as the cost of a ld.w insn. */
527 + return (outer == SET) ? COSTS_N_INSNS (4) : COSTS_N_INSNS (1);
532 + return optimize_size ? COSTS_N_INSNS (1) : COSTS_N_INSNS (16);
536 + if (mode == TImode)
537 + return COSTS_N_INSNS (100);
539 + if (mode == DImode)
540 + return COSTS_N_INSNS (10);
541 + return COSTS_N_INSNS (4);
546 + if (mode == TImode)
547 + return COSTS_N_INSNS (10);
549 + if (mode == DImode)
550 + return COSTS_N_INSNS (4);
551 + return COSTS_N_INSNS (1);
557 + if (GET_MODE_CLASS (mode) == MODE_FLOAT)
558 + return COSTS_N_INSNS (100);
560 + if (mode == TImode)
561 + return COSTS_N_INSNS (50);
563 + if (mode == DImode)
564 + return COSTS_N_INSNS (2);
565 + return COSTS_N_INSNS (1);
569 + if (GET_MODE_CLASS (mode) == MODE_FLOAT)
570 + return COSTS_N_INSNS (300);
572 + if (mode == TImode)
573 + return COSTS_N_INSNS (16);
575 + if (mode == DImode)
576 + return COSTS_N_INSNS (4);
578 + if (mode == HImode)
579 + return COSTS_N_INSNS (2);
581 + return COSTS_N_INSNS (3);
584 + if (GET_CODE (XEXP (x, 1)) == PC || GET_CODE (XEXP (x, 2)) == PC)
585 + return COSTS_N_INSNS (4);
586 + return COSTS_N_INSNS (1);
589 + /* Sign/Zero extensions of registers cost quite much since these
590 + instrcutions only take one register operand which means that gcc
591 + often must insert some move instrcutions */
592 + if (mode == QImode || mode == HImode)
593 + return (COSTS_N_INSNS (GET_CODE (XEXP (x, 0)) == MEM ? 0 : 1));
594 + return COSTS_N_INSNS (4);
596 + /* divmod operations */
597 + if (XINT (x, 1) == UNSPEC_UDIVMODSI4_INTERNAL
598 + || XINT (x, 1) == UNSPEC_DIVMODSI4_INTERNAL)
600 + return optimize_size ? COSTS_N_INSNS (1) : COSTS_N_INSNS (16);
604 + return COSTS_N_INSNS (1);
609 +avr32_rtx_costs (rtx x, int code, int outer_code, int *total)
611 + *total = avr32_rtx_costs_1 (x, code, outer_code);
617 +avr32_cannot_force_const_mem (rtx x ATTRIBUTE_UNUSED)
619 + /* Do not want symbols in the constant pool when compiling pic or if using
620 + address pseudo instructions. */
621 + return ((flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS)
622 + && avr32_find_symbol (x) != NULL_RTX);
626 +/* Table of machine attributes. */
627 +const struct attribute_spec avr32_attribute_table[] = {
628 + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
629 + /* Interrupt Service Routines have special prologue and epilogue
631 + {"isr", 0, 1, false, false, false, avr32_handle_isr_attribute},
632 + {"interrupt", 0, 1, false, false, false, avr32_handle_isr_attribute},
633 + {"acall", 0, 1, false, true, true, avr32_handle_acall_attribute},
634 + {"naked", 0, 0, true, false, false, avr32_handle_fndecl_attribute},
635 + {NULL, 0, 0, false, false, false, NULL}
641 + const char *const arg;
642 + const unsigned long return_value;
646 +static const isr_attribute_arg isr_attribute_args[] = {
647 + {"FULL", AVR32_FT_ISR_FULL},
648 + {"full", AVR32_FT_ISR_FULL},
649 + {"HALF", AVR32_FT_ISR_HALF},
650 + {"half", AVR32_FT_ISR_HALF},
651 + {"NONE", AVR32_FT_ISR_NONE},
652 + {"none", AVR32_FT_ISR_NONE},
653 + {"UNDEF", AVR32_FT_ISR_NONE},
654 + {"undef", AVR32_FT_ISR_NONE},
655 + {"SWI", AVR32_FT_ISR_NONE},
656 + {"swi", AVR32_FT_ISR_NONE},
657 + {NULL, AVR32_FT_ISR_NONE}
660 +/* Returns the (interrupt) function type of the current
661 + function, or AVR32_FT_UNKNOWN if the type cannot be determined. */
663 +static unsigned long
664 +avr32_isr_value (tree argument)
666 + const isr_attribute_arg *ptr;
669 + /* No argument - default to ISR_NONE. */
670 + if (argument == NULL_TREE)
671 + return AVR32_FT_ISR_NONE;
673 + /* Get the value of the argument. */
674 + if (TREE_VALUE (argument) == NULL_TREE
675 + || TREE_CODE (TREE_VALUE (argument)) != STRING_CST)
676 + return AVR32_FT_UNKNOWN;
678 + arg = TREE_STRING_POINTER (TREE_VALUE (argument));
680 + /* Check it against the list of known arguments. */
681 + for (ptr = isr_attribute_args; ptr->arg != NULL; ptr++)
682 + if (streq (arg, ptr->arg))
683 + return ptr->return_value;
685 + /* An unrecognized interrupt type. */
686 + return AVR32_FT_UNKNOWN;
692 +These hooks specify assembly directives for creating certain kinds
693 +of integer object. The TARGET_ASM_BYTE_OP directive creates a
694 +byte-sized object, the TARGET_ASM_ALIGNED_HI_OP one creates an
695 +aligned two-byte object, and so on. Any of the hooks may be
696 +NULL, indicating that no suitable directive is available.
698 +The compiler will print these strings at the start of a new line,
699 +followed immediately by the object's initial value. In most cases,
700 +the string should contain a tab, a pseudo-op, and then another tab.
702 +#undef TARGET_ASM_BYTE_OP
703 +#define TARGET_ASM_BYTE_OP "\t.byte\t"
704 +#undef TARGET_ASM_ALIGNED_HI_OP
705 +#define TARGET_ASM_ALIGNED_HI_OP "\t.align 1\n\t.short\t"
706 +#undef TARGET_ASM_ALIGNED_SI_OP
707 +#define TARGET_ASM_ALIGNED_SI_OP "\t.align 2\n\t.int\t"
708 +#undef TARGET_ASM_ALIGNED_DI_OP
709 +#define TARGET_ASM_ALIGNED_DI_OP NULL
710 +#undef TARGET_ASM_ALIGNED_TI_OP
711 +#define TARGET_ASM_ALIGNED_TI_OP NULL
712 +#undef TARGET_ASM_UNALIGNED_HI_OP
713 +#define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t"
714 +#undef TARGET_ASM_UNALIGNED_SI_OP
715 +#define TARGET_ASM_UNALIGNED_SI_OP "\t.int\t"
716 +#undef TARGET_ASM_UNALIGNED_DI_OP
717 +#define TARGET_ASM_UNALIGNED_DI_OP NULL
718 +#undef TARGET_ASM_UNALIGNED_TI_OP
719 +#define TARGET_ASM_UNALIGNED_TI_OP NULL
721 +#undef TARGET_ASM_OUTPUT_MI_THUNK
722 +#define TARGET_ASM_OUTPUT_MI_THUNK avr32_output_mi_thunk
724 +#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
725 +#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
728 +avr32_output_mi_thunk (FILE * file,
729 + tree thunk ATTRIBUTE_UNUSED,
730 + HOST_WIDE_INT delta,
731 + HOST_WIDE_INT vcall_offset, tree function)
733 + int mi_delta = delta;
735 + (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function) ?
736 + INTERNAL_REGNUM (11) : INTERNAL_REGNUM (12));
739 + if (!avr32_const_ok_for_constraint_p (mi_delta, 'I', "Is21")
743 + fputs ("\tpushm\tlr\n", file);
749 + if (avr32_const_ok_for_constraint_p (mi_delta, 'I', "Is21"))
751 + fprintf (file, "\tsub\t%s, -0x%x\n", reg_names[this_regno],
756 + /* Immediate is larger than k21 we must make us a temp register by
757 + pushing a register to the stack. */
758 + fprintf (file, "\tmov\tlr, lo(%x)\n", mi_delta);
759 + fprintf (file, "\torh\tlr, hi(%x)\n", mi_delta);
760 + fprintf (file, "\tadd\t%s, lr\n", reg_names[this_regno]);
765 + if (vcall_offset != 0)
767 + fprintf (file, "\tld.w\tlr, %s[0]\n", reg_names[this_regno]);
768 + fprintf (file, "\tld.w\tlr, lr[%i]\n", (int) vcall_offset);
769 + fprintf (file, "\tadd\t%s, lr\n", reg_names[this_regno]);
773 + if ( (!avr32_const_ok_for_constraint_p (mi_delta, 'I', "Is21")
777 + fputs ("\tpopm\tlr\n", file);
782 + /* Load the got into lr and then load the pointer
783 + to the function from the got and put it on the stack.
784 + We can then call the function and restore lr by issuing
785 + a doubleword load from the stack. We do not use a popm/ldm
786 + since it will be treated as a return and might need a flushing
787 + of the return-stack if available. */
788 + rtx label = gen_label_rtx ();
789 + /* Load the got. */
790 + fputs ("\tlddpc\tlr, 0f\n", file);
791 + (*targetm.asm_out.internal_label) (file, "L",
792 + CODE_LABEL_NUMBER (label));
793 + fputs ("\trsub\tlr, pc\n", file);
794 + /* Load the function pointer. */
795 + fputs ("\tld.w\tlr, lr[", file);
796 + assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
797 + fputs ("@got]\n", file);
798 + /* Push the function pointer on the stack.*/
799 + fputs ("\tpushm\tlr\n", file);
800 + /* Restore the old lr value and load the function pointer into
802 + fputs ("\tld.d\tlr,sp++\n", file);
803 + fprintf (file, "\t.align 2\n");
804 + fprintf (file, "0:\t.long\t.L%d - _GLOBAL_OFFSET_TABLE_\n", CODE_LABEL_NUMBER (label));
808 + fprintf (file, "\tlddpc\tpc, 0f\n");
809 + fprintf (file, "\t.align 2\n");
810 + fputs ("0:\t.long\t", file);
811 + assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
812 + fputc ('\n', file);
816 +/* Implements target hook vector_mode_supported. */
818 +avr32_vector_mode_supported (enum machine_mode mode)
820 + if ((mode == V2HImode) || (mode == V4QImode))
827 +#undef TARGET_INIT_LIBFUNCS
828 +#define TARGET_INIT_LIBFUNCS avr32_init_libfuncs
830 +#undef TARGET_INIT_BUILTINS
831 +#define TARGET_INIT_BUILTINS avr32_init_builtins
833 +#undef TARGET_EXPAND_BUILTIN
834 +#define TARGET_EXPAND_BUILTIN avr32_expand_builtin
836 +tree int_ftype_int, int_ftype_void, short_ftype_short, void_ftype_int_int,
838 +tree void_ftype_int, void_ftype_void, int_ftype_ptr_int;
839 +tree short_ftype_short, int_ftype_int_short, int_ftype_short_short,
840 +short_ftype_short_short;
841 +tree int_ftype_int_int, longlong_ftype_int_short, longlong_ftype_short_short;
842 +tree void_ftype_int_int_int_int_int, void_ftype_int_int_int;
843 +tree longlong_ftype_int_int, void_ftype_int_int_longlong;
844 +tree int_ftype_int_int_int, longlong_ftype_longlong_int_short;
845 +tree longlong_ftype_longlong_short_short, int_ftype_int_short_short;
847 +#define def_builtin(NAME, TYPE, CODE) \
848 + lang_hooks.builtin_function ((NAME), (TYPE), (CODE), \
849 + BUILT_IN_MD, NULL, NULL_TREE)
851 +#define def_mbuiltin(MASK, NAME, TYPE, CODE) \
855 + lang_hooks.builtin_function ((NAME), (TYPE), (CODE), \
856 + BUILT_IN_MD, NULL, NULL_TREE); \
860 +struct builtin_description
862 + const unsigned int mask;
863 + const enum insn_code icode;
864 + const char *const name;
866 + const enum rtx_code comparison;
867 + const unsigned int flag;
871 +static const struct builtin_description bdesc_2arg[] = {
872 +#define DSP_BUILTIN(code, builtin, ftype) \
873 + { 1, CODE_FOR_##code, "__builtin_" #code , \
874 + AVR32_BUILTIN_##builtin, 0, 0, ftype }
876 + DSP_BUILTIN (mulsathh_h, MULSATHH_H, &short_ftype_short_short),
877 + DSP_BUILTIN (mulsathh_w, MULSATHH_W, &int_ftype_short_short),
878 + DSP_BUILTIN (mulsatrndhh_h, MULSATRNDHH_H, &short_ftype_short_short),
879 + DSP_BUILTIN (mulsatrndwh_w, MULSATRNDWH_W, &int_ftype_int_short),
880 + DSP_BUILTIN (mulsatwh_w, MULSATWH_W, &int_ftype_int_short),
881 + DSP_BUILTIN (satadd_h, SATADD_H, &short_ftype_short_short),
882 + DSP_BUILTIN (satsub_h, SATSUB_H, &short_ftype_short_short),
883 + DSP_BUILTIN (satadd_w, SATADD_W, &int_ftype_int_int),
884 + DSP_BUILTIN (satsub_w, SATSUB_W, &int_ftype_int_int),
885 + DSP_BUILTIN (mulwh_d, MULWH_D, &longlong_ftype_int_short),
886 + DSP_BUILTIN (mulnwh_d, MULNWH_D, &longlong_ftype_int_short)
891 +avr32_init_builtins (void)
894 + const struct builtin_description *d;
895 + tree endlink = void_list_node;
896 + tree int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
897 + tree longlong_endlink =
898 + tree_cons (NULL_TREE, long_long_integer_type_node, endlink);
899 + tree short_endlink =
900 + tree_cons (NULL_TREE, short_integer_type_node, endlink);
901 + tree void_endlink = tree_cons (NULL_TREE, void_type_node, endlink);
903 + /* int func (int) */
904 + int_ftype_int = build_function_type (integer_type_node, int_endlink);
906 + /* short func (short) */
908 + = build_function_type (short_integer_type_node, short_endlink);
910 + /* short func (short, short) */
911 + short_ftype_short_short
912 + = build_function_type (short_integer_type_node,
913 + tree_cons (NULL_TREE, short_integer_type_node,
916 + /* long long func (long long, short, short) */
917 + longlong_ftype_longlong_short_short
918 + = build_function_type (long_long_integer_type_node,
919 + tree_cons (NULL_TREE, long_long_integer_type_node,
920 + tree_cons (NULL_TREE,
921 + short_integer_type_node,
924 + /* long long func (short, short) */
925 + longlong_ftype_short_short
926 + = build_function_type (long_long_integer_type_node,
927 + tree_cons (NULL_TREE, short_integer_type_node,
930 + /* int func (int, int) */
932 + = build_function_type (integer_type_node,
933 + tree_cons (NULL_TREE, integer_type_node,
936 + /* long long func (int, int) */
937 + longlong_ftype_int_int
938 + = build_function_type (long_long_integer_type_node,
939 + tree_cons (NULL_TREE, integer_type_node,
942 + /* long long int func (long long, int, short) */
943 + longlong_ftype_longlong_int_short
944 + = build_function_type (long_long_integer_type_node,
945 + tree_cons (NULL_TREE, long_long_integer_type_node,
946 + tree_cons (NULL_TREE, integer_type_node,
949 + /* long long int func (int, short) */
950 + longlong_ftype_int_short
951 + = build_function_type (long_long_integer_type_node,
952 + tree_cons (NULL_TREE, integer_type_node,
955 + /* int func (int, short, short) */
956 + int_ftype_int_short_short
957 + = build_function_type (integer_type_node,
958 + tree_cons (NULL_TREE, integer_type_node,
959 + tree_cons (NULL_TREE,
960 + short_integer_type_node,
963 + /* int func (short, short) */
964 + int_ftype_short_short
965 + = build_function_type (integer_type_node,
966 + tree_cons (NULL_TREE, short_integer_type_node,
969 + /* int func (int, short) */
970 + int_ftype_int_short
971 + = build_function_type (integer_type_node,
972 + tree_cons (NULL_TREE, integer_type_node,
975 + /* void func (int, int) */
977 + = build_function_type (void_type_node,
978 + tree_cons (NULL_TREE, integer_type_node,
981 + /* void func (int, int, int) */
982 + void_ftype_int_int_int
983 + = build_function_type (void_type_node,
984 + tree_cons (NULL_TREE, integer_type_node,
985 + tree_cons (NULL_TREE, integer_type_node,
988 + /* void func (int, int, long long) */
989 + void_ftype_int_int_longlong
990 + = build_function_type (void_type_node,
991 + tree_cons (NULL_TREE, integer_type_node,
992 + tree_cons (NULL_TREE, integer_type_node,
993 + longlong_endlink)));
995 + /* void func (int, int, int, int, int) */
996 + void_ftype_int_int_int_int_int
997 + = build_function_type (void_type_node,
998 + tree_cons (NULL_TREE, integer_type_node,
999 + tree_cons (NULL_TREE, integer_type_node,
1000 + tree_cons (NULL_TREE,
1001 + integer_type_node,
1004 + integer_type_node,
1007 + /* void func (void *, int) */
1008 + void_ftype_ptr_int
1009 + = build_function_type (void_type_node,
1010 + tree_cons (NULL_TREE, ptr_type_node, int_endlink));
1012 + /* void func (int) */
1013 + void_ftype_int = build_function_type (void_type_node, int_endlink);
1015 + /* void func (void) */
1016 + void_ftype_void = build_function_type (void_type_node, void_endlink);
1018 + /* int func (void) */
1019 + int_ftype_void = build_function_type (integer_type_node, void_endlink);
1021 + /* int func (void *, int) */
1023 + = build_function_type (integer_type_node,
1024 + tree_cons (NULL_TREE, ptr_type_node, int_endlink));
1026 + /* int func (int, int, int) */
1027 + int_ftype_int_int_int
1028 + = build_function_type (integer_type_node,
1029 + tree_cons (NULL_TREE, integer_type_node,
1030 + tree_cons (NULL_TREE, integer_type_node,
1033 + /* Initialize avr32 builtins. */
1034 + def_builtin ("__builtin_mfsr", int_ftype_int, AVR32_BUILTIN_MFSR);
1035 + def_builtin ("__builtin_mtsr", void_ftype_int_int, AVR32_BUILTIN_MTSR);
1036 + def_builtin ("__builtin_mfdr", int_ftype_int, AVR32_BUILTIN_MFDR);
1037 + def_builtin ("__builtin_mtdr", void_ftype_int_int, AVR32_BUILTIN_MTDR);
1038 + def_builtin ("__builtin_cache", void_ftype_ptr_int, AVR32_BUILTIN_CACHE);
1039 + def_builtin ("__builtin_sync", void_ftype_int, AVR32_BUILTIN_SYNC);
1040 + def_builtin ("__builtin_tlbr", void_ftype_void, AVR32_BUILTIN_TLBR);
1041 + def_builtin ("__builtin_tlbs", void_ftype_void, AVR32_BUILTIN_TLBS);
1042 + def_builtin ("__builtin_tlbw", void_ftype_void, AVR32_BUILTIN_TLBW);
1043 + def_builtin ("__builtin_breakpoint", void_ftype_void,
1044 + AVR32_BUILTIN_BREAKPOINT);
1045 + def_builtin ("__builtin_xchg", int_ftype_ptr_int, AVR32_BUILTIN_XCHG);
1046 + def_builtin ("__builtin_ldxi", int_ftype_ptr_int, AVR32_BUILTIN_LDXI);
1047 + def_builtin ("__builtin_bswap_16", short_ftype_short,
1048 + AVR32_BUILTIN_BSWAP16);
1049 + def_builtin ("__builtin_bswap_32", int_ftype_int, AVR32_BUILTIN_BSWAP32);
1050 + def_builtin ("__builtin_cop", void_ftype_int_int_int_int_int,
1051 + AVR32_BUILTIN_COP);
1052 + def_builtin ("__builtin_mvcr_w", int_ftype_int_int, AVR32_BUILTIN_MVCR_W);
1053 + def_builtin ("__builtin_mvrc_w", void_ftype_int_int_int,
1054 + AVR32_BUILTIN_MVRC_W);
1055 + def_builtin ("__builtin_mvcr_d", longlong_ftype_int_int,
1056 + AVR32_BUILTIN_MVCR_D);
1057 + def_builtin ("__builtin_mvrc_d", void_ftype_int_int_longlong,
1058 + AVR32_BUILTIN_MVRC_D);
1059 + def_builtin ("__builtin_sats", int_ftype_int_int_int, AVR32_BUILTIN_SATS);
1060 + def_builtin ("__builtin_satu", int_ftype_int_int_int, AVR32_BUILTIN_SATU);
1061 + def_builtin ("__builtin_satrnds", int_ftype_int_int_int,
1062 + AVR32_BUILTIN_SATRNDS);
1063 + def_builtin ("__builtin_satrndu", int_ftype_int_int_int,
1064 + AVR32_BUILTIN_SATRNDU);
1065 + def_builtin ("__builtin_musfr", void_ftype_int, AVR32_BUILTIN_MUSFR);
1066 + def_builtin ("__builtin_mustr", int_ftype_void, AVR32_BUILTIN_MUSTR);
1067 + def_builtin ("__builtin_macsathh_w", int_ftype_int_short_short,
1068 + AVR32_BUILTIN_MACSATHH_W);
1069 + def_builtin ("__builtin_macwh_d", longlong_ftype_longlong_int_short,
1070 + AVR32_BUILTIN_MACWH_D);
1071 + def_builtin ("__builtin_machh_d", longlong_ftype_longlong_short_short,
1072 + AVR32_BUILTIN_MACHH_D);
1074 + /* Add all builtins that are more or less simple operations on two
1076 + for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
1078 + /* Use one of the operands; the target can have a different mode for
1079 + mask-generating compares. */
1084 + def_mbuiltin (d->mask, d->name, *(d->ftype), d->code);
1089 +/* Subroutine of avr32_expand_builtin to take care of binop insns. */
1092 +avr32_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
1095 + tree arg0 = TREE_VALUE (arglist);
1096 + tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1097 + rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1098 + rtx op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1099 + enum machine_mode tmode = insn_data[icode].operand[0].mode;
1100 + enum machine_mode mode0 = insn_data[icode].operand[1].mode;
1101 + enum machine_mode mode1 = insn_data[icode].operand[2].mode;
1104 + || GET_MODE (target) != tmode
1105 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1106 + target = gen_reg_rtx (tmode);
1108 + /* In case the insn wants input operands in modes different from the
1110 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1112 + /* If op0 is already a reg we must cast it to the correct mode. */
1114 + op0 = convert_to_mode (mode0, op0, 1);
1116 + op0 = copy_to_mode_reg (mode0, op0);
1118 + if (!(*insn_data[icode].operand[2].predicate) (op1, mode1))
1120 + /* If op1 is already a reg we must cast it to the correct mode. */
1122 + op1 = convert_to_mode (mode1, op1, 1);
1124 + op1 = copy_to_mode_reg (mode1, op1);
1126 + pat = GEN_FCN (icode) (target, op0, op1);
1133 +/* Expand an expression EXP that calls a built-in function,
1134 + with result going to TARGET if that's convenient
1135 + (and in mode MODE if that's convenient).
1136 + SUBTARGET may be used as the target for computing one of EXP's operands.
1137 + IGNORE is nonzero if the value is to be ignored. */
1140 +avr32_expand_builtin (tree exp,
1142 + rtx subtarget ATTRIBUTE_UNUSED,
1143 + enum machine_mode mode ATTRIBUTE_UNUSED,
1144 + int ignore ATTRIBUTE_UNUSED)
1146 + const struct builtin_description *d;
1148 + enum insn_code icode;
1149 + tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
1150 + tree arglist = TREE_OPERAND (exp, 1);
1151 + tree arg0, arg1, arg2;
1152 + rtx op0, op1, op2, pat;
1153 + enum machine_mode tmode, mode0, mode1;
1154 + enum machine_mode arg0_mode;
1155 + int fcode = DECL_FUNCTION_CODE (fndecl);
1162 + case AVR32_BUILTIN_SATS:
1163 + case AVR32_BUILTIN_SATU:
1164 + case AVR32_BUILTIN_SATRNDS:
1165 + case AVR32_BUILTIN_SATRNDU:
1167 + const char *fname;
1171 + case AVR32_BUILTIN_SATS:
1172 + icode = CODE_FOR_sats;
1175 + case AVR32_BUILTIN_SATU:
1176 + icode = CODE_FOR_satu;
1179 + case AVR32_BUILTIN_SATRNDS:
1180 + icode = CODE_FOR_satrnds;
1181 + fname = "satrnds";
1183 + case AVR32_BUILTIN_SATRNDU:
1184 + icode = CODE_FOR_satrndu;
1185 + fname = "satrndu";
1189 + arg0 = TREE_VALUE (arglist);
1190 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1191 + arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
1192 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1193 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1194 + op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
1196 + tmode = insn_data[icode].operand[0].mode;
1200 + || GET_MODE (target) != tmode
1201 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1202 + target = gen_reg_rtx (tmode);
1205 + if (!(*insn_data[icode].operand[0].predicate) (op0, GET_MODE (op0)))
1207 + op0 = copy_to_mode_reg (insn_data[icode].operand[0].mode, op0);
1210 + if (!(*insn_data[icode].operand[1].predicate) (op1, SImode))
1212 + error ("Parameter 2 to __builtin_%s should be a constant number.",
1217 + if (!(*insn_data[icode].operand[1].predicate) (op2, SImode))
1219 + error ("Parameter 3 to __builtin_%s should be a constant number.",
1224 + emit_move_insn (target, op0);
1225 + pat = GEN_FCN (icode) (target, op1, op2);
1232 + case AVR32_BUILTIN_MUSTR:
1233 + icode = CODE_FOR_mustr;
1234 + tmode = insn_data[icode].operand[0].mode;
1237 + || GET_MODE (target) != tmode
1238 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1239 + target = gen_reg_rtx (tmode);
1240 + pat = GEN_FCN (icode) (target);
1246 + case AVR32_BUILTIN_MFSR:
1247 + icode = CODE_FOR_mfsr;
1248 + arg0 = TREE_VALUE (arglist);
1249 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1250 + tmode = insn_data[icode].operand[0].mode;
1251 + mode0 = insn_data[icode].operand[1].mode;
1253 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1255 + error ("Parameter 1 to __builtin_mfsr must be a constant number");
1259 + || GET_MODE (target) != tmode
1260 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1261 + target = gen_reg_rtx (tmode);
1262 + pat = GEN_FCN (icode) (target, op0);
1267 + case AVR32_BUILTIN_MTSR:
1268 + icode = CODE_FOR_mtsr;
1269 + arg0 = TREE_VALUE (arglist);
1270 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1271 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1272 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1273 + mode0 = insn_data[icode].operand[0].mode;
1274 + mode1 = insn_data[icode].operand[1].mode;
1276 + if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1278 + error ("Parameter 1 to __builtin_mtsr must be a constant number");
1279 + return gen_reg_rtx (mode0);
1281 + if (!(*insn_data[icode].operand[1].predicate) (op1, mode1))
1282 + op1 = copy_to_mode_reg (mode1, op1);
1283 + pat = GEN_FCN (icode) (op0, op1);
1288 + case AVR32_BUILTIN_MFDR:
1289 + icode = CODE_FOR_mfdr;
1290 + arg0 = TREE_VALUE (arglist);
1291 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1292 + tmode = insn_data[icode].operand[0].mode;
1293 + mode0 = insn_data[icode].operand[1].mode;
1295 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1297 + error ("Parameter 1 to __builtin_mfdr must be a constant number");
1301 + || GET_MODE (target) != tmode
1302 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1303 + target = gen_reg_rtx (tmode);
1304 + pat = GEN_FCN (icode) (target, op0);
1309 + case AVR32_BUILTIN_MTDR:
1310 + icode = CODE_FOR_mtdr;
1311 + arg0 = TREE_VALUE (arglist);
1312 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1313 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1314 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1315 + mode0 = insn_data[icode].operand[0].mode;
1316 + mode1 = insn_data[icode].operand[1].mode;
1318 + if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1320 + error ("Parameter 1 to __builtin_mtdr must be a constant number");
1321 + return gen_reg_rtx (mode0);
1323 + if (!(*insn_data[icode].operand[1].predicate) (op1, mode1))
1324 + op1 = copy_to_mode_reg (mode1, op1);
1325 + pat = GEN_FCN (icode) (op0, op1);
1330 + case AVR32_BUILTIN_CACHE:
1331 + icode = CODE_FOR_cache;
1332 + arg0 = TREE_VALUE (arglist);
1333 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1334 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1335 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1336 + mode0 = insn_data[icode].operand[0].mode;
1337 + mode1 = insn_data[icode].operand[1].mode;
1339 + if (!(*insn_data[icode].operand[1].predicate) (op1, mode1))
1341 + error ("Parameter 2 to __builtin_cache must be a constant number");
1342 + return gen_reg_rtx (mode1);
1345 + if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1346 + op0 = copy_to_mode_reg (mode0, op0);
1348 + pat = GEN_FCN (icode) (op0, op1);
1353 + case AVR32_BUILTIN_SYNC:
1354 + case AVR32_BUILTIN_MUSFR:
1356 + const char *fname;
1360 + case AVR32_BUILTIN_SYNC:
1361 + icode = CODE_FOR_sync;
1364 + case AVR32_BUILTIN_MUSFR:
1365 + icode = CODE_FOR_musfr;
1370 + arg0 = TREE_VALUE (arglist);
1371 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1372 + mode0 = insn_data[icode].operand[0].mode;
1374 + if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1376 + if (icode == CODE_FOR_musfr)
1377 + op0 = copy_to_mode_reg (mode0, op0);
1380 + error ("Parameter to __builtin_%s is illegal.", fname);
1381 + return gen_reg_rtx (mode0);
1384 + pat = GEN_FCN (icode) (op0);
1390 + case AVR32_BUILTIN_TLBR:
1391 + icode = CODE_FOR_tlbr;
1392 + pat = GEN_FCN (icode) (NULL_RTX);
1397 + case AVR32_BUILTIN_TLBS:
1398 + icode = CODE_FOR_tlbs;
1399 + pat = GEN_FCN (icode) (NULL_RTX);
1404 + case AVR32_BUILTIN_TLBW:
1405 + icode = CODE_FOR_tlbw;
1406 + pat = GEN_FCN (icode) (NULL_RTX);
1411 + case AVR32_BUILTIN_BREAKPOINT:
1412 + icode = CODE_FOR_breakpoint;
1413 + pat = GEN_FCN (icode) (NULL_RTX);
1418 + case AVR32_BUILTIN_XCHG:
1419 + icode = CODE_FOR_sync_lock_test_and_setsi;
1420 + arg0 = TREE_VALUE (arglist);
1421 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1422 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1423 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1424 + tmode = insn_data[icode].operand[0].mode;
1425 + mode0 = insn_data[icode].operand[1].mode;
1426 + mode1 = insn_data[icode].operand[2].mode;
1428 + if (!(*insn_data[icode].operand[2].predicate) (op1, mode1))
1430 + op1 = copy_to_mode_reg (mode1, op1);
1433 + op0 = gen_rtx_MEM (SImode, op0);
1434 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1437 + ("Parameter 1 to __builtin_xchg must be a pointer to an integer.");
1441 + || GET_MODE (target) != tmode
1442 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1443 + target = gen_reg_rtx (tmode);
1444 + pat = GEN_FCN (icode) (target, op0, op1);
1449 + case AVR32_BUILTIN_LDXI:
1450 + icode = CODE_FOR_ldxi;
1451 + arg0 = TREE_VALUE (arglist);
1452 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1453 + arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
1454 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1455 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1456 + op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
1457 + tmode = insn_data[icode].operand[0].mode;
1458 + mode0 = insn_data[icode].operand[1].mode;
1459 + mode1 = insn_data[icode].operand[2].mode;
1461 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1463 + op0 = copy_to_mode_reg (mode0, op0);
1466 + if (!(*insn_data[icode].operand[2].predicate) (op1, mode1))
1468 + op1 = copy_to_mode_reg (mode1, op1);
1471 + if (!(*insn_data[icode].operand[3].predicate) (op2, SImode))
1474 + ("Parameter 3 to __builtin_ldxi must be a valid extract shift operand: (0|8|16|24)");
1475 + return gen_reg_rtx (mode0);
1479 + || GET_MODE (target) != tmode
1480 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1481 + target = gen_reg_rtx (tmode);
1482 + pat = GEN_FCN (icode) (target, op0, op1, op2);
1487 + case AVR32_BUILTIN_BSWAP16:
1489 + icode = CODE_FOR_bswap_16;
1490 + arg0 = TREE_VALUE (arglist);
1491 + arg0_mode = TYPE_MODE (TREE_TYPE (arg0));
1492 + mode0 = insn_data[icode].operand[1].mode;
1493 + if (arg0_mode != mode0)
1494 + arg0 = build1 (NOP_EXPR,
1495 + (*lang_hooks.types.type_for_mode) (mode0, 0), arg0);
1497 + op0 = expand_expr (arg0, NULL_RTX, HImode, 0);
1498 + tmode = insn_data[icode].operand[0].mode;
1501 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1503 + op0 = copy_to_mode_reg (mode0, op0);
1507 + || GET_MODE (target) != tmode
1508 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1510 + target = gen_reg_rtx (tmode);
1514 + pat = GEN_FCN (icode) (target, op0);
1521 + case AVR32_BUILTIN_BSWAP32:
1523 + icode = CODE_FOR_bswap_32;
1524 + arg0 = TREE_VALUE (arglist);
1525 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1526 + tmode = insn_data[icode].operand[0].mode;
1527 + mode0 = insn_data[icode].operand[1].mode;
1529 + if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1531 + op0 = copy_to_mode_reg (mode0, op0);
1535 + || GET_MODE (target) != tmode
1536 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1537 + target = gen_reg_rtx (tmode);
1540 + pat = GEN_FCN (icode) (target, op0);
1547 + case AVR32_BUILTIN_MVCR_W:
1548 + case AVR32_BUILTIN_MVCR_D:
1550 + arg0 = TREE_VALUE (arglist);
1551 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1552 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1553 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1555 + if (fcode == AVR32_BUILTIN_MVCR_W)
1556 + icode = CODE_FOR_mvcrsi;
1558 + icode = CODE_FOR_mvcrdi;
1560 + tmode = insn_data[icode].operand[0].mode;
1563 + || GET_MODE (target) != tmode
1564 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1565 + target = gen_reg_rtx (tmode);
1567 + if (!(*insn_data[icode].operand[1].predicate) (op0, SImode))
1570 + ("Parameter 1 to __builtin_cop is not a valid coprocessor number.");
1571 + error ("Number should be between 0 and 7.");
1575 + if (!(*insn_data[icode].operand[2].predicate) (op1, SImode))
1578 + ("Parameter 2 to __builtin_cop is not a valid coprocessor register number.");
1579 + error ("Number should be between 0 and 15.");
1583 + pat = GEN_FCN (icode) (target, op0, op1);
1590 + case AVR32_BUILTIN_MACSATHH_W:
1591 + case AVR32_BUILTIN_MACWH_D:
1592 + case AVR32_BUILTIN_MACHH_D:
1594 + arg0 = TREE_VALUE (arglist);
1595 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1596 + arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
1597 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1598 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1599 + op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
1601 + icode = ((fcode == AVR32_BUILTIN_MACSATHH_W) ? CODE_FOR_macsathh_w :
1602 + (fcode == AVR32_BUILTIN_MACWH_D) ? CODE_FOR_macwh_d :
1603 + CODE_FOR_machh_d);
1605 + tmode = insn_data[icode].operand[0].mode;
1606 + mode0 = insn_data[icode].operand[1].mode;
1607 + mode1 = insn_data[icode].operand[2].mode;
1611 + || GET_MODE (target) != tmode
1612 + || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1613 + target = gen_reg_rtx (tmode);
1615 + if (!(*insn_data[icode].operand[0].predicate) (op0, tmode))
1617 + /* If op0 is already a reg we must cast it to the correct mode. */
1619 + op0 = convert_to_mode (tmode, op0, 1);
1621 + op0 = copy_to_mode_reg (tmode, op0);
1624 + if (!(*insn_data[icode].operand[1].predicate) (op1, mode0))
1626 + /* If op1 is already a reg we must cast it to the correct mode. */
1628 + op1 = convert_to_mode (mode0, op1, 1);
1630 + op1 = copy_to_mode_reg (mode0, op1);
1633 + if (!(*insn_data[icode].operand[2].predicate) (op2, mode1))
1635 + /* If op1 is already a reg we must cast it to the correct mode. */
1637 + op2 = convert_to_mode (mode1, op2, 1);
1639 + op2 = copy_to_mode_reg (mode1, op2);
1642 + emit_move_insn (target, op0);
1644 + pat = GEN_FCN (icode) (target, op1, op2);
1650 + case AVR32_BUILTIN_MVRC_W:
1651 + case AVR32_BUILTIN_MVRC_D:
1653 + arg0 = TREE_VALUE (arglist);
1654 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1655 + arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
1656 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1657 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1658 + op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
1660 + if (fcode == AVR32_BUILTIN_MVRC_W)
1661 + icode = CODE_FOR_mvrcsi;
1663 + icode = CODE_FOR_mvrcdi;
1665 + if (!(*insn_data[icode].operand[0].predicate) (op0, SImode))
1667 + error ("Parameter 1 is not a valid coprocessor number.");
1668 + error ("Number should be between 0 and 7.");
1672 + if (!(*insn_data[icode].operand[1].predicate) (op1, SImode))
1674 + error ("Parameter 2 is not a valid coprocessor register number.");
1675 + error ("Number should be between 0 and 15.");
1679 + if (GET_CODE (op2) == CONST_INT
1680 + || GET_CODE (op2) == CONST
1681 + || GET_CODE (op2) == SYMBOL_REF || GET_CODE (op2) == LABEL_REF)
1683 + op2 = force_const_mem (insn_data[icode].operand[2].mode, op2);
1686 + if (!(*insn_data[icode].operand[2].predicate) (op2, GET_MODE (op2)))
1687 + op2 = copy_to_mode_reg (insn_data[icode].operand[2].mode, op2);
1690 + pat = GEN_FCN (icode) (op0, op1, op2);
1697 + case AVR32_BUILTIN_COP:
1701 + icode = CODE_FOR_cop;
1702 + arg0 = TREE_VALUE (arglist);
1703 + arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1704 + arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
1705 + arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist))));
1707 + TREE_VALUE (TREE_CHAIN
1708 + (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist)))));
1709 + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1710 + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1711 + op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
1712 + op3 = expand_expr (arg3, NULL_RTX, VOIDmode, 0);
1713 + op4 = expand_expr (arg4, NULL_RTX, VOIDmode, 0);
1715 + if (!(*insn_data[icode].operand[0].predicate) (op0, SImode))
1718 + ("Parameter 1 to __builtin_cop is not a valid coprocessor number.");
1719 + error ("Number should be between 0 and 7.");
1723 + if (!(*insn_data[icode].operand[1].predicate) (op1, SImode))
1726 + ("Parameter 2 to __builtin_cop is not a valid coprocessor register number.");
1727 + error ("Number should be between 0 and 15.");
1731 + if (!(*insn_data[icode].operand[2].predicate) (op2, SImode))
1734 + ("Parameter 3 to __builtin_cop is not a valid coprocessor register number.");
1735 + error ("Number should be between 0 and 15.");
1739 + if (!(*insn_data[icode].operand[3].predicate) (op3, SImode))
1742 + ("Parameter 4 to __builtin_cop is not a valid coprocessor register number.");
1743 + error ("Number should be between 0 and 15.");
1747 + if (!(*insn_data[icode].operand[4].predicate) (op4, SImode))
1750 + ("Parameter 5 to __builtin_cop is not a valid coprocessor operation.");
1751 + error ("Number should be between 0 and 127.");
1755 + pat = GEN_FCN (icode) (op0, op1, op2, op3, op4);
1764 + for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
1765 + if (d->code == fcode)
1766 + return avr32_expand_binop_builtin (d->icode, arglist, target);
1769 + /* @@@ Should really do something sensible here. */
1774 +/* Handle an "interrupt" or "isr" attribute;
1775 + arguments as in struct attribute_spec.handler. */
1778 +avr32_handle_isr_attribute (tree * node, tree name, tree args,
1779 + int flags, bool * no_add_attrs)
1781 + if (DECL_P (*node))
1783 + if (TREE_CODE (*node) != FUNCTION_DECL)
1785 + warning ("`%s' attribute only applies to functions",
1786 + IDENTIFIER_POINTER (name));
1787 + *no_add_attrs = true;
1789 + /* FIXME: the argument if any is checked for type attributes; should it
1790 + be checked for decl ones? */
1794 + if (TREE_CODE (*node) == FUNCTION_TYPE
1795 + || TREE_CODE (*node) == METHOD_TYPE)
1797 + if (avr32_isr_value (args) == AVR32_FT_UNKNOWN)
1799 + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
1800 + *no_add_attrs = true;
1803 + else if (TREE_CODE (*node) == POINTER_TYPE
1804 + && (TREE_CODE (TREE_TYPE (*node)) == FUNCTION_TYPE
1805 + || TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE)
1806 + && avr32_isr_value (args) != AVR32_FT_UNKNOWN)
1808 + *node = build_variant_type_copy (*node);
1809 + TREE_TYPE (*node) = build_type_attribute_variant
1810 + (TREE_TYPE (*node),
1811 + tree_cons (name, args, TYPE_ATTRIBUTES (TREE_TYPE (*node))));
1812 + *no_add_attrs = true;
1816 + /* Possibly pass this attribute on from the type to a decl. */
1817 + if (flags & ((int) ATTR_FLAG_DECL_NEXT
1818 + | (int) ATTR_FLAG_FUNCTION_NEXT
1819 + | (int) ATTR_FLAG_ARRAY_NEXT))
1821 + *no_add_attrs = true;
1822 + return tree_cons (name, args, NULL_TREE);
1826 + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
1834 +/* Handle an attribute requiring a FUNCTION_DECL;
1835 + arguments as in struct attribute_spec.handler. */
1837 +avr32_handle_fndecl_attribute (tree * node, tree name,
1838 + tree args ATTRIBUTE_UNUSED,
1839 + int flags ATTRIBUTE_UNUSED,
1840 + bool * no_add_attrs)
1842 + if (TREE_CODE (*node) != FUNCTION_DECL)
1844 + warning ("%qs attribute only applies to functions",
1845 + IDENTIFIER_POINTER (name));
1846 + *no_add_attrs = true;
1853 +/* Handle an acall attribute;
1854 + arguments as in struct attribute_spec.handler. */
1857 +avr32_handle_acall_attribute (tree * node, tree name,
1858 + tree args ATTRIBUTE_UNUSED,
1859 + int flags ATTRIBUTE_UNUSED, bool * no_add_attrs)
1861 + if (TREE_CODE (*node) == FUNCTION_TYPE || TREE_CODE (*node) == METHOD_TYPE)
1863 + warning ("`%s' attribute not yet supported...",
1864 + IDENTIFIER_POINTER (name));
1865 + *no_add_attrs = true;
1869 + warning ("`%s' attribute only applies to functions",
1870 + IDENTIFIER_POINTER (name));
1871 + *no_add_attrs = true;
1876 +/* Return 0 if the attributes for two types are incompatible, 1 if they
1877 + are compatible, and 2 if they are nearly compatible (which causes a
1878 + warning to be generated). */
1881 +avr32_comp_type_attributes (tree type1, tree type2)
1883 + int acall1, acall2, isr1, isr2, naked1, naked2;
1885 + /* Check for mismatch of non-default calling convention. */
1886 + if (TREE_CODE (type1) != FUNCTION_TYPE)
1889 + /* Check for mismatched call attributes. */
1890 + acall1 = lookup_attribute ("acall", TYPE_ATTRIBUTES (type1)) != NULL;
1891 + acall2 = lookup_attribute ("acall", TYPE_ATTRIBUTES (type2)) != NULL;
1892 + naked1 = lookup_attribute ("naked", TYPE_ATTRIBUTES (type1)) != NULL;
1893 + naked2 = lookup_attribute ("naked", TYPE_ATTRIBUTES (type2)) != NULL;
1894 + isr1 = lookup_attribute ("isr", TYPE_ATTRIBUTES (type1)) != NULL;
1896 + isr1 = lookup_attribute ("interrupt", TYPE_ATTRIBUTES (type1)) != NULL;
1898 + isr2 = lookup_attribute ("isr", TYPE_ATTRIBUTES (type2)) != NULL;
1900 + isr2 = lookup_attribute ("interrupt", TYPE_ATTRIBUTES (type2)) != NULL;
1902 + if ((acall1 && isr2)
1903 + || (acall2 && isr1) || (naked1 && isr2) || (naked2 && isr1))
1910 +/* Computes the type of the current function. */
1912 +static unsigned long
1913 +avr32_compute_func_type (void)
1915 + unsigned long type = AVR32_FT_UNKNOWN;
1919 + if (TREE_CODE (current_function_decl) != FUNCTION_DECL)
1922 + /* Decide if the current function is volatile. Such functions never
1923 + return, and many memory cycles can be saved by not storing register
1924 + values that will never be needed again. This optimization was added to
1925 + speed up context switching in a kernel application. */
1927 + && TREE_NOTHROW (current_function_decl)
1928 + && TREE_THIS_VOLATILE (current_function_decl))
1929 + type |= AVR32_FT_VOLATILE;
1931 + if (cfun->static_chain_decl != NULL)
1932 + type |= AVR32_FT_NESTED;
1934 + attr = DECL_ATTRIBUTES (current_function_decl);
1936 + a = lookup_attribute ("isr", attr);
1937 + if (a == NULL_TREE)
1938 + a = lookup_attribute ("interrupt", attr);
1940 + if (a == NULL_TREE)
1941 + type |= AVR32_FT_NORMAL;
1943 + type |= avr32_isr_value (TREE_VALUE (a));
1946 + a = lookup_attribute ("acall", attr);
1947 + if (a != NULL_TREE)
1948 + type |= AVR32_FT_ACALL;
1950 + a = lookup_attribute ("naked", attr);
1951 + if (a != NULL_TREE)
1952 + type |= AVR32_FT_NAKED;
1957 +/* Returns the type of the current function. */
1959 +static unsigned long
1960 +avr32_current_func_type (void)
1962 + if (AVR32_FUNC_TYPE (cfun->machine->func_type) == AVR32_FT_UNKNOWN)
1963 + cfun->machine->func_type = avr32_compute_func_type ();
1965 + return cfun->machine->func_type;
1969 + This target hook should return true if we should not pass type solely
1970 + in registers. The file expr.h defines a definition that is usually appropriate,
1971 + refer to expr.h for additional documentation.
1974 +avr32_must_pass_in_stack (enum machine_mode mode ATTRIBUTE_UNUSED, tree type)
1976 + if (type && AGGREGATE_TYPE_P (type)
1977 + /* If the alignment is less than the size then pass in the struct on
1979 + && ((unsigned int) TYPE_ALIGN_UNIT (type) <
1980 + (unsigned int) int_size_in_bytes (type))
1981 + /* If we support unaligned word accesses then structs of size 4 and 8
1982 + can have any alignment and still be passed in registers. */
1983 + && !(TARGET_UNALIGNED_WORD
1984 + && (int_size_in_bytes (type) == 4
1985 + || int_size_in_bytes (type) == 8))
1986 + /* Double word structs need only a word alignment. */
1987 + && !(int_size_in_bytes (type) == 8 && TYPE_ALIGN_UNIT (type) >= 4))
1990 + if (type && AGGREGATE_TYPE_P (type)
1991 + /* Structs of size 3,5,6,7 are always passed in registers. */
1992 + && (int_size_in_bytes (type) == 3
1993 + || int_size_in_bytes (type) == 5
1994 + || int_size_in_bytes (type) == 6 || int_size_in_bytes (type) == 7))
1998 + return (type && TREE_ADDRESSABLE (type));
2003 +avr32_strict_argument_naming (CUMULATIVE_ARGS * ca ATTRIBUTE_UNUSED)
2009 + This target hook should return true if an argument at the position indicated
2010 + by cum should be passed by reference. This predicate is queried after target
2011 + independent reasons for being passed by reference, such as TREE_ADDRESSABLE (type).
2013 + If the hook returns true, a copy of that argument is made in memory and a
2014 + pointer to the argument is passed instead of the argument itself. The pointer
2015 + is passed in whatever way is appropriate for passing a pointer to that type.
2018 +avr32_pass_by_reference (CUMULATIVE_ARGS * cum ATTRIBUTE_UNUSED,
2019 + enum machine_mode mode ATTRIBUTE_UNUSED,
2020 + tree type, bool named ATTRIBUTE_UNUSED)
2022 + return (type && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST));
2026 +avr32_arg_partial_bytes (CUMULATIVE_ARGS * pcum ATTRIBUTE_UNUSED,
2027 + enum machine_mode mode ATTRIBUTE_UNUSED,
2028 + tree type ATTRIBUTE_UNUSED,
2029 + bool named ATTRIBUTE_UNUSED)
2035 +struct gcc_target targetm = TARGET_INITIALIZER;
2038 + Table used to convert from register number in the assembler instructions and
2039 + the register numbers used in gcc.
2041 +const int avr32_function_arg_reglist[] = {
2042 + INTERNAL_REGNUM (12),
2043 + INTERNAL_REGNUM (11),
2044 + INTERNAL_REGNUM (10),
2045 + INTERNAL_REGNUM (9),
2046 + INTERNAL_REGNUM (8)
2049 +rtx avr32_compare_op0 = NULL_RTX;
2050 +rtx avr32_compare_op1 = NULL_RTX;
2051 +rtx avr32_compare_operator = NULL_RTX;
2052 +rtx avr32_acc_cache = NULL_RTX;
2055 + Returns nonzero if it is allowed to store a value of mode mode in hard
2056 + register number regno.
2059 +avr32_hard_regno_mode_ok (int regnr, enum machine_mode mode)
2061 + /* We allow only float modes in the fp-registers */
2062 + if (regnr >= FIRST_FP_REGNUM
2063 + && regnr <= LAST_FP_REGNUM && GET_MODE_CLASS (mode) != MODE_FLOAT)
2070 + case DImode: /* long long */
2071 + case DFmode: /* double */
2072 + case SCmode: /* __complex__ float */
2073 + case CSImode: /* __complex__ int */
2075 + { /* long long int not supported in r12, sp, lr
2081 + if (regnr % 2) /* long long int has to be refered in even
2087 + case CDImode: /* __complex__ long long */
2088 + case DCmode: /* __complex__ double */
2089 + case TImode: /* 16 bytes */
2092 + else if (regnr % 2)
2103 +avr32_rnd_operands (rtx add, rtx shift)
2105 + if (GET_CODE (shift) == CONST_INT &&
2106 + GET_CODE (add) == CONST_INT && INTVAL (shift) > 0)
2108 + if ((1 << (INTVAL (shift) - 1)) == INTVAL (add))
2118 +avr32_const_ok_for_constraint_p (HOST_WIDE_INT value, char c, const char *str)
2125 + HOST_WIDE_INT min_value = 0, max_value = 0;
2129 + size_str[0] = str[2];
2130 + size_str[1] = str[3];
2131 + size_str[2] = '\0';
2132 + const_size = atoi (size_str);
2134 + if (toupper (str[1]) == 'U')
2137 + max_value = (1 << const_size) - 1;
2139 + else if (toupper (str[1]) == 'S')
2141 + min_value = -(1 << (const_size - 1));
2142 + max_value = (1 << (const_size - 1)) - 1;
2150 + if (value >= min_value && value <= max_value)
2157 + return avr32_mask_upper_bits_operand (GEN_INT (value), VOIDmode);
2164 +/*Compute mask of which floating-point registers needs saving upon
2165 + entry to this function*/
2166 +static unsigned long
2167 +avr32_compute_save_fp_reg_mask (void)
2169 + unsigned long func_type = avr32_current_func_type ();
2170 + unsigned int save_reg_mask = 0;
2172 + unsigned int max_reg = 7;
2173 + int save_all_call_used_regs = FALSE;
2175 + /* This only applies for hardware floating-point implementation. */
2176 + if (!TARGET_HARD_FLOAT)
2179 + if (IS_INTERRUPT (func_type))
2182 + /* Interrupt functions must not corrupt any registers, even call
2183 + clobbered ones. If this is a leaf function we can just examine the
2184 + registers used by the RTL, but otherwise we have to assume that
2185 + whatever function is called might clobber anything, and so we have
2186 + to save all the call-clobbered registers as well. */
2188 + save_all_call_used_regs = !current_function_is_leaf;
2191 + /* All used registers used must be saved */
2192 + for (reg = 0; reg <= max_reg; reg++)
2193 + if (regs_ever_live[INTERNAL_FP_REGNUM (reg)]
2194 + || (save_all_call_used_regs
2195 + && call_used_regs[INTERNAL_FP_REGNUM (reg)]))
2196 + save_reg_mask |= (1 << reg);
2198 + return save_reg_mask;
2201 +/*Compute mask of registers which needs saving upon function entry */
2202 +static unsigned long
2203 +avr32_compute_save_reg_mask (int push)
2205 + unsigned long func_type;
2206 + unsigned int save_reg_mask = 0;
2209 + func_type = avr32_current_func_type ();
2211 + if (IS_INTERRUPT (func_type))
2213 + unsigned int max_reg = 12;
2216 + /* Get the banking scheme for the interrupt */
2217 + switch (func_type)
2219 + case AVR32_FT_ISR_FULL:
2222 + case AVR32_FT_ISR_HALF:
2225 + case AVR32_FT_ISR_NONE:
2230 + /* Interrupt functions must not corrupt any registers, even call
2231 + clobbered ones. If this is a leaf function we can just examine the
2232 + registers used by the RTL, but otherwise we have to assume that
2233 + whatever function is called might clobber anything, and so we have
2234 + to save all the call-clobbered registers as well. */
2236 + /* Need not push the registers r8-r12 for AVR32A architectures, as this
2237 + is automatially done in hardware. We also do not have any shadow
2239 + if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A)
2242 + func_type = AVR32_FT_ISR_NONE;
2245 + /* All registers which are used and is not shadowed must be saved */
2246 + for (reg = 0; reg <= max_reg; reg++)
2247 + if (regs_ever_live[INTERNAL_REGNUM (reg)]
2248 + || (!current_function_is_leaf
2249 + && call_used_regs[INTERNAL_REGNUM (reg)]))
2250 + save_reg_mask |= (1 << reg);
2253 + if ((regs_ever_live[LR_REGNUM]
2254 + || !current_function_is_leaf || frame_pointer_needed)
2255 + /* Only non-shadowed register models */
2256 + && (func_type == AVR32_FT_ISR_NONE))
2257 + save_reg_mask |= (1 << ASM_REGNUM (LR_REGNUM));
2259 + /* Make sure that the GOT register is pushed. */
2260 + if (max_reg >= ASM_REGNUM (PIC_OFFSET_TABLE_REGNUM)
2261 + && current_function_uses_pic_offset_table)
2262 + save_reg_mask |= (1 << ASM_REGNUM (PIC_OFFSET_TABLE_REGNUM));
2267 + int use_pushm = optimize_size;
2269 + /* In the normal case we only need to save those registers which are
2270 + call saved and which are used by this function. */
2271 + for (reg = 0; reg <= 7; reg++)
2272 + if (regs_ever_live[INTERNAL_REGNUM (reg)]
2273 + && !call_used_regs[INTERNAL_REGNUM (reg)])
2274 + save_reg_mask |= (1 << reg);
2276 + /* Make sure that the GOT register is pushed. */
2277 + if (current_function_uses_pic_offset_table)
2278 + save_reg_mask |= (1 << ASM_REGNUM (PIC_OFFSET_TABLE_REGNUM));
2281 + /* If we optimize for size and do not have anonymous arguments: use
2282 + popm/pushm always */
2285 + if ((save_reg_mask & (1 << 0))
2286 + || (save_reg_mask & (1 << 1))
2287 + || (save_reg_mask & (1 << 2)) || (save_reg_mask & (1 << 3)))
2288 + save_reg_mask |= 0xf;
2290 + if ((save_reg_mask & (1 << 4))
2291 + || (save_reg_mask & (1 << 5))
2292 + || (save_reg_mask & (1 << 6)) || (save_reg_mask & (1 << 7)))
2293 + save_reg_mask |= 0xf0;
2295 + if ((save_reg_mask & (1 << 8)) || (save_reg_mask & (1 << 9)))
2296 + save_reg_mask |= 0x300;
2301 + if ((regs_ever_live[LR_REGNUM]
2302 + || !current_function_is_leaf
2305 + && !current_function_calls_eh_return) || frame_pointer_needed))
2308 + /* Never pop LR into PC for functions which
2309 + calls __builtin_eh_return, since we need to
2310 + fix the SP after the restoring of the registers
2311 + and before returning. */
2312 + || current_function_calls_eh_return)
2315 + save_reg_mask |= (1 << ASM_REGNUM (LR_REGNUM));
2320 + save_reg_mask |= (1 << ASM_REGNUM (PC_REGNUM));
2326 + /* Save registers so the exception handler can modify them. */
2327 + if (current_function_calls_eh_return)
2333 + reg = EH_RETURN_DATA_REGNO (i);
2334 + if (reg == INVALID_REGNUM)
2336 + save_reg_mask |= 1 << ASM_REGNUM (reg);
2340 + return save_reg_mask;
2343 +/*Compute total size in bytes of all saved registers */
2345 +avr32_get_reg_mask_size (int reg_mask)
2350 + for (reg = 0; reg <= 15; reg++)
2351 + if (reg_mask & (1 << reg))
2357 +/*Get a register from one of the registers which are saved onto the stack
2358 + upon function entry */
2361 +avr32_get_saved_reg (int save_reg_mask)
2365 + /* Find the first register which is saved in the saved_reg_mask */
2366 + for (reg = 0; reg <= 15; reg++)
2367 + if (save_reg_mask & (1 << reg))
2373 +/* Return 1 if it is possible to return using a single instruction. */
2375 +avr32_use_return_insn (int iscond)
2377 + unsigned int func_type = avr32_current_func_type ();
2378 + unsigned long saved_int_regs;
2379 + unsigned long saved_fp_regs;
2381 + /* Never use a return instruction before reload has run. */
2382 + if (!reload_completed)
2385 + /* Must adjust the stack for vararg functions. */
2386 + if (current_function_args_info.uses_anonymous_args)
2389 + /* If there a stack adjstment. */
2390 + if (get_frame_size ())
2393 + saved_int_regs = avr32_compute_save_reg_mask (TRUE);
2394 + saved_fp_regs = avr32_compute_save_fp_reg_mask ();
2396 + /* Functions which have saved fp-regs on the stack can not be performed in
2397 + one instruction */
2398 + if (saved_fp_regs)
2401 + /* Conditional returns can not be performed in one instruction if we need
2402 + to restore registers from the stack */
2403 + if (iscond && saved_int_regs)
2406 + /* Conditional return can not be used for interrupt handlers. */
2407 + if (iscond && IS_INTERRUPT (func_type))
2410 + /* For interrupt handlers which needs to pop registers */
2411 + if (saved_int_regs && IS_INTERRUPT (func_type))
2415 + /* If there are saved registers but the LR isn't saved, then we need two
2416 + instructions for the return. */
2417 + if (saved_int_regs && !(saved_int_regs & (1 << ASM_REGNUM (LR_REGNUM))))
2425 +/*Generate some function prologue info in the assembly file*/
2428 +avr32_target_asm_function_prologue (FILE * f, HOST_WIDE_INT frame_size)
2430 + if (IS_NAKED (avr32_current_func_type ()))
2432 + "\t# Function is naked: Prologue and epilogue provided by programmer\n");
2434 + if (IS_INTERRUPT (avr32_current_func_type ()))
2436 + switch (avr32_current_func_type ())
2438 + case AVR32_FT_ISR_FULL:
2440 + "\t# Interrupt Function: Fully shadowed register file\n");
2442 + case AVR32_FT_ISR_HALF:
2444 + "\t# Interrupt Function: Half shadowed register file\n");
2447 + case AVR32_FT_ISR_NONE:
2448 + fprintf (f, "\t# Interrupt Function: No shadowed register file\n");
2454 + fprintf (f, "\t# args = %i, frame = %li, pretend = %i\n",
2455 + current_function_args_size, frame_size,
2456 + current_function_pretend_args_size);
2458 + fprintf (f, "\t# frame_needed = %i, leaf_function = %i\n",
2459 + frame_pointer_needed, current_function_is_leaf);
2461 + fprintf (f, "\t# uses_anonymous_args = %i\n",
2462 + current_function_args_info.uses_anonymous_args);
2463 + if (current_function_calls_eh_return)
2464 + fprintf (f, "\t# Calls __builtin_eh_return.\n");
2469 +/* Generate and emit an insn that we will recognize as a pushm or stm.
2470 + Unfortunately, since this insn does not reflect very well the actual
2471 + semantics of the operation, we need to annotate the insn for the benefit
2472 + of DWARF2 frame unwind information. */
2474 +int avr32_convert_to_reglist16 (int reglist8_vect);
2477 +emit_multi_reg_push (int reglist, int usePUSHM)
2489 + insn = emit_insn (gen_pushm (gen_rtx_CONST_INT (SImode, reglist)));
2490 + reglist = avr32_convert_to_reglist16 (reglist);
2494 + insn = emit_insn (gen_stm (stack_pointer_rtx,
2495 + gen_rtx_CONST_INT (SImode, reglist),
2496 + gen_rtx_CONST_INT (SImode, 1)));
2499 + nr_regs = avr32_get_reg_mask_size (reglist) / 4;
2500 + dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (nr_regs + 1));
2502 + for (i = 15; i >= 0; i--)
2504 + if (reglist & (1 << i))
2506 + reg = gen_rtx_REG (SImode, INTERNAL_REGNUM (i));
2507 + tmp = gen_rtx_SET (VOIDmode,
2508 + gen_rtx_MEM (SImode,
2509 + plus_constant (stack_pointer_rtx,
2510 + 4 * index)), reg);
2511 + RTX_FRAME_RELATED_P (tmp) = 1;
2512 + XVECEXP (dwarf, 0, 1 + index++) = tmp;
2516 + tmp = gen_rtx_SET (SImode,
2517 + stack_pointer_rtx,
2518 + gen_rtx_PLUS (SImode,
2519 + stack_pointer_rtx,
2520 + GEN_INT (-4 * nr_regs)));
2521 + RTX_FRAME_RELATED_P (tmp) = 1;
2522 + XVECEXP (dwarf, 0, 0) = tmp;
2523 + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
2524 + REG_NOTES (insn));
2530 +emit_multi_fp_reg_push (int reglist)
2540 + insn = emit_insn (gen_stm_fp (stack_pointer_rtx,
2541 + gen_rtx_CONST_INT (SImode, reglist),
2542 + gen_rtx_CONST_INT (SImode, 1)));
2544 + nr_regs = avr32_get_reg_mask_size (reglist) / 4;
2545 + dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (nr_regs + 1));
2547 + for (i = 15; i >= 0; i--)
2549 + if (reglist & (1 << i))
2551 + reg = gen_rtx_REG (SImode, INTERNAL_FP_REGNUM (i));
2552 + tmp = gen_rtx_SET (VOIDmode,
2553 + gen_rtx_MEM (SImode,
2554 + plus_constant (stack_pointer_rtx,
2555 + 4 * index)), reg);
2556 + RTX_FRAME_RELATED_P (tmp) = 1;
2557 + XVECEXP (dwarf, 0, 1 + index++) = tmp;
2561 + tmp = gen_rtx_SET (SImode,
2562 + stack_pointer_rtx,
2563 + gen_rtx_PLUS (SImode,
2564 + stack_pointer_rtx,
2565 + GEN_INT (-4 * nr_regs)));
2566 + RTX_FRAME_RELATED_P (tmp) = 1;
2567 + XVECEXP (dwarf, 0, 0) = tmp;
2568 + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
2569 + REG_NOTES (insn));
2574 +avr32_gen_load_multiple (rtx * regs, int count, rtx from,
2575 + int write_back, int in_struct_p, int scalar_p)
2582 + gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + (write_back ? 1 : 0)));
2586 + XVECEXP (result, 0, 0)
2587 + = gen_rtx_SET (GET_MODE (from), from,
2588 + plus_constant (from, count * 4));
2594 + for (j = 0; i < count; i++, j++)
2597 + rtx mem = gen_rtx_MEM (SImode, plus_constant (from, j * 4));
2598 + MEM_IN_STRUCT_P (mem) = in_struct_p;
2599 + MEM_SCALAR_P (mem) = scalar_p;
2600 + unspec = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, mem), UNSPEC_LDM);
2601 + XVECEXP (result, 0, i) = gen_rtx_SET (VOIDmode, regs[j], unspec);
2609 +avr32_gen_store_multiple (rtx * regs, int count, rtx to,
2610 + int in_struct_p, int scalar_p)
2615 + result = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2617 + for (j = 0; i < count; i++, j++)
2619 + rtx mem = gen_rtx_MEM (SImode, plus_constant (to, j * 4));
2620 + MEM_IN_STRUCT_P (mem) = in_struct_p;
2621 + MEM_SCALAR_P (mem) = scalar_p;
2622 + XVECEXP (result, 0, i)
2623 + = gen_rtx_SET (VOIDmode, mem,
2624 + gen_rtx_UNSPEC (VOIDmode,
2625 + gen_rtvec (1, regs[j]),
2626 + UNSPEC_STORE_MULTIPLE));
2633 +/* Move a block of memory if it is word aligned or we support unaligned
2634 + word memory accesses. The size must be maximum 64 bytes. */
2637 +avr32_gen_movmemsi (rtx * operands)
2639 + HOST_WIDE_INT bytes_to_go;
2641 + rtx st_src, st_dst;
2642 + int ptr_offset = 0;
2644 + int dst_in_struct_p, src_in_struct_p;
2645 + int dst_scalar_p, src_scalar_p;
2648 + if (GET_CODE (operands[2]) != CONST_INT
2649 + || GET_CODE (operands[3]) != CONST_INT
2650 + || INTVAL (operands[2]) > 64
2651 + || ((INTVAL (operands[3]) & 3) && !TARGET_UNALIGNED_WORD))
2654 + unaligned = (INTVAL (operands[3]) & 3) != 0;
2658 + st_dst = XEXP (operands[0], 0);
2659 + st_src = XEXP (operands[1], 0);
2661 + dst_in_struct_p = MEM_IN_STRUCT_P (operands[0]);
2662 + dst_scalar_p = MEM_SCALAR_P (operands[0]);
2663 + src_in_struct_p = MEM_IN_STRUCT_P (operands[1]);
2664 + src_scalar_p = MEM_SCALAR_P (operands[1]);
2666 + dst = copy_to_mode_reg (SImode, st_dst);
2667 + src = copy_to_mode_reg (SImode, st_src);
2669 + bytes_to_go = INTVAL (operands[2]);
2671 + while (bytes_to_go)
2673 + enum machine_mode move_mode;
2674 + /* (Seems to be a problem with reloads for the movti pattern so this is
2675 + disabled until that problem is resolved)
2676 + UPDATE: Problem seems to be solved now.... */
2677 + if (bytes_to_go >= GET_MODE_SIZE (TImode) && !unaligned
2678 + /* Do not emit ldm/stm for UC3 as ld.d/st.d is more optimal. */
2679 + && avr32_arch->arch_type != ARCH_TYPE_AVR32_UC)
2680 + move_mode = TImode;
2681 + else if ((bytes_to_go >= GET_MODE_SIZE (DImode)) && !unaligned)
2682 + move_mode = DImode;
2683 + else if (bytes_to_go >= GET_MODE_SIZE (SImode))
2684 + move_mode = SImode;
2686 + move_mode = QImode;
2689 + rtx dst_mem = gen_rtx_MEM (move_mode,
2690 + gen_rtx_PLUS (SImode, dst,
2691 + GEN_INT (ptr_offset)));
2692 + rtx src_mem = gen_rtx_MEM (move_mode,
2693 + gen_rtx_PLUS (SImode, src,
2694 + GEN_INT (ptr_offset)));
2695 + ptr_offset += GET_MODE_SIZE (move_mode);
2696 + bytes_to_go -= GET_MODE_SIZE (move_mode);
2698 + MEM_IN_STRUCT_P (dst_mem) = dst_in_struct_p;
2699 + MEM_SCALAR_P (dst_mem) = dst_scalar_p;
2701 + MEM_IN_STRUCT_P (src_mem) = src_in_struct_p;
2702 + MEM_SCALAR_P (src_mem) = src_scalar_p;
2703 + emit_move_insn (dst_mem, src_mem);
2713 +/*Expand the prologue instruction*/
2715 +avr32_expand_prologue (void)
2718 + unsigned long saved_reg_mask, saved_fp_reg_mask;
2721 + /* Naked functions does not have a prologue */
2722 + if (IS_NAKED (avr32_current_func_type ()))
2725 + saved_reg_mask = avr32_compute_save_reg_mask (TRUE);
2727 + if (saved_reg_mask)
2729 + /* Must push used registers */
2731 + /* Should we use POPM or LDM? */
2732 + int usePUSHM = TRUE;
2734 + if (((saved_reg_mask & (1 << 0)) ||
2735 + (saved_reg_mask & (1 << 1)) ||
2736 + (saved_reg_mask & (1 << 2)) || (saved_reg_mask & (1 << 3))))
2738 + /* One of R0-R3 should at least be pushed */
2739 + if (((saved_reg_mask & (1 << 0)) &&
2740 + (saved_reg_mask & (1 << 1)) &&
2741 + (saved_reg_mask & (1 << 2)) && (saved_reg_mask & (1 << 3))))
2743 + /* All should be pushed */
2752 + if (((saved_reg_mask & (1 << 4)) ||
2753 + (saved_reg_mask & (1 << 5)) ||
2754 + (saved_reg_mask & (1 << 6)) || (saved_reg_mask & (1 << 7))))
2756 + /* One of R4-R7 should at least be pushed */
2757 + if (((saved_reg_mask & (1 << 4)) &&
2758 + (saved_reg_mask & (1 << 5)) &&
2759 + (saved_reg_mask & (1 << 6)) && (saved_reg_mask & (1 << 7))))
2762 + /* All should be pushed */
2771 + if (((saved_reg_mask & (1 << 8)) || (saved_reg_mask & (1 << 9))))
2773 + /* One of R8-R9 should at least be pushed */
2774 + if (((saved_reg_mask & (1 << 8)) && (saved_reg_mask & (1 << 9))))
2777 + /* All should be pushed */
2786 + if (saved_reg_mask & (1 << 10))
2789 + if (saved_reg_mask & (1 << 11))
2792 + if (saved_reg_mask & (1 << 12))
2795 + if (saved_reg_mask & (1 << ASM_REGNUM (LR_REGNUM)))
2803 + insn = emit_multi_reg_push (reglist8, TRUE);
2807 + insn = emit_multi_reg_push (saved_reg_mask, FALSE);
2809 + RTX_FRAME_RELATED_P (insn) = 1;
2811 + /* Prevent this instruction from being scheduled after any other
2813 + emit_insn (gen_blockage ());
2816 + saved_fp_reg_mask = avr32_compute_save_fp_reg_mask ();
2817 + if (saved_fp_reg_mask)
2819 + insn = emit_multi_fp_reg_push (saved_fp_reg_mask);
2820 + RTX_FRAME_RELATED_P (insn) = 1;
2822 + /* Prevent this instruction from being scheduled after any other
2824 + emit_insn (gen_blockage ());
2827 + /* Set frame pointer */
2828 + if (frame_pointer_needed)
2830 + insn = emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
2831 + RTX_FRAME_RELATED_P (insn) = 1;
2834 + if (get_frame_size () > 0)
2836 + if (avr32_const_ok_for_constraint_p (get_frame_size (), 'K', "Ks21"))
2838 + insn = emit_insn (gen_rtx_SET (SImode,
2839 + stack_pointer_rtx,
2840 + gen_rtx_PLUS (SImode,
2841 + stack_pointer_rtx,
2846 + RTX_FRAME_RELATED_P (insn) = 1;
2850 + /* Immediate is larger than k21 We must either check if we can use
2851 + one of the pushed reegisters as temporary storage or we must
2852 + make us a temp register by pushing a register to the stack. */
2853 + rtx temp_reg, const_pool_entry, insn;
2854 + if (saved_reg_mask)
2857 + gen_rtx_REG (SImode,
2858 + INTERNAL_REGNUM (avr32_get_saved_reg
2859 + (saved_reg_mask)));
2863 + temp_reg = gen_rtx_REG (SImode, INTERNAL_REGNUM (7));
2864 + emit_move_insn (gen_rtx_MEM
2866 + gen_rtx_PRE_DEC (SImode, stack_pointer_rtx)),
2870 + const_pool_entry =
2871 + force_const_mem (SImode,
2872 + gen_rtx_CONST_INT (SImode, get_frame_size ()));
2873 + emit_move_insn (temp_reg, const_pool_entry);
2875 + insn = emit_insn (gen_rtx_SET (SImode,
2876 + stack_pointer_rtx,
2877 + gen_rtx_MINUS (SImode,
2878 + stack_pointer_rtx,
2881 + dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
2882 + gen_rtx_PLUS (SImode, stack_pointer_rtx,
2883 + GEN_INT (-get_frame_size ())));
2884 + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
2885 + dwarf, REG_NOTES (insn));
2886 + RTX_FRAME_RELATED_P (insn) = 1;
2888 + if (!saved_reg_mask)
2891 + emit_move_insn (temp_reg,
2892 + gen_rtx_MEM (SImode,
2893 + gen_rtx_POST_INC (SImode,
2899 + /* Mark the temp register as dead */
2900 + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, temp_reg,
2901 + REG_NOTES (insn));
2906 + /* Prevent the the stack adjustment to be scheduled after any
2907 + instructions using the frame pointer. */
2908 + emit_insn (gen_blockage ());
2914 + avr32_load_pic_register ();
2916 + /* gcc does not know that load or call instructions might use the pic
2917 + register so it might schedule these instructions before the loading
2918 + of the pic register. To avoid this emit a barrier for now. TODO!
2919 + Find out a better way to let gcc know which instructions might use
2920 + the pic register. */
2921 + emit_insn (gen_blockage ());
2927 +avr32_set_return_address (rtx source, rtx scratch)
2930 + unsigned long saved_regs;
2932 + saved_regs = avr32_compute_save_reg_mask (TRUE);
2934 + if (!(saved_regs & (1 << ASM_REGNUM (LR_REGNUM))))
2935 + emit_move_insn (gen_rtx_REG (Pmode, LR_REGNUM), source);
2938 + if (frame_pointer_needed)
2939 + addr = gen_rtx_REG (Pmode, FRAME_POINTER_REGNUM);
2941 + if (avr32_const_ok_for_constraint_p (get_frame_size (), 'K', "Ks16"))
2943 + addr = plus_constant (stack_pointer_rtx, get_frame_size ());
2947 + emit_insn (gen_movsi (scratch, GEN_INT (get_frame_size ())));
2950 + emit_move_insn (gen_rtx_MEM (Pmode, addr), source);
2956 +/* Return the length of INSN. LENGTH is the initial length computed by
2957 + attributes in the machine-description file. */
2960 +avr32_adjust_insn_length (rtx insn ATTRIBUTE_UNUSED,
2961 + int length ATTRIBUTE_UNUSED)
2967 +avr32_output_return_instruction (int single_ret_inst ATTRIBUTE_UNUSED,
2968 + int iscond ATTRIBUTE_UNUSED,
2969 + rtx cond ATTRIBUTE_UNUSED, rtx r12_imm)
2972 + unsigned long saved_reg_mask, saved_fp_reg_mask;
2973 + int insert_ret = TRUE;
2975 + int stack_adjustment = get_frame_size ();
2976 + unsigned int func_type = avr32_current_func_type ();
2977 + FILE *f = asm_out_file;
2979 + /* Naked functions does not have an epilogue */
2980 + if (IS_NAKED (func_type))
2983 + saved_fp_reg_mask = avr32_compute_save_fp_reg_mask ();
2985 + saved_reg_mask = avr32_compute_save_reg_mask (FALSE);
2987 + /* Reset frame pointer */
2988 + if (stack_adjustment > 0)
2990 + if (avr32_const_ok_for_constraint_p (stack_adjustment, 'I', "Is21"))
2992 + fprintf (f, "\tsub\tsp, %i # Reset Frame Pointer\n",
2993 + -stack_adjustment);
2997 + /* TODO! Is it safe to use r8 as scratch?? */
2998 + fprintf (f, "\tmov\tr8, lo(%i) # Reset Frame Pointer\n",
2999 + -stack_adjustment);
3000 + fprintf (f, "\torh\tr8, hi(%i) # Reset Frame Pointer\n",
3001 + -stack_adjustment);
3002 + fprintf (f, "\tadd\tsp, r8 # Reset Frame Pointer\n");
3006 + if (saved_fp_reg_mask)
3008 + char reglist[64]; /* 64 bytes should be enough... */
3009 + avr32_make_fp_reglist_w (saved_fp_reg_mask, (char *) reglist);
3010 + fprintf (f, "\tldcm.w\tcp0, sp++, %s\n", reglist);
3011 + if (saved_fp_reg_mask & ~0xff)
3013 + saved_fp_reg_mask &= ~0xff;
3014 + avr32_make_fp_reglist_d (saved_fp_reg_mask, (char *) reglist);
3015 + fprintf (f, "\tldcm.d\tcp0, sp++, %s\n", reglist);
3019 + if (saved_reg_mask)
3021 + /* Must pop used registers */
3023 + /* Should we use POPM or LDM? */
3024 + int usePOPM = TRUE;
3025 + if (((saved_reg_mask & (1 << 0)) ||
3026 + (saved_reg_mask & (1 << 1)) ||
3027 + (saved_reg_mask & (1 << 2)) || (saved_reg_mask & (1 << 3))))
3029 + /* One of R0-R3 should at least be popped */
3030 + if (((saved_reg_mask & (1 << 0)) &&
3031 + (saved_reg_mask & (1 << 1)) &&
3032 + (saved_reg_mask & (1 << 2)) && (saved_reg_mask & (1 << 3))))
3034 + /* All should be popped */
3043 + if (((saved_reg_mask & (1 << 4)) ||
3044 + (saved_reg_mask & (1 << 5)) ||
3045 + (saved_reg_mask & (1 << 6)) || (saved_reg_mask & (1 << 7))))
3047 + /* One of R0-R3 should at least be popped */
3048 + if (((saved_reg_mask & (1 << 4)) &&
3049 + (saved_reg_mask & (1 << 5)) &&
3050 + (saved_reg_mask & (1 << 6)) && (saved_reg_mask & (1 << 7))))
3053 + /* All should be popped */
3062 + if (((saved_reg_mask & (1 << 8)) || (saved_reg_mask & (1 << 9))))
3064 + /* One of R8-R9 should at least be pushed */
3065 + if (((saved_reg_mask & (1 << 8)) && (saved_reg_mask & (1 << 9))))
3068 + /* All should be pushed */
3077 + if (saved_reg_mask & (1 << 10))
3080 + if (saved_reg_mask & (1 << 11))
3083 + if (saved_reg_mask & (1 << 12))
3086 + if (saved_reg_mask & (1 << ASM_REGNUM (LR_REGNUM)))
3090 + if (saved_reg_mask & (1 << ASM_REGNUM (PC_REGNUM)))
3091 + /* Pop LR into PC. */
3096 + char reglist[64]; /* 64 bytes should be enough... */
3097 + avr32_make_reglist8 (reglist8, (char *) reglist);
3099 + if (reglist8 & 0x80)
3100 + /* This instruction is also a return */
3101 + insert_ret = FALSE;
3103 + if (r12_imm && !insert_ret)
3104 + fprintf (f, "\tpopm\t%s, r12=%li\n", reglist, INTVAL (r12_imm));
3106 + fprintf (f, "\tpopm\t%s\n", reglist);
3111 + char reglist[64]; /* 64 bytes should be enough... */
3112 + avr32_make_reglist16 (saved_reg_mask, (char *) reglist);
3113 + if (saved_reg_mask & (1 << ASM_REGNUM (PC_REGNUM)))
3114 + /* This instruction is also a return */
3115 + insert_ret = FALSE;
3117 + if (r12_imm && !insert_ret)
3118 + fprintf (f, "\tldm\tsp++, %s, r12=%li\n", reglist,
3119 + INTVAL (r12_imm));
3121 + fprintf (f, "\tldm\tsp++, %s\n", reglist);
3127 + /* Stack adjustment for exception handler. */
3128 + if (current_function_calls_eh_return)
3129 + fprintf (f, "\tadd\tsp, r%d\n", ASM_REGNUM (EH_RETURN_STACKADJ_REGNO));
3132 + if (IS_INTERRUPT (func_type))
3134 + fprintf (f, "\trete\n");
3136 + else if (insert_ret)
3139 + fprintf (f, "\tretal\t%li\n", INTVAL (r12_imm));
3141 + fprintf (f, "\tretal\tr12\n");
3145 +/* Function for converting a fp-register mask to a
3146 + reglistCPD8 register list string. */
3148 +avr32_make_fp_reglist_d (int reglist_mask, char *reglist_string)
3152 + /* Make sure reglist_string is empty */
3153 + reglist_string[0] = '\0';
3155 + for (i = 0; i < NUM_FP_REGS; i += 2)
3157 + if (reglist_mask & (1 << i))
3159 + strlen (reglist_string) ?
3160 + sprintf (reglist_string, "%s, %s-%s", reglist_string,
3161 + reg_names[INTERNAL_FP_REGNUM (i)],
3162 + reg_names[INTERNAL_FP_REGNUM (i + 1)]) :
3163 + sprintf (reglist_string, "%s-%s",
3164 + reg_names[INTERNAL_FP_REGNUM (i)],
3165 + reg_names[INTERNAL_FP_REGNUM (i + 1)]);
3170 +/* Function for converting a fp-register mask to a
3171 + reglistCP8 register list string. */
3173 +avr32_make_fp_reglist_w (int reglist_mask, char *reglist_string)
3177 + /* Make sure reglist_string is empty */
3178 + reglist_string[0] = '\0';
3180 + for (i = 0; i < NUM_FP_REGS; ++i)
3182 + if (reglist_mask & (1 << i))
3184 + strlen (reglist_string) ?
3185 + sprintf (reglist_string, "%s, %s", reglist_string,
3186 + reg_names[INTERNAL_FP_REGNUM (i)]) :
3187 + sprintf (reglist_string, "%s", reg_names[INTERNAL_FP_REGNUM (i)]);
3193 +avr32_make_reglist16 (int reglist16_vect, char *reglist16_string)
3197 + /* Make sure reglist16_string is empty */
3198 + reglist16_string[0] = '\0';
3200 + for (i = 0; i < 16; ++i)
3202 + if (reglist16_vect & (1 << i))
3204 + strlen (reglist16_string) ?
3205 + sprintf (reglist16_string, "%s, %s", reglist16_string,
3206 + reg_names[INTERNAL_REGNUM (i)]) :
3207 + sprintf (reglist16_string, "%s", reg_names[INTERNAL_REGNUM (i)]);
3213 +avr32_convert_to_reglist16 (int reglist8_vect)
3215 + int reglist16_vect = 0;
3216 + if (reglist8_vect & 0x1)
3217 + reglist16_vect |= 0xF;
3218 + if (reglist8_vect & 0x2)
3219 + reglist16_vect |= 0xF0;
3220 + if (reglist8_vect & 0x4)
3221 + reglist16_vect |= 0x300;
3222 + if (reglist8_vect & 0x8)
3223 + reglist16_vect |= 0x400;
3224 + if (reglist8_vect & 0x10)
3225 + reglist16_vect |= 0x800;
3226 + if (reglist8_vect & 0x20)
3227 + reglist16_vect |= 0x1000;
3228 + if (reglist8_vect & 0x40)
3229 + reglist16_vect |= 0x4000;
3230 + if (reglist8_vect & 0x80)
3231 + reglist16_vect |= 0x8000;
3233 + return reglist16_vect;
3237 +avr32_make_reglist8 (int reglist8_vect, char *reglist8_string)
3239 + /* Make sure reglist8_string is empty */
3240 + reglist8_string[0] = '\0';
3242 + if (reglist8_vect & 0x1)
3243 + sprintf (reglist8_string, "r0-r3");
3244 + if (reglist8_vect & 0x2)
3245 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r4-r7",
3246 + reglist8_string) :
3247 + sprintf (reglist8_string, "r4-r7");
3248 + if (reglist8_vect & 0x4)
3249 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r8-r9",
3250 + reglist8_string) :
3251 + sprintf (reglist8_string, "r8-r9");
3252 + if (reglist8_vect & 0x8)
3253 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r10",
3254 + reglist8_string) :
3255 + sprintf (reglist8_string, "r10");
3256 + if (reglist8_vect & 0x10)
3257 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r11",
3258 + reglist8_string) :
3259 + sprintf (reglist8_string, "r11");
3260 + if (reglist8_vect & 0x20)
3261 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r12",
3262 + reglist8_string) :
3263 + sprintf (reglist8_string, "r12");
3264 + if (reglist8_vect & 0x40)
3265 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, lr",
3266 + reglist8_string) :
3267 + sprintf (reglist8_string, "lr");
3268 + if (reglist8_vect & 0x80)
3269 + strlen (reglist8_string) ? sprintf (reglist8_string, "%s, pc",
3270 + reglist8_string) :
3271 + sprintf (reglist8_string, "pc");
3275 +avr32_eh_return_data_regno (int n)
3277 + if (n >= 0 && n <= 3)
3280 + return INVALID_REGNUM;
3283 +/* Compute the distance from register FROM to register TO.
3284 + These can be the arg pointer, the frame pointer or
3285 + the stack pointer.
3286 + Typical stack layout looks like this:
3288 + old stack pointer -> | |
3291 + | | saved arguments for
3292 + | | vararg functions
3293 + arg_pointer -> | | /
3303 + stack ptr --> | | /
3311 + For a given funciton some or all of these stack compomnents
3312 + may not be needed, giving rise to the possibility of
3313 + eliminating some of the registers.
3315 + The values returned by this function must reflect the behaviour
3316 + of avr32_expand_prologue() and avr32_compute_save_reg_mask().
3318 + The sign of the number returned reflects the direction of stack
3319 + growth, so the values are positive for all eliminations except
3320 + from the soft frame pointer to the hard frame pointer. */
3324 +avr32_initial_elimination_offset (int from, int to)
3327 + int call_saved_regs = 0;
3328 + unsigned long saved_reg_mask, saved_fp_reg_mask;
3329 + unsigned int local_vars = get_frame_size ();
3331 + saved_reg_mask = avr32_compute_save_reg_mask (TRUE);
3332 + saved_fp_reg_mask = avr32_compute_save_fp_reg_mask ();
3334 + for (i = 0; i < 16; ++i)
3336 + if (saved_reg_mask & (1 << i))
3337 + call_saved_regs += 4;
3340 + for (i = 0; i < NUM_FP_REGS; ++i)
3342 + if (saved_fp_reg_mask & (1 << i))
3343 + call_saved_regs += 4;
3348 + case ARG_POINTER_REGNUM:
3351 + case STACK_POINTER_REGNUM:
3352 + return call_saved_regs + local_vars;
3353 + case FRAME_POINTER_REGNUM:
3354 + return call_saved_regs;
3358 + case FRAME_POINTER_REGNUM:
3361 + case STACK_POINTER_REGNUM:
3362 + return local_vars;
3373 + Returns a rtx used when passing the next argument to a function.
3374 + avr32_init_cumulative_args() and avr32_function_arg_advance() sets witch
3378 +avr32_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode,
3379 + tree type, int named)
3383 + HOST_WIDE_INT arg_size, arg_rsize;
3386 + arg_size = int_size_in_bytes (type);
3390 + arg_size = GET_MODE_SIZE (mode);
3392 + arg_rsize = PUSH_ROUNDING (arg_size);
3395 + The last time this macro is called, it is called with mode == VOIDmode,
3396 + and its result is passed to the call or call_value pattern as operands 2
3397 + and 3 respectively. */
3398 + if (mode == VOIDmode)
3400 + return gen_rtx_CONST_INT (SImode, 22); /* ToDo: fixme. */
3403 + if ((*targetm.calls.must_pass_in_stack) (mode, type) || !named)
3408 + if (arg_rsize == 8)
3410 + /* use r11:r10 or r9:r8. */
3411 + if (!(GET_USED_INDEX (cum, 1) || GET_USED_INDEX (cum, 2)))
3413 + else if (!(GET_USED_INDEX (cum, 3) || GET_USED_INDEX (cum, 4)))
3418 + else if (arg_rsize == 4)
3419 + { /* Use first available register */
3421 + while (index <= LAST_CUM_REG_INDEX && GET_USED_INDEX (cum, index))
3423 + if (index > LAST_CUM_REG_INDEX)
3427 + SET_REG_INDEX (cum, index);
3429 + if (GET_REG_INDEX (cum) >= 0)
3430 + return gen_rtx_REG (mode,
3431 + avr32_function_arg_reglist[GET_REG_INDEX (cum)]);
3437 + Set the register used for passing the first argument to a function.
3440 +avr32_init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype,
3441 + rtx libname ATTRIBUTE_UNUSED,
3442 + tree fndecl ATTRIBUTE_UNUSED)
3444 + /* Set all registers as unused. */
3445 + SET_INDEXES_UNUSED (cum);
3447 + /* Reset uses_anonymous_args */
3448 + cum->uses_anonymous_args = 0;
3450 + /* Reset size of stack pushed arguments */
3451 + cum->stack_pushed_args_size = 0;
3455 + Set register used for passing the next argument to a function. Only the
3456 + Scratch Registers are used.
3461 + 13 r13 _SP_________
3462 + FIRST_CUM_REG 12 r12 _||_
3464 + 11 r10 _||_ Scratch Registers
3466 + LAST_SCRATCH_REG 9 r8 _\/_________
3478 +avr32_function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode,
3479 + tree type, int named ATTRIBUTE_UNUSED)
3481 + HOST_WIDE_INT arg_size, arg_rsize;
3485 + arg_size = int_size_in_bytes (type);
3489 + arg_size = GET_MODE_SIZE (mode);
3491 + arg_rsize = PUSH_ROUNDING (arg_size);
3493 + /* It the argument had to be passed in stack, no register is used. */
3494 + if ((*targetm.calls.must_pass_in_stack) (mode, type))
3496 + cum->stack_pushed_args_size += PUSH_ROUNDING (int_size_in_bytes (type));
3500 + /* Mark the used registers as "used". */
3501 + if (GET_REG_INDEX (cum) >= 0)
3503 + SET_USED_INDEX (cum, GET_REG_INDEX (cum));
3504 + if (arg_rsize == 8)
3506 + SET_USED_INDEX (cum, (GET_REG_INDEX (cum) + 1));
3511 + /* Had to use stack */
3512 + cum->stack_pushed_args_size += arg_rsize;
3517 + Defines witch direction to go to find the next register to use if the
3518 + argument is larger then one register or for arguments shorter than an
3519 + int which is not promoted, such as the last part of structures with
3520 + size not a multiple of 4. */
3522 +avr32_function_arg_padding (enum machine_mode mode ATTRIBUTE_UNUSED,
3525 + /* Pad upward for all aggregates except byte and halfword sized aggregates
3526 + which can be passed in registers. */
3528 + && AGGREGATE_TYPE_P (type)
3529 + && (int_size_in_bytes (type) != 1)
3530 + && !((int_size_in_bytes (type) == 2)
3531 + && TYPE_ALIGN_UNIT (type) >= 2)
3532 + && (int_size_in_bytes (type) & 0x3))
3541 + Return a rtx used for the return value from a function call.
3544 +avr32_function_value (tree type, tree func, bool outgoing ATTRIBUTE_UNUSED)
3546 + if (avr32_return_in_memory (type, func))
3549 + if (int_size_in_bytes (type) <= 4)
3550 + if (avr32_return_in_msb (type))
3551 + /* Aggregates of size less than a word which does align the data in the
3552 + MSB must use SImode for r12. */
3553 + return gen_rtx_REG (SImode, RET_REGISTER);
3555 + return gen_rtx_REG (TYPE_MODE (type), RET_REGISTER);
3556 + else if (int_size_in_bytes (type) <= 8)
3557 + return gen_rtx_REG (TYPE_MODE (type), INTERNAL_REGNUM (11));
3563 + Return a rtx used for the return value from a library function call.
3566 +avr32_libcall_value (enum machine_mode mode)
3569 + if (GET_MODE_SIZE (mode) <= 4)
3570 + return gen_rtx_REG (mode, RET_REGISTER);
3571 + else if (GET_MODE_SIZE (mode) <= 8)
3572 + return gen_rtx_REG (mode, INTERNAL_REGNUM (11));
3577 +/* Return TRUE if X references a SYMBOL_REF. */
3579 +symbol_mentioned_p (rtx x)
3584 + if (GET_CODE (x) == SYMBOL_REF)
3587 + fmt = GET_RTX_FORMAT (GET_CODE (x));
3589 + for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
3591 + if (fmt[i] == 'E')
3595 + for (j = XVECLEN (x, i) - 1; j >= 0; j--)
3596 + if (symbol_mentioned_p (XVECEXP (x, i, j)))
3599 + else if (fmt[i] == 'e' && symbol_mentioned_p (XEXP (x, i)))
3606 +/* Return TRUE if X references a LABEL_REF. */
3608 +label_mentioned_p (rtx x)
3613 + if (GET_CODE (x) == LABEL_REF)
3616 + fmt = GET_RTX_FORMAT (GET_CODE (x));
3617 + for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
3619 + if (fmt[i] == 'E')
3623 + for (j = XVECLEN (x, i) - 1; j >= 0; j--)
3624 + if (label_mentioned_p (XVECEXP (x, i, j)))
3627 + else if (fmt[i] == 'e' && label_mentioned_p (XEXP (x, i)))
3636 +avr32_legitimate_pic_operand_p (rtx x)
3639 + /* We can't have const, this must be broken down to a symbol. */
3640 + if (GET_CODE (x) == CONST)
3643 + /* Can't access symbols or labels via the constant pool either */
3644 + if ((GET_CODE (x) == SYMBOL_REF
3645 + && CONSTANT_POOL_ADDRESS_P (x)
3646 + && (symbol_mentioned_p (get_pool_constant (x))
3647 + || label_mentioned_p (get_pool_constant (x)))))
3655 +legitimize_pic_address (rtx orig, enum machine_mode mode ATTRIBUTE_UNUSED,
3659 + if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
3665 + if (no_new_pseudos)
3668 + reg = gen_reg_rtx (Pmode);
3673 + emit_move_insn (reg, orig);
3675 + /* Only set current function as using pic offset table if flag_pic is
3676 + set. This is because this function is also used if
3677 + TARGET_HAS_ASM_ADDR_PSEUDOS is set. */
3679 + current_function_uses_pic_offset_table = 1;
3681 + /* Put a REG_EQUAL note on this insn, so that it can be optimized by
3685 + else if (GET_CODE (orig) == CONST)
3690 + && GET_CODE (XEXP (orig, 0)) == PLUS
3691 + && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
3696 + if (no_new_pseudos)
3699 + reg = gen_reg_rtx (Pmode);
3702 + if (GET_CODE (XEXP (orig, 0)) == PLUS)
3705 + legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
3707 + legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
3708 + base == reg ? 0 : reg);
3713 + if (GET_CODE (offset) == CONST_INT)
3715 + /* The base register doesn't really matter, we only want to test
3716 + the index for the appropriate mode. */
3717 + if (!avr32_const_ok_for_constraint_p (INTVAL (offset), 'I', "Is21"))
3719 + if (!no_new_pseudos)
3720 + offset = force_reg (Pmode, offset);
3725 + if (GET_CODE (offset) == CONST_INT)
3726 + return plus_constant (base, INTVAL (offset));
3729 + return gen_rtx_PLUS (Pmode, base, offset);
3735 +/* Generate code to load the PIC register. */
3737 +avr32_load_pic_register (void)
3740 + rtx global_offset_table;
3742 + if ((current_function_uses_pic_offset_table == 0) || TARGET_NO_INIT_GOT)
3748 + l1 = gen_label_rtx ();
3750 + global_offset_table = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
3752 + gen_rtx_CONST (Pmode,
3753 + gen_rtx_MINUS (SImode, gen_rtx_LABEL_REF (Pmode, l1),
3754 + global_offset_table));
3755 + emit_insn (gen_pic_load_addr
3756 + (pic_offset_table_rtx, force_const_mem (SImode, pic_tmp)));
3757 + emit_insn (gen_pic_compute_got_from_pc (pic_offset_table_rtx, l1));
3759 + /* Need to emit this whether or not we obey regdecls, since setjmp/longjmp
3760 + can cause life info to screw up. */
3761 + emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
3766 +/* This hook should return true if values of type type are returned at the most
3767 + significant end of a register (in other words, if they are padded at the
3768 + least significant end). You can assume that type is returned in a register;
3769 + the caller is required to check this. Note that the register provided by
3770 + FUNCTION_VALUE must be able to hold the complete return value. For example,
3771 + if a 1-, 2- or 3-byte structure is returned at the most significant end of a
3772 + 4-byte register, FUNCTION_VALUE should provide an SImode rtx. */
3774 +avr32_return_in_msb (tree type ATTRIBUTE_UNUSED)
3776 + /* if ( AGGREGATE_TYPE_P (type) ) if ((int_size_in_bytes(type) == 1) ||
3777 + ((int_size_in_bytes(type) == 2) && TYPE_ALIGN_UNIT(type) >= 2)) return
3778 + false; else return true; */
3785 + Returns one if a certain function value is going to be returned in memory
3786 + and zero if it is going to be returned in a register.
3788 + BLKmode and all other modes that is larger than 64 bits are returned in
3792 +avr32_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
3794 + if (TYPE_MODE (type) == VOIDmode)
3797 + if (int_size_in_bytes (type) > (2 * UNITS_PER_WORD)
3798 + || int_size_in_bytes (type) == -1)
3803 + /* If we have an aggregate then use the same mechanism as when checking if
3804 + it should be passed on the stack. */
3806 + && AGGREGATE_TYPE_P (type)
3807 + && (*targetm.calls.must_pass_in_stack) (TYPE_MODE (type), type))
3814 +/* Output the constant part of the trampoline.
3815 + lddpc r0, pc[0x8:e] ; load static chain register
3816 + lddpc pc, pc[0x8:e] ; jump to subrutine
3817 + .long 0 ; Address to static chain,
3818 + ; filled in by avr32_initialize_trampoline()
3819 + .long 0 ; Address to subrutine,
3820 + ; filled in by avr32_initialize_trampoline()
3823 +avr32_trampoline_template (FILE * file)
3825 + fprintf (file, "\tlddpc r0, pc[8]\n");
3826 + fprintf (file, "\tlddpc pc, pc[8]\n");
3827 + /* make room for the address of the static chain. */
3828 + fprintf (file, "\t.long\t0\n");
3829 + /* make room for the address to the subrutine. */
3830 + fprintf (file, "\t.long\t0\n");
3835 + Initialize the variable parts of a trampoline.
3838 +avr32_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
3840 + /* Store the address to the static chain. */
3841 + emit_move_insn (gen_rtx_MEM
3842 + (SImode, plus_constant (addr, TRAMPOLINE_SIZE - 4)),
3845 + /* Store the address to the function. */
3846 + emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, TRAMPOLINE_SIZE)),
3849 + emit_insn (gen_cache (gen_rtx_REG (SImode, 13),
3850 + gen_rtx_CONST_INT (SImode,
3851 + AVR32_CACHE_INVALIDATE_ICACHE)));
3854 +/* Return nonzero if X is valid as an addressing register. */
3856 +avr32_address_register_rtx_p (rtx x, int strict_p)
3860 + if (!register_operand(x, GET_MODE(x)))
3863 + /* If strict we require the register to be a hard register. */
3868 + regno = REGNO (x);
3871 + return REGNO_OK_FOR_BASE_P (regno);
3873 + return (regno <= LAST_REGNUM || regno >= FIRST_PSEUDO_REGISTER);
3876 +/* Return nonzero if INDEX is valid for an address index operand. */
3878 +avr32_legitimate_index_p (enum machine_mode mode, rtx index, int strict_p)
3880 + enum rtx_code code = GET_CODE (index);
3882 + if (GET_MODE_SIZE (mode) > 8)
3885 + /* Standard coprocessor addressing modes. */
3886 + if (code == CONST_INT)
3888 + if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT)
3889 + /* Coprocessor mem insns has a smaller reach than ordinary mem insns */
3890 + return CONST_OK_FOR_CONSTRAINT_P (INTVAL (index), 'K', "Ku14");
3892 + return CONST_OK_FOR_CONSTRAINT_P (INTVAL (index), 'K', "Ks16");
3895 + if (avr32_address_register_rtx_p (index, strict_p))
3900 + rtx xiop0 = XEXP (index, 0);
3901 + rtx xiop1 = XEXP (index, 1);
3902 + return ((avr32_address_register_rtx_p (xiop0, strict_p)
3903 + && power_of_two_operand (xiop1, SImode)
3904 + && (INTVAL (xiop1) <= 8))
3905 + || (avr32_address_register_rtx_p (xiop1, strict_p)
3906 + && power_of_two_operand (xiop0, SImode)
3907 + && (INTVAL (xiop0) <= 8)));
3909 + else if (code == ASHIFT)
3911 + rtx op = XEXP (index, 1);
3913 + return (avr32_address_register_rtx_p (XEXP (index, 0), strict_p)
3914 + && GET_CODE (op) == CONST_INT
3915 + && INTVAL (op) > 0 && INTVAL (op) <= 3);
3922 + Used in the GO_IF_LEGITIMATE_ADDRESS macro. Returns a nonzero value if
3923 + the RTX x is a legitimate memory address.
3925 + Returns NO_REGS if the address is not legatime, GENERAL_REGS or ALL_REGS
3929 +/* Forward declaration*/
3930 +int is_minipool_label (rtx label);
3933 +avr32_legitimate_address (enum machine_mode mode, rtx x, int strict)
3936 + switch (GET_CODE (x))
3939 + return avr32_address_register_rtx_p (x, strict);
3942 + rtx label = avr32_find_symbol (x);
3945 + ((CONSTANT_POOL_ADDRESS_P (label)
3947 + && (symbol_mentioned_p (get_pool_constant (label))
3948 + || label_mentioned_p (get_pool_constant (label)))))
3949 + /* TODO! Can this ever happen??? */
3950 + || ((GET_CODE (label) == LABEL_REF)
3951 + && GET_CODE (XEXP (label, 0)) == CODE_LABEL
3952 + && is_minipool_label (XEXP (label, 0)))))
3959 + if (GET_CODE (XEXP (x, 0)) == CODE_LABEL
3960 + && is_minipool_label (XEXP (x, 0)))
3967 + if (CONSTANT_POOL_ADDRESS_P (x)
3969 + && (symbol_mentioned_p (get_pool_constant (x))
3970 + || label_mentioned_p (get_pool_constant (x)))))
3973 + A symbol_ref is only legal if it is a function. If all of them are
3974 + legal, a pseudo reg that is a constant will be replaced by a
3975 + symbol_ref and make illegale code. SYMBOL_REF_FLAG is set by
3976 + ENCODE_SECTION_INFO. */
3977 + else if (SYMBOL_REF_RCALL_FUNCTION_P (x))
3981 + case PRE_DEC: /* (pre_dec (...)) */
3982 + case POST_INC: /* (post_inc (...)) */
3983 + return avr32_address_register_rtx_p (XEXP (x, 0), strict);
3984 + case PLUS: /* (plus (...) (...)) */
3986 + rtx xop0 = XEXP (x, 0);
3987 + rtx xop1 = XEXP (x, 1);
3989 + return ((avr32_address_register_rtx_p (xop0, strict)
3990 + && avr32_legitimate_index_p (mode, xop1, strict))
3991 + || (avr32_address_register_rtx_p (xop1, strict)
3992 + && avr32_legitimate_index_p (mode, xop0, strict)));
4003 +avr32_const_double_immediate (rtx value)
4005 + HOST_WIDE_INT hi, lo;
4007 + if (GET_CODE (value) != CONST_DOUBLE)
4010 + if (SCALAR_FLOAT_MODE_P (GET_MODE (value)))
4012 + HOST_WIDE_INT target_float[2];
4014 + real_to_target (target_float, CONST_DOUBLE_REAL_VALUE (value),
4015 + GET_MODE (value));
4016 + lo = target_float[0];
4017 + hi = target_float[1];
4021 + hi = CONST_DOUBLE_HIGH (value);
4022 + lo = CONST_DOUBLE_LOW (value);
4025 + if (avr32_const_ok_for_constraint_p (lo, 'K', "Ks21")
4026 + && (GET_MODE (value) == SFmode
4027 + || avr32_const_ok_for_constraint_p (hi, 'K', "Ks21")))
4037 +avr32_legitimate_constant_p (rtx x)
4039 + switch (GET_CODE (x))
4042 + /* Check if we should put large immediate into constant pool
4043 + or load them directly with mov/orh.*/
4044 + if (!avr32_imm_in_const_pool)
4047 + return avr32_const_ok_for_constraint_p (INTVAL (x), 'K', "Ks21");
4048 + case CONST_DOUBLE:
4049 + /* Check if we should put large immediate into constant pool
4050 + or load them directly with mov/orh.*/
4051 + if (!avr32_imm_in_const_pool)
4054 + if (GET_MODE (x) == SFmode
4055 + || GET_MODE (x) == DFmode || GET_MODE (x) == DImode)
4056 + return avr32_const_double_immediate (x);
4060 + return flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS;
4062 + return flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS;
4065 + case CONST_VECTOR:
4068 + printf ("%s():\n", __FUNCTION__);
4075 +/* Strip any special encoding from labels */
4077 +avr32_strip_name_encoding (const char *name)
4079 + const char *stripped = name;
4083 + switch (stripped[0])
4086 + stripped = strchr (name + 1, '#') + 1;
4089 + stripped = &stripped[1];
4099 +/* Do anything needed before RTL is emitted for each function. */
4100 +static struct machine_function *
4101 +avr32_init_machine_status (void)
4103 + struct machine_function *machine;
4105 + (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
4107 +#if AVR32_FT_UNKNOWN != 0
4108 + machine->func_type = AVR32_FT_UNKNOWN;
4111 + machine->minipool_label_head = 0;
4112 + machine->minipool_label_tail = 0;
4117 +avr32_init_expanders (void)
4119 + /* Arrange to initialize and mark the machine per-function status. */
4120 + init_machine_status = avr32_init_machine_status;
4124 +/* Return an RTX indicating where the return address to the
4125 + calling function can be found. */
4128 +avr32_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
4133 + return get_hard_reg_initial_val (Pmode, LR_REGNUM);
4138 +avr32_encode_section_info (tree decl, rtx rtl, int first)
4141 + if (first && DECL_P (decl))
4143 + /* Set SYMBOL_REG_FLAG for local functions */
4144 + if (!TREE_PUBLIC (decl) && TREE_CODE (decl) == FUNCTION_DECL)
4146 + if ((*targetm.binds_local_p) (decl))
4148 + SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
4156 +avr32_asm_output_ascii (FILE * stream, char *ptr, int len)
4159 + char *new_ptr = xmalloc (4 * len);
4160 + if (new_ptr == NULL)
4161 + internal_error ("Out of memory.");
4163 + for (i = 0; i < len; i++)
4165 + if (ptr[i] == '\n')
4167 + new_ptr[i_new++] = '\\';
4168 + new_ptr[i_new++] = '0';
4169 + new_ptr[i_new++] = '1';
4170 + new_ptr[i_new++] = '2';
4172 + else if (ptr[i] == '\"')
4174 + new_ptr[i_new++] = '\\';
4175 + new_ptr[i_new++] = '\"';
4177 + else if (ptr[i] == '\\')
4179 + new_ptr[i_new++] = '\\';
4180 + new_ptr[i_new++] = '\\';
4182 + else if (ptr[i] == '\0' && i + 1 < len)
4184 + new_ptr[i_new++] = '\\';
4185 + new_ptr[i_new++] = '0';
4189 + new_ptr[i_new++] = ptr[i];
4193 + /* Terminate new_ptr. */
4194 + new_ptr[i_new] = '\0';
4195 + fprintf (stream, "\t.ascii\t\"%s\"\n", new_ptr);
4201 +avr32_asm_output_label (FILE * stream, const char *name)
4203 + name = avr32_strip_name_encoding (name);
4205 + /* Print the label. */
4206 + assemble_name (stream, name);
4207 + fprintf (stream, ":\n");
4213 +avr32_asm_weaken_label (FILE * stream, const char *name)
4215 + fprintf (stream, "\t.weak ");
4216 + assemble_name (stream, name);
4217 + fprintf (stream, "\n");
4221 + Checks if a labelref is equal to a reserved word in the assembler. If it is,
4222 + insert a '_' before the label name.
4225 +avr32_asm_output_labelref (FILE * stream, const char *name)
4227 + int verbatim = FALSE;
4228 + const char *stripped = name;
4229 + int strip_finished = FALSE;
4231 + while (!strip_finished)
4233 + switch (stripped[0])
4236 + stripped = strchr (name + 1, '#') + 1;
4239 + stripped = &stripped[1];
4243 + strip_finished = TRUE;
4249 + fputs (stripped, stream);
4251 + asm_fprintf (stream, "%U%s", stripped);
4257 + Check if the comparison in compare_exp is redundant
4258 + for the condition given in next_cond given that the
4259 + needed flags are already set by an earlier instruction.
4260 + Uses cc_prev_status to check this.
4262 + Returns NULL_RTX if the compare is not redundant
4263 + or the new condition to use in the conditional
4264 + instruction if the compare is redundant.
4267 +is_compare_redundant (rtx compare_exp, rtx next_cond)
4269 + int z_flag_valid = FALSE;
4270 + int n_flag_valid = FALSE;
4273 + if (GET_CODE (compare_exp) != COMPARE)
4277 + if (rtx_equal_p (cc_prev_status.mdep.value, compare_exp))
4279 + /* cc0 already contains the correct comparison -> delete cmp insn */
4283 + if (GET_MODE (compare_exp) != SImode)
4286 + switch (cc_prev_status.mdep.flags)
4290 + n_flag_valid = TRUE;
4293 + z_flag_valid = TRUE;
4296 + if (cc_prev_status.mdep.value
4297 + && REG_P (XEXP (compare_exp, 0))
4298 + && REGNO (XEXP (compare_exp, 0)) == REGNO (cc_prev_status.mdep.value)
4299 + && GET_CODE (XEXP (compare_exp, 1)) == CONST_INT
4300 + && next_cond != NULL_RTX)
4302 + if (INTVAL (XEXP (compare_exp, 1)) == 0
4304 + && (GET_CODE (next_cond) == EQ || GET_CODE (next_cond) == NE))
4305 + /* We can skip comparison Z flag is already reflecting ops[0] */
4307 + else if (n_flag_valid
4308 + && ((INTVAL (XEXP (compare_exp, 1)) == 0
4309 + && (GET_CODE (next_cond) == GE
4310 + || GET_CODE (next_cond) == LT))
4311 + || (INTVAL (XEXP (compare_exp, 1)) == -1
4312 + && (GET_CODE (next_cond) == GT
4313 + || GET_CODE (next_cond) == LE))))
4315 + /* We can skip comparison N flag is already reflecting ops[0],
4316 + which means that we can use the mi/pl conditions to check if
4317 + ops[0] is GE or LT 0. */
4318 + if ((GET_CODE (next_cond) == GE) || (GET_CODE (next_cond) == GT))
4320 + gen_rtx_UNSPEC (GET_MODE (next_cond), gen_rtvec (2, cc0_rtx, const0_rtx),
4324 + gen_rtx_UNSPEC (GET_MODE (next_cond), gen_rtvec (2, cc0_rtx, const0_rtx),
4332 +/* Updates cc_status. */
4334 +avr32_notice_update_cc (rtx exp, rtx insn)
4336 + switch (get_attr_cc (insn))
4341 + /* Check if the function call returns a value in r12 */
4342 + if (REG_P (recog_data.operand[0])
4343 + && REGNO (recog_data.operand[0]) == RETVAL_REGNUM)
4345 + cc_status.flags = 0;
4346 + cc_status.mdep.value =
4347 + gen_rtx_COMPARE (SImode, recog_data.operand[0], const0_rtx);
4348 + cc_status.mdep.flags = CC_SET_VNCZ;
4353 + /* Check that compare will not be optimized away if so nothing should
4355 + if (is_compare_redundant (SET_SRC (exp), get_next_insn_cond (insn)) ==
4359 + /* Reset the nonstandard flag */
4361 + cc_status.flags = 0;
4362 + cc_status.mdep.value = SET_SRC (exp);
4363 + cc_status.mdep.flags = CC_SET_VNCZ;
4366 + case CC_CMP_COND_INSN:
4368 + /* Conditional insn that emit the compare itself. */
4369 + rtx cmp = gen_rtx_COMPARE (GET_MODE (recog_data.operand[4]),
4370 + recog_data.operand[4],
4371 + recog_data.operand[5]);
4373 + if (is_compare_redundant (cmp, recog_data.operand[1]) == NULL_RTX)
4376 + /* Reset the nonstandard flag */
4378 + cc_status.flags = 0;
4379 + cc_status.mdep.value = cmp;
4380 + cc_status.mdep.flags = CC_SET_VNCZ;
4384 + case CC_FPCOMPARE:
4385 + /* Check that floating-point compare will not be optimized away if so
4386 + nothing should be done */
4387 + if (!rtx_equal_p (cc_prev_status.mdep.fpvalue, SET_SRC (exp)))
4389 + /* cc0 already contains the correct comparison -> delete cmp insn */
4390 + /* Reset the nonstandard flag */
4391 + cc_status.mdep.fpvalue = SET_SRC (exp);
4392 + cc_status.mdep.fpflags = CC_SET_CZ;
4395 + case CC_FROM_FPCC:
4396 + /* Flags are updated with flags from Floating-point coprocessor, set
4397 + CC_NOT_SIGNED flag since the flags are set so that unsigned
4398 + condidion codes can be used directly. */
4400 + cc_status.flags = CC_NOT_SIGNED;
4401 + cc_status.mdep.value = cc_status.mdep.fpvalue;
4402 + cc_status.mdep.flags = cc_status.mdep.fpflags;
4405 + /* Bit load is kind of like an inverted testsi, because the Z flag is
4408 + cc_status.flags = CC_INVERTED;
4409 + cc_status.mdep.value = SET_SRC (exp);
4410 + cc_status.mdep.flags = CC_SET_Z;
4413 + /* Insn does not affect CC at all. Check if the instruction updates
4414 + some of the register currently reflected in cc0 */
4416 + if ((GET_CODE (exp) == SET)
4417 + && (cc_status.value1 || cc_status.value2 || cc_status.mdep.value)
4418 + && (reg_mentioned_p (SET_DEST (exp), cc_status.value1)
4419 + || reg_mentioned_p (SET_DEST (exp), cc_status.value2)
4420 + || reg_mentioned_p (SET_DEST (exp), cc_status.mdep.value)))
4425 + /* If this is a parallel we must step through each of the parallel
4427 + if (GET_CODE (exp) == PARALLEL)
4430 + for (i = 0; i < XVECLEN (exp, 0); ++i)
4432 + rtx vec_exp = XVECEXP (exp, 0, i);
4433 + if ((GET_CODE (vec_exp) == SET)
4434 + && (cc_status.value1 || cc_status.value2
4435 + || cc_status.mdep.value)
4436 + && (reg_mentioned_p (SET_DEST (vec_exp), cc_status.value1)
4437 + || reg_mentioned_p (SET_DEST (vec_exp),
4439 + || reg_mentioned_p (SET_DEST (vec_exp),
4440 + cc_status.mdep.value)))
4447 + /* Check if we have memory opartions with post_inc or pre_dec on the
4448 + register currently reflected in cc0 */
4449 + if (GET_CODE (exp) == SET
4450 + && GET_CODE (SET_SRC (exp)) == MEM
4451 + && (GET_CODE (XEXP (SET_SRC (exp), 0)) == POST_INC
4452 + || GET_CODE (XEXP (SET_SRC (exp), 0)) == PRE_DEC)
4455 + (XEXP (XEXP (SET_SRC (exp), 0), 0), cc_status.value1)
4456 + || reg_mentioned_p (XEXP (XEXP (SET_SRC (exp), 0), 0),
4458 + || reg_mentioned_p (XEXP (XEXP (SET_SRC (exp), 0), 0),
4459 + cc_status.mdep.value)))
4462 + if (GET_CODE (exp) == SET
4463 + && GET_CODE (SET_DEST (exp)) == MEM
4464 + && (GET_CODE (XEXP (SET_DEST (exp), 0)) == POST_INC
4465 + || GET_CODE (XEXP (SET_DEST (exp), 0)) == PRE_DEC)
4468 + (XEXP (XEXP (SET_DEST (exp), 0), 0), cc_status.value1)
4469 + || reg_mentioned_p (XEXP (XEXP (SET_DEST (exp), 0), 0),
4471 + || reg_mentioned_p (XEXP (XEXP (SET_DEST (exp), 0), 0),
4472 + cc_status.mdep.value)))
4478 + cc_status.mdep.value = recog_data.operand[0];
4479 + cc_status.mdep.flags = CC_SET_VNCZ;
4484 + cc_status.mdep.value = recog_data.operand[0];
4485 + cc_status.mdep.flags = CC_SET_NCZ;
4490 + cc_status.mdep.value = recog_data.operand[0];
4491 + cc_status.mdep.flags = CC_SET_CZ;
4496 + cc_status.mdep.value = recog_data.operand[0];
4497 + cc_status.mdep.flags = CC_SET_Z;
4511 + Outputs to stdio stream stream the assembler syntax for an instruction
4512 + operand x. x is an RTL expression.
4515 +avr32_print_operand (FILE * stream, rtx x, int code)
4519 + switch (GET_CODE (x))
4522 + switch (XINT (x, 1))
4524 + case UNSPEC_COND_PL:
4526 + fputs ("mi", stream);
4528 + fputs ("pl", stream);
4530 + case UNSPEC_COND_MI:
4532 + fputs ("pl", stream);
4534 + fputs ("mi", stream);
4542 + fputs ("ne", stream);
4544 + fputs ("eq", stream);
4548 + fputs ("eq", stream);
4550 + fputs ("ne", stream);
4554 + fputs ("le", stream);
4556 + fputs ("gt", stream);
4560 + fputs ("ls", stream);
4562 + fputs ("hi", stream);
4566 + fputs ("ge", stream);
4568 + fputs ("lt", stream);
4572 + fputs ("hs", stream);
4574 + fputs ("lo", stream);
4578 + fputs ("lt", stream);
4580 + fputs ("ge", stream);
4584 + fputs ("lo", stream);
4586 + fputs ("hs", stream);
4590 + fputs ("gt", stream);
4592 + fputs ("le", stream);
4596 + fputs ("hi", stream);
4598 + fputs ("ls", stream);
4602 + HOST_WIDE_INT value = INTVAL (x);
4607 + if ( HOST_BITS_PER_WIDE_INT > BITS_PER_WORD )
4609 + /* A const_int can be used to represent DImode constants. */
4610 + value >>= BITS_PER_WORD;
4612 + /* We might get a const_int immediate for setting a DI register,
4613 + we then must then return the correct sign extended DI. The most
4614 + significant word is just a sign extension. */
4615 + else if (value < 0)
4625 + /* Set to bit position of first bit set in immediate */
4626 + int i, bitpos = 32;
4627 + for (i = 0; i < 32; i++)
4628 + if (value & (1 << i))
4643 + sprintf (op, "r0-r3");
4645 + strlen (op) ? sprintf (op, "%s, r4-r7", op) : sprintf (op,
4648 + strlen (op) ? sprintf (op, "%s, r8-r9", op) : sprintf (op,
4651 + strlen (op) ? sprintf (op, "%s, r10", op) : sprintf (op,
4654 + strlen (op) ? sprintf (op, "%s, r11", op) : sprintf (op,
4657 + strlen (op) ? sprintf (op, "%s, r12", op) : sprintf (op,
4660 + strlen (op) ? sprintf (op, "%s, lr", op) : sprintf (op, "lr");
4662 + strlen (op) ? sprintf (op, "%s, pc", op) : sprintf (op, "pc");
4664 + fputs (op, stream);
4670 + char reglist16_string[100];
4672 + reglist16_string[0] = '\0';
4674 + for (i = 0; i < 16; ++i)
4676 + if (value & (1 << i))
4678 + strlen (reglist16_string) ? sprintf (reglist16_string,
4684 + sprintf (reglist16_string, "%s",
4685 + reg_names[INTERNAL_REGNUM (i)]);
4688 + fputs (reglist16_string, stream);
4694 + char reglist_string[100];
4695 + avr32_make_fp_reglist_w (value, (char *) reglist_string);
4696 + fputs (reglist_string, stream);
4702 + char reglist_string[100];
4703 + avr32_make_fp_reglist_d (value, (char *) reglist_string);
4704 + fputs (reglist_string, stream);
4708 + /* Print halfword part of word */
4709 + fputs (value ? "b" : "t", stream);
4714 + fprintf (stream, "%d", value);
4717 + case CONST_DOUBLE:
4719 + HOST_WIDE_INT hi, lo;
4720 + if (SCALAR_FLOAT_MODE_P (GET_MODE (x)))
4722 + HOST_WIDE_INT target_float[2];
4724 + real_to_target (target_float, CONST_DOUBLE_REAL_VALUE (x),
4726 + /* For doubles the most significant part starts at index 0. */
4727 + if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
4729 + hi = target_float[0];
4730 + lo = target_float[1];
4734 + lo = target_float[0];
4739 + hi = CONST_DOUBLE_HIGH (x);
4740 + lo = CONST_DOUBLE_LOW (x);
4744 + fprintf (stream, "%ld", hi);
4746 + fprintf (stream, "%ld", lo);
4751 + output_addr_const (stream, XEXP (XEXP (x, 0), 0));
4752 + fprintf (stream, "+%ld", INTVAL (XEXP (XEXP (x, 0), 1)));
4755 + /* Swap register name if the register is DImode or DFmode. */
4756 + if (GET_MODE (x) == DImode || GET_MODE (x) == DFmode)
4758 + /* Double register must have an even numbered address */
4759 + gcc_assert (!(REGNO (x) % 2));
4761 + fputs (reg_names[true_regnum (x)], stream);
4763 + fputs (reg_names[true_regnum (x) + 1], stream);
4765 + else if (GET_MODE (x) == TImode)
4770 + fputs (reg_names[true_regnum (x)], stream);
4773 + fputs (reg_names[true_regnum (x) + 1], stream);
4776 + fputs (reg_names[true_regnum (x) + 2], stream);
4779 + fputs (reg_names[true_regnum (x) + 3], stream);
4782 + fprintf (stream, "%s, %s, %s, %s",
4783 + reg_names[true_regnum (x) + 3],
4784 + reg_names[true_regnum (x) + 2],
4785 + reg_names[true_regnum (x) + 1],
4786 + reg_names[true_regnum (x)]);
4792 + fputs (reg_names[true_regnum (x)], stream);
4798 + output_addr_const (stream, x);
4801 + switch (GET_CODE (XEXP (x, 0)))
4805 + output_addr_const (stream, XEXP (x, 0));
4808 + switch (GET_CODE (XEXP (XEXP (x, 0), 0)))
4811 + output_addr_const (stream, XEXP (XEXP (x, 0), 0));
4819 + avr32_print_operand (stream, XEXP (x, 0), 0);
4821 + fputs ("[0]", stream);
4824 + fputs ("--", stream);
4825 + avr32_print_operand (stream, XEXP (XEXP (x, 0), 0), 0);
4828 + avr32_print_operand (stream, XEXP (XEXP (x, 0), 0), 0);
4829 + fputs ("++", stream);
4833 + rtx op0 = XEXP (XEXP (x, 0), 0);
4834 + rtx op1 = XEXP (XEXP (x, 0), 1);
4835 + rtx base = NULL_RTX, offset = NULL_RTX;
4837 + if (avr32_address_register_rtx_p (op0, 1))
4842 + else if (avr32_address_register_rtx_p (op1, 1))
4844 + /* Operands are switched. */
4849 + gcc_assert (base && offset
4850 + && avr32_address_register_rtx_p (base, 1)
4851 + && avr32_legitimate_index_p (GET_MODE (x), offset,
4854 + avr32_print_operand (stream, base, 0);
4855 + fputs ("[", stream);
4856 + avr32_print_operand (stream, offset, 0);
4857 + fputs ("]", stream);
4861 + output_addr_const (stream, XEXP (XEXP (XEXP (x, 0), 0), 0));
4862 + fprintf (stream, " + %ld",
4863 + INTVAL (XEXP (XEXP (XEXP (x, 0), 0), 1)));
4871 + int value = INTVAL (XEXP (x, 1));
4873 + /* Convert immediate in multiplication into a shift immediate */
4888 + fprintf (stream, "%s << %i", reg_names[true_regnum (XEXP (x, 0))],
4893 + if (GET_CODE (XEXP (x, 1)) == CONST_INT)
4894 + fprintf (stream, "%s << %i", reg_names[true_regnum (XEXP (x, 0))],
4895 + (int) INTVAL (XEXP (x, 1)));
4896 + else if (REG_P (XEXP (x, 1)))
4897 + fprintf (stream, "%s << %s", reg_names[true_regnum (XEXP (x, 0))],
4898 + reg_names[true_regnum (XEXP (x, 1))]);
4905 + if (GET_CODE (XEXP (x, 1)) == CONST_INT)
4906 + fprintf (stream, "%s >> %i", reg_names[true_regnum (XEXP (x, 0))],
4907 + (int) INTVAL (XEXP (x, 1)));
4908 + else if (REG_P (XEXP (x, 1)))
4909 + fprintf (stream, "%s >> %s", reg_names[true_regnum (XEXP (x, 0))],
4910 + reg_names[true_regnum (XEXP (x, 1))]);
4915 + fprintf (stream, ">>");
4919 + /* Load store multiple */
4921 + int count = XVECLEN (x, 0);
4922 + int reglist16 = 0;
4923 + char reglist16_string[100];
4925 + for (i = 0; i < count; ++i)
4927 + rtx vec_elm = XVECEXP (x, 0, i);
4928 + if (GET_MODE (vec_elm) != SET)
4930 + debug_rtx (vec_elm);
4931 + internal_error ("Unknown element in parallel expression!");
4933 + if (GET_MODE (XEXP (vec_elm, 0)) == REG)
4935 + /* Load multiple */
4936 + reglist16 |= 1 << ASM_REGNUM (REGNO (XEXP (vec_elm, 0)));
4940 + /* Store multiple */
4941 + reglist16 |= 1 << ASM_REGNUM (REGNO (XEXP (vec_elm, 1)));
4945 + avr32_make_reglist16 (reglist16, reglist16_string);
4946 + fputs (reglist16_string, stream);
4958 + internal_error ("Illegal expression for avr32_print_operand");
4963 +avr32_get_note_reg_equiv (rtx insn)
4967 + note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
4969 + if (note != NULL_RTX)
4970 + return XEXP (note, 0);
4976 + Outputs to stdio stream stream the assembler syntax for an instruction
4977 + operand that is a memory reference whose address is x. x is an RTL
4983 +avr32_print_operand_address (FILE * stream, rtx x)
4985 + fprintf (stream, "(%d) /* address */", REGNO (x));
4988 +/* Return true if _GLOBAL_OFFSET_TABLE_ symbol is mentioned. */
4990 +avr32_got_mentioned_p (rtx addr)
4992 + if (GET_CODE (addr) == MEM)
4993 + addr = XEXP (addr, 0);
4994 + while (GET_CODE (addr) == CONST)
4995 + addr = XEXP (addr, 0);
4996 + if (GET_CODE (addr) == SYMBOL_REF)
4998 + return streq (XSTR (addr, 0), "_GLOBAL_OFFSET_TABLE_");
5000 + if (GET_CODE (addr) == PLUS || GET_CODE (addr) == MINUS)
5004 + l1 = avr32_got_mentioned_p (XEXP (addr, 0));
5005 + l2 = avr32_got_mentioned_p (XEXP (addr, 1));
5012 +/* Find the symbol in an address expression. */
5015 +avr32_find_symbol (rtx addr)
5017 + if (GET_CODE (addr) == MEM)
5018 + addr = XEXP (addr, 0);
5020 + while (GET_CODE (addr) == CONST)
5021 + addr = XEXP (addr, 0);
5023 + if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
5025 + if (GET_CODE (addr) == PLUS)
5029 + l1 = avr32_find_symbol (XEXP (addr, 0));
5030 + l2 = avr32_find_symbol (XEXP (addr, 1));
5031 + if (l1 != NULL_RTX && l2 == NULL_RTX)
5033 + else if (l1 == NULL_RTX && l2 != NULL_RTX)
5041 +/* Routines for manipulation of the constant pool. */
5043 +/* AVR32 instructions cannot load a large constant directly into a
5044 + register; they have to come from a pc relative load. The constant
5045 + must therefore be placed in the addressable range of the pc
5046 + relative load. Depending on the precise pc relative load
5047 + instruction the range is somewhere between 256 bytes and 4k. This
5048 + means that we often have to dump a constant inside a function, and
5049 + generate code to branch around it.
5051 + It is important to minimize this, since the branches will slow
5052 + things down and make the code larger.
5054 + Normally we can hide the table after an existing unconditional
5055 + branch so that there is no interruption of the flow, but in the
5056 + worst case the code looks like this:
5074 + We fix this by performing a scan after scheduling, which notices
5075 + which instructions need to have their operands fetched from the
5076 + constant table and builds the table.
5078 + The algorithm starts by building a table of all the constants that
5079 + need fixing up and all the natural barriers in the function (places
5080 + where a constant table can be dropped without breaking the flow).
5081 + For each fixup we note how far the pc-relative replacement will be
5082 + able to reach and the offset of the instruction into the function.
5084 + Having built the table we then group the fixes together to form
5085 + tables that are as large as possible (subject to addressing
5086 + constraints) and emit each table of constants after the last
5087 + barrier that is within range of all the instructions in the group.
5088 + If a group does not contain a barrier, then we forcibly create one
5089 + by inserting a jump instruction into the flow. Once the table has
5090 + been inserted, the insns are then modified to reference the
5091 + relevant entry in the pool.
5093 + Possible enhancements to the algorithm (not implemented) are:
5095 + 1) For some processors and object formats, there may be benefit in
5096 + aligning the pools to the start of cache lines; this alignment
5097 + would need to be taken into account when calculating addressability
5100 +/* These typedefs are located at the start of this file, so that
5101 + they can be used in the prototypes there. This comment is to
5102 + remind readers of that fact so that the following structures
5103 + can be understood more easily.
5105 + typedef struct minipool_node Mnode;
5106 + typedef struct minipool_fixup Mfix; */
5108 +struct minipool_node
5110 + /* Doubly linked chain of entries. */
5113 + /* The maximum offset into the code that this entry can be placed. While
5114 + pushing fixes for forward references, all entries are sorted in order of
5115 + increasing max_address. */
5116 + HOST_WIDE_INT max_address;
5117 + /* Similarly for an entry inserted for a backwards ref. */
5118 + HOST_WIDE_INT min_address;
5119 + /* The number of fixes referencing this entry. This can become zero if we
5120 + "unpush" an entry. In this case we ignore the entry when we come to
5123 + /* The offset from the start of the minipool. */
5124 + HOST_WIDE_INT offset;
5125 + /* The value in table. */
5127 + /* The mode of value. */
5128 + enum machine_mode mode;
5129 + /* The size of the value. */
5133 +struct minipool_fixup
5137 + HOST_WIDE_INT address;
5139 + enum machine_mode mode;
5143 + HOST_WIDE_INT forwards;
5144 + HOST_WIDE_INT backwards;
5148 +/* Fixes less than a word need padding out to a word boundary. */
5149 +#define MINIPOOL_FIX_SIZE(mode, value) \
5150 + (IS_FORCE_MINIPOOL(value) ? 0 : \
5151 + (GET_MODE_SIZE ((mode)) >= 4 ? GET_MODE_SIZE ((mode)) : 4))
5153 +#define IS_FORCE_MINIPOOL(x) \
5154 + (GET_CODE(x) == UNSPEC && \
5155 + XINT(x, 1) == UNSPEC_FORCE_MINIPOOL)
5157 +static Mnode *minipool_vector_head;
5158 +static Mnode *minipool_vector_tail;
5160 +/* The linked list of all minipool fixes required for this function. */
5161 +Mfix *minipool_fix_head;
5162 +Mfix *minipool_fix_tail;
5163 +/* The fix entry for the current minipool, once it has been placed. */
5164 +Mfix *minipool_barrier;
5166 +/* Determines if INSN is the start of a jump table. Returns the end
5167 + of the TABLE or NULL_RTX. */
5169 +is_jump_table (rtx insn)
5173 + if (GET_CODE (insn) == JUMP_INSN
5174 + && JUMP_LABEL (insn) != NULL
5175 + && ((table = next_real_insn (JUMP_LABEL (insn)))
5176 + == next_real_insn (insn))
5178 + && GET_CODE (table) == JUMP_INSN
5179 + && (GET_CODE (PATTERN (table)) == ADDR_VEC
5180 + || GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
5186 +static HOST_WIDE_INT
5187 +get_jump_table_size (rtx insn)
5189 + /* ADDR_VECs only take room if read-only data does into the text section. */
5190 + if (JUMP_TABLES_IN_TEXT_SECTION
5191 +#if !defined(READONLY_DATA_SECTION_ASM_OP)
5196 + rtx body = PATTERN (insn);
5197 + int elt = GET_CODE (body) == ADDR_DIFF_VEC ? 1 : 0;
5199 + return GET_MODE_SIZE (GET_MODE (body)) * XVECLEN (body, elt);
5205 +/* Move a minipool fix MP from its current location to before MAX_MP.
5206 + If MAX_MP is NULL, then MP doesn't need moving, but the addressing
5207 + constraints may need updating. */
5209 +move_minipool_fix_forward_ref (Mnode * mp, Mnode * max_mp,
5210 + HOST_WIDE_INT max_address)
5212 + /* This should never be true and the code below assumes these are
5217 + if (max_mp == NULL)
5219 + if (max_address < mp->max_address)
5220 + mp->max_address = max_address;
5224 + if (max_address > max_mp->max_address - mp->fix_size)
5225 + mp->max_address = max_mp->max_address - mp->fix_size;
5227 + mp->max_address = max_address;
5229 + /* Unlink MP from its current position. Since max_mp is non-null,
5230 + mp->prev must be non-null. */
5231 + mp->prev->next = mp->next;
5232 + if (mp->next != NULL)
5233 + mp->next->prev = mp->prev;
5235 + minipool_vector_tail = mp->prev;
5237 + /* Re-insert it before MAX_MP. */
5238 + mp->next = max_mp;
5239 + mp->prev = max_mp->prev;
5240 + max_mp->prev = mp;
5242 + if (mp->prev != NULL)
5243 + mp->prev->next = mp;
5245 + minipool_vector_head = mp;
5248 + /* Save the new entry. */
5251 + /* Scan over the preceding entries and adjust their addresses as required.
5253 + while (mp->prev != NULL
5254 + && mp->prev->max_address > mp->max_address - mp->prev->fix_size)
5256 + mp->prev->max_address = mp->max_address - mp->prev->fix_size;
5263 +/* Add a constant to the minipool for a forward reference. Returns the
5264 + node added or NULL if the constant will not fit in this pool. */
5266 +add_minipool_forward_ref (Mfix * fix)
5268 + /* If set, max_mp is the first pool_entry that has a lower constraint than
5269 + the one we are trying to add. */
5270 + Mnode *max_mp = NULL;
5271 + HOST_WIDE_INT max_address = fix->address + fix->forwards;
5274 + /* If this fix's address is greater than the address of the first entry,
5275 + then we can't put the fix in this pool. We subtract the size of the
5276 + current fix to ensure that if the table is fully packed we still have
5277 + enough room to insert this value by suffling the other fixes forwards. */
5278 + if (minipool_vector_head &&
5279 + fix->address >= minipool_vector_head->max_address - fix->fix_size)
5282 + /* Scan the pool to see if a constant with the same value has already been
5283 + added. While we are doing this, also note the location where we must
5284 + insert the constant if it doesn't already exist. */
5285 + for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
5287 + if (GET_CODE (fix->value) == GET_CODE (mp->value)
5288 + && fix->mode == mp->mode
5289 + && (GET_CODE (fix->value) != CODE_LABEL
5290 + || (CODE_LABEL_NUMBER (fix->value)
5291 + == CODE_LABEL_NUMBER (mp->value)))
5292 + && rtx_equal_p (fix->value, mp->value))
5294 + /* More than one fix references this entry. */
5296 + return move_minipool_fix_forward_ref (mp, max_mp, max_address);
5299 + /* Note the insertion point if necessary. */
5300 + if (max_mp == NULL && mp->max_address > max_address)
5305 + /* The value is not currently in the minipool, so we need to create a new
5306 + entry for it. If MAX_MP is NULL, the entry will be put on the end of
5307 + the list since the placement is less constrained than any existing
5308 + entry. Otherwise, we insert the new fix before MAX_MP and, if
5309 + necessary, adjust the constraints on the other entries. */
5310 + mp = xmalloc (sizeof (*mp));
5311 + mp->fix_size = fix->fix_size;
5312 + mp->mode = fix->mode;
5313 + mp->value = fix->value;
5315 + /* Not yet required for a backwards ref. */
5316 + mp->min_address = -65536;
5318 + if (max_mp == NULL)
5320 + mp->max_address = max_address;
5322 + mp->prev = minipool_vector_tail;
5324 + if (mp->prev == NULL)
5326 + minipool_vector_head = mp;
5327 + minipool_vector_label = gen_label_rtx ();
5330 + mp->prev->next = mp;
5332 + minipool_vector_tail = mp;
5336 + if (max_address > max_mp->max_address - mp->fix_size)
5337 + mp->max_address = max_mp->max_address - mp->fix_size;
5339 + mp->max_address = max_address;
5341 + mp->next = max_mp;
5342 + mp->prev = max_mp->prev;
5343 + max_mp->prev = mp;
5344 + if (mp->prev != NULL)
5345 + mp->prev->next = mp;
5347 + minipool_vector_head = mp;
5350 + /* Save the new entry. */
5353 + /* Scan over the preceding entries and adjust their addresses as required.
5355 + while (mp->prev != NULL
5356 + && mp->prev->max_address > mp->max_address - mp->prev->fix_size)
5358 + mp->prev->max_address = mp->max_address - mp->prev->fix_size;
5366 +move_minipool_fix_backward_ref (Mnode * mp, Mnode * min_mp,
5367 + HOST_WIDE_INT min_address)
5369 + HOST_WIDE_INT offset;
5371 + /* This should never be true, and the code below assumes these are
5376 + if (min_mp == NULL)
5378 + if (min_address > mp->min_address)
5379 + mp->min_address = min_address;
5383 + /* We will adjust this below if it is too loose. */
5384 + mp->min_address = min_address;
5386 + /* Unlink MP from its current position. Since min_mp is non-null,
5387 + mp->next must be non-null. */
5388 + mp->next->prev = mp->prev;
5389 + if (mp->prev != NULL)
5390 + mp->prev->next = mp->next;
5392 + minipool_vector_head = mp->next;
5394 + /* Reinsert it after MIN_MP. */
5395 + mp->prev = min_mp;
5396 + mp->next = min_mp->next;
5397 + min_mp->next = mp;
5398 + if (mp->next != NULL)
5399 + mp->next->prev = mp;
5401 + minipool_vector_tail = mp;
5407 + for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
5409 + mp->offset = offset;
5410 + if (mp->refcount > 0)
5411 + offset += mp->fix_size;
5413 + if (mp->next && mp->next->min_address < mp->min_address + mp->fix_size)
5414 + mp->next->min_address = mp->min_address + mp->fix_size;
5420 +/* Add a constant to the minipool for a backward reference. Returns the
5421 + node added or NULL if the constant will not fit in this pool.
5423 + Note that the code for insertion for a backwards reference can be
5424 + somewhat confusing because the calculated offsets for each fix do
5425 + not take into account the size of the pool (which is still under
5428 +add_minipool_backward_ref (Mfix * fix)
5430 + /* If set, min_mp is the last pool_entry that has a lower constraint than
5431 + the one we are trying to add. */
5432 + Mnode *min_mp = NULL;
5433 + /* This can be negative, since it is only a constraint. */
5434 + HOST_WIDE_INT min_address = fix->address - fix->backwards;
5437 + /* If we can't reach the current pool from this insn, or if we can't insert
5438 + this entry at the end of the pool without pushing other fixes out of
5439 + range, then we don't try. This ensures that we can't fail later on. */
5440 + if (min_address >= minipool_barrier->address
5441 + || (minipool_vector_tail->min_address + fix->fix_size
5442 + >= minipool_barrier->address))
5445 + /* Scan the pool to see if a constant with the same value has already been
5446 + added. While we are doing this, also note the location where we must
5447 + insert the constant if it doesn't already exist. */
5448 + for (mp = minipool_vector_tail; mp != NULL; mp = mp->prev)
5450 + if (GET_CODE (fix->value) == GET_CODE (mp->value)
5451 + && fix->mode == mp->mode
5452 + && (GET_CODE (fix->value) != CODE_LABEL
5453 + || (CODE_LABEL_NUMBER (fix->value)
5454 + == CODE_LABEL_NUMBER (mp->value)))
5455 + && rtx_equal_p (fix->value, mp->value)
5456 + /* Check that there is enough slack to move this entry to the end
5457 + of the table (this is conservative). */
5458 + && (mp->max_address
5459 + > (minipool_barrier->address
5460 + + minipool_vector_tail->offset
5461 + + minipool_vector_tail->fix_size)))
5464 + return move_minipool_fix_backward_ref (mp, min_mp, min_address);
5467 + if (min_mp != NULL)
5468 + mp->min_address += fix->fix_size;
5471 + /* Note the insertion point if necessary. */
5472 + if (mp->min_address < min_address)
5476 + else if (mp->max_address
5477 + < minipool_barrier->address + mp->offset + fix->fix_size)
5479 + /* Inserting before this entry would push the fix beyond its
5480 + maximum address (which can happen if we have re-located a
5481 + forwards fix); force the new fix to come after it. */
5483 + min_address = mp->min_address + fix->fix_size;
5488 + /* We need to create a new entry. */
5489 + mp = xmalloc (sizeof (*mp));
5490 + mp->fix_size = fix->fix_size;
5491 + mp->mode = fix->mode;
5492 + mp->value = fix->value;
5494 + mp->max_address = minipool_barrier->address + 65536;
5496 + mp->min_address = min_address;
5498 + if (min_mp == NULL)
5501 + mp->next = minipool_vector_head;
5503 + if (mp->next == NULL)
5505 + minipool_vector_tail = mp;
5506 + minipool_vector_label = gen_label_rtx ();
5509 + mp->next->prev = mp;
5511 + minipool_vector_head = mp;
5515 + mp->next = min_mp->next;
5516 + mp->prev = min_mp;
5517 + min_mp->next = mp;
5519 + if (mp->next != NULL)
5520 + mp->next->prev = mp;
5522 + minipool_vector_tail = mp;
5525 + /* Save the new entry. */
5533 + /* Scan over the following entries and adjust their offsets. */
5534 + while (mp->next != NULL)
5536 + if (mp->next->min_address < mp->min_address + mp->fix_size)
5537 + mp->next->min_address = mp->min_address + mp->fix_size;
5540 + mp->next->offset = mp->offset + mp->fix_size;
5542 + mp->next->offset = mp->offset;
5551 +assign_minipool_offsets (Mfix * barrier)
5553 + HOST_WIDE_INT offset = 0;
5556 + minipool_barrier = barrier;
5558 + for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
5560 + mp->offset = offset;
5562 + if (mp->refcount > 0)
5563 + offset += mp->fix_size;
5567 +/* Print a symbolic form of X to the debug file, F. */
5569 +avr32_print_value (FILE * f, rtx x)
5571 + switch (GET_CODE (x))
5574 + fprintf (f, "0x%x", (int) INTVAL (x));
5577 + case CONST_DOUBLE:
5578 + fprintf (f, "<0x%lx,0x%lx>", (long) XWINT (x, 2), (long) XWINT (x, 3));
5581 + case CONST_VECTOR:
5586 + for (i = 0; i < CONST_VECTOR_NUNITS (x); i++)
5588 + fprintf (f, "0x%x", (int) INTVAL (CONST_VECTOR_ELT (x, i)));
5589 + if (i < (CONST_VECTOR_NUNITS (x) - 1))
5596 + case CONST_STRING:
5597 + fprintf (f, "\"%s\"", XSTR (x, 0));
5601 + fprintf (f, "`%s'", XSTR (x, 0));
5605 + fprintf (f, "L%d", INSN_UID (XEXP (x, 0)));
5609 + avr32_print_value (f, XEXP (x, 0));
5613 + avr32_print_value (f, XEXP (x, 0));
5615 + avr32_print_value (f, XEXP (x, 1));
5619 + fprintf (f, "pc");
5623 + fprintf (f, "????");
5629 +is_minipool_label (rtx label)
5631 + minipool_labels *cur_mp_label = cfun->machine->minipool_label_head;
5633 + if (GET_CODE (label) != CODE_LABEL)
5636 + while (cur_mp_label)
5638 + if (CODE_LABEL_NUMBER (label)
5639 + == CODE_LABEL_NUMBER (cur_mp_label->label))
5641 + cur_mp_label = cur_mp_label->next;
5647 +new_minipool_label (rtx label)
5649 + if (!cfun->machine->minipool_label_head)
5651 + cfun->machine->minipool_label_head =
5652 + ggc_alloc (sizeof (minipool_labels));
5653 + cfun->machine->minipool_label_tail = cfun->machine->minipool_label_head;
5654 + cfun->machine->minipool_label_head->label = label;
5655 + cfun->machine->minipool_label_head->next = 0;
5656 + cfun->machine->minipool_label_head->prev = 0;
5660 + cfun->machine->minipool_label_tail->next =
5661 + ggc_alloc (sizeof (minipool_labels));
5662 + cfun->machine->minipool_label_tail->next->label = label;
5663 + cfun->machine->minipool_label_tail->next->next = 0;
5664 + cfun->machine->minipool_label_tail->next->prev =
5665 + cfun->machine->minipool_label_tail;
5666 + cfun->machine->minipool_label_tail =
5667 + cfun->machine->minipool_label_tail->next;
5671 +/* Output the literal table */
5673 +dump_minipool (rtx scan)
5679 + fprintf (dump_file,
5680 + ";; Emitting minipool after insn %u; address %ld; align %d (bytes)\n",
5681 + INSN_UID (scan), (unsigned long) minipool_barrier->address, 4);
5683 + scan = emit_insn_after (gen_consttable_start (), scan);
5684 + scan = emit_insn_after (gen_align_4 (), scan);
5685 + scan = emit_label_after (minipool_vector_label, scan);
5686 + new_minipool_label (minipool_vector_label);
5688 + for (mp = minipool_vector_head; mp != NULL; mp = nmp)
5690 + if (mp->refcount > 0)
5694 + fprintf (dump_file,
5695 + ";; Offset %u, min %ld, max %ld ",
5696 + (unsigned) mp->offset, (unsigned long) mp->min_address,
5697 + (unsigned long) mp->max_address);
5698 + avr32_print_value (dump_file, mp->value);
5699 + fputc ('\n', dump_file);
5702 + switch (mp->fix_size)
5704 +#ifdef HAVE_consttable_4
5706 + scan = emit_insn_after (gen_consttable_4 (mp->value), scan);
5710 +#ifdef HAVE_consttable_8
5712 + scan = emit_insn_after (gen_consttable_8 (mp->value), scan);
5716 +#ifdef HAVE_consttable_16
5718 + scan = emit_insn_after (gen_consttable_16 (mp->value), scan);
5723 + /* This can happen for force-minipool entries which just are
5724 + there to force the minipool to be generate. */
5736 + minipool_vector_head = minipool_vector_tail = NULL;
5737 + scan = emit_insn_after (gen_consttable_end (), scan);
5738 + scan = emit_barrier_after (scan);
5741 +/* Return the cost of forcibly inserting a barrier after INSN. */
5743 +avr32_barrier_cost (rtx insn)
5745 + /* Basing the location of the pool on the loop depth is preferable, but at
5746 + the moment, the basic block information seems to be corrupt by this
5747 + stage of the compilation. */
5748 + int base_cost = 50;
5749 + rtx next = next_nonnote_insn (insn);
5751 + if (next != NULL && GET_CODE (next) == CODE_LABEL)
5754 + switch (GET_CODE (insn))
5757 + /* It will always be better to place the table before the label, rather
5766 + return base_cost - 10;
5769 + return base_cost + 10;
5773 +/* Find the best place in the insn stream in the range
5774 + (FIX->address,MAX_ADDRESS) to forcibly insert a minipool barrier.
5775 + Create the barrier by inserting a jump and add a new fix entry for
5778 +create_fix_barrier (Mfix * fix, HOST_WIDE_INT max_address)
5780 + HOST_WIDE_INT count = 0;
5782 + rtx from = fix->insn;
5783 + rtx selected = from;
5784 + int selected_cost;
5785 + HOST_WIDE_INT selected_address;
5787 + HOST_WIDE_INT max_count = max_address - fix->address;
5788 + rtx label = gen_label_rtx ();
5790 + selected_cost = avr32_barrier_cost (from);
5791 + selected_address = fix->address;
5793 + while (from && count < max_count)
5798 + /* This code shouldn't have been called if there was a natural barrier
5800 + if (GET_CODE (from) == BARRIER)
5803 + /* Count the length of this insn. */
5804 + count += get_attr_length (from);
5806 + /* If there is a jump table, add its length. */
5807 + tmp = is_jump_table (from);
5810 + count += get_jump_table_size (tmp);
5812 + /* Jump tables aren't in a basic block, so base the cost on the
5813 + dispatch insn. If we select this location, we will still put
5814 + the pool after the table. */
5815 + new_cost = avr32_barrier_cost (from);
5817 + if (count < max_count && new_cost <= selected_cost)
5820 + selected_cost = new_cost;
5821 + selected_address = fix->address + count;
5824 + /* Continue after the dispatch table. */
5825 + from = NEXT_INSN (tmp);
5829 + new_cost = avr32_barrier_cost (from);
5831 + if (count < max_count && new_cost <= selected_cost)
5834 + selected_cost = new_cost;
5835 + selected_address = fix->address + count;
5838 + from = NEXT_INSN (from);
5841 + /* Create a new JUMP_INSN that branches around a barrier. */
5842 + from = emit_jump_insn_after (gen_jump (label), selected);
5843 + JUMP_LABEL (from) = label;
5844 + barrier = emit_barrier_after (from);
5845 + emit_label_after (label, barrier);
5847 + /* Create a minipool barrier entry for the new barrier. */
5848 + new_fix = (Mfix *) obstack_alloc (&minipool_obstack, sizeof (*new_fix));
5849 + new_fix->insn = barrier;
5850 + new_fix->address = selected_address;
5851 + new_fix->next = fix->next;
5852 + fix->next = new_fix;
5857 +/* Record that there is a natural barrier in the insn stream at
5860 +push_minipool_barrier (rtx insn, HOST_WIDE_INT address)
5862 + Mfix *fix = (Mfix *) obstack_alloc (&minipool_obstack, sizeof (*fix));
5865 + fix->address = address;
5868 + if (minipool_fix_head != NULL)
5869 + minipool_fix_tail->next = fix;
5871 + minipool_fix_head = fix;
5873 + minipool_fix_tail = fix;
5876 +/* Record INSN, which will need fixing up to load a value from the
5877 + minipool. ADDRESS is the offset of the insn since the start of the
5878 + function; LOC is a pointer to the part of the insn which requires
5879 + fixing; VALUE is the constant that must be loaded, which is of type
5882 +push_minipool_fix (rtx insn, HOST_WIDE_INT address, rtx * loc,
5883 + enum machine_mode mode, rtx value)
5885 + Mfix *fix = (Mfix *) obstack_alloc (&minipool_obstack, sizeof (*fix));
5886 + rtx body = PATTERN (insn);
5889 + fix->address = address;
5892 + fix->fix_size = MINIPOOL_FIX_SIZE (mode, value);
5893 + fix->value = value;
5895 + if (GET_CODE (body) == PARALLEL)
5897 + /* Mcall : Ks16 << 2 */
5898 + fix->forwards = ((1 << 15) - 1) << 2;
5899 + fix->backwards = (1 << 15) << 2;
5901 + else if (GET_CODE (body) == SET
5902 + && GET_MODE_SIZE (GET_MODE (SET_DEST (body))) == 4)
5905 + if (TARGET_HARD_FLOAT
5906 + && GET_MODE_CLASS (GET_MODE (SET_DEST (body))) == MODE_FLOAT)
5908 + /* Ldc0.w : Ku12 << 2 */
5909 + fix->forwards = ((1 << 12) - 1) << 2;
5910 + fix->backwards = 0;
5914 + if (optimize_size)
5916 + /* Lddpc : Ku7 << 2 */
5917 + fix->forwards = ((1 << 7) - 1) << 2;
5918 + fix->backwards = 0;
5923 + fix->forwards = ((1 << 15) - 4);
5924 + fix->backwards = (1 << 15);
5928 + else if (GET_CODE (body) == SET
5929 + && GET_MODE_SIZE (GET_MODE (SET_DEST (body))) == 8)
5931 + /* Double word load */
5932 + if (TARGET_HARD_FLOAT
5933 + && GET_MODE_CLASS (GET_MODE (SET_DEST (body))) == MODE_FLOAT)
5935 + /* Ldc0.d : Ku12 << 2 */
5936 + fix->forwards = ((1 << 12) - 1) << 2;
5937 + fix->backwards = 0;
5942 + fix->forwards = ((1 << 15) - 4);
5943 + fix->backwards = (1 << 15);
5946 + else if (GET_CODE (body) == UNSPEC_VOLATILE
5947 + && XINT (body, 1) == VUNSPEC_MVRC)
5949 + /* Coprocessor load */
5950 + /* Ldc : Ku8 << 2 */
5951 + fix->forwards = ((1 << 8) - 1) << 2;
5952 + fix->backwards = 0;
5956 + /* Assume worst case which is lddpc insn. */
5957 + fix->forwards = ((1 << 7) - 1) << 2;
5958 + fix->backwards = 0;
5961 + fix->minipool = NULL;
5963 + /* If an insn doesn't have a range defined for it, then it isn't expecting
5964 + to be reworked by this code. Better to abort now than to generate duff
5966 + if (fix->forwards == 0 && fix->backwards == 0)
5971 + fprintf (dump_file,
5972 + ";; %smode fixup for i%d; addr %lu, range (%ld,%ld): ",
5973 + GET_MODE_NAME (mode),
5974 + INSN_UID (insn), (unsigned long) address,
5975 + -1 * (long) fix->backwards, (long) fix->forwards);
5976 + avr32_print_value (dump_file, fix->value);
5977 + fprintf (dump_file, "\n");
5980 + /* Add it to the chain of fixes. */
5983 + if (minipool_fix_head != NULL)
5984 + minipool_fix_tail->next = fix;
5986 + minipool_fix_head = fix;
5988 + minipool_fix_tail = fix;
5991 +/* Scan INSN and note any of its operands that need fixing.
5992 + If DO_PUSHES is false we do not actually push any of the fixups
5993 + needed. The function returns TRUE is any fixups were needed/pushed.
5994 + This is used by avr32_memory_load_p() which needs to know about loads
5995 + of constants that will be converted into minipool loads. */
5997 +note_invalid_constants (rtx insn, HOST_WIDE_INT address, int do_pushes)
5999 + bool result = false;
6002 + extract_insn (insn);
6004 + if (!constrain_operands (1))
6005 + fatal_insn_not_found (insn);
6007 + if (recog_data.n_alternatives == 0)
6010 + /* Fill in recog_op_alt with information about the constraints of this
6012 + preprocess_constraints ();
6014 + for (opno = 0; opno < recog_data.n_operands; opno++)
6018 + /* Things we need to fix can only occur in inputs. */
6019 + if (recog_data.operand_type[opno] != OP_IN)
6022 + op = recog_data.operand[opno];
6024 + if (avr32_const_pool_ref_operand (op, GET_MODE (op)))
6028 + rtx cop = avoid_constant_pool_reference (op);
6030 + /* Casting the address of something to a mode narrower than a
6031 + word can cause avoid_constant_pool_reference() to return the
6032 + pool reference itself. That's no good to us here. Lets
6033 + just hope that we can use the constant pool value directly.
6036 + cop = get_pool_constant (XEXP (op, 0));
6038 + push_minipool_fix (insn, address,
6039 + recog_data.operand_loc[opno],
6040 + recog_data.operand_mode[opno], cop);
6045 + else if (TARGET_HAS_ASM_ADDR_PSEUDOS
6046 + && avr32_address_operand (op, GET_MODE (op)))
6048 + /* Handle pseudo instructions using a direct address. These pseudo
6049 + instructions might need entries in the constant pool and we must
6050 + therefor create a constant pool for them, in case the
6051 + assembler/linker needs to insert entries. */
6054 + /* Push a dummy constant pool entry so that the .cpool
6055 + directive should be inserted on the appropriate place in the
6056 + code even if there are no real constant pool entries. This
6057 + is used by the assembler and linker to know where to put
6058 + generated constant pool entries. */
6059 + push_minipool_fix (insn, address,
6060 + recog_data.operand_loc[opno],
6061 + recog_data.operand_mode[opno],
6062 + gen_rtx_UNSPEC (VOIDmode,
6063 + gen_rtvec (1, const0_rtx),
6064 + UNSPEC_FORCE_MINIPOOL));
6074 +avr32_insn_is_cast (rtx insn)
6077 + if (NONJUMP_INSN_P (insn)
6078 + && GET_CODE (PATTERN (insn)) == SET
6079 + && (GET_CODE (SET_SRC (PATTERN (insn))) == ZERO_EXTEND
6080 + || GET_CODE (SET_SRC (PATTERN (insn))) == SIGN_EXTEND)
6081 + && REG_P (XEXP (SET_SRC (PATTERN (insn)), 0))
6082 + && REG_P (SET_DEST (PATTERN (insn))))
6087 +/* FIXME: The level of nesting in this function is way too deep. It needs to be
6090 +avr32_reorg_optimization (void)
6092 + rtx first = get_insns ();
6095 + if (TARGET_MD_REORG_OPTIMIZATION && (optimize_size || (optimize > 0)))
6098 + /* Scan through all insns looking for cast operations. */
6101 + fprintf (dump_file, ";; Deleting redundant cast operations:\n");
6103 + for (insn = first; insn; insn = NEXT_INSN (insn))
6105 + rtx reg, src_reg, scan;
6106 + enum machine_mode mode;
6110 + if (avr32_insn_is_cast (insn)
6111 + && (GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == QImode
6112 + || GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == HImode))
6114 + mode = GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 0));
6115 + reg = SET_DEST (PATTERN (insn));
6116 + src_reg = XEXP (SET_SRC (PATTERN (insn)), 0);
6123 + unused_cast = false;
6124 + label_ref = NULL_RTX;
6125 + for (scan = NEXT_INSN (insn); scan; scan = NEXT_INSN (scan))
6127 + /* Check if we have reached the destination of a simple
6128 + conditional jump which we have already scanned past. If so,
6129 + we can safely continue scanning. */
6130 + if (LABEL_P (scan) && label_ref != NULL_RTX)
6132 + if (CODE_LABEL_NUMBER (scan) ==
6133 + CODE_LABEL_NUMBER (XEXP (label_ref, 0)))
6134 + label_ref = NULL_RTX;
6139 + if (!INSN_P (scan))
6142 + /* For conditional jumps we can manage to keep on scanning if
6143 + we meet the destination label later on before any new jump
6145 + if (GET_CODE (scan) == JUMP_INSN)
6147 + if (any_condjump_p (scan) && label_ref == NULL_RTX)
6148 + label_ref = condjump_label (scan);
6153 + if (!reg_mentioned_p (reg, PATTERN (scan)))
6156 + /* Check if casted register is used in this insn */
6157 + if ((regno_use_in (REGNO (reg), PATTERN (scan)) != NULL_RTX)
6158 + && (GET_MODE (regno_use_in (REGNO (reg), PATTERN (scan))) ==
6161 + /* If not used in the source to the set or in a memory
6162 + expression in the destiantion then the register is used
6163 + as a destination and is really dead. */
6164 + if (single_set (scan)
6165 + && GET_CODE (PATTERN (scan)) == SET
6166 + && REG_P (SET_DEST (PATTERN (scan)))
6167 + && !regno_use_in (REGNO (reg), SET_SRC (PATTERN (scan)))
6168 + && label_ref == NULL_RTX)
6170 + unused_cast = true;
6175 + /* Check if register is dead or set in this insn */
6176 + if (dead_or_set_p (scan, reg))
6178 + unused_cast = true;
6183 + /* Check if we have unresolved conditional jumps */
6184 + if (label_ref != NULL_RTX)
6189 + if (REGNO (reg) == REGNO (XEXP (SET_SRC (PATTERN (insn)), 0)))
6191 + /* One operand cast, safe to delete */
6194 + fprintf (dump_file,
6195 + ";; INSN %i removed, casted register %i value not used.\n",
6196 + INSN_UID (insn), REGNO (reg));
6198 + SET_INSN_DELETED (insn);
6199 + /* Force the instruction to be recognized again */
6200 + INSN_CODE (insn) = -1;
6204 + /* Two operand cast, which really could be substituted with
6205 + a move, if the source register is dead after the cast
6206 + insn and then the insn which sets the source register
6207 + could instead directly set the destination register for
6208 + the cast. As long as there are no insns in between which
6209 + uses the register. */
6210 + rtx link = NULL_RTX;
6212 + rtx src_reg = XEXP (SET_SRC (PATTERN (insn)), 0);
6213 + unused_cast = false;
6215 + if (!find_reg_note (insn, REG_DEAD, src_reg))
6218 + /* Search for the insn which sets the source register */
6219 + for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
6221 + if (REG_NOTE_KIND (link) != 0)
6223 + set = single_set (XEXP (link, 0));
6224 + if (set && rtx_equal_p (src_reg, SET_DEST (set)))
6226 + link = XEXP (link, 0);
6231 + /* Found no link or link is a call insn where we can not
6232 + change the destination register */
6233 + if (link == NULL_RTX || CALL_P (link))
6236 + /* Scan through all insn between link and insn */
6237 + for (scan = NEXT_INSN (link); scan; scan = NEXT_INSN (scan))
6239 + /* Don't try to trace forward past a CODE_LABEL if we
6240 + haven't seen INSN yet. Ordinarily, we will only
6241 + find the setting insn in LOG_LINKS if it is in the
6242 + same basic block. However, cross-jumping can insert
6243 + code labels in between the load and the call, and
6244 + can result in situations where a single call insn
6245 + may have two targets depending on where we came
6248 + if (GET_CODE (scan) == CODE_LABEL)
6251 + if (!INSN_P (scan))
6254 + /* Don't try to trace forward past a JUMP. To optimize
6255 + safely, we would have to check that all the
6256 + instructions at the jump destination did not use REG.
6259 + if (GET_CODE (scan) == JUMP_INSN)
6264 + if (!reg_mentioned_p (src_reg, PATTERN (scan)))
6267 + /* We have reached the cast insn */
6270 + /* We can remove cast and replace the destination
6271 + register of the link insn with the destination
6275 + fprintf (dump_file,
6276 + ";; INSN %i removed, casted value unused. "
6277 + "Destination of removed cast operation: register %i, folded into INSN %i.\n",
6278 + INSN_UID (insn), REGNO (reg),
6281 + /* Update link insn */
6282 + SET_DEST (PATTERN (link)) =
6283 + gen_rtx_REG (mode, REGNO (reg));
6284 + /* Force the instruction to be recognized again */
6285 + INSN_CODE (link) = -1;
6288 + SET_INSN_DELETED (insn);
6289 + /* Force the instruction to be recognized again */
6290 + INSN_CODE (insn) = -1;
6299 + if (TARGET_MD_REORG_OPTIMIZATION && (optimize_size || (optimize > 0)))
6302 + /* Scan through all insns looking for shifted add operations */
6305 + fprintf (dump_file,
6306 + ";; Deleting redundant shifted add operations:\n");
6308 + for (insn = first; insn; insn = NEXT_INSN (insn))
6310 + rtx reg, mem_expr, scan, op0, op1;
6311 + int add_only_used_as_pointer;
6314 + && GET_CODE (PATTERN (insn)) == SET
6315 + && GET_CODE (SET_SRC (PATTERN (insn))) == PLUS
6316 + && (GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == MULT
6317 + || GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == ASHIFT)
6318 + && GET_CODE (XEXP (XEXP (SET_SRC (PATTERN (insn)), 0), 1)) ==
6319 + CONST_INT && REG_P (SET_DEST (PATTERN (insn)))
6320 + && REG_P (XEXP (SET_SRC (PATTERN (insn)), 1))
6321 + && REG_P (XEXP (XEXP (SET_SRC (PATTERN (insn)), 0), 0)))
6323 + reg = SET_DEST (PATTERN (insn));
6324 + mem_expr = SET_SRC (PATTERN (insn));
6325 + op0 = XEXP (XEXP (mem_expr, 0), 0);
6326 + op1 = XEXP (mem_expr, 1);
6333 + /* Scan forward the check if the result of the shifted add
6334 + operation is only used as an address in memory operations and
6335 + that the operands to the shifted add are not clobbered. */
6336 + add_only_used_as_pointer = false;
6337 + for (scan = NEXT_INSN (insn); scan; scan = NEXT_INSN (scan))
6339 + if (!INSN_P (scan))
6342 + /* Don't try to trace forward past a JUMP or CALL. To optimize
6343 + safely, we would have to check that all the instructions at
6344 + the jump destination did not use REG. */
6346 + if (GET_CODE (scan) == JUMP_INSN)
6351 + /* If used in a call insn then we cannot optimize it away */
6352 + if (CALL_P (scan) && find_regno_fusage (scan, USE, REGNO (reg)))
6355 + /* If any of the operands of the shifted add are clobbered we
6356 + cannot optimize the shifted adda away */
6357 + if ((reg_set_p (op0, scan) && (REGNO (op0) != REGNO (reg)))
6358 + || (reg_set_p (op1, scan) && (REGNO (op1) != REGNO (reg))))
6361 + if (!reg_mentioned_p (reg, PATTERN (scan)))
6364 + /* If used any other place than as a pointer or as the
6365 + destination register we failed */
6366 + if (!(single_set (scan)
6367 + && GET_CODE (PATTERN (scan)) == SET
6368 + && ((MEM_P (SET_DEST (PATTERN (scan)))
6369 + && REG_P (XEXP (SET_DEST (PATTERN (scan)), 0))
6370 + && REGNO (XEXP (SET_DEST (PATTERN (scan)), 0)) ==
6371 + REGNO (reg)) || (MEM_P (SET_SRC (PATTERN (scan)))
6374 + (SET_SRC (PATTERN (scan)),
6378 + (SET_SRC (PATTERN (scan)),
6379 + 0)) == REGNO (reg))))
6380 + && !(GET_CODE (PATTERN (scan)) == SET
6381 + && REG_P (SET_DEST (PATTERN (scan)))
6382 + && !regno_use_in (REGNO (reg),
6383 + SET_SRC (PATTERN (scan)))))
6386 + /* Check if register is dead or set in this insn */
6387 + if (dead_or_set_p (scan, reg))
6389 + add_only_used_as_pointer = true;
6394 + if (add_only_used_as_pointer)
6396 + /* Lets delete the add insn and replace all memory references
6397 + which uses the pointer with the full expression. */
6400 + fprintf (dump_file,
6401 + ";; Deleting INSN %i since address expression can be folded into all "
6402 + "memory references using this expression\n",
6405 + SET_INSN_DELETED (insn);
6406 + /* Force the instruction to be recognized again */
6407 + INSN_CODE (insn) = -1;
6409 + for (scan = NEXT_INSN (insn); scan; scan = NEXT_INSN (scan))
6411 + if (!INSN_P (scan))
6414 + if (!reg_mentioned_p (reg, PATTERN (scan)))
6417 + /* If used any other place than as a pointer or as the
6418 + destination register we failed */
6419 + if ((single_set (scan)
6420 + && GET_CODE (PATTERN (scan)) == SET
6421 + && ((MEM_P (SET_DEST (PATTERN (scan)))
6422 + && REG_P (XEXP (SET_DEST (PATTERN (scan)), 0))
6423 + && REGNO (XEXP (SET_DEST (PATTERN (scan)), 0)) ==
6424 + REGNO (reg)) || (MEM_P (SET_SRC (PATTERN (scan)))
6427 + (SET_SRC (PATTERN (scan)),
6431 + (SET_SRC (PATTERN (scan)),
6432 + 0)) == REGNO (reg)))))
6436 + fprintf (dump_file,
6437 + ";; Register %i replaced by indexed address in INSN %i\n",
6438 + REGNO (reg), INSN_UID (scan));
6440 + if (MEM_P (SET_DEST (PATTERN (scan))))
6441 + XEXP (SET_DEST (PATTERN (scan)), 0) = mem_expr;
6443 + XEXP (SET_SRC (PATTERN (scan)), 0) = mem_expr;
6446 + /* Check if register is dead or set in this insn */
6447 + if (dead_or_set_p (scan, reg))
6458 +/* Exported to toplev.c.
6460 + Do a final pass over the function, just before delayed branch
6467 + HOST_WIDE_INT address = 0;
6470 + minipool_fix_head = minipool_fix_tail = NULL;
6472 + /* The first insn must always be a note, or the code below won't scan it
6474 + insn = get_insns ();
6475 + if (GET_CODE (insn) != NOTE)
6478 + /* Scan all the insns and record the operands that will need fixing. */
6479 + for (insn = next_nonnote_insn (insn); insn; insn = next_nonnote_insn (insn))
6481 + if (GET_CODE (insn) == BARRIER)
6482 + push_minipool_barrier (insn, address);
6483 + else if (INSN_P (insn))
6487 + note_invalid_constants (insn, address, true);
6488 + address += get_attr_length (insn);
6490 + /* If the insn is a vector jump, add the size of the table and skip
6492 + if ((table = is_jump_table (insn)) != NULL)
6494 + address += get_jump_table_size (table);
6500 + fix = minipool_fix_head;
6502 + /* Now scan the fixups and perform the required changes. */
6507 + Mfix *last_added_fix;
6508 + Mfix *last_barrier = NULL;
6511 + /* Skip any further barriers before the next fix. */
6512 + while (fix && GET_CODE (fix->insn) == BARRIER)
6515 + /* No more fixes. */
6519 + last_added_fix = NULL;
6521 + for (ftmp = fix; ftmp; ftmp = ftmp->next)
6523 + if (GET_CODE (ftmp->insn) == BARRIER)
6525 + if (ftmp->address >= minipool_vector_head->max_address)
6528 + last_barrier = ftmp;
6530 + else if ((ftmp->minipool = add_minipool_forward_ref (ftmp)) == NULL)
6533 + last_added_fix = ftmp; /* Keep track of the last fix added.
6537 + /* If we found a barrier, drop back to that; any fixes that we could
6538 + have reached but come after the barrier will now go in the next
6540 + if (last_barrier != NULL)
6542 + /* Reduce the refcount for those fixes that won't go into this pool
6544 + for (fdel = last_barrier->next;
6545 + fdel && fdel != ftmp; fdel = fdel->next)
6547 + fdel->minipool->refcount--;
6548 + fdel->minipool = NULL;
6551 + ftmp = last_barrier;
6555 + /* ftmp is first fix that we can't fit into this pool and there no
6556 + natural barriers that we could use. Insert a new barrier in the
6557 + code somewhere between the previous fix and this one, and
6558 + arrange to jump around it. */
6559 + HOST_WIDE_INT max_address;
6561 + /* The last item on the list of fixes must be a barrier, so we can
6562 + never run off the end of the list of fixes without last_barrier
6567 + max_address = minipool_vector_head->max_address;
6568 + /* Check that there isn't another fix that is in range that we
6569 + couldn't fit into this pool because the pool was already too
6570 + large: we need to put the pool before such an instruction. */
6571 + if (ftmp->address < max_address)
6572 + max_address = ftmp->address;
6574 + last_barrier = create_fix_barrier (last_added_fix, max_address);
6577 + assign_minipool_offsets (last_barrier);
6581 + if (GET_CODE (ftmp->insn) != BARRIER
6582 + && ((ftmp->minipool = add_minipool_backward_ref (ftmp))
6586 + ftmp = ftmp->next;
6589 + /* Scan over the fixes we have identified for this pool, fixing them up
6590 + and adding the constants to the pool itself. */
6591 + for (this_fix = fix; this_fix && ftmp != this_fix;
6592 + this_fix = this_fix->next)
6593 + if (GET_CODE (this_fix->insn) != BARRIER
6594 + /* Do nothing for entries present just to force the insertion of
6596 + && !IS_FORCE_MINIPOOL (this_fix->value))
6598 + rtx addr = plus_constant (gen_rtx_LABEL_REF (VOIDmode,
6599 + minipool_vector_label),
6600 + this_fix->minipool->offset);
6601 + *this_fix->loc = gen_rtx_MEM (this_fix->mode, addr);
6604 + dump_minipool (last_barrier->insn);
6608 + /* Free the minipool memory. */
6609 + obstack_free (&minipool_obstack, minipool_startobj);
6611 + avr32_reorg_optimization ();
6616 + Hook for doing some final scanning of instructions. Does nothing yet...*/
6618 +avr32_final_prescan_insn (rtx insn ATTRIBUTE_UNUSED,
6619 + rtx * opvec ATTRIBUTE_UNUSED,
6620 + int noperands ATTRIBUTE_UNUSED)
6626 +/* Function for changing the condition on the next instruction,
6627 + should be used when emmiting compare instructions and
6628 + the condition of the next instruction needs to change.
6631 +set_next_insn_cond (rtx cur_insn, rtx new_cond)
6633 + rtx next_insn = next_nonnote_insn (cur_insn);
6634 + if ((next_insn != NULL_RTX)
6635 + && (INSN_P (next_insn))
6636 + && (GET_CODE (PATTERN (next_insn)) == SET)
6637 + && (GET_CODE (SET_SRC (PATTERN (next_insn))) == IF_THEN_ELSE))
6639 + /* Branch instructions */
6640 + XEXP (SET_SRC (PATTERN (next_insn)), 0) = new_cond;
6641 + /* Force the instruction to be recognized again */
6642 + INSN_CODE (next_insn) = -1;
6645 + else if ((next_insn != NULL_RTX)
6646 + && (INSN_P (next_insn))
6647 + && (GET_CODE (PATTERN (next_insn)) == SET)
6648 + && comparison_operator (SET_SRC (PATTERN (next_insn)),
6649 + GET_MODE (SET_SRC (PATTERN (next_insn)))))
6651 + /* scc with no compare */
6652 + SET_SRC (PATTERN (next_insn)) = new_cond;
6653 + /* Force the instruction to be recognized again */
6654 + INSN_CODE (next_insn) = -1;
6661 +/* Function for obtaining the condition for the next instruction
6665 +get_next_insn_cond (rtx cur_insn)
6667 + rtx next_insn = next_nonnote_insn (cur_insn);
6668 + rtx cond = NULL_RTX;
6669 + if ((next_insn != NULL_RTX)
6670 + && (INSN_P (next_insn))
6671 + && (GET_CODE (PATTERN (next_insn)) == SET)
6672 + && (GET_CODE (SET_SRC (PATTERN (next_insn))) == IF_THEN_ELSE))
6674 + /* Branch instructions */
6675 + cond = XEXP (SET_SRC (PATTERN (next_insn)), 0);
6677 + else if ((next_insn != NULL_RTX)
6678 + && (INSN_P (next_insn))
6679 + && (GET_CODE (PATTERN (next_insn)) == SET)
6680 + && comparison_operator (SET_SRC (PATTERN (next_insn)),
6681 + GET_MODE (SET_SRC (PATTERN (next_insn)))))
6683 + /* scc with no compare */
6684 + cond = SET_SRC (PATTERN (next_insn));
6692 +avr32_output_cmp (rtx cond, enum machine_mode mode, rtx op0, rtx op1)
6695 + rtx new_cond = NULL_RTX;
6697 + rtx compare_pattern;
6701 + compare_pattern = gen_rtx_COMPARE (mode, op0, op1);
6703 + new_cond = is_compare_redundant (compare_pattern, cond);
6705 + if (new_cond != NULL_RTX)
6708 + /* Insert compare */
6712 + output_asm_insn ("cp.b\t%0, %1", ops);
6715 + output_asm_insn ("cp.h\t%0, %1", ops);
6718 + output_asm_insn ("cp.w\t%0, %1", ops);
6721 + if (GET_CODE (op1) != REG)
6722 + output_asm_insn ("cp.w\t%0, %1\ncpc\t%m0", ops);
6724 + output_asm_insn ("cp.w\t%0, %1\ncpc\t%m0, %m1", ops);
6727 + internal_error ("Unknown comparison mode");
6735 +avr32_load_multiple_operation (rtx op,
6736 + enum machine_mode mode ATTRIBUTE_UNUSED)
6738 + int count = XVECLEN (op, 0);
6739 + unsigned int dest_regno;
6742 + int i = 1, base = 0;
6744 + if (count <= 1 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
6747 + /* Check to see if this might be a write-back. */
6748 + if (GET_CODE (SET_SRC (elt = XVECEXP (op, 0, 0))) == PLUS)
6753 + /* Now check it more carefully. */
6754 + if (GET_CODE (SET_DEST (elt)) != REG
6755 + || GET_CODE (XEXP (SET_SRC (elt), 0)) != REG
6756 + || GET_CODE (XEXP (SET_SRC (elt), 1)) != CONST_INT
6757 + || INTVAL (XEXP (SET_SRC (elt), 1)) != (count - 1) * 4)
6761 + /* Perform a quick check so we don't blow up below. */
6763 + || GET_CODE (XVECEXP (op, 0, i - 1)) != SET
6764 + || GET_CODE (SET_DEST (XVECEXP (op, 0, i - 1))) != REG
6765 + || GET_CODE (SET_SRC (XVECEXP (op, 0, i - 1))) != UNSPEC)
6768 + dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, i - 1)));
6769 + src_addr = XEXP (SET_SRC (XVECEXP (op, 0, i - 1)), 0);
6771 + for (; i < count; i++)
6773 + elt = XVECEXP (op, 0, i);
6775 + if (GET_CODE (elt) != SET
6776 + || GET_CODE (SET_DEST (elt)) != REG
6777 + || GET_MODE (SET_DEST (elt)) != SImode
6778 + || GET_CODE (SET_SRC (elt)) != UNSPEC)
6786 +avr32_store_multiple_operation (rtx op,
6787 + enum machine_mode mode ATTRIBUTE_UNUSED)
6789 + int count = XVECLEN (op, 0);
6795 + if (count <= 1 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
6798 + /* Perform a quick check so we don't blow up below. */
6800 + || GET_CODE (XVECEXP (op, 0, i - 1)) != SET
6801 + || GET_CODE (SET_DEST (XVECEXP (op, 0, i - 1))) != MEM
6802 + || GET_CODE (SET_SRC (XVECEXP (op, 0, i - 1))) != UNSPEC)
6805 + src_regno = REGNO (SET_SRC (XVECEXP (op, 0, i - 1)));
6806 + dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, i - 1)), 0);
6808 + for (; i < count; i++)
6810 + elt = XVECEXP (op, 0, i);
6812 + if (GET_CODE (elt) != SET
6813 + || GET_CODE (SET_DEST (elt)) != MEM
6814 + || GET_MODE (SET_DEST (elt)) != SImode
6815 + || GET_CODE (SET_SRC (elt)) != UNSPEC)
6823 +avr32_valid_macmac_bypass (rtx insn_out, rtx insn_in)
6825 + /* Check if they use the same accumulator */
6827 + (SET_DEST (PATTERN (insn_out)), SET_DEST (PATTERN (insn_in))))
6836 +avr32_valid_mulmac_bypass (rtx insn_out, rtx insn_in)
6839 + Check if the mul instruction produces the accumulator for the mac
6842 + (SET_DEST (PATTERN (insn_out)), SET_DEST (PATTERN (insn_in))))
6850 +avr32_store_bypass (rtx insn_out, rtx insn_in)
6852 + /* Only valid bypass if the output result is used as an src in the store
6853 + instruction, NOT if used as a pointer or base. */
6855 + (SET_DEST (PATTERN (insn_out)), SET_SRC (PATTERN (insn_in))))
6864 +avr32_mul_waw_bypass (rtx insn_out, rtx insn_in)
6866 + /* Check if the register holding the result from the mul instruction is
6867 + used as a result register in the input instruction. */
6869 + (SET_DEST (PATTERN (insn_out)), SET_DEST (PATTERN (insn_in))))
6878 +avr32_valid_load_double_bypass (rtx insn_out, rtx insn_in)
6880 + /* Check if the first loaded word in insn_out is used in insn_in. */
6882 + rtx second_loaded_reg;
6884 + /* If this is a double alu operation then the bypass is not valid */
6885 + if ((get_attr_type (insn_in) == TYPE_ALU
6886 + || get_attr_type (insn_in) == TYPE_ALU2)
6887 + && (GET_MODE_SIZE (GET_MODE (SET_DEST (PATTERN (insn_out)))) > 4))
6890 + /* Get the destination register in the load */
6891 + if (!REG_P (SET_DEST (PATTERN (insn_out))))
6894 + dst_reg = SET_DEST (PATTERN (insn_out));
6895 + second_loaded_reg = gen_rtx_REG (SImode, REGNO (dst_reg) + 1);
6897 + if (!reg_mentioned_p (second_loaded_reg, PATTERN (insn_in)))
6905 +avr32_valid_load_quad_bypass (rtx insn_out, rtx insn_in)
6908 + Check if the two first loaded word in insn_out are used in insn_in. */
6910 + rtx third_loaded_reg, fourth_loaded_reg;
6912 + /* Get the destination register in the load */
6913 + if (!REG_P (SET_DEST (PATTERN (insn_out))))
6916 + dst_reg = SET_DEST (PATTERN (insn_out));
6917 + third_loaded_reg = gen_rtx_REG (SImode, REGNO (dst_reg) + 2);
6918 + fourth_loaded_reg = gen_rtx_REG (SImode, REGNO (dst_reg) + 3);
6920 + if (!reg_mentioned_p (third_loaded_reg, PATTERN (insn_in))
6921 + && !reg_mentioned_p (fourth_loaded_reg, PATTERN (insn_in)))
6931 +//avr32_select_rtx_section (enum machine_mode mode ATTRIBUTE_UNUSED,
6932 +// rtx x ATTRIBUTE_UNUSED,
6933 +// unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
6935 +// /* Let ASM_OUTPUT_POOL_PROLOGUE take care of this */
6940 +/* Function for getting an integer value from a const_int or const_double
6941 + expression regardless of the HOST_WIDE_INT size. Each target cpu word
6942 + will be put into the val array where the LSW will be stored at the lowest
6943 + address and so forth. Assumes that const_expr is either a const_int or
6944 + const_double. Only valid for modes which have sizes that are a multiple
6948 +avr32_get_intval (enum machine_mode mode,
6950 + HOST_WIDE_INT *val)
6952 + int words_in_mode = GET_MODE_SIZE (mode)/UNITS_PER_WORD;
6953 + const int words_in_const_int = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD;
6955 + if ( GET_CODE(const_expr) == CONST_DOUBLE ){
6956 + HOST_WIDE_INT hi = CONST_DOUBLE_HIGH(const_expr);
6957 + HOST_WIDE_INT lo = CONST_DOUBLE_LOW(const_expr);
6958 + /* Evaluate hi and lo values of const_double. */
6959 + avr32_get_intval (mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0),
6962 + avr32_get_intval (mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0),
6964 + &val[words_in_const_int]);
6965 + } else if ( GET_CODE(const_expr) == CONST_INT ){
6966 + HOST_WIDE_INT value = INTVAL(const_expr);
6968 + for ( word = 0; (word < words_in_mode) && (word < words_in_const_int); word++ ){
6969 + /* Shift word up to the MSW and shift down again to extract the
6970 + word and sign-extend. */
6971 + int lshift = (words_in_const_int - word - 1) * BITS_PER_WORD;
6972 + int rshift = (words_in_const_int-1) * BITS_PER_WORD;
6973 + val[word] = (value << lshift) >> rshift;
6976 + for ( ; word < words_in_mode; word++ ){
6977 + /* Just put the sign bits in the remaining words. */
6978 + val[word] = value < 0 ? -1 : 0;
6984 +avr32_split_const_expr (enum machine_mode mode,
6985 + enum machine_mode new_mode,
6990 + int words_in_intval = GET_MODE_SIZE (mode)/UNITS_PER_WORD;
6991 + int words_in_split_values = GET_MODE_SIZE (new_mode)/UNITS_PER_WORD;
6992 + const int words_in_const_int = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD;
6993 + HOST_WIDE_INT *val = alloca (words_in_intval * UNITS_PER_WORD);
6995 + avr32_get_intval (mode, expr, val);
6997 + for ( i=0; i < (words_in_intval/words_in_split_values); i++ )
6999 + HOST_WIDE_INT value_lo = 0, value_hi = 0;
7000 + for ( word = 0; word < words_in_split_values; word++ )
7002 + if ( word >= words_in_const_int )
7003 + value_hi |= ((val[i * words_in_split_values + word] &
7004 + (((HOST_WIDE_INT)1 << BITS_PER_WORD)-1))
7005 + << (BITS_PER_WORD * (word - words_in_const_int)));
7007 + value_lo |= ((val[i * words_in_split_values + word] &
7008 + (((HOST_WIDE_INT)1 << BITS_PER_WORD)-1))
7009 + << (BITS_PER_WORD * word));
7011 + split_expr[i] = immed_double_const(value_lo, value_hi, new_mode);
7017 +/* Set up library functions to comply to AVR32 ABI */
7020 +/* Set up library functions to comply to AVR32 ABI */
7023 +avr32_init_libfuncs (void)
7025 + /* Convert gcc run-time function names to AVR32 ABI names */
7027 + /* Double-precision floating-point arithmetic. */
7028 + set_optab_libfunc (sdiv_optab, DFmode, "__avr32_f64_div");
7029 + set_optab_libfunc (smul_optab, DFmode, "__avr32_f64_mul");
7030 + set_optab_libfunc (neg_optab, DFmode, NULL);
7032 + /* Double-precision comparisons. */
7033 + set_optab_libfunc (eq_optab, DFmode, "__avr32_f64_cmp_eq");
7034 + set_optab_libfunc (ne_optab, DFmode, NULL);
7035 + set_optab_libfunc (lt_optab, DFmode, "__avr32_f64_cmp_lt");
7036 + set_optab_libfunc (le_optab, DFmode, NULL);
7037 + set_optab_libfunc (ge_optab, DFmode, "__avr32_f64_cmp_ge");
7038 + set_optab_libfunc (gt_optab, DFmode, NULL);
7040 + /* Single-precision floating-point arithmetic. */
7041 + set_optab_libfunc (smul_optab, SFmode, "__avr32_f32_mul");
7042 + set_optab_libfunc (neg_optab, SFmode, NULL);
7044 + /* Single-precision comparisons. */
7045 + set_optab_libfunc (eq_optab, SFmode, "__avr32_f32_cmp_eq");
7046 + set_optab_libfunc (ne_optab, SFmode, NULL);
7047 + set_optab_libfunc (lt_optab, SFmode, "__avr32_f32_cmp_lt");
7048 + set_optab_libfunc (le_optab, SFmode, NULL);
7049 + set_optab_libfunc (ge_optab, SFmode, "__avr32_f32_cmp_ge");
7050 + set_optab_libfunc (gt_optab, SFmode, NULL);
7052 + /* Floating-point to integer conversions. */
7053 + set_conv_libfunc (sfix_optab, SImode, DFmode, "__avr32_f64_to_s32");
7054 + set_conv_libfunc (ufix_optab, SImode, DFmode, "__avr32_f64_to_u32");
7055 + set_conv_libfunc (sfix_optab, DImode, DFmode, "__avr32_f64_to_s64");
7056 + set_conv_libfunc (ufix_optab, DImode, DFmode, "__avr32_f64_to_u64");
7057 + set_conv_libfunc (sfix_optab, SImode, SFmode, "__avr32_f32_to_s32");
7058 + set_conv_libfunc (ufix_optab, SImode, SFmode, "__avr32_f32_to_u32");
7059 + set_conv_libfunc (sfix_optab, DImode, SFmode, "__avr32_f32_to_s64");
7060 + set_conv_libfunc (ufix_optab, DImode, SFmode, "__avr32_f32_to_u64");
7062 + /* Conversions between floating types. */
7063 + set_conv_libfunc (trunc_optab, SFmode, DFmode, "__avr32_f64_to_f32");
7064 + set_conv_libfunc (sext_optab, DFmode, SFmode, "__avr32_f32_to_f64");
7066 + /* Integer to floating-point conversions. Table 8. */
7067 + set_conv_libfunc (sfloat_optab, DFmode, SImode, "__avr32_s32_to_f64");
7068 + set_conv_libfunc (sfloat_optab, DFmode, DImode, "__avr32_s64_to_f64");
7069 + set_conv_libfunc (sfloat_optab, SFmode, SImode, "__avr32_s32_to_f32");
7070 + set_conv_libfunc (sfloat_optab, SFmode, DImode, "__avr32_s64_to_f32");
7071 + set_conv_libfunc (ufloat_optab, DFmode, SImode, "__avr32_u32_to_f64");
7072 + set_conv_libfunc (ufloat_optab, SFmode, SImode, "__avr32_u32_to_f32");
7073 + /* TODO: Add these to gcc library functions */
7074 + //set_conv_libfunc (ufloat_optab, DFmode, DImode, NULL);
7075 + //set_conv_libfunc (ufloat_optab, SFmode, DImode, NULL);
7077 + /* Long long. Table 9. */
7078 + set_optab_libfunc (smul_optab, DImode, "__avr32_mul64");
7079 + set_optab_libfunc (sdiv_optab, DImode, "__avr32_sdiv64");
7080 + set_optab_libfunc (udiv_optab, DImode, "__avr32_udiv64");
7081 + set_optab_libfunc (smod_optab, DImode, "__avr32_smod64");
7082 + set_optab_libfunc (umod_optab, DImode, "__avr32_umod64");
7083 + set_optab_libfunc (ashl_optab, DImode, "__avr32_lsl64");
7084 + set_optab_libfunc (lshr_optab, DImode, "__avr32_lsr64");
7085 + set_optab_libfunc (ashr_optab, DImode, "__avr32_asr64");
7087 + /* Floating point library functions which have fast versions. */
7088 + if ( TARGET_FAST_FLOAT )
7090 + set_optab_libfunc (add_optab, DFmode, "__avr32_f64_add_fast");
7091 + set_optab_libfunc (sub_optab, DFmode, "__avr32_f64_sub_fast");
7092 + set_optab_libfunc (add_optab, SFmode, "__avr32_f32_add_fast");
7093 + set_optab_libfunc (sub_optab, SFmode, "__avr32_f32_sub_fast");
7094 + set_optab_libfunc (sdiv_optab, SFmode, "__avr32_f32_div_fast");
7098 + set_optab_libfunc (add_optab, DFmode, "__avr32_f64_add");
7099 + set_optab_libfunc (sub_optab, DFmode, "__avr32_f64_sub");
7100 + set_optab_libfunc (add_optab, SFmode, "__avr32_f32_add");
7101 + set_optab_libfunc (sub_optab, SFmode, "__avr32_f32_sub");
7102 + set_optab_libfunc (sdiv_optab, SFmode, "__avr32_f32_div");
7106 Index: gcc-4.2.3/gcc/config/avr32/avr32-elf.h
7107 ===================================================================
7108 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
7109 +++ gcc-4.2.3/gcc/config/avr32/avr32-elf.h 2008-05-21 13:45:54.149288905 +0200
7112 + Elf specific definitions.
7113 + Copyright 2003-2006 Atmel Corporation.
7115 + Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
7117 + This file is part of GCC.
7119 + This program is free software; you can redistribute it and/or modify
7120 + it under the terms of the GNU General Public License as published by
7121 + the Free Software Foundation; either version 2 of the License, or
7122 + (at your option) any later version.
7124 + This program is distributed in the hope that it will be useful,
7125 + but WITHOUT ANY WARRANTY; without even the implied warranty of
7126 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7127 + GNU General Public License for more details.
7129 + You should have received a copy of the GNU General Public License
7130 + along with this program; if not, write to the Free Software
7131 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7134 +/*****************************************************************************
7135 + * Controlling the Compilator Driver, 'gcc'
7136 + *****************************************************************************/
7138 +/* Run-time Target Specification. */
7139 +#undef TARGET_VERSION
7140 +#define TARGET_VERSION fputs (" (AVR32 GNU with ELF)", stderr);
7143 +Another C string constant used much like LINK_SPEC. The
7144 +difference between the two is that STARTFILE_SPEC is used at
7145 +the very beginning of the command given to the linker.
7147 +If this macro is not defined, a default is provided that loads the
7148 +standard C startup file from the usual place. See gcc.c.
7150 +#undef STARTFILE_SPEC
7151 +#define STARTFILE_SPEC "crt0%O%s crti%O%s crtbegin%O%s"
7154 +#define LINK_SPEC "%{muse-oscall:--defsym __do_not_use_oscall_coproc__=0} %{mrelax|O*:%{mno-relax|O0|O1: ;:--relax}} %{mpart=*:-mavr32elf_%*} %{mcpu=*:-mavr32elf_%*}"
7158 +Another C string constant used much like LINK_SPEC. The
7159 +difference between the two is that ENDFILE_SPEC is used at
7160 +the very end of the command given to the linker.
7162 +Do not define this macro if it does not need to do anything.
7164 +#undef ENDFILE_SPEC
7165 +#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
7168 +/* Target CPU builtins. */
7169 +#define TARGET_CPU_CPP_BUILTINS() \
7172 + builtin_define ("__avr32__"); \
7173 + builtin_define ("__AVR32__"); \
7174 + builtin_define ("__AVR32_ELF__"); \
7175 + builtin_define (avr32_part->macro); \
7176 + builtin_define (avr32_arch->macro); \
7177 + if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A) \
7178 + builtin_define ("__AVR32_AVR32A__"); \
7180 + builtin_define ("__AVR32_AVR32B__"); \
7181 + if (TARGET_UNALIGNED_WORD) \
7182 + builtin_define ("__AVR32_HAS_UNALIGNED_WORD__"); \
7183 + if (TARGET_SIMD) \
7184 + builtin_define ("__AVR32_HAS_SIMD__"); \
7186 + builtin_define ("__AVR32_HAS_DSP__"); \
7188 + builtin_define ("__AVR32_HAS_RMW__"); \
7189 + if (TARGET_BRANCH_PRED) \
7190 + builtin_define ("__AVR32_HAS_BRANCH_PRED__"); \
7191 + if (TARGET_FAST_FLOAT) \
7192 + builtin_define ("__AVR32_FAST_FLOAT__"); \
7195 Index: gcc-4.2.3/gcc/config/avr32/avr32.h
7196 ===================================================================
7197 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
7198 +++ gcc-4.2.3/gcc/config/avr32/avr32.h 2008-05-21 13:45:54.157287690 +0200
7201 + Definitions of target machine for AVR32.
7202 + Copyright 2003-2006 Atmel Corporation.
7204 + Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
7205 + Initial porting by Anders �dland.
7207 + This file is part of GCC.
7209 + This program is free software; you can redistribute it and/or modify
7210 + it under the terms of the GNU General Public License as published by
7211 + the Free Software Foundation; either version 2 of the License, or
7212 + (at your option) any later version.
7214 + This program is distributed in the hope that it will be useful,
7215 + but WITHOUT ANY WARRANTY; without even the implied warranty of
7216 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7217 + GNU General Public License for more details.
7219 + You should have received a copy of the GNU General Public License
7220 + along with this program; if not, write to the Free Software
7221 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7223 +#ifndef GCC_AVR32_H
7224 +#define GCC_AVR32_H
7227 +#ifndef OBJECT_FORMAT_ELF
7228 +#error avr32.h included before elfos.h
7231 +#ifndef LOCAL_LABEL_PREFIX
7232 +#define LOCAL_LABEL_PREFIX "."
7235 +#ifndef SUBTARGET_CPP_SPEC
7236 +#define SUBTARGET_CPP_SPEC "-D__ELF__"
7240 +extern struct rtx_def *avr32_compare_op0;
7241 +extern struct rtx_def *avr32_compare_op1;
7244 +extern struct rtx_def *avr32_acc_cache;
7246 +/* cache instruction op5 codes */
7247 +#define AVR32_CACHE_INVALIDATE_ICACHE 1
7249 +/* These bits describe the different types of function supported
7250 + by the AVR32 backend. They are exclusive. ie a function cannot be both a
7251 + normal function and an interworked function, for example. Knowing the
7252 + type of a function is important for determining its prologue and
7253 + epilogue sequences.
7254 + Note value 7 is currently unassigned. Also note that the interrupt
7255 + function types all have bit 2 set, so that they can be tested for easily.
7256 + Note that 0 is deliberately chosen for AVR32_FT_UNKNOWN so that when the
7257 + machine_function structure is initialized (to zero) func_type will
7258 + default to unknown. This will force the first use of avr32_current_func_type
7259 + to call avr32_compute_func_type. */
7260 +#define AVR32_FT_UNKNOWN 0 /* Type has not yet been determined.
7262 +#define AVR32_FT_NORMAL 1 /* Your normal, straightforward
7264 +#define AVR32_FT_ACALL 2 /* An acall function. */
7265 +#define AVR32_FT_EXCEPTION_HANDLER 3 /* A C++ exception handler. */
7266 +#define AVR32_FT_ISR_FULL 4 /* A fully shadowed interrupt mode. */
7267 +#define AVR32_FT_ISR_HALF 5 /* A half shadowed interrupt mode. */
7268 +#define AVR32_FT_ISR_NONE 6 /* No shadow registers. */
7270 +#define AVR32_FT_TYPE_MASK ((1 << 3) - 1)
7272 +/* In addition functions can have several type modifiers,
7273 + outlined by these bit masks: */
7274 +#define AVR32_FT_INTERRUPT (1 << 2) /* Note overlap with FT_ISR
7276 +#define AVR32_FT_NAKED (1 << 3) /* No prologue or epilogue. */
7277 +#define AVR32_FT_VOLATILE (1 << 4) /* Does not return. */
7278 +#define AVR32_FT_NESTED (1 << 5) /* Embedded inside another
7281 +/* Some macros to test these flags. */
7282 +#define AVR32_FUNC_TYPE(t) (t & AVR32_FT_TYPE_MASK)
7283 +#define IS_INTERRUPT(t) (t & AVR32_FT_INTERRUPT)
7284 +#define IS_VOLATILE(t) (t & AVR32_FT_VOLATILE)
7285 +#define IS_NAKED(t) (t & AVR32_FT_NAKED)
7286 +#define IS_NESTED(t) (t & AVR32_FT_NESTED)
7289 +typedef struct minipool_labels
7290 +GTY ((chain_next ("%h.next"), chain_prev ("%h.prev")))
7293 + struct minipool_labels *prev;
7294 + struct minipool_labels *next;
7297 +/* A C structure for machine-specific, per-function data.
7298 + This is added to the cfun structure. */
7300 +typedef struct machine_function
7303 + /* Records the type of the current function. */
7304 + unsigned long func_type;
7305 + /* List of minipool labels, use for checking if code label is valid in a
7306 + memory expression */
7307 + minipool_labels *minipool_label_head;
7308 + minipool_labels *minipool_label_tail;
7309 +} machine_function;
7311 +/* Initialize data used by insn expanders. This is called from insn_emit,
7312 + once for every function before code is generated. */
7313 +#define INIT_EXPANDERS avr32_init_expanders ()
7315 +/******************************************************************************
7317 + *****************************************************************************/
7320 +#define ASM_SPEC "%{fpic:--pic} %{mrelax|O*:%{mno-relax|O0|O1: ;:--linkrelax}} %{march=*:-march=%*} %{mpart=*:-mpart=%*}"
7323 +#ifndef MULTILIB_DEFAULTS
7324 +#define MULTILIB_DEFAULTS { "march=ap", "" }
7327 +/******************************************************************************
7328 + * Run-time Target Specification
7329 + *****************************************************************************/
7330 +#ifndef TARGET_VERSION
7331 +#define TARGET_VERSION fprintf(stderr, " (AVR32, GNU assembler syntax)");
7334 +/* Part types. Keep this in sync with the order of avr32_part_types in avr32.c*/
7337 + PART_TYPE_AVR32_NONE,
7338 + PART_TYPE_AVR32_AP7000,
7339 + PART_TYPE_AVR32_AP7010,
7340 + PART_TYPE_AVR32_AP7020,
7341 + PART_TYPE_AVR32_UC3A0256,
7342 + PART_TYPE_AVR32_UC3A0512,
7343 + PART_TYPE_AVR32_UC3A1128,
7344 + PART_TYPE_AVR32_UC3A1256,
7345 + PART_TYPE_AVR32_UC3A1512,
7346 + PART_TYPE_AVR32_UC3B064,
7347 + PART_TYPE_AVR32_UC3B0128,
7348 + PART_TYPE_AVR32_UC3B0256,
7349 + PART_TYPE_AVR32_UC3B164,
7350 + PART_TYPE_AVR32_UC3B1128,
7351 + PART_TYPE_AVR32_UC3B1256
7354 +/* Microarchitectures. */
7355 +enum microarchitecture_type
7357 + UARCH_TYPE_AVR32A,
7358 + UARCH_TYPE_AVR32B,
7362 +/* Architectures types which specifies the pipeline.
7363 + Keep this in sync with avr32_arch_types in avr32.c
7364 + and the pipeline attribute in avr32.md */
7365 +enum architecture_type
7367 + ARCH_TYPE_AVR32_AP,
7368 + ARCH_TYPE_AVR32_UC,
7369 + ARCH_TYPE_AVR32_NONE
7372 +/* Flag specifying if the cpu has support for DSP instructions.*/
7373 +#define FLAG_AVR32_HAS_DSP (1 << 0)
7374 +/* Flag specifying if the cpu has support for Read-Modify-Write
7376 +#define FLAG_AVR32_HAS_RMW (1 << 1)
7377 +/* Flag specifying if the cpu has support for SIMD instructions. */
7378 +#define FLAG_AVR32_HAS_SIMD (1 << 2)
7379 +/* Flag specifying if the cpu has support for unaligned memory word access. */
7380 +#define FLAG_AVR32_HAS_UNALIGNED_WORD (1 << 3)
7381 +/* Flag specifying if the cpu has support for branch prediction. */
7382 +#define FLAG_AVR32_HAS_BRANCH_PRED (1 << 4)
7383 +/* Flag specifying if the cpu has support for a return stack. */
7384 +#define FLAG_AVR32_HAS_RETURN_STACK (1 << 5)
7385 +/* Flag specifying if the cpu has caches. */
7386 +#define FLAG_AVR32_HAS_CACHES (1 << 6)
7388 +/* Structure for holding information about different avr32 CPUs/parts */
7391 + const char *const name;
7392 + enum part_type part_type;
7393 + enum architecture_type arch_type;
7394 + /* Must lie outside user's namespace. NULL == no macro. */
7395 + const char *const macro;
7398 +/* Structure for holding information about different avr32 pipeline
7402 + const char *const name;
7403 + enum architecture_type arch_type;
7404 + enum microarchitecture_type uarch_type;
7405 + const unsigned long feature_flags;
7406 + /* Must lie outside user's namespace. NULL == no macro. */
7407 + const char *const macro;
7410 +extern const struct part_type_s *avr32_part;
7411 +extern const struct arch_type_s *avr32_arch;
7413 +#define TARGET_SIMD (avr32_arch->feature_flags & FLAG_AVR32_HAS_SIMD)
7414 +#define TARGET_DSP (avr32_arch->feature_flags & FLAG_AVR32_HAS_DSP)
7415 +#define TARGET_RMW (avr32_arch->feature_flags & FLAG_AVR32_HAS_RMW)
7416 +#define TARGET_UNALIGNED_WORD (avr32_arch->feature_flags & FLAG_AVR32_HAS_UNALIGNED_WORD)
7417 +#define TARGET_BRANCH_PRED (avr32_arch->feature_flags & FLAG_AVR32_HAS_BRANCH_PRED)
7418 +#define TARGET_RETURN_STACK (avr32_arch->feature_flags & FLAG_AVR32_HAS_RETURN_STACK)
7419 +#define TARGET_CACHES (avr32_arch->feature_flags & FLAG_AVR32_HAS_CACHES)
7421 +#define CAN_DEBUG_WITHOUT_FP
7423 +/******************************************************************************
7425 + *****************************************************************************/
7428 +Define this macro to have the value 1 if the most significant bit in a
7429 +byte has the lowest number; otherwise define it to have the value zero.
7430 +This means that bit-field instructions count from the most significant
7431 +bit. If the machine has no bit-field instructions, then this must still
7432 +be defined, but it doesn't matter which value it is defined to. This
7433 +macro need not be a constant.
7435 +This macro does not affect the way structure fields are packed into
7436 +bytes or words; that is controlled by BYTES_BIG_ENDIAN.
7438 +#define BITS_BIG_ENDIAN 0
7441 +Define this macro to have the value 1 if the most significant byte in a
7442 +word has the lowest number. This macro need not be a constant.
7445 + Data is stored in an big-endian way.
7447 +#define BYTES_BIG_ENDIAN 1
7450 +Define this macro to have the value 1 if, in a multiword object, the
7451 +most significant word has the lowest number. This applies to both
7452 +memory locations and registers; GCC fundamentally assumes that the
7453 +order of words in memory is the same as the order in registers. This
7454 +macro need not be a constant.
7457 + Data is stored in an bin-endian way.
7459 +#define WORDS_BIG_ENDIAN 1
7462 +Define this macro if WORDS_BIG_ENDIAN is not constant. This must be a
7463 +constant value with the same meaning as WORDS_BIG_ENDIAN, which will be
7464 +used only when compiling libgcc2.c. Typically the value will be set
7465 +based on preprocessor defines.
7467 +#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
7470 +Define this macro to have the value 1 if DFmode, XFmode or
7471 +TFmode floating point numbers are stored in memory with the word
7472 +containing the sign bit at the lowest address; otherwise define it to
7473 +have the value 0. This macro need not be a constant.
7475 +You need not define this macro if the ordering is the same as for
7476 +multi-word integers.
7478 +/* #define FLOAT_WORDS_BIG_ENDIAN 1 */
7481 +Define this macro to be the number of bits in an addressable storage
7482 +unit (byte); normally 8.
7484 +#define BITS_PER_UNIT 8
7487 +Number of bits in a word; normally 32.
7489 +#define BITS_PER_WORD 32
7492 +Maximum number of bits in a word. If this is undefined, the default is
7493 +BITS_PER_WORD. Otherwise, it is the constant value that is the
7494 +largest value that BITS_PER_WORD can have at run-time.
7496 +/* MAX_BITS_PER_WORD not defined*/
7499 +Number of storage units in a word; normally 4.
7501 +#define UNITS_PER_WORD 4
7504 +Minimum number of units in a word. If this is undefined, the default is
7505 +UNITS_PER_WORD. Otherwise, it is the constant value that is the
7506 +smallest value that UNITS_PER_WORD can have at run-time.
7508 +/* MIN_UNITS_PER_WORD not defined */
7511 +Width of a pointer, in bits. You must specify a value no wider than the
7512 +width of Pmode. If it is not equal to the width of Pmode,
7513 +you must define POINTERS_EXTEND_UNSIGNED.
7515 +#define POINTER_SIZE 32
7518 +A C expression whose value is greater than zero if pointers that need to be
7519 +extended from being POINTER_SIZE bits wide to Pmode are to
7520 +be zero-extended and zero if they are to be sign-extended. If the value
7521 +is less then zero then there must be an "ptr_extend" instruction that
7522 +extends a pointer from POINTER_SIZE to Pmode.
7524 +You need not define this macro if the POINTER_SIZE is equal
7525 +to the width of Pmode.
7527 +/* #define POINTERS_EXTEND_UNSIGNED */
7530 +A Macro to update M and UNSIGNEDP when an object whose type
7531 +is TYPE and which has the specified mode and signedness is to be
7532 +stored in a register. This macro is only called when TYPE is a
7535 +On most RISC machines, which only have operations that operate on a full
7536 +register, define this macro to set M to word_mode if
7537 +M is an integer mode narrower than BITS_PER_WORD. In most
7538 +cases, only integer modes should be widened because wider-precision
7539 +floating-point operations are usually more expensive than their narrower
7542 +For most machines, the macro definition does not change UNSIGNEDP.
7543 +However, some machines, have instructions that preferentially handle
7544 +either signed or unsigned quantities of certain modes. For example, on
7545 +the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
7546 +sign-extend the result to 64 bits. On such machines, set
7547 +UNSIGNEDP according to which kind of extension is more efficient.
7549 +Do not define this macro if it would never modify M.
7551 +#define PROMOTE_MODE(M, UNSIGNEDP, TYPE) \
7553 + if (GET_MODE_CLASS (M) == MODE_INT \
7554 + && GET_MODE_SIZE (M) < 4) \
7556 + if (M == QImode) \
7558 + else if (M == SImode) \
7564 +#define PROMOTE_FUNCTION_MODE(M, UNSIGNEDP, TYPE) \
7566 + if (GET_MODE_CLASS (M) == MODE_INT \
7567 + && GET_MODE_SIZE (M) < 4) \
7573 +/* Define if operations between registers always perform the operation
7574 + on the full register even if a narrower mode is specified. */
7575 +#define WORD_REGISTER_OPERATIONS
7577 +/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
7578 + will either zero-extend or sign-extend. The value of this macro should
7579 + be the code that says which one of the two operations is implicitly
7580 + done, UNKNOWN if not known. */
7581 +#define LOAD_EXTEND_OP(MODE) \
7582 + (((MODE) == QImode) ? ZERO_EXTEND \
7583 + : ((MODE) == HImode) ? SIGN_EXTEND : UNKNOWN)
7587 +Define this macro if the promotion described by PROMOTE_MODE
7588 +should only be performed for outgoing function arguments or
7589 +function return values, as specified by PROMOTE_FUNCTION_ARGS
7590 +and PROMOTE_FUNCTION_RETURN, respectively.
7592 +/* #define PROMOTE_FOR_CALL_ONLY */
7595 +Normal alignment required for function parameters on the stack, in
7596 +bits. All stack parameters receive at least this much alignment
7597 +regardless of data type. On most machines, this is the same as the
7598 +size of an integer.
7600 +#define PARM_BOUNDARY 32
7603 +Define this macro to the minimum alignment enforced by hardware for the
7604 +stack pointer on this machine. The definition is a C expression for the
7605 +desired alignment (measured in bits). This value is used as a default
7606 +if PREFERRED_STACK_BOUNDARY is not defined. On most machines,
7607 +this should be the same as PARM_BOUNDARY.
7609 +#define STACK_BOUNDARY 32
7612 +Define this macro if you wish to preserve a certain alignment for the
7613 +stack pointer, greater than what the hardware enforces. The definition
7614 +is a C expression for the desired alignment (measured in bits). This
7615 +macro must evaluate to a value equal to or larger than
7618 +#define PREFERRED_STACK_BOUNDARY (TARGET_FORCE_DOUBLE_ALIGN ? 64 : 32 )
7621 +Alignment required for a function entry point, in bits.
7623 +#define FUNCTION_BOUNDARY 16
7626 +Biggest alignment that any data type can require on this machine, in bits.
7628 +#define BIGGEST_ALIGNMENT (TARGET_FORCE_DOUBLE_ALIGN ? 64 : 32 )
7631 +If defined, the smallest alignment, in bits, that can be given to an
7632 +object that can be referenced in one operation, without disturbing any
7633 +nearby object. Normally, this is BITS_PER_UNIT, but may be larger
7634 +on machines that don't have byte or half-word store operations.
7636 +#define MINIMUM_ATOMIC_ALIGNMENT BITS_PER_UNIT
7640 +An integer expression for the size in bits of the largest integer machine mode that
7641 +should actually be used. All integer machine modes of this size or smaller can be
7642 +used for structures and unions with the appropriate sizes. If this macro is undefined,
7643 +GET_MODE_BITSIZE (DImode) is assumed.*/
7644 +#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
7648 +If defined, a C expression to compute the alignment given to a constant
7649 +that is being placed in memory. CONSTANT is the constant and
7650 +BASIC_ALIGN is the alignment that the object would ordinarily
7651 +have. The value of this macro is used instead of that alignment to
7654 +If this macro is not defined, then BASIC_ALIGN is used.
7656 +The typical use of this macro is to increase alignment for string
7657 +constants to be word aligned so that strcpy calls that copy
7658 +constants can be done inline.
7660 +#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \
7661 + ((TREE_CODE(CONSTANT) == STRING_CST) ? BITS_PER_WORD : BASIC_ALIGN)
7663 +/* Try to align string to a word. */
7664 +#define DATA_ALIGNMENT(TYPE, ALIGN) \
7665 + ({(TREE_CODE (TYPE) == ARRAY_TYPE \
7666 + && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
7667 + && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN));})
7669 +/* Try to align local store strings to a word. */
7670 +#define LOCAL_ALIGNMENT(TYPE, ALIGN) \
7671 + ({(TREE_CODE (TYPE) == ARRAY_TYPE \
7672 + && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
7673 + && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN));})
7676 +Define this macro to be the value 1 if instructions will fail to work
7677 +if given data not on the nominal alignment. If instructions will merely
7678 +go slower in that case, define this macro as 0.
7680 +#define STRICT_ALIGNMENT 1
7683 +Define this if you wish to imitate the way many other C compilers handle
7684 +alignment of bit-fields and the structures that contain them.
7686 +The behavior is that the type written for a bit-field (int,
7687 +short, or other integer type) imposes an alignment for the
7688 +entire structure, as if the structure really did contain an ordinary
7689 +field of that type. In addition, the bit-field is placed within the
7690 +structure so that it would fit within such a field, not crossing a
7693 +Thus, on most machines, a bit-field whose type is written as int
7694 +would not cross a four-byte boundary, and would force four-byte
7695 +alignment for the whole structure. (The alignment used may not be four
7696 +bytes; it is controlled by the other alignment parameters.)
7698 +If the macro is defined, its definition should be a C expression;
7699 +a nonzero value for the expression enables this behavior.
7701 +Note that if this macro is not defined, or its value is zero, some
7702 +bit-fields may cross more than one alignment boundary. The compiler can
7703 +support such references if there are insv, extv, and
7704 +extzv insns that can directly reference memory.
7706 +The other known way of making bit-fields work is to define
7707 +STRUCTURE_SIZE_BOUNDARY as large as BIGGEST_ALIGNMENT.
7708 +Then every structure can be accessed with fullwords.
7710 +Unless the machine has bit-field instructions or you define
7711 +STRUCTURE_SIZE_BOUNDARY that way, you must define
7712 +PCC_BITFIELD_TYPE_MATTERS to have a nonzero value.
7714 +If your aim is to make GCC use the same conventions for laying out
7715 +bit-fields as are used by another compiler, here is how to investigate
7716 +what the other compiler does. Compile and run this program:
7734 + printf ("Size of foo1 is %d\n",
7735 + sizeof (struct foo1));
7736 + printf ("Size of foo2 is %d\n",
7737 + sizeof (struct foo2));
7741 +If this prints 2 and 5, then the compiler's behavior is what you would
7742 +get from PCC_BITFIELD_TYPE_MATTERS.
7744 +#define PCC_BITFIELD_TYPE_MATTERS 1
7747 +/******************************************************************************
7748 + * Layout of Source Language Data Types
7749 + *****************************************************************************/
7752 +A C expression for the size in bits of the type int on the
7753 +target machine. If you don't define this, the default is one word.
7755 +#define INT_TYPE_SIZE 32
7758 +A C expression for the size in bits of the type short on the
7759 +target machine. If you don't define this, the default is half a word. (If
7760 +this would be less than one storage unit, it is rounded up to one unit.)
7762 +#define SHORT_TYPE_SIZE 16
7765 +A C expression for the size in bits of the type long on the
7766 +target machine. If you don't define this, the default is one word.
7768 +#define LONG_TYPE_SIZE 32
7772 +A C expression for the size in bits of the type long long on the
7773 +target machine. If you don't define this, the default is two
7774 +words. If you want to support GNU Ada on your machine, the value of this
7775 +macro must be at least 64.
7777 +#define LONG_LONG_TYPE_SIZE 64
7780 +A C expression for the size in bits of the type char on the
7781 +target machine. If you don't define this, the default is
7784 +#define CHAR_TYPE_SIZE 8
7788 +A C expression for the size in bits of the C++ type bool and
7789 +C99 type _Bool on the target machine. If you don't define
7790 +this, and you probably shouldn't, the default is CHAR_TYPE_SIZE.
7792 +#define BOOL_TYPE_SIZE 8
7796 +An expression whose value is 1 or 0, according to whether the type
7797 +char should be signed or unsigned by default. The user can
7798 +always override this default with the options -fsigned-char
7799 +and -funsigned-char.
7801 +/* We are using unsigned char */
7802 +#define DEFAULT_SIGNED_CHAR 0
7806 +A C expression for a string describing the name of the data type to use
7807 +for size values. The typedef name size_t is defined using the
7808 +contents of the string.
7810 +The string can contain more than one keyword. If so, separate them with
7811 +spaces, and write first any length keyword, then unsigned if
7812 +appropriate, and finally int. The string must exactly match one
7813 +of the data type names defined in the function
7814 +init_decl_processing in the file c-decl.c. You may not
7815 +omit int or change the order - that would cause the compiler to
7818 +If you don't define this macro, the default is "long unsigned int".
7820 +#define SIZE_TYPE "long unsigned int"
7823 +A C expression for a string describing the name of the data type to use
7824 +for the result of subtracting two pointers. The typedef name
7825 +ptrdiff_t is defined using the contents of the string. See
7826 +SIZE_TYPE above for more information.
7828 +If you don't define this macro, the default is "long int".
7830 +#define PTRDIFF_TYPE "long int"
7834 +A C expression for the size in bits of the data type for wide
7835 +characters. This is used in cpp, which cannot make use of
7838 +#define WCHAR_TYPE_SIZE 32
7842 +A C expression for a string describing the name of the data type to
7843 +use for wide characters passed to printf and returned from
7844 +getwc. The typedef name wint_t is defined using the
7845 +contents of the string. See SIZE_TYPE above for more
7848 +If you don't define this macro, the default is "unsigned int".
7850 +#define WINT_TYPE "unsigned int"
7853 +A C expression for a string describing the name of the data type that
7854 +can represent any value of any standard or extended signed integer type.
7855 +The typedef name intmax_t is defined using the contents of the
7856 +string. See SIZE_TYPE above for more information.
7858 +If you don't define this macro, the default is the first of
7859 +"int", "long int", or "long long int" that has as
7860 +much precision as long long int.
7862 +#define INTMAX_TYPE "long long int"
7865 +A C expression for a string describing the name of the data type that
7866 +can represent any value of any standard or extended unsigned integer
7867 +type. The typedef name uintmax_t is defined using the contents
7868 +of the string. See SIZE_TYPE above for more information.
7870 +If you don't define this macro, the default is the first of
7871 +"unsigned int", "long unsigned int", or "long long unsigned int"
7872 +that has as much precision as long long unsigned int.
7874 +#define UINTMAX_TYPE "long long unsigned int"
7877 +/******************************************************************************
7879 + *****************************************************************************/
7881 +/* Convert from gcc internal register number to register number
7882 + used in assembly code */
7883 +#define ASM_REGNUM(reg) (LAST_REGNUM - (reg))
7884 +#define ASM_FP_REGNUM(reg) (LAST_FP_REGNUM - (reg))
7886 +/* Convert between register number used in assembly to gcc
7887 + internal register number */
7888 +#define INTERNAL_REGNUM(reg) (LAST_REGNUM - (reg))
7889 +#define INTERNAL_FP_REGNUM(reg) (LAST_FP_REGNUM - (reg))
7891 +/** Basic Characteristics of Registers **/
7894 +Number of hardware registers known to the compiler. They receive
7895 +numbers 0 through FIRST_PSEUDO_REGISTER-1; thus, the first
7896 +pseudo register's number really is assigned the number
7897 +FIRST_PSEUDO_REGISTER.
7899 +#define FIRST_PSEUDO_REGISTER (LAST_FP_REGNUM + 1)
7901 +#define FIRST_REGNUM 0
7902 +#define LAST_REGNUM 15
7903 +#define NUM_FP_REGS 16
7904 +#define FIRST_FP_REGNUM 16
7905 +#define LAST_FP_REGNUM (16+NUM_FP_REGS-1)
7908 +An initializer that says which registers are used for fixed purposes
7909 +all throughout the compiled code and are therefore not available for
7910 +general allocation. These would include the stack pointer, the frame
7911 +pointer (except on machines where that can be used as a general
7912 +register when no frame pointer is needed), the program counter on
7913 +machines where that is considered one of the addressable registers,
7914 +and any other numbered register with a standard use.
7916 +This information is expressed as a sequence of numbers, separated by
7917 +commas and surrounded by braces. The nth number is 1 if
7918 +register n is fixed, 0 otherwise.
7920 +The table initialized from this macro, and the table initialized by
7921 +the following one, may be overridden at run time either automatically,
7922 +by the actions of the macro CONDITIONAL_REGISTER_USAGE, or by
7923 +the user with the command options -ffixed-[reg],
7924 +-fcall-used-[reg] and -fcall-saved-[reg].
7927 +/* The internal gcc register numbers are reversed
7928 + compared to the real register numbers since
7929 + gcc expects data types stored over multiple
7930 + registers in the register file to be big endian
7931 + if the memory layout is big endian. But this
7932 + is not the case for avr32 so we fake a big
7933 + endian register file. */
7935 +#define FIXED_REGISTERS { \
7936 + 1, /* Program Counter */ \
7937 + 0, /* Link Register */ \
7938 + 1, /* Stack Pointer */ \
7971 +Like FIXED_REGISTERS but has 1 for each register that is
7972 +clobbered (in general) by function calls as well as for fixed
7973 +registers. This macro therefore identifies the registers that are not
7974 +available for general allocation of values that must live across
7977 +If a register has 0 in CALL_USED_REGISTERS, the compiler
7978 +automatically saves it on function entry and restores it on function
7979 +exit, if the register is used within the function.
7981 +#define CALL_USED_REGISTERS { \
7982 + 1, /* Program Counter */ \
7983 + 0, /* Link Register */ \
7984 + 1, /* Stack Pointer */ \
8016 +/* Interrupt functions can only use registers that have already been
8017 + saved by the prologue, even if they would normally be
8018 + call-clobbered. */
8019 +#define HARD_REGNO_RENAME_OK(SRC, DST) \
8020 + (! IS_INTERRUPT (cfun->machine->func_type) || \
8021 + regs_ever_live[DST])
8025 +Zero or more C statements that may conditionally modify five variables
8026 +fixed_regs, call_used_regs, global_regs,
8027 +reg_names, and reg_class_contents, to take into account
8028 +any dependence of these register sets on target flags. The first three
8029 +of these are of type char [] (interpreted as Boolean vectors).
8030 +global_regs is a const char *[], and
8031 +reg_class_contents is a HARD_REG_SET. Before the macro is
8032 +called, fixed_regs, call_used_regs,
8033 +reg_class_contents, and reg_names have been initialized
8034 +from FIXED_REGISTERS, CALL_USED_REGISTERS,
8035 +REG_CLASS_CONTENTS, and REGISTER_NAMES, respectively.
8036 +global_regs has been cleared, and any -ffixed-[reg],
8037 +-fcall-used-[reg] and -fcall-saved-[reg]
8038 +command options have been applied.
8040 +You need not define this macro if it has no work to do.
8042 +If the usage of an entire class of registers depends on the target
8043 +flags, you may indicate this to GCC by using this macro to modify
8044 +fixed_regs and call_used_regs to 1 for each of the
8045 +registers in the classes which should not be used by GCC. Also define
8046 +the macro REG_CLASS_FROM_LETTER to return NO_REGS if it
8047 +is called with a letter for a class that shouldn't be used.
8049 + (However, if this class is not included in GENERAL_REGS and all
8050 +of the insn patterns whose constraints permit this class are
8051 +controlled by target switches, then GCC will automatically avoid using
8052 +these registers when the target switches are opposed to them.)
8054 +#define CONDITIONAL_REGISTER_USAGE \
8059 + if (TARGET_SOFT_FLOAT) \
8061 + for (regno = FIRST_FP_REGNUM; \
8062 + regno <= LAST_FP_REGNUM; ++regno) \
8063 + fixed_regs[regno] = call_used_regs[regno] = 1; \
8067 + fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
8068 + call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
8075 +If the program counter has a register number, define this as that
8076 +register number. Otherwise, do not define it.
8079 +#define LAST_AVR32_REGNUM 16
8082 +/** Order of Allocation of Registers **/
8085 +If defined, an initializer for a vector of integers, containing the
8086 +numbers of hard registers in the order in which GCC should prefer
8087 +to use them (from most preferred to least).
8089 +If this macro is not defined, registers are used lowest numbered first
8090 +(all else being equal).
8092 +One use of this macro is on machines where the highest numbered
8093 +registers must always be saved and the save-multiple-registers
8094 +instruction supports only sequences of consecutive registers. On such
8095 +machines, define REG_ALLOC_ORDER to be an initializer that lists
8096 +the highest numbered allocable register first.
8098 +#define REG_ALLOC_ORDER \
8100 + INTERNAL_REGNUM(8), \
8101 + INTERNAL_REGNUM(9), \
8102 + INTERNAL_REGNUM(10), \
8103 + INTERNAL_REGNUM(11), \
8104 + INTERNAL_REGNUM(12), \
8106 + INTERNAL_REGNUM(7), \
8107 + INTERNAL_REGNUM(6), \
8108 + INTERNAL_REGNUM(5), \
8109 + INTERNAL_REGNUM(4), \
8110 + INTERNAL_REGNUM(3), \
8111 + INTERNAL_REGNUM(2), \
8112 + INTERNAL_REGNUM(1), \
8113 + INTERNAL_REGNUM(0), \
8114 + INTERNAL_FP_REGNUM(15), \
8115 + INTERNAL_FP_REGNUM(14), \
8116 + INTERNAL_FP_REGNUM(13), \
8117 + INTERNAL_FP_REGNUM(12), \
8118 + INTERNAL_FP_REGNUM(11), \
8119 + INTERNAL_FP_REGNUM(10), \
8120 + INTERNAL_FP_REGNUM(9), \
8121 + INTERNAL_FP_REGNUM(8), \
8122 + INTERNAL_FP_REGNUM(7), \
8123 + INTERNAL_FP_REGNUM(6), \
8124 + INTERNAL_FP_REGNUM(5), \
8125 + INTERNAL_FP_REGNUM(4), \
8126 + INTERNAL_FP_REGNUM(3), \
8127 + INTERNAL_FP_REGNUM(2), \
8128 + INTERNAL_FP_REGNUM(1), \
8129 + INTERNAL_FP_REGNUM(0), \
8135 +/** How Values Fit in Registers **/
8138 +A C expression for the number of consecutive hard registers, starting
8139 +at register number REGNO, required to hold a value of mode
8142 +On a machine where all registers are exactly one word, a suitable
8143 +definition of this macro is
8145 +#define HARD_REGNO_NREGS(REGNO, MODE) \
8146 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
8149 +#define HARD_REGNO_NREGS(REGNO, MODE) \
8150 + ((unsigned int)((GET_MODE_SIZE(MODE) + UNITS_PER_WORD -1 ) / UNITS_PER_WORD))
8153 +A C expression that is nonzero if it is permissible to store a value
8154 +of mode MODE in hard register number REGNO (or in several
8155 +registers starting with that one). For a machine where all registers
8156 +are equivalent, a suitable definition is
8158 + #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
8160 +You need not include code to check for the numbers of fixed registers,
8161 +because the allocation mechanism considers them to be always occupied.
8163 +On some machines, double-precision values must be kept in even/odd
8164 +register pairs. You can implement that by defining this macro to reject
8165 +odd register numbers for such modes.
8167 +The minimum requirement for a mode to be OK in a register is that the
8168 +mov[mode] instruction pattern support moves between the
8169 +register and other hard register in the same class and that moving a
8170 +value into the register and back out not alter it.
8172 +Since the same instruction used to move word_mode will work for
8173 +all narrower integer modes, it is not necessary on any machine for
8174 +HARD_REGNO_MODE_OK to distinguish between these modes, provided
8175 +you define patterns movhi, etc., to take advantage of this. This
8176 +is useful because of the interaction between HARD_REGNO_MODE_OK
8177 +and MODES_TIEABLE_P; it is very desirable for all integer modes
8180 +Many machines have special registers for floating point arithmetic.
8181 +Often people assume that floating point machine modes are allowed only
8182 +in floating point registers. This is not true. Any registers that
8183 +can hold integers can safely hold a floating point machine
8184 +mode, whether or not floating arithmetic can be done on it in those
8185 +registers. Integer move instructions can be used to move the values.
8187 +On some machines, though, the converse is true: fixed-point machine
8188 +modes may not go in floating registers. This is true if the floating
8189 +registers normalize any value stored in them, because storing a
8190 +non-floating value there would garble it. In this case,
8191 +HARD_REGNO_MODE_OK should reject fixed-point machine modes in
8192 +floating registers. But if the floating registers do not automatically
8193 +normalize, if you can store any bit pattern in one and retrieve it
8194 +unchanged without a trap, then any machine mode may go in a floating
8195 +register, so you can define this macro to say so.
8197 +The primary significance of special floating registers is rather that
8198 +they are the registers acceptable in floating point arithmetic
8199 +instructions. However, this is of no concern to
8200 +HARD_REGNO_MODE_OK. You handle it by writing the proper
8201 +constraints for those instructions.
8203 +On some machines, the floating registers are especially slow to access,
8204 +so that it is better to store a value in a stack frame than in such a
8205 +register if floating point arithmetic is not being done. As long as the
8206 +floating registers are not in class GENERAL_REGS, they will not
8207 +be used unless some pattern's constraint asks for one.
8209 +#define HARD_REGNO_MODE_OK(REGNO, MODE) avr32_hard_regno_mode_ok(REGNO, MODE)
8212 +A C expression that is nonzero if a value of mode
8213 +MODE1 is accessible in mode MODE2 without copying.
8215 +If HARD_REGNO_MODE_OK(R, MODE1) and
8216 +HARD_REGNO_MODE_OK(R, MODE2) are always the same for
8217 +any R, then MODES_TIEABLE_P(MODE1, MODE2)
8218 +should be nonzero. If they differ for any R, you should define
8219 +this macro to return zero unless some other mechanism ensures the
8220 +accessibility of the value in a narrower mode.
8222 +You should define this macro to return nonzero in as many cases as
8223 +possible since doing so will allow GCC to perform better register
8226 +#define MODES_TIEABLE_P(MODE1, MODE2) \
8227 + (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
8231 +/******************************************************************************
8232 + * Register Classes
8233 + *****************************************************************************/
8236 +An enumeral type that must be defined with all the register class names
8237 +as enumeral values. NO_REGS must be first. ALL_REGS
8238 +must be the last register class, followed by one more enumeral value,
8239 +LIM_REG_CLASSES, which is not a register class but rather
8240 +tells how many classes there are.
8242 +Each register class has a number, which is the value of casting
8243 +the class name to type int. The number serves as an index
8244 +in many of the tables described below.
8256 +The number of distinct register classes, defined as follows:
8257 + #define N_REG_CLASSES (int) LIM_REG_CLASSES
8259 +#define N_REG_CLASSES (int)LIM_REG_CLASSES
8262 +An initializer containing the names of the register classes as C string
8263 +constants. These names are used in writing some of the debugging dumps.
8265 +#define REG_CLASS_NAMES \
8269 + "FLOATING_POINT_REGS", \
8274 +An initializer containing the contents of the register classes, as integers
8275 +which are bit masks. The nth integer specifies the contents of class
8276 +n. The way the integer mask is interpreted is that
8277 +register r is in the class if mask & (1 << r) is 1.
8279 +When the machine has more than 32 registers, an integer does not suffice.
8280 +Then the integers are replaced by sub-initializers, braced groupings containing
8281 +several integers. Each sub-initializer must be suitable as an initializer
8282 +for the type HARD_REG_SET which is defined in hard-reg-set.h.
8283 +In this situation, the first integer in each sub-initializer corresponds to
8284 +registers 0 through 31, the second integer to registers 32 through 63, and
8287 +#define REG_CLASS_CONTENTS { \
8288 + {0x00000000}, /* NO_REGS */ \
8289 + {0x0000FFFF}, /* GENERAL_REGS */ \
8290 + {0xFFFF0000}, /* FP_REGS */ \
8291 + {0x7FFFFFFF}, /* ALL_REGS */ \
8296 +A C expression whose value is a register class containing hard register
8297 +REGNO. In general there is more than one such class; choose a class
8298 +which is minimal, meaning that no smaller class also contains the
8301 +#define REGNO_REG_CLASS(REGNO) ((REGNO < 16) ? GENERAL_REGS : FP_REGS)
8304 +A macro whose definition is the name of the class to which a valid
8305 +base register must belong. A base register is one used in an address
8306 +which is the register value plus a displacement.
8308 +#define BASE_REG_CLASS GENERAL_REGS
8311 +This is a variation of the BASE_REG_CLASS macro which allows
8312 +the selection of a base register in a mode depenedent manner. If
8313 +mode is VOIDmode then it should return the same value as
8316 +#define MODE_BASE_REG_CLASS(MODE) BASE_REG_CLASS
8319 +A macro whose definition is the name of the class to which a valid
8320 +index register must belong. An index register is one used in an
8321 +address where its value is either multiplied by a scale factor or
8322 +added to another register (as well as added to a displacement).
8324 +#define INDEX_REG_CLASS BASE_REG_CLASS
8327 +A C expression which defines the machine-dependent operand constraint
8328 +letters for register classes. If CHAR is such a letter, the
8329 +value should be the register class corresponding to it. Otherwise,
8330 +the value should be NO_REGS. The register letter r,
8331 +corresponding to class GENERAL_REGS, will not be passed
8332 +to this macro; you do not need to handle it.
8334 +#define REG_CLASS_FROM_LETTER(CHAR) ((CHAR) == 'f' ? FP_REGS : NO_REGS)
8337 +/* These assume that REGNO is a hard or pseudo reg number.
8338 + They give nonzero only if REGNO is a hard reg of the suitable class
8339 + or a pseudo reg currently allocated to a suitable hard reg.
8340 + Since they use reg_renumber, they are safe only once reg_renumber
8341 + has been allocated, which happens in local-alloc.c. */
8342 +#define TEST_REGNO(R, TEST, VALUE) \
8343 + ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
8346 +A C expression which is nonzero if register number num is suitable for use as a base
8347 +register in operand addresses. It may be either a suitable hard register or a pseudo
8348 +register that has been allocated such a hard register.
8350 +#define REGNO_OK_FOR_BASE_P(NUM) TEST_REGNO(NUM, <=, LAST_REGNUM)
8353 +A C expression which is nonzero if register number NUM is
8354 +suitable for use as an index register in operand addresses. It may be
8355 +either a suitable hard register or a pseudo register that has been
8356 +allocated such a hard register.
8358 +The difference between an index register and a base register is that
8359 +the index register may be scaled. If an address involves the sum of
8360 +two registers, neither one of them scaled, then either one may be
8361 +labeled the ``base'' and the other the ``index''; but whichever
8362 +labeling is used must fit the machine's constraints of which registers
8363 +may serve in each capacity. The compiler will try both labelings,
8364 +looking for one that is valid, and will reload one or both registers
8365 +only if neither labeling works.
8367 +#define REGNO_OK_FOR_INDEX_P(NUM) TEST_REGNO(NUM, <=, LAST_REGNUM)
8370 +A C expression that places additional restrictions on the register class
8371 +to use when it is necessary to copy value X into a register in class
8372 +CLASS. The value is a register class; perhaps CLASS, or perhaps
8373 +another, smaller class. On many machines, the following definition is
8374 +safe: #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
8376 +Sometimes returning a more restrictive class makes better code. For
8377 +example, on the 68000, when X is an integer constant that is in range
8378 +for a 'moveq' instruction, the value of this macro is always
8379 +DATA_REGS as long as CLASS includes the data registers.
8380 +Requiring a data register guarantees that a 'moveq' will be used.
8382 +If X is a const_double, by returning NO_REGS
8383 +you can force X into a memory constant. This is useful on
8384 +certain machines where immediate floating values cannot be loaded into
8385 +certain kinds of registers.
8387 +#define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS
8392 +A C expression for the maximum number of consecutive registers
8393 +of class CLASS needed to hold a value of mode MODE.
8395 +This is closely related to the macro HARD_REGNO_NREGS. In fact,
8396 +the value of the macro CLASS_MAX_NREGS(CLASS, MODE)
8397 +should be the maximum value of HARD_REGNO_NREGS(REGNO, MODE)
8398 +for all REGNO values in the class CLASS.
8400 +This macro helps control the handling of multiple-word values
8401 +in the reload pass.
8403 +#define CLASS_MAX_NREGS(CLASS, MODE) /* ToDo:fixme */ \
8404 + (unsigned int)((GET_MODE_SIZE(MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
8408 + Using CONST_OK_FOR_CONSTRAINT_P instead of CONS_OK_FOR_LETTER_P
8409 + in order to support constraints with more than one letter.
8410 + Only two letters are then used for constant constraints,
8411 + the letter 'K' and the letter 'I'. The constraint starting with
8412 + these letters must consist of four characters. The character following
8413 + 'K' or 'I' must be either 'u' (unsigned) or 's' (signed) to specify
8414 + if the constant is zero or sign extended. The last two characters specify
8415 + the length in bits of the constant. The base constraint letter 'I' means
8416 + that this is an negated constant, meaning that actually -VAL should be
8417 + checked to lie withing the valid range instead of VAL which is used when
8418 + 'K' is the base constraint letter.
8422 +#define CONSTRAINT_LEN(C, STR) \
8423 + ( ((C) == 'K' || (C) == 'I') ? 4 : \
8424 + ((C) == 'R') ? 5 : \
8425 + ((C) == 'N' || (C) == 'O' || \
8426 + (C) == 'P' || (C) == 'L' || (C) == 'J') ? -1 : \
8427 + DEFAULT_CONSTRAINT_LEN((C), (STR)) )
8429 +#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, STR) \
8430 + avr32_const_ok_for_constraint_p(VALUE, C, STR)
8433 +A C expression that defines the machine-dependent operand constraint
8434 +letters that specify particular ranges of const_double values ('G' or 'H').
8436 +If C is one of those letters, the expression should check that
8437 +VALUE, an RTX of code const_double, is in the appropriate
8438 +range and return 1 if so, 0 otherwise. If C is not one of those
8439 +letters, the value should be 0 regardless of VALUE.
8441 +const_double is used for all floating-point constants and for
8442 +DImode fixed-point constants. A given letter can accept either
8443 +or both kinds of values. It can use GET_MODE to distinguish
8444 +between these kinds.
8446 +#define CONST_DOUBLE_OK_FOR_LETTER_P(OP, C) \
8447 + ((C) == 'G' ? avr32_const_double_immediate(OP) : 0)
8450 +A C expression that defines the optional machine-dependent constraint
8451 +letters that can be used to segregate specific types of operands, usually
8452 +memory references, for the target machine. Any letter that is not
8453 +elsewhere defined and not matched by REG_CLASS_FROM_LETTER
8454 +may be used. Normally this macro will not be defined.
8456 +If it is required for a particular target machine, it should return 1
8457 +if VALUE corresponds to the operand type represented by the
8458 +constraint letter C. If C is not defined as an extra
8459 +constraint, the value returned should be 0 regardless of VALUE.
8461 +For example, on the ROMP, load instructions cannot have their output
8462 +in r0 if the memory reference contains a symbolic address. Constraint
8463 +letter 'Q' is defined as representing a memory address that does
8464 +not contain a symbolic address. An alternative is specified with
8465 +a 'Q' constraint on the input and 'r' on the output. The next
8466 +alternative specifies 'm' on the input and a register class that
8467 +does not include r0 on the output.
8469 +#define EXTRA_CONSTRAINT_STR(OP, C, STR) \
8470 + ((C) == 'W' ? avr32_address_operand(OP, GET_MODE(OP)) : \
8471 + (C) == 'R' ? (avr32_indirect_register_operand(OP, GET_MODE(OP)) || \
8472 + (avr32_imm_disp_memory_operand(OP, GET_MODE(OP)) \
8473 + && avr32_const_ok_for_constraint_p( \
8474 + INTVAL(XEXP(XEXP(OP, 0), 1)), \
8475 + (STR)[1], &(STR)[1]))) : \
8476 + (C) == 'S' ? avr32_indexed_memory_operand(OP, GET_MODE(OP)) : \
8477 + (C) == 'T' ? avr32_const_pool_ref_operand(OP, GET_MODE(OP)) : \
8478 + (C) == 'U' ? SYMBOL_REF_RCALL_FUNCTION_P(OP) : \
8479 + (C) == 'Z' ? avr32_cop_memory_operand(OP, GET_MODE(OP)) : \
8483 +#define EXTRA_MEMORY_CONSTRAINT(C, STR) ( ((C) == 'R') || \
8488 +/* Returns nonzero if op is a function SYMBOL_REF which
8489 + can be called using an rcall instruction */
8490 +#define SYMBOL_REF_RCALL_FUNCTION_P(op) \
8491 + ( GET_CODE(op) == SYMBOL_REF \
8492 + && SYMBOL_REF_FUNCTION_P(op) \
8493 + && SYMBOL_REF_LOCAL_P(op) \
8494 + && !SYMBOL_REF_EXTERNAL_P(op) \
8495 + && !TARGET_HAS_ASM_ADDR_PSEUDOS )
8497 +/******************************************************************************
8498 + * Stack Layout and Calling Conventions
8499 + *****************************************************************************/
8501 +/** Basic Stack Layout **/
8504 +Define this macro if pushing a word onto the stack moves the stack
8505 +pointer to a smaller address.
8507 +When we say, ``define this macro if ...,'' it means that the
8508 +compiler checks this macro only with #ifdef so the precise
8509 +definition used does not matter.
8511 +/* pushm decrece SP: *(--SP) <-- Rx */
8512 +#define STACK_GROWS_DOWNWARD
8515 +This macro defines the operation used when something is pushed
8516 +on the stack. In RTL, a push operation will be
8517 +(set (mem (STACK_PUSH_CODE (reg sp))) ...)
8519 +The choices are PRE_DEC, POST_DEC, PRE_INC,
8520 +and POST_INC. Which of these is correct depends on
8521 +the stack direction and on whether the stack pointer points
8522 +to the last item on the stack or whether it points to the
8523 +space for the next item on the stack.
8525 +The default is PRE_DEC when STACK_GROWS_DOWNWARD is
8526 +defined, which is almost always right, and PRE_INC otherwise,
8527 +which is often wrong.
8529 +/* pushm: *(--SP) <-- Rx */
8530 +#define STACK_PUSH_CODE PRE_DEC
8532 +/* Define this to nonzero if the nominal address of the stack frame
8533 + is at the high-address end of the local variables;
8534 + that is, each additional local variable allocated
8535 + goes at a more negative offset in the frame. */
8536 +#define FRAME_GROWS_DOWNWARD 1
8540 +Offset from the frame pointer to the first local variable slot to be allocated.
8542 +If FRAME_GROWS_DOWNWARD, find the next slot's offset by
8543 +subtracting the first slot's length from STARTING_FRAME_OFFSET.
8544 +Otherwise, it is found by adding the length of the first slot to the
8545 +value STARTING_FRAME_OFFSET.
8546 + (i'm not sure if the above is still correct.. had to change it to get
8547 + rid of an overfull. --mew 2feb93 )
8549 +#define STARTING_FRAME_OFFSET 0
8552 +Offset from the stack pointer register to the first location at which
8553 +outgoing arguments are placed. If not specified, the default value of
8554 +zero is used. This is the proper value for most machines.
8556 +If ARGS_GROW_DOWNWARD, this is the offset to the location above
8557 +the first location at which outgoing arguments are placed.
8559 +#define STACK_POINTER_OFFSET 0
8562 +Offset from the argument pointer register to the first argument's
8563 +address. On some machines it may depend on the data type of the
8566 +If ARGS_GROW_DOWNWARD, this is the offset to the location above
8567 +the first argument's address.
8569 +#define FIRST_PARM_OFFSET(FUNDECL) 0
8573 +A C expression whose value is RTL representing the address in a stack
8574 +frame where the pointer to the caller's frame is stored. Assume that
8575 +FRAMEADDR is an RTL expression for the address of the stack frame
8578 +If you don't define this macro, the default is to return the value
8579 +of FRAMEADDR - that is, the stack frame address is also the
8580 +address of the stack word that points to the previous frame.
8582 +#define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) plus_constant ((FRAMEADDR), 4)
8586 +A C expression whose value is RTL representing the value of the return
8587 +address for the frame COUNT steps up from the current frame, after
8588 +the prologue. FRAMEADDR is the frame pointer of the COUNT
8589 +frame, or the frame pointer of the COUNT - 1 frame if
8590 +RETURN_ADDR_IN_PREVIOUS_FRAME is defined.
8592 +The value of the expression must always be the correct address when
8593 +COUNT is zero, but may be NULL_RTX if there is not way to
8594 +determine the return address of other frames.
8596 +#define RETURN_ADDR_RTX(COUNT, FRAMEADDR) avr32_return_addr(COUNT, FRAMEADDR)
8600 +A C expression whose value is RTL representing the location of the
8601 +incoming return address at the beginning of any function, before the
8602 +prologue. This RTL is either a REG, indicating that the return
8603 +value is saved in 'REG', or a MEM representing a location in
8606 +You only need to define this macro if you want to support call frame
8607 +debugging information like that provided by DWARF 2.
8609 +If this RTL is a REG, you should also define
8610 +DWARF_FRAME_RETURN_COLUMN to DWARF_FRAME_REGNUM (REGNO).
8612 +#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LR_REGNUM)
8617 +A C expression whose value is an integer giving the offset, in bytes,
8618 +from the value of the stack pointer register to the top of the stack
8619 +frame at the beginning of any function, before the prologue. The top of
8620 +the frame is defined to be the value of the stack pointer in the
8621 +previous frame, just before the call instruction.
8623 +You only need to define this macro if you want to support call frame
8624 +debugging information like that provided by DWARF 2.
8626 +#define INCOMING_FRAME_SP_OFFSET 0
8629 +/** Exception Handling Support **/
8631 +/* Use setjump/longjump for exception handling. */
8632 +#define DWARF2_UNWIND_INFO 0
8633 +#define MUST_USE_SJLJ_EXCEPTIONS 1
8636 +A C expression whose value is the Nth register number used for
8637 +data by exception handlers, or INVALID_REGNUM if fewer than
8638 +N registers are usable.
8640 +The exception handling library routines communicate with the exception
8641 +handlers via a set of agreed upon registers. Ideally these registers
8642 +should be call-clobbered; it is possible to use call-saved registers,
8643 +but may negatively impact code size. The target must support at least
8644 +2 data registers, but should define 4 if there are enough free registers.
8646 +You must define this macro if you want to support call frame exception
8647 +handling like that provided by DWARF 2.
8652 +#define EH_RETURN_DATA_REGNO(N) \
8653 + ((N<3) ? INTERNAL_REGNUM(N+9) : INVALID_REGNUM)
8656 +A C expression whose value is RTL representing a location in which
8657 +to store a stack adjustment to be applied before function return.
8658 +This is used to unwind the stack to an exception handler's call frame.
8659 +It will be assigned zero on code paths that return normally.
8661 +Typically this is a call-clobbered hard register that is otherwise
8662 +untouched by the epilogue, but could also be a stack slot.
8664 +You must define this macro if you want to support call frame exception
8665 +handling like that provided by DWARF 2.
8670 +#define EH_RETURN_STACKADJ_REGNO INTERNAL_REGNUM(8)
8671 +#define EH_RETURN_STACKADJ_RTX gen_rtx_REG(SImode, EH_RETURN_STACKADJ_REGNO)
8674 +A C expression whose value is RTL representing a location in which
8675 +to store the address of an exception handler to which we should
8676 +return. It will not be assigned on code paths that return normally.
8678 +Typically this is the location in the call frame at which the normal
8679 +return address is stored. For targets that return by popping an
8680 +address off the stack, this might be a memory address just below
8681 +the target call frame rather than inside the current call
8682 +frame. EH_RETURN_STACKADJ_RTX will have already been assigned,
8683 +so it may be used to calculate the location of the target call frame.
8685 +Some targets have more complex requirements than storing to an
8686 +address calculable during initial code generation. In that case
8687 +the eh_return instruction pattern should be used instead.
8689 +If you want to support call frame exception handling, you must
8690 +define either this macro or the eh_return instruction pattern.
8693 + We define the eh_return instruction pattern, so this isn't needed.
8695 +/* #define EH_RETURN_HANDLER_RTX gen_rtx_REG(Pmode, RET_REGISTER) */
8698 + This macro chooses the encoding of pointers embedded in the
8699 + exception handling sections. If at all possible, this should be
8700 + defined such that the exception handling section will not require
8701 + dynamic relocations, and so may be read-only.
8703 + code is 0 for data, 1 for code labels, 2 for function
8704 + pointers. global is true if the symbol may be affected by dynamic
8705 + relocations. The macro should return a combination of the DW_EH_PE_*
8706 + defines as found in dwarf2.h.
8708 + If this macro is not defined, pointers will not be encoded but
8709 + represented directly.
8711 +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
8712 + ((flag_pic && (GLOBAL) ? DW_EH_PE_indirect : 0) \
8713 + | (flag_pic ? DW_EH_PE_pcrel : DW_EH_PE_absptr) \
8714 + | DW_EH_PE_sdata4)
8716 +/* ToDo: The rest of this subsection */
8718 +/** Specifying How Stack Checking is Done **/
8719 +/* ToDo: All in this subsection */
8721 +/** Registers That Address the Stack Frame **/
8724 +The register number of the stack pointer register, which must also be a
8725 +fixed register according to FIXED_REGISTERS. On most machines,
8726 +the hardware determines which register this is.
8728 +/* Using r13 as stack pointer. */
8729 +#define STACK_POINTER_REGNUM INTERNAL_REGNUM(13)
8732 +The register number of the frame pointer register, which is used to
8733 +access automatic variables in the stack frame. On some machines, the
8734 +hardware determines which register this is. On other machines, you can
8735 +choose any register you wish for this purpose.
8738 +#define FRAME_POINTER_REGNUM INTERNAL_REGNUM(7)
8743 +The register number of the arg pointer register, which is used to access
8744 +the function's argument list. On some machines, this is the same as the
8745 +frame pointer register. On some machines, the hardware determines which
8746 +register this is. On other machines, you can choose any register you
8747 +wish for this purpose. If this is not the same register as the frame
8748 +pointer register, then you must mark it as a fixed register according to
8749 +FIXED_REGISTERS, or arrange to be able to eliminate it (see Section
8750 +10.10.5 [Elimination], page 224).
8753 +#define ARG_POINTER_REGNUM INTERNAL_REGNUM(4)
8757 +Register numbers used for passing a function's static chain pointer. If
8758 +register windows are used, the register number as seen by the called
8759 +function is STATIC_CHAIN_INCOMING_REGNUM, while the register
8760 +number as seen by the calling function is STATIC_CHAIN_REGNUM. If
8761 +these registers are the same, STATIC_CHAIN_INCOMING_REGNUM need
8764 +The static chain register need not be a fixed register.
8766 +If the static chain is passed in memory, these macros should not be
8767 +defined; instead, the next two macros should be defined.
8770 +#define STATIC_CHAIN_REGNUM INTERNAL_REGNUM(0)
8773 +/** Eliminating Frame Pointer and Arg Pointer **/
8776 +A C expression which is nonzero if a function must have and use a frame
8777 +pointer. This expression is evaluated in the reload pass. If its value is
8778 +nonzero the function will have a frame pointer.
8780 +The expression can in principle examine the current function and decide
8781 +according to the facts, but on most machines the constant 0 or the
8782 +constant 1 suffices. Use 0 when the machine allows code to be generated
8783 +with no frame pointer, and doing so saves some time or space. Use 1
8784 +when there is no possible advantage to avoiding a frame pointer.
8786 +In certain cases, the compiler does not know how to produce valid code
8787 +without a frame pointer. The compiler recognizes those cases and
8788 +automatically gives the function a frame pointer regardless of what
8789 +FRAME_POINTER_REQUIRED says. You don't need to worry about
8792 +In a function that does not require a frame pointer, the frame pointer
8793 +register can be allocated for ordinary usage, unless you mark it as a
8794 +fixed register. See FIXED_REGISTERS for more information.
8796 +/* We need the frame pointer when compiling for profiling */
8797 +#define FRAME_POINTER_REQUIRED (current_function_profile)
8800 +A C statement to store in the variable DEPTH_VAR the difference
8801 +between the frame pointer and the stack pointer values immediately after
8802 +the function prologue. The value would be computed from information
8803 +such as the result of get_frame_size () and the tables of
8804 +registers regs_ever_live and call_used_regs.
8806 +If ELIMINABLE_REGS is defined, this macro will be not be used and
8807 +need not be defined. Otherwise, it must be defined even if
8808 +FRAME_POINTER_REQUIRED is defined to always be true; in that
8809 +case, you may set DEPTH_VAR to anything.
8811 +#define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) ((DEPTH_VAR) = get_frame_size())
8814 +If defined, this macro specifies a table of register pairs used to
8815 +eliminate unneeded registers that point into the stack frame. If it is not
8816 +defined, the only elimination attempted by the compiler is to replace
8817 +references to the frame pointer with references to the stack pointer.
8819 +The definition of this macro is a list of structure initializations, each
8820 +of which specifies an original and replacement register.
8822 +On some machines, the position of the argument pointer is not known until
8823 +the compilation is completed. In such a case, a separate hard register
8824 +must be used for the argument pointer. This register can be eliminated by
8825 +replacing it with either the frame pointer or the argument pointer,
8826 +depending on whether or not the frame pointer has been eliminated.
8828 +In this case, you might specify:
8829 + #define ELIMINABLE_REGS \
8830 + {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
8831 + {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
8832 + {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
8834 +Note that the elimination of the argument pointer with the stack pointer is
8835 +specified first since that is the preferred elimination.
8837 +#define ELIMINABLE_REGS \
8839 + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
8840 + { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
8841 + { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM } \
8845 +A C expression that returns nonzero if the compiler is allowed to try
8846 +to replace register number FROM with register number
8847 +TO. This macro need only be defined if ELIMINABLE_REGS
8848 +is defined, and will usually be the constant 1, since most of the cases
8849 +preventing register elimination are things that the compiler already
8852 +#define CAN_ELIMINATE(FROM, TO) 1
8855 +This macro is similar to INITIAL_FRAME_POINTER_OFFSET. It
8856 +specifies the initial difference between the specified pair of
8857 +registers. This macro must be defined if ELIMINABLE_REGS is
8860 +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
8861 + ((OFFSET) = avr32_initial_elimination_offset(FROM, TO))
8863 +/** Passing Function Arguments on the Stack **/
8867 +A C expression. If nonzero, push insns will be used to pass
8868 +outgoing arguments.
8869 +If the target machine does not have a push instruction, set it to zero.
8870 +That directs GCC to use an alternate strategy: to
8871 +allocate the entire argument block and then store the arguments into
8872 +it. When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
8874 +#define PUSH_ARGS 1
8878 +A C expression that is the number of bytes actually pushed onto the
8879 +stack when an instruction attempts to push NPUSHED bytes.
8881 +On some machines, the definition
8883 + #define PUSH_ROUNDING(BYTES) (BYTES)
8885 +will suffice. But on other machines, instructions that appear
8886 +to push one byte actually push two bytes in an attempt to maintain
8887 +alignment. Then the definition should be
8889 + #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
8891 +/* Push 4 bytes at the time. */
8892 +#define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3)
8895 +A C expression. If nonzero, the maximum amount of space required for
8896 +outgoing arguments will be computed and placed into the variable
8897 +current_function_outgoing_args_size. No space will be pushed
8898 +onto the stack for each call; instead, the function prologue should
8899 +increase the stack frame size by this amount.
8901 +Setting both PUSH_ARGS and ACCUMULATE_OUTGOING_ARGS is not proper.
8903 +#define ACCUMULATE_OUTGOING_ARGS 0
8909 +A C expression that should indicate the number of bytes of its own
8910 +arguments that a function pops on returning, or 0 if the
8911 +function pops no arguments and the caller must therefore pop them all
8912 +after the function returns.
8914 +FUNDECL is a C variable whose value is a tree node that describes
8915 +the function in question. Normally it is a node of type
8916 +FUNCTION_DECL that describes the declaration of the function.
8917 +From this you can obtain the DECL_ATTRIBUTES of the function.
8919 +FUNTYPE is a C variable whose value is a tree node that
8920 +describes the function in question. Normally it is a node of type
8921 +FUNCTION_TYPE that describes the data type of the function.
8922 +From this it is possible to obtain the data types of the value and
8923 +arguments (if known).
8925 +When a call to a library function is being considered, FUNDECL
8926 +will contain an identifier node for the library function. Thus, if
8927 +you need to distinguish among various library functions, you can do so
8928 +by their names. Note that ``library function'' in this context means
8929 +a function used to perform arithmetic, whose name is known specially
8930 +in the compiler and was not mentioned in the C code being compiled.
8932 +STACK_SIZE is the number of bytes of arguments passed on the
8933 +stack. If a variable number of bytes is passed, it is zero, and
8934 +argument popping will always be the responsibility of the calling function.
8936 +On the VAX, all functions always pop their arguments, so the definition
8937 +of this macro is STACK_SIZE. On the 68000, using the standard
8938 +calling convention, no functions pop their arguments, so the value of
8939 +the macro is always 0 in this case. But an alternative calling
8940 +convention is available in which functions that take a fixed number of
8941 +arguments pop them but other functions (such as printf) pop
8942 +nothing (the caller pops all). When this convention is in use,
8943 +FUNTYPE is examined to determine whether a function takes a fixed
8944 +number of arguments.
8946 +#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
8949 +/*Return true if this function can we use a single return instruction*/
8950 +#define USE_RETURN_INSN(ISCOND) avr32_use_return_insn(ISCOND)
8953 +A C expression that should indicate the number of bytes a call sequence
8954 +pops off the stack. It is added to the value of RETURN_POPS_ARGS
8955 +when compiling a function call.
8957 +CUM is the variable in which all arguments to the called function
8958 +have been accumulated.
8960 +On certain architectures, such as the SH5, a call trampoline is used
8961 +that pops certain registers off the stack, depending on the arguments
8962 +that have been passed to the function. Since this is a property of the
8963 +call site, not of the called function, RETURN_POPS_ARGS is not
8966 +#define CALL_POPS_ARGS(CUM) 0
8968 +/* Passing Arguments in Registers */
8971 +A C expression that controls whether a function argument is passed
8972 +in a register, and which register.
8974 +The arguments are CUM, which summarizes all the previous
8975 +arguments; MODE, the machine mode of the argument; TYPE,
8976 +the data type of the argument as a tree node or 0 if that is not known
8977 +(which happens for C support library functions); and NAMED,
8978 +which is 1 for an ordinary argument and 0 for nameless arguments that
8979 +correspond to '...' in the called function's prototype.
8980 +TYPE can be an incomplete type if a syntax error has previously
8983 +The value of the expression is usually either a reg RTX for the
8984 +hard register in which to pass the argument, or zero to pass the
8985 +argument on the stack.
8987 +For machines like the VAX and 68000, where normally all arguments are
8988 +pushed, zero suffices as a definition.
8990 +The value of the expression can also be a parallel RTX. This is
8991 +used when an argument is passed in multiple locations. The mode of the
8992 +of the parallel should be the mode of the entire argument. The
8993 +parallel holds any number of expr_list pairs; each one
8994 +describes where part of the argument is passed. In each
8995 +expr_list the first operand must be a reg RTX for the hard
8996 +register in which to pass this part of the argument, and the mode of the
8997 +register RTX indicates how large this part of the argument is. The
8998 +second operand of the expr_list is a const_int which gives
8999 +the offset in bytes into the entire argument of where this part starts.
9000 +As a special exception the first expr_list in the parallel
9001 +RTX may have a first operand of zero. This indicates that the entire
9002 +argument is also stored on the stack.
9004 +The last time this macro is called, it is called with MODE == VOIDmode,
9005 +and its result is passed to the call or call_value
9006 +pattern as operands 2 and 3 respectively.
9008 +The usual way to make the ISO library 'stdarg.h' work on a machine
9009 +where some arguments are usually passed in registers, is to cause
9010 +nameless arguments to be passed on the stack instead. This is done
9011 +by making FUNCTION_ARG return 0 whenever NAMED is 0.
9013 +You may use the macro MUST_PASS_IN_STACK (MODE, TYPE)
9014 +in the definition of this macro to determine if this argument is of a
9015 +type that must be passed in the stack. If REG_PARM_STACK_SPACE
9016 +is not defined and FUNCTION_ARG returns nonzero for such an
9017 +argument, the compiler will abort. If REG_PARM_STACK_SPACE is
9018 +defined, the argument will be computed in the stack and then loaded into
9021 +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
9022 + avr32_function_arg(&(CUM), MODE, TYPE, NAMED)
9028 +A C type for declaring a variable that is used as the first argument of
9029 +FUNCTION_ARG and other related values. For some target machines,
9030 +the type int suffices and can hold the number of bytes of
9033 +There is no need to record in CUMULATIVE_ARGS anything about the
9034 +arguments that have been passed on the stack. The compiler has other
9035 +variables to keep track of that. For target machines on which all
9036 +arguments are passed on the stack, there is no need to store anything in
9037 +CUMULATIVE_ARGS; however, the data structure must exist and
9038 +should not be empty, so use int.
9040 +typedef struct avr32_args
9042 + /* Index representing the argument register the current function argument
9045 + /* A mask with bits representing the argument registers: if a bit is set
9046 + then this register is used for an arguemnt */
9048 + /* TRUE if this function has anonymous arguments */
9049 + int uses_anonymous_args;
9050 + /* The size in bytes of the named arguments pushed on the stack */
9051 + int stack_pushed_args_size;
9052 + /* Set to true if this function needs a Return Value Pointer */
9058 +#define FIRST_CUM_REG_INDEX 0
9059 +#define LAST_CUM_REG_INDEX 4
9060 +#define GET_REG_INDEX(CUM) ((CUM)->index)
9061 +#define SET_REG_INDEX(CUM, INDEX) ((CUM)->index = (INDEX));
9062 +#define GET_USED_INDEX(CUM, INDEX) ((CUM)->used_index & (1 << (INDEX)))
9063 +#define SET_USED_INDEX(CUM, INDEX) \
9067 + (CUM)->used_index |= (1 << (INDEX)); \
9070 +#define SET_INDEXES_UNUSED(CUM) ((CUM)->used_index = 0)
9074 + A C statement (sans semicolon) for initializing the variable cum for the
9075 + state at the beginning of the argument list. The variable has type
9076 + CUMULATIVE_ARGS. The value of FNTYPE is the tree node for the data type of
9077 + the function which will receive the args, or 0 if the args are to a compiler
9078 + support library function. For direct calls that are not libcalls, FNDECL
9079 + contain the declaration node of the function. FNDECL is also set when
9080 + INIT_CUMULATIVE_ARGS is used to find arguments for the function being
9081 + compiled. N_NAMED_ARGS is set to the number of named arguments, including a
9082 + structure return address if it is passed as a parameter, when making a call.
9083 + When processing incoming arguments, N_NAMED_ARGS is set to -1.
9085 + When processing a call to a compiler support library function, LIBNAME
9086 + identifies which one. It is a symbol_ref rtx which contains the name of the
9087 + function, as a string. LIBNAME is 0 when an ordinary C function call is
9088 + being processed. Thus, each time this macro is called, either LIBNAME or
9089 + FNTYPE is nonzero, but never both of them at once.
9091 +#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
9092 + avr32_init_cumulative_args(&(CUM), FNTYPE, LIBNAME, FNDECL)
9096 +A C statement (sans semicolon) to update the summarizer variable
9097 +CUM to advance past an argument in the argument list. The
9098 +values MODE, TYPE and NAMED describe that argument.
9099 +Once this is done, the variable CUM is suitable for analyzing
9100 +the following argument with FUNCTION_ARG, etc.
9102 +This macro need not do anything if the argument in question was passed
9103 +on the stack. The compiler knows how to track the amount of stack space
9104 +used for arguments without any special help.
9106 +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
9107 + avr32_function_arg_advance(&(CUM), MODE, TYPE, NAMED)
9110 +If defined, a C expression which determines whether, and in which direction,
9111 +to pad out an argument with extra space. The value should be of type
9112 +enum direction: either 'upward' to pad above the argument,
9113 +'downward' to pad below, or 'none' to inhibit padding.
9115 +The amount of padding is always just enough to reach the next
9116 +multiple of FUNCTION_ARG_BOUNDARY; this macro does not control
9119 +This macro has a default definition which is right for most systems.
9120 +For little-endian machines, the default is to pad upward. For
9121 +big-endian machines, the default is to pad downward for an argument of
9122 +constant size shorter than an int, and upward otherwise.
9124 +#define FUNCTION_ARG_PADDING(MODE, TYPE) \
9125 + avr32_function_arg_padding(MODE, TYPE)
9128 + Specify padding for the last element of a block move between registers
9129 + and memory. First is nonzero if this is the only element. Defining
9130 + this macro allows better control of register function parameters on
9131 + big-endian machines, without using PARALLEL rtl. In particular,
9132 + MUST_PASS_IN_STACK need not test padding and mode of types in registers,
9133 + as there is no longer a "wrong" part of a register; For example, a three
9134 + byte aggregate may be passed in the high part of a register if so required.
9136 +#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
9137 + avr32_function_arg_padding(MODE, TYPE)
9140 +If defined, a C expression which determines whether the default
9141 +implementation of va_arg will attempt to pad down before reading the
9142 +next argument, if that argument is smaller than its aligned space as
9143 +controlled by PARM_BOUNDARY. If this macro is not defined, all such
9144 +arguments are padded down if BYTES_BIG_ENDIAN is true.
9146 +#define PAD_VARARGS_DOWN \
9147 + (FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward)
9151 +A C expression that is nonzero if REGNO is the number of a hard
9152 +register in which function arguments are sometimes passed. This does
9153 +not include implicit arguments such as the static chain and
9154 +the structure-value address. On many machines, no registers can be
9155 +used for this purpose since all function arguments are pushed on the
9159 + Use r8 - r12 for function arguments.
9161 +#define FUNCTION_ARG_REGNO_P(REGNO) \
9162 + (REGNO >= 3 && REGNO <= 7)
9164 +/* Number of registers used for passing function arguments */
9165 +#define NUM_ARG_REGS 5
9168 +If defined, the order in which arguments are loaded into their
9169 +respective argument registers is reversed so that the last
9170 +argument is loaded first. This macro only affects arguments
9171 +passed in registers.
9173 +/* #define LOAD_ARGS_REVERSED */
9175 +/** How Scalar Function Values Are Returned **/
9177 +/* AVR32 is using r12 as return register. */
9178 +#define RET_REGISTER (15 - 12)
9182 +A C expression to create an RTX representing the place where a library
9183 +function returns a value of mode MODE. If the precise function
9184 +being called is known, FUNC is a tree node
9185 +(FUNCTION_DECL) for it; otherwise, func is a null
9186 +pointer. This makes it possible to use a different value-returning
9187 +convention for specific functions when all their calls are
9190 +Note that "library function" in this context means a compiler
9191 +support routine, used to perform arithmetic, whose name is known
9192 +specially by the compiler and was not mentioned in the C code being
9195 +The definition of LIBRARY_VALUE need not be concerned aggregate
9196 +data types, because none of the library functions returns such types.
9198 +#define LIBCALL_VALUE(MODE) avr32_libcall_value(MODE)
9201 +A C expression that is nonzero if REGNO is the number of a hard
9202 +register in which the values of called function may come back.
9204 +A register whose use for returning values is limited to serving as the
9205 +second of a pair (for a value of type double, say) need not be
9206 +recognized by this macro. So for most machines, this definition
9208 + #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
9210 +If the machine has register windows, so that the caller and the called
9211 +function use different registers for the return value, this macro
9212 +should recognize only the caller's register numbers.
9215 + When returning a value of mode DImode, r11:r10 is used, else r12 is used.
9217 +#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RET_REGISTER \
9218 + || (REGNO) == INTERNAL_REGNUM(11))
9221 +/** How Large Values Are Returned **/
9225 +Define this macro to be 1 if all structure and union return values must be
9226 +in memory. Since this results in slower code, this should be defined
9227 +only if needed for compatibility with other compilers or with an ABI.
9228 +If you define this macro to be 0, then the conventions used for structure
9229 +and union return values are decided by the RETURN_IN_MEMORY macro.
9231 +If not defined, this defaults to the value 1.
9233 +#define DEFAULT_PCC_STRUCT_RETURN 0
9238 +/** Generating Code for Profiling **/
9241 +A C statement or compound statement to output to FILE some
9242 +assembler code to call the profiling subroutine mcount.
9244 +The details of how mcount expects to be called are determined by
9245 +your operating system environment, not by GCC. To figure them out,
9246 +compile a small program for profiling using the system's installed C
9247 +compiler and look at the assembler code that results.
9249 +Older implementations of mcount expect the address of a counter
9250 +variable to be loaded into some register. The name of this variable is
9251 +'LP' followed by the number LABELNO, so you would generate
9252 +the name using 'LP%d' in a fprintf.
9255 +#ifndef FUNCTION_PROFILER
9256 +#define FUNCTION_PROFILER(FILE, LABELNO) \
9257 + fprintf((FILE), "/* profiler %d */", (LABELNO))
9261 +/*****************************************************************************
9262 + * Trampolines for Nested Functions *
9263 + *****************************************************************************/
9266 +A C statement to output, on the stream FILE, assembler code for a
9267 +block of data that contains the constant parts of a trampoline. This
9268 +code should not include a label - the label is taken care of
9271 +If you do not define this macro, it means no template is needed
9272 +for the target. Do not define this macro on systems where the block move
9273 +code to copy the trampoline into place would be larger than the code
9274 +to generate it on the spot.
9276 +/* ToDo: correct? */
9277 +#define TRAMPOLINE_TEMPLATE(FILE) avr32_trampoline_template(FILE);
9281 +A C expression for the size in bytes of the trampoline, as an integer.
9284 +#define TRAMPOLINE_SIZE 0x0C
9287 +Alignment required for trampolines, in bits.
9289 +If you don't define this macro, the value of BIGGEST_ALIGNMENT
9290 +is used for aligning trampolines.
9292 +#define TRAMPOLINE_ALIGNMENT 16
9295 +A C statement to initialize the variable parts of a trampoline.
9296 +ADDR is an RTX for the address of the trampoline; FNADDR is
9297 +an RTX for the address of the nested function; STATIC_CHAIN is an
9298 +RTX for the static chain value that should be passed to the function
9301 +#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
9302 + avr32_initialize_trampoline(ADDR, FNADDR, STATIC_CHAIN)
9305 +/******************************************************************************
9306 + * Implicit Calls to Library Routines
9307 + *****************************************************************************/
9309 +/* Tail calling. */
9311 +/* A C expression that evaluates to true if it is ok to perform a sibling
9313 +#define FUNCTION_OK_FOR_SIBCALL(DECL) 0
9315 +#define OVERRIDE_OPTIONS avr32_override_options ()
9317 +#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) avr32_optimization_options (LEVEL, SIZE)
9320 +/******************************************************************************
9321 + * Addressing Modes
9322 + *****************************************************************************/
9325 +A C expression that is nonzero if the machine supports pre-increment,
9326 +pre-decrement, post-increment, or post-decrement addressing respectively.
9329 + AVR32 supports Rp++ and --Rp
9331 +#define HAVE_PRE_INCREMENT 0
9332 +#define HAVE_PRE_DECREMENT 1
9333 +#define HAVE_POST_INCREMENT 1
9334 +#define HAVE_POST_DECREMENT 0
9337 +A C expression that is nonzero if the machine supports pre- or
9338 +post-address side-effect generation involving constants other than
9339 +the size of the memory operand.
9341 +#define HAVE_PRE_MODIFY_DISP 0
9342 +#define HAVE_POST_MODIFY_DISP 0
9345 +A C expression that is nonzero if the machine supports pre- or
9346 +post-address side-effect generation involving a register displacement.
9348 +#define HAVE_PRE_MODIFY_REG 0
9349 +#define HAVE_POST_MODIFY_REG 0
9352 +A C expression that is 1 if the RTX X is a constant which
9353 +is a valid address. On most machines, this can be defined as
9354 +CONSTANT_P (X), but a few machines are more restrictive
9355 +in which constant addresses are supported.
9357 +CONSTANT_P accepts integer-values expressions whose values are
9358 +not explicitly known, such as symbol_ref, label_ref, and
9359 +high expressions and const arithmetic expressions, in
9360 +addition to const_int and const_double expressions.
9362 +#define CONSTANT_ADDRESS_P(X) CONSTANT_P(X)
9365 +A number, the maximum number of registers that can appear in a valid
9366 +memory address. Note that it is up to you to specify a value equal to
9367 +the maximum number that GO_IF_LEGITIMATE_ADDRESS would ever
9370 +#define MAX_REGS_PER_ADDRESS 2
9373 +A C compound statement with a conditional goto LABEL;
9374 +executed if X (an RTX) is a legitimate memory address on the
9375 +target machine for a memory operand of mode MODE.
9377 +It usually pays to define several simpler macros to serve as
9378 +subroutines for this one. Otherwise it may be too complicated to
9381 +This macro must exist in two variants: a strict variant and a
9382 +non-strict one. The strict variant is used in the reload pass. It
9383 +must be defined so that any pseudo-register that has not been
9384 +allocated a hard register is considered a memory reference. In
9385 +contexts where some kind of register is required, a pseudo-register
9386 +with no hard register must be rejected.
9388 +The non-strict variant is used in other passes. It must be defined to
9389 +accept all pseudo-registers in every context where some kind of
9390 +register is required.
9392 +Compiler source files that want to use the strict variant of this
9393 +macro define the macro REG_OK_STRICT. You should use an
9394 +#ifdef REG_OK_STRICT conditional to define the strict variant
9395 +in that case and the non-strict variant otherwise.
9397 +Subroutines to check for acceptable registers for various purposes (one
9398 +for base registers, one for index registers, and so on) are typically
9399 +among the subroutines used to define GO_IF_LEGITIMATE_ADDRESS.
9400 +Then only these subroutine macros need have two variants; the higher
9401 +levels of macros may be the same whether strict or not.
9403 +Normally, constant addresses which are the sum of a symbol_ref
9404 +and an integer are stored inside a const RTX to mark them as
9405 +constant. Therefore, there is no need to recognize such sums
9406 +specifically as legitimate addresses. Normally you would simply
9407 +recognize any const as legitimate.
9409 +Usually PRINT_OPERAND_ADDRESS is not prepared to handle constant
9410 +sums that are not marked with const. It assumes that a naked
9411 +plus indicates indexing. If so, then you must reject such
9412 +naked constant sums as illegitimate addresses, so that none of them will
9413 +be given to PRINT_OPERAND_ADDRESS.
9415 +On some machines, whether a symbolic address is legitimate depends on
9416 +the section that the address refers to. On these machines, define the
9417 +macro ENCODE_SECTION_INFO to store the information into the
9418 +symbol_ref, and then check for it here. When you see a
9419 +const, you will have to look inside it to find the
9420 +symbol_ref in order to determine the section.
9422 +The best way to modify the name string is by adding text to the
9423 +beginning, with suitable punctuation to prevent any ambiguity. Allocate
9424 +the new name in saveable_obstack. You will have to modify
9425 +ASM_OUTPUT_LABELREF to remove and decode the added text and
9426 +output the name accordingly, and define STRIP_NAME_ENCODING to
9427 +access the original name string.
9429 +You can check the information stored here into the symbol_ref in
9430 +the definitions of the macros GO_IF_LEGITIMATE_ADDRESS and
9431 +PRINT_OPERAND_ADDRESS.
9433 +#ifdef REG_OK_STRICT
9434 +# define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
9437 + if (avr32_legitimate_address(MODE, X, 1)) \
9442 +# define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
9445 + if (avr32_legitimate_address(MODE, X, 0)) \
9454 +A C compound statement that attempts to replace X with a valid
9455 +memory address for an operand of mode MODE. win will be a
9456 +C statement label elsewhere in the code; the macro definition may use
9458 + GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
9460 +to avoid further processing if the address has become legitimate.
9462 +X will always be the result of a call to break_out_memory_refs,
9463 +and OLDX will be the operand that was given to that function to produce
9466 +The code generated by this macro should not alter the substructure of
9467 +X. If it transforms X into a more legitimate form, it
9468 +should assign X (which will always be a C variable) a new value.
9470 +It is not necessary for this macro to come up with a legitimate
9471 +address. The compiler has standard ways of doing so in all cases. In
9472 +fact, it is safe for this macro to do nothing. But often a
9473 +machine-dependent strategy can generate better code.
9475 +#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
9478 + if (GET_CODE(X) == PLUS \
9479 + && GET_CODE(XEXP(X, 0)) == REG \
9480 + && GET_CODE(XEXP(X, 1)) == CONST_INT \
9481 + && !CONST_OK_FOR_CONSTRAINT_P(INTVAL(XEXP(X, 1)), \
9484 + rtx index = force_reg(SImode, XEXP(X, 1)); \
9485 + X = gen_rtx_PLUS( SImode, XEXP(X, 0), index); \
9487 + GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN); \
9493 +A C statement or compound statement with a conditional
9494 +goto LABEL; executed if memory address X (an RTX) can have
9495 +different meanings depending on the machine mode of the memory
9496 +reference it is used for or if the address is valid for some modes
9499 +Autoincrement and autodecrement addresses typically have mode-dependent
9500 +effects because the amount of the increment or decrement is the size
9501 +of the operand being addressed. Some machines have other mode-dependent
9502 +addresses. Many RISC machines have no mode-dependent addresses.
9504 +You may assume that ADDR is a valid address for the machine.
9506 +#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
9509 + if (GET_CODE (ADDR) == POST_INC \
9510 + || GET_CODE (ADDR) == PRE_DEC) \
9516 +A C expression that is nonzero if X is a legitimate constant for
9517 +an immediate operand on the target machine. You can assume that
9518 +X satisfies CONSTANT_P, so you need not check this. In fact,
9519 +'1' is a suitable definition for this macro on machines where
9520 +anything CONSTANT_P is valid.
9522 +#define LEGITIMATE_CONSTANT_P(X) avr32_legitimate_constant_p(X)
9525 +/******************************************************************************
9526 + * Condition Code Status
9527 + *****************************************************************************/
9529 +#define HAVE_conditional_move 1
9532 +C code for a data type which is used for declaring the mdep
9533 +component of cc_status. It defaults to int.
9535 +This macro is not used on machines that do not use cc0.
9544 +} avr32_status_reg;
9547 +#define CC_STATUS_MDEP avr32_status_reg
9550 +A C expression to initialize the mdep field to "empty".
9551 +The default definition does nothing, since most machines don't use
9552 +the field anyway. If you want to use the field, you should probably
9553 +define this macro to initialize it.
9555 +This macro is not used on machines that do not use cc0.
9558 +#define CC_STATUS_MDEP_INIT \
9559 + (cc_status.mdep.flags = CC_NONE , cc_status.mdep.value = 0)
9561 +#define FPCC_STATUS_INIT \
9562 + (cc_status.mdep.fpflags = CC_NONE , cc_status.mdep.fpvalue = 0)
9565 +A C compound statement to set the components of cc_status
9566 +appropriately for an insn INSN whose body is EXP. It is
9567 +this macro's responsibility to recognize insns that set the condition
9568 +code as a byproduct of other activity as well as those that explicitly
9571 +This macro is not used on machines that do not use cc0.
9573 +If there are insns that do not set the condition code but do alter
9574 +other machine registers, this macro must check to see whether they
9575 +invalidate the expressions that the condition code is recorded as
9576 +reflecting. For example, on the 68000, insns that store in address
9577 +registers do not set the condition code, which means that usually
9578 +NOTICE_UPDATE_CC can leave cc_status unaltered for such
9579 +insns. But suppose that the previous insn set the condition code
9580 +based on location 'a4@@(102)' and the current insn stores a new
9581 +value in 'a4'. Although the condition code is not changed by
9582 +this, it will no longer be true that it reflects the contents of
9583 +'a4@@(102)'. Therefore, NOTICE_UPDATE_CC must alter
9584 +cc_status in this case to say that nothing is known about the
9585 +condition code value.
9587 +The definition of NOTICE_UPDATE_CC must be prepared to deal
9588 +with the results of peephole optimization: insns whose patterns are
9589 +parallel RTXs containing various reg, mem or
9590 +constants which are just the operands. The RTL structure of these
9591 +insns is not sufficient to indicate what the insns actually do. What
9592 +NOTICE_UPDATE_CC should do when it sees one is just to run
9595 +A possible definition of NOTICE_UPDATE_CC is to call a function
9596 +that looks at an attribute (see Insn Attributes) named, for example,
9597 +'cc'. This avoids having detailed information about patterns in
9598 +two places, the 'md' file and in NOTICE_UPDATE_CC.
9601 +#define NOTICE_UPDATE_CC(EXP, INSN) avr32_notice_update_cc(EXP, INSN)
9606 +/******************************************************************************
9607 + * Describing Relative Costs of Operations
9608 + *****************************************************************************/
9613 +A C expression for the cost of moving data of mode MODE from a
9614 +register in class FROM to one in class TO. The classes are
9615 +expressed using the enumeration values such as GENERAL_REGS. A
9616 +value of 2 is the default; other values are interpreted relative to
9619 +It is not required that the cost always equal 2 when FROM is the
9620 +same as TO; on some machines it is expensive to move between
9621 +registers if they are not general registers.
9623 +If reload sees an insn consisting of a single set between two
9624 +hard registers, and if REGISTER_MOVE_COST applied to their
9625 +classes returns a value of 2, reload does not check to ensure that the
9626 +constraints of the insn are met. Setting a cost of other than 2 will
9627 +allow reload to verify that the constraints are met. You should do this
9628 +if the movm pattern's constraints do not allow such copying.
9630 +#define REGISTER_MOVE_COST(MODE, FROM, TO) \
9631 + ((GET_MODE_SIZE(MODE) <= 4) ? 2: \
9632 + (GET_MODE_SIZE(MODE) <= 8) ? 3: \
9636 +A C expression for the cost of moving data of mode MODE between a
9637 +register of class CLASS and memory; IN is zero if the value
9638 +is to be written to memory, nonzero if it is to be read in. This cost
9639 +is relative to those in REGISTER_MOVE_COST. If moving between
9640 +registers and memory is more expensive than between two registers, you
9641 +should define this macro to express the relative cost.
9643 +If you do not define this macro, GCC uses a default cost of 4 plus
9644 +the cost of copying via a secondary reload register, if one is
9645 +needed. If your machine requires a secondary reload register to copy
9646 +between memory and a register of CLASS but the reload mechanism is
9647 +more complex than copying via an intermediate, define this macro to
9648 +reflect the actual cost of the move.
9650 +GCC defines the function memory_move_secondary_cost if
9651 +secondary reloads are needed. It computes the costs due to copying via
9652 +a secondary register. If your machine copies from memory using a
9653 +secondary register in the conventional way but the default base value of
9654 +4 is not correct for your machine, define this macro to add some other
9655 +value to the result of that function. The arguments to that function
9656 +are the same as to this macro.
9659 + Memory moves are costly
9661 +#define MEMORY_MOVE_COST(MODE, CLASS, IN) \
9662 + (((IN) ? ((GET_MODE_SIZE(MODE) < 4) ? 4 : \
9663 + (GET_MODE_SIZE(MODE) > 8) ? 6 : \
9665 + : ((GET_MODE_SIZE(MODE) > 8) ? 6 : 3)))
9668 +A C expression for the cost of a branch instruction. A value of 1 is
9669 +the default; other values are interpreted relative to that.
9671 + /* Try to use conditionals as much as possible */
9672 +#define BRANCH_COST (TARGET_BRANCH_PRED ? 3 : 4)
9674 +/*A C expression for the maximum number of instructions to execute via conditional
9675 + execution instructions instead of a branch. A value of BRANCH_COST+1 is the default
9676 + if the machine does not use cc0, and 1 if it does use cc0.*/
9677 +#define MAX_CONDITIONAL_EXECUTE 4
9680 +Define this macro as a C expression which is nonzero if accessing less
9681 +than a word of memory (i.e.: a char or a short) is no
9682 +faster than accessing a word of memory, i.e., if such access
9683 +require more than one instruction or if there is no difference in cost
9684 +between byte and (aligned) word loads.
9686 +When this macro is not defined, the compiler will access a field by
9687 +finding the smallest containing object; when it is defined, a fullword
9688 +load will be used if alignment permits. Unless bytes accesses are
9689 +faster than word accesses, using word accesses is preferable since it
9690 +may eliminate subsequent memory access if subsequent accesses occur to
9691 +other fields in the same word of the structure, but to different bytes.
9693 +#define SLOW_BYTE_ACCESS 1
9697 +Define this macro if it is as good or better to call a constant
9698 +function address than to call an address kept in a register.
9700 +#define NO_FUNCTION_CSE
9703 +/******************************************************************************
9704 + * Adjusting the Instruction Scheduler
9705 + *****************************************************************************/
9707 +/*****************************************************************************
9708 + * Dividing the Output into Sections (Texts, Data, ...) *
9709 + *****************************************************************************/
9712 +A C expression whose value is a string, including spacing, containing the
9713 +assembler operation that should precede instructions and read-only data.
9714 +Normally "\t.text" is right.
9716 +#define TEXT_SECTION_ASM_OP "\t.text"
9718 +A C statement that switches to the default section containing instructions.
9719 +Normally this is not needed, as simply defining TEXT_SECTION_ASM_OP
9720 +is enough. The MIPS port uses this to sort all functions after all data
9723 +/* #define TEXT_SECTION */
9726 +A C expression whose value is a string, including spacing, containing the
9727 +assembler operation to identify the following data as writable initialized
9728 +data. Normally "\t.data" is right.
9730 +#define DATA_SECTION_ASM_OP "\t.data"
9733 +If defined, a C expression whose value is a string, including spacing,
9734 +containing the assembler operation to identify the following data as
9735 +shared data. If not defined, DATA_SECTION_ASM_OP will be used.
9739 +A C expression whose value is a string, including spacing, containing
9740 +the assembler operation to identify the following data as read-only
9743 +#undef READONLY_DATA_SECTION_ASM_OP
9744 +#define READONLY_DATA_SECTION_ASM_OP \
9745 + ((TARGET_USE_RODATA_SECTION) ? \
9746 + "\t.section\t.rodata" : \
9747 + TEXT_SECTION_ASM_OP )
9751 +If defined, a C expression whose value is a string, including spacing,
9752 +containing the assembler operation to identify the following data as
9753 +uninitialized global data. If not defined, and neither
9754 +ASM_OUTPUT_BSS nor ASM_OUTPUT_ALIGNED_BSS are defined,
9755 +uninitialized global data will be output in the data section if
9756 +-fno-common is passed, otherwise ASM_OUTPUT_COMMON will be
9759 +#define BSS_SECTION_ASM_OP "\t.section\t.bss"
9762 +If defined, a C expression whose value is a string, including spacing,
9763 +containing the assembler operation to identify the following data as
9764 +uninitialized global shared data. If not defined, and
9765 +BSS_SECTION_ASM_OP is, the latter will be used.
9767 +/*#define SHARED_BSS_SECTION_ASM_OP "\trseg\tshared_bbs_section:data:noroot(0)\n"*/
9769 +If defined, a C expression whose value is a string, including spacing,
9770 +containing the assembler operation to identify the following data as
9771 +initialization code. If not defined, GCC will assume such a section does
9774 +#undef INIT_SECTION_ASM_OP
9775 +#define INIT_SECTION_ASM_OP "\t.section\t.init"
9778 +If defined, a C expression whose value is a string, including spacing,
9779 +containing the assembler operation to identify the following data as
9780 +finalization code. If not defined, GCC will assume such a section does
9783 +#undef FINI_SECTION_ASM_OP
9784 +#define FINI_SECTION_ASM_OP "\t.section\t.fini"
9787 +If defined, an ASM statement that switches to a different section
9788 +via SECTION_OP, calls FUNCTION, and switches back to
9789 +the text section. This is used in crtstuff.c if
9790 +INIT_SECTION_ASM_OP or FINI_SECTION_ASM_OP to calls
9791 +to initialization and finalization functions from the init and fini
9792 +sections. By default, this macro uses a simple function call. Some
9793 +ports need hand-crafted assembly code to avoid dependencies on
9794 +registers initialized in the function prologue or to ensure that
9795 +constant pools don't end up too far way in the text section.
9797 +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
9798 + asm ( SECTION_OP "\n" \
9799 + "mcall r6[" USER_LABEL_PREFIX #FUNC "@got]\n" \
9800 + TEXT_SECTION_ASM_OP);
9804 +Define this macro to be an expression with a nonzero value if jump
9805 +tables (for tablejump insns) should be output in the text
9806 +section, along with the assembler instructions. Otherwise, the
9807 +readonly data section is used.
9809 +This macro is irrelevant if there is no separate readonly data section.
9811 +/* Put jump tables in text section if we have caches. Otherwise assume that
9812 + loading data from code memory is slow. */
9813 +#define JUMP_TABLES_IN_TEXT_SECTION \
9814 + (TARGET_CACHES ? 1 : 0)
9817 +/******************************************************************************
9818 + * Position Independent Code (PIC)
9819 + *****************************************************************************/
9821 +#ifndef AVR32_ALWAYS_PIC
9822 +#define AVR32_ALWAYS_PIC 0
9825 +/* GOT is set to r6 */
9826 +#define PIC_OFFSET_TABLE_REGNUM INTERNAL_REGNUM(6)
9829 +A C expression that is nonzero if X is a legitimate immediate
9830 +operand on the target machine when generating position independent code.
9831 +You can assume that X satisfies CONSTANT_P, so you need not
9832 +check this. You can also assume flag_pic is true, so you need not
9833 +check it either. You need not define this macro if all constants
9834 +(including SYMBOL_REF) can be immediate operands when generating
9835 +position independent code.
9837 +/* We can't directly access anything that contains a symbol,
9838 + nor can we indirect via the constant pool. */
9839 +#define LEGITIMATE_PIC_OPERAND_P(X) avr32_legitimate_pic_operand_p(X)
9842 +/* We need to know when we are making a constant pool; this determines
9843 + whether data needs to be in the GOT or can be referenced via a GOT
9845 +extern int making_const_table;
9847 +/******************************************************************************
9848 + * Defining the Output Assembler Language
9849 + *****************************************************************************/
9853 +A C string constant describing how to begin a comment in the target
9854 +assembler language. The compiler assumes that the comment will end at
9855 +the end of the line.
9857 +#define ASM_COMMENT_START "# "
9860 +A C string constant for text to be output before each asm
9861 +statement or group of consecutive ones. Normally this is
9862 +"#APP", which is a comment that has no effect on most
9863 +assemblers but tells the GNU assembler that it must check the lines
9864 +that follow for all valid assembler constructs.
9867 +#define ASM_APP_ON "#APP\n"
9870 +A C string constant for text to be output after each asm
9871 +statement or group of consecutive ones. Normally this is
9872 +"#NO_APP", which tells the GNU assembler to resume making the
9873 +time-saving assumptions that are valid for ordinary compiler output.
9876 +#define ASM_APP_OFF "#NO_APP\n"
9880 +#define FILE_ASM_OP "\t.file\n"
9881 +#define IDENT_ASM_OP "\t.ident\t"
9882 +#define SET_ASM_OP "\t.set\t"
9886 + * Output assembly directives to switch to section name. The section
9887 + * should have attributes as specified by flags, which is a bit mask
9888 + * of the SECTION_* flags defined in 'output.h'. If align is nonzero,
9889 + * it contains an alignment in bytes to be used for the section,
9890 + * otherwise some target default should be used. Only targets that
9891 + * must specify an alignment within the section directive need pay
9892 + * attention to align -- we will still use ASM_OUTPUT_ALIGN.
9894 + * NOTE: This one must not be moved to avr32.c
9896 +#undef TARGET_ASM_NAMED_SECTION
9897 +#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
9901 +You may define this macro as a C expression. You should define the
9902 +expression to have a nonzero value if GCC should output the constant
9903 +pool for a function before the code for the function, or a zero value if
9904 +GCC should output the constant pool after the function. If you do
9905 +not define this macro, the usual case, GCC will output the constant
9906 +pool before the function.
9908 +#define CONSTANT_POOL_BEFORE_FUNCTION 0
9912 +Define this macro as a C expression which is nonzero if the constant
9913 +EXP, of type tree, should be output after the code for a
9914 +function. The compiler will normally output all constants before the
9915 +function; you need not define this macro if this is OK.
9917 +#define CONSTANT_AFTER_FUNCTION_P(EXP) 1
9921 +Define this macro as a C expression which is nonzero if C is
9922 +used as a logical line separator by the assembler.
9924 +If you do not define this macro, the default is that only
9925 +the character ';' is treated as a logical line separator.
9927 +#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n')
9930 +/** Output of Uninitialized Variables **/
9933 +A C statement (sans semicolon) to output to the stdio stream
9934 +STREAM the assembler definition of a common-label named
9935 +NAME whose size is SIZE bytes. The variable ROUNDED
9936 +is the size rounded up to whatever alignment the caller wants.
9938 +Use the expression assemble_name(STREAM, NAME) to
9939 +output the name itself; before and after that, output the additional
9940 +assembler syntax for defining the name, and a newline.
9942 +This macro controls how the assembler definitions of uninitialized
9943 +common global variables are output.
9946 +#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
9947 + avr32_asm_output_common(STREAM, NAME, SIZE, ROUNDED)
9950 +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
9953 + fputs ("\t.comm ", (FILE)); \
9954 + assemble_name ((FILE), (NAME)); \
9955 + fprintf ((FILE), ",%d\n", (SIZE)); \
9960 + * Like ASM_OUTPUT_BSS except takes the required alignment as a
9961 + * separate, explicit argument. If you define this macro, it is used
9962 + * in place of ASM_OUTPUT_BSS, and gives you more flexibility in
9963 + * handling the required alignment of the variable. The alignment is
9964 + * specified as the number of bits.
9966 + * Try to use function asm_output_aligned_bss defined in file varasm.c
9967 + * when defining this macro.
9969 +#define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
9970 + asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGNMENT)
9973 +A C statement (sans semicolon) to output to the stdio stream
9974 +STREAM the assembler definition of a local-common-label named
9975 +NAME whose size is SIZE bytes. The variable ROUNDED
9976 +is the size rounded up to whatever alignment the caller wants.
9978 +Use the expression assemble_name(STREAM, NAME) to
9979 +output the name itself; before and after that, output the additional
9980 +assembler syntax for defining the name, and a newline.
9982 +This macro controls how the assembler definitions of uninitialized
9983 +static variables are output.
9985 +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
9988 + fputs ("\t.lcomm ", (FILE)); \
9989 + assemble_name ((FILE), (NAME)); \
9990 + fprintf ((FILE), ",%d, %d\n", (SIZE), 2); \
9996 +A C statement (sans semicolon) to output to the stdio stream
9997 +STREAM the assembler definition of a label named NAME.
9998 +Use the expression assemble_name(STREAM, NAME) to
9999 +output the name itself; before and after that, output the additional
10000 +assembler syntax for defining the name, and a newline.
10002 +#define ASM_OUTPUT_LABEL(STREAM, NAME) avr32_asm_output_label(STREAM, NAME)
10004 +/* A C string containing the appropriate assembler directive to
10005 + * specify the size of a symbol, without any arguments. On systems
10006 + * that use ELF, the default (in 'config/elfos.h') is '"\t.size\t"';
10007 + * on other systems, the default is not to define this macro.
10009 + * Define this macro only if it is correct to use the default
10010 + * definitions of ASM_ OUTPUT_SIZE_DIRECTIVE and
10011 + * ASM_OUTPUT_MEASURED_SIZE for your system. If you need your own
10012 + * custom definitions of those macros, or if you do not need explicit
10013 + * symbol sizes at all, do not define this macro.
10015 +#define SIZE_ASM_OP "\t.size\t"
10019 +A C statement (sans semicolon) to output to the stdio stream
10020 +STREAM some commands that will make the label NAME global;
10021 +that is, available for reference from other files. Use the expression
10022 +assemble_name(STREAM, NAME) to output the name
10023 +itself; before and after that, output the additional assembler syntax
10024 +for making that name global, and a newline.
10026 +#define GLOBAL_ASM_OP "\t.globl\t"
10031 +A C expression which evaluates to true if the target supports weak symbols.
10033 +If you don't define this macro, defaults.h provides a default
10034 +definition. If either ASM_WEAKEN_LABEL or ASM_WEAKEN_DECL
10035 +is defined, the default definition is '1'; otherwise, it is
10036 +'0'. Define this macro if you want to control weak symbol support
10037 +with a compiler flag such as -melf.
10039 +#define SUPPORTS_WEAK 1
10042 +A C statement (sans semicolon) to output to the stdio stream
10043 +STREAM a reference in assembler syntax to a label named
10044 +NAME. This should add '_' to the front of the name, if that
10045 +is customary on your operating system, as it is in most Berkeley Unix
10046 +systems. This macro is used in assemble_name.
10048 +#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
10049 + avr32_asm_output_labelref(STREAM, NAME)
10054 +A C expression to assign to OUTVAR (which is a variable of type
10055 +char *) a newly allocated string made from the string
10056 +NAME and the number NUMBER, with some suitable punctuation
10057 +added. Use alloca to get space for the string.
10059 +The string will be used as an argument to ASM_OUTPUT_LABELREF to
10060 +produce an assembler label for an internal static variable whose name is
10061 +NAME. Therefore, the string must be such as to result in valid
10062 +assembler code. The argument NUMBER is different each time this
10063 +macro is executed; it prevents conflicts between similarly-named
10064 +internal static variables in different scopes.
10066 +Ideally this string should not be a valid C identifier, to prevent any
10067 +conflict with the user's own symbols. Most assemblers allow periods
10068 +or percent signs in assembler symbols; putting at least one of these
10069 +between the name and the number will suffice.
10071 +#define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \
10074 + (OUTVAR) = (char *) alloca (strlen ((NAME)) + 10); \
10075 + sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)); \
10080 +/** Macros Controlling Initialization Routines **/
10084 +If defined, main will not call __main as described above.
10085 +This macro should be defined for systems that control start-up code
10086 +on a symbol-by-symbol basis, such as OSF/1, and should not
10087 +be defined explicitly for systems that support INIT_SECTION_ASM_OP.
10090 + __main is not defined when debugging.
10092 +#define HAS_INIT_SECTION
10095 +/** Output of Assembler Instructions **/
10098 +A C initializer containing the assembler's names for the machine
10099 +registers, each one as a C string constant. This is what translates
10100 +register numbers in the compiler into assembler language.
10103 +#define REGISTER_NAMES \
10124 +A C compound statement to output to stdio stream STREAM the
10125 +assembler syntax for an instruction operand X. X is an
10128 +CODE is a value that can be used to specify one of several ways
10129 +of printing the operand. It is used when identical operands must be
10130 +printed differently depending on the context. CODE comes from
10131 +the '%' specification that was used to request printing of the
10132 +operand. If the specification was just '%digit' then
10133 +CODE is 0; if the specification was '%ltr digit'
10134 +then CODE is the ASCII code for ltr.
10136 +If X is a register, this macro should print the register's name.
10137 +The names can be found in an array reg_names whose type is
10138 +char *[]. reg_names is initialized from REGISTER_NAMES.
10140 +When the machine description has a specification '%punct'
10141 +(a '%' followed by a punctuation character), this macro is called
10142 +with a null pointer for X and the punctuation character for
10145 +#define PRINT_OPERAND(STREAM, X, CODE) avr32_print_operand(STREAM, X, CODE)
10147 +/* A C statement to be executed just prior to the output of
10148 + assembler code for INSN, to modify the extracted operands so
10149 + they will be output differently.
10151 + Here the argument OPVEC is the vector containing the operands
10152 + extracted from INSN, and NOPERANDS is the number of elements of
10153 + the vector which contain meaningful data for this insn.
10154 + The contents of this vector are what will be used to convert the insn
10155 + template into assembler code, so you can change the assembler output
10156 + by changing the contents of the vector. */
10157 +#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
10158 + avr32_final_prescan_insn ((INSN), (OPVEC), (NOPERANDS))
10161 +A C expression which evaluates to true if CODE is a valid
10162 +punctuation character for use in the PRINT_OPERAND macro. If
10163 +PRINT_OPERAND_PUNCT_VALID_P is not defined, it means that no
10164 +punctuation characters (except for the standard one, '%') are used
10168 + 'm' refers to the most significant word in a two-register mode.
10170 +#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == 'm' || (CODE) == 'e')
10173 +A C compound statement to output to stdio stream STREAM the
10174 +assembler syntax for an instruction operand that is a memory reference
10175 +whose address is X. X is an RTL expression.
10177 +On some machines, the syntax for a symbolic address depends on the
10178 +section that the address refers to. On these machines, define the macro
10179 +ENCODE_SECTION_INFO to store the information into the
10180 +symbol_ref, and then check for it here. (see Assembler Format.)
10182 +#define PRINT_OPERAND_ADDRESS(STREAM, X) avr32_print_operand_address(STREAM, X)
10185 +/** Output of Dispatch Tables **/
10188 + * A C statement to output to the stdio stream stream an assembler
10189 + * pseudo-instruction to generate a difference between two
10190 + * labels. value and rel are the numbers of two internal labels. The
10191 + * definitions of these labels are output using
10192 + * (*targetm.asm_out.internal_label), and they must be printed in the
10193 + * same way here. For example,
10195 + * fprintf (stream, "\t.word L%d-L%d\n",
10198 + * You must provide this macro on machines where the addresses in a
10199 + * dispatch table are relative to the table's own address. If defined,
10200 + * GCC will also use this macro on all machines when producing
10201 + * PIC. body is the body of the ADDR_DIFF_VEC; it is provided so that
10202 + * the mode and flags can be read.
10204 +#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
10205 + fprintf(STREAM, "\tbral\t%sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
10208 +This macro should be provided on machines where the addresses
10209 +in a dispatch table are absolute.
10211 +The definition should be a C statement to output to the stdio stream
10212 +STREAM an assembler pseudo-instruction to generate a reference to
10213 +a label. VALUE is the number of an internal label whose
10214 +definition is output using ASM_OUTPUT_INTERNAL_LABEL.
10217 +fprintf(STREAM, "\t.word L%d\n", VALUE)
10220 +#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
10221 + fprintf(STREAM, "\t.long %sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
10223 +/** Assembler Commands for Exception Regions */
10225 +/* ToDo: All of this subsection */
10227 +/** Assembler Commands for Alignment */
10231 +A C statement to output to the stdio stream STREAM an assembler
10232 +command to advance the location counter to a multiple of 2 to the
10233 +POWER bytes. POWER will be a C expression of type int.
10235 +#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
10238 + if ((POWER) != 0) \
10239 + fprintf(STREAM, "\t.align\t%d\n", POWER); \
10244 +Like ASM_OUTPUT_ALIGN, except that the \nop" instruction is used for padding, if
10247 +#define ASM_OUTPUT_ALIGN_WITH_NOP(STREAM, POWER) \
10248 + fprintf(STREAM, "\t.balignw\t%d, 0xd703\n", (1 << POWER))
10252 +/******************************************************************************
10253 + * Controlling Debugging Information Format
10254 + *****************************************************************************/
10256 +/* How to renumber registers for dbx and gdb. */
10257 +#define DBX_REGISTER_NUMBER(REGNO) ASM_REGNUM (REGNO)
10259 +/* The DWARF 2 CFA column which tracks the return address. */
10260 +#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM(LR_REGNUM)
10263 +Define this macro if GCC should produce dwarf version 2 format
10264 +debugging output in response to the -g option.
10266 +To support optional call frame debugging information, you must also
10267 +define INCOMING_RETURN_ADDR_RTX and either set
10268 +RTX_FRAME_RELATED_P on the prologue insns if you use RTL for the
10269 +prologue, or call dwarf2out_def_cfa and dwarf2out_reg_save
10270 +as appropriate from TARGET_ASM_FUNCTION_PROLOGUE if you don't.
10272 +#define DWARF2_DEBUGGING_INFO 1
10275 +#define DWARF2_ASM_LINE_DEBUG_INFO 1
10276 +#define DWARF2_FRAME_INFO 1
10279 +/******************************************************************************
10280 + * Miscellaneous Parameters
10281 + *****************************************************************************/
10286 +An alias for a machine mode name. This is the machine mode that
10287 +elements of a jump-table should have.
10289 +#define CASE_VECTOR_MODE SImode
10292 +Define this macro to be a C expression to indicate when jump-tables
10293 +should contain relative addresses. If jump-tables never contain
10294 +relative addresses, then you need not define this macro.
10296 +#define CASE_VECTOR_PC_RELATIVE 0
10298 +/* Increase the threshold for using table jumps on the UC arch. */
10299 +#define CASE_VALUES_THRESHOLD ((avr32_arch->arch_type == ARCH_TYPE_AVR32_UC) ? 7 : 4)
10302 +The maximum number of bytes that a single instruction can move quickly
10303 +between memory and registers or between two memory locations.
10305 +#define MOVE_MAX (2*UNITS_PER_WORD)
10308 +/* A C expression that is nonzero if on this machine the number of bits actually used
10309 + for the count of a shift operation is equal to the number of bits needed to represent
10310 + the size of the object being shifted. When this macro is nonzero, the compiler will
10311 + assume that it is safe to omit a sign-extend, zero-extend, and certain bitwise 'and'
10312 + instructions that truncates the count of a shift operation. On machines that have
10313 + instructions that act on bit-fields at variable positions, which may include 'bit test'
10314 + 378 GNU Compiler Collection (GCC) Internals
10315 + instructions, a nonzero SHIFT_COUNT_TRUNCATED also enables deletion of truncations
10316 + of the values that serve as arguments to bit-field instructions.
10317 + If both types of instructions truncate the count (for shifts) and position (for bit-field
10318 + operations), or if no variable-position bit-field instructions exist, you should define
10320 + However, on some machines, such as the 80386 and the 680x0, truncation only applies
10321 + to shift operations and not the (real or pretended) bit-field operations. Define SHIFT_
10322 + COUNT_TRUNCATED to be zero on such machines. Instead, add patterns to the 'md' file
10323 + that include the implied truncation of the shift instructions.
10324 + You need not de
\fne this macro if it would always have the value of zero. */
10325 +#define SHIFT_COUNT_TRUNCATED 1
10328 +A C expression which is nonzero if on this machine it is safe to
10329 +convert an integer of INPREC bits to one of OUTPREC
10330 +bits (where OUTPREC is smaller than INPREC) by merely
10331 +operating on it as if it had only OUTPREC bits.
10333 +On many machines, this expression can be 1.
10335 +When TRULY_NOOP_TRUNCATION returns 1 for a pair of sizes for
10336 +modes for which MODES_TIEABLE_P is 0, suboptimal code can result.
10337 +If this is the case, making TRULY_NOOP_TRUNCATION return 0 in
10338 +such cases may improve things.
10340 +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
10343 +An alias for the machine mode for pointers. On most machines, define
10344 +this to be the integer mode corresponding to the width of a hardware
10345 +pointer; SImode on 32-bit machine or DImode on 64-bit machines.
10346 +On some machines you must define this to be one of the partial integer
10347 +modes, such as PSImode.
10349 +The width of Pmode must be at least as large as the value of
10350 +POINTER_SIZE. If it is not equal, you must define the macro
10351 +POINTERS_EXTEND_UNSIGNED to specify how pointers are extended
10354 +#define Pmode SImode
10357 +An alias for the machine mode used for memory references to functions
10358 +being called, in call RTL expressions. On most machines this
10361 +#define FUNCTION_MODE SImode
10364 +#define REG_S_P(x) \
10365 + (REG_P (x) || (GET_CODE (x) == SUBREG && REG_P (XEXP (x, 0))))
10368 +/* If defined, modifies the length assigned to instruction INSN as a
10369 + function of the context in which it is used. LENGTH is an lvalue
10370 + that contains the initially computed length of the insn and should
10371 + be updated with the correct length of the insn. */
10372 +#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
10373 + ((LENGTH) = avr32_adjust_insn_length ((INSN), (LENGTH)))
10376 +#define CLZ_DEFINED_VALUE_AT_ZERO(mode, value) \
10377 + (value = 32, (mode == SImode))
10379 +#define CTZ_DEFINED_VALUE_AT_ZERO(mode, value) \
10380 + (value = 32, (mode == SImode))
10382 +#define UNITS_PER_SIMD_WORD UNITS_PER_WORD
10384 +#define STORE_FLAG_VALUE 1
10386 +enum avr32_builtins
10388 + AVR32_BUILTIN_MTSR,
10389 + AVR32_BUILTIN_MFSR,
10390 + AVR32_BUILTIN_MTDR,
10391 + AVR32_BUILTIN_MFDR,
10392 + AVR32_BUILTIN_CACHE,
10393 + AVR32_BUILTIN_SYNC,
10394 + AVR32_BUILTIN_TLBR,
10395 + AVR32_BUILTIN_TLBS,
10396 + AVR32_BUILTIN_TLBW,
10397 + AVR32_BUILTIN_BREAKPOINT,
10398 + AVR32_BUILTIN_XCHG,
10399 + AVR32_BUILTIN_LDXI,
10400 + AVR32_BUILTIN_BSWAP16,
10401 + AVR32_BUILTIN_BSWAP32,
10402 + AVR32_BUILTIN_COP,
10403 + AVR32_BUILTIN_MVCR_W,
10404 + AVR32_BUILTIN_MVRC_W,
10405 + AVR32_BUILTIN_MVCR_D,
10406 + AVR32_BUILTIN_MVRC_D,
10407 + AVR32_BUILTIN_MULSATHH_H,
10408 + AVR32_BUILTIN_MULSATHH_W,
10409 + AVR32_BUILTIN_MULSATRNDHH_H,
10410 + AVR32_BUILTIN_MULSATRNDWH_W,
10411 + AVR32_BUILTIN_MULSATWH_W,
10412 + AVR32_BUILTIN_MACSATHH_W,
10413 + AVR32_BUILTIN_SATADD_H,
10414 + AVR32_BUILTIN_SATSUB_H,
10415 + AVR32_BUILTIN_SATADD_W,
10416 + AVR32_BUILTIN_SATSUB_W,
10417 + AVR32_BUILTIN_MULWH_D,
10418 + AVR32_BUILTIN_MULNWH_D,
10419 + AVR32_BUILTIN_MACWH_D,
10420 + AVR32_BUILTIN_MACHH_D,
10421 + AVR32_BUILTIN_MUSFR,
10422 + AVR32_BUILTIN_MUSTR,
10423 + AVR32_BUILTIN_SATS,
10424 + AVR32_BUILTIN_SATU,
10425 + AVR32_BUILTIN_SATRNDS,
10426 + AVR32_BUILTIN_SATRNDU
10430 +#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) \
10431 + ((MODE == SFmode) || (MODE == DFmode))
10433 +#define RENAME_LIBRARY_SET ".set"
10435 +/* Make ABI_NAME an alias for __GCC_NAME. */
10436 +#define RENAME_LIBRARY(GCC_NAME, ABI_NAME) \
10437 + __asm__ (".globl\t__avr32_" #ABI_NAME "\n" \
10438 + ".set\t__avr32_" #ABI_NAME \
10439 + ", __" #GCC_NAME "\n");
10441 +/* Give libgcc functions avr32 ABI name. */
10443 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, mul64)
10446 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (divdi3, sdiv64)
10449 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (udivdi3, udiv64)
10452 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (moddi3, smod64)
10455 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (umoddi3, umod64)
10458 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (ashldi3, lsl64)
10461 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (lshrdi3, lsr64)
10464 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (ashrdi3, asr64)
10468 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f32_to_s64)
10470 +#ifdef L_fixunssfdi
10471 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f32_to_u64)
10473 +#ifdef L_floatdidf
10474 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, s64_to_f64)
10476 +#ifdef L_floatdisf
10477 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, s64_to_f32)
10481 Index: gcc-4.2.3/gcc/config/avr32/avr32.md
10482 ===================================================================
10483 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
10484 +++ gcc-4.2.3/gcc/config/avr32/avr32.md 2008-05-21 13:45:54.165287871 +0200
10486 +;; AVR32 machine description file.
10487 +;; Copyright 2003-2006 Atmel Corporation.
10489 +;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
10491 +;; This file is part of GCC.
10493 +;; This program is free software; you can redistribute it and/or modify
10494 +;; it under the terms of the GNU General Public License as published by
10495 +;; the Free Software Foundation; either version 2 of the License, or
10496 +;; (at your option) any later version.
10498 +;; This program is distributed in the hope that it will be useful,
10499 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10500 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10501 +;; GNU General Public License for more details.
10503 +;; You should have received a copy of the GNU General Public License
10504 +;; along with this program; if not, write to the Free Software
10505 +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10507 +;; -*- Mode: Scheme -*-
10509 +(define_attr "type" "alu,alu2,alu_sat,mulhh,mulwh,mulww_w,mulww_d,div,machh_w,macww_w,macww_d,branch,call,load,load_rm,store,load2,load4,store2,store4,fmul,fcmps,fcmpd,fcast,fmv,fmvcpu,fldd,fstd,flds,fsts,fstm"
10510 + (const_string "alu"))
10513 +(define_attr "cc" "none,set_vncz,set_ncz,set_cz,set_z,bld,compare,cmp_cond_insn,clobber,call_set,fpcompare,from_fpcc"
10514 + (const_string "none"))
10517 +; NB! Keep this in sync with enum architecture_type in avr32.h
10518 +(define_attr "pipeline" "ap,uc"
10519 + (const (symbol_ref "avr32_arch->arch_type")))
10521 +(define_attr "length" ""
10525 +;; Uses of UNSPEC in this file:
10527 + [(UNSPEC_PUSHM 0)
10529 + (UNSPEC_UDIVMODSI4_INTERNAL 2)
10530 + (UNSPEC_DIVMODSI4_INTERNAL 3)
10533 + (UNSPEC_MOVSICC 6)
10534 + (UNSPEC_ADDSICC 7)
10535 + (UNSPEC_COND_MI 8)
10536 + (UNSPEC_COND_PL 9)
10537 + (UNSPEC_PIC_SYM 10)
10538 + (UNSPEC_PIC_BASE 11)
10539 + (UNSPEC_STORE_MULTIPLE 12)
10540 + (UNSPEC_STMFP 13)
10541 + (UNSPEC_FPCC_TO_REG 14)
10542 + (UNSPEC_REG_TO_CC 15)
10543 + (UNSPEC_FORCE_MINIPOOL 16)
10546 + (UNSPEC_SATRNDS 19)
10547 + (UNSPEC_SATRNDU 20)
10551 + [(VUNSPEC_EPILOGUE 0)
10552 + (VUNSPEC_CACHE 1)
10555 + (VUNSPEC_BLOCKAGE 4)
10560 + (VUNSPEC_BREAKPOINT 9)
10561 + (VUNSPEC_MTDR 10)
10562 + (VUNSPEC_MFDR 11)
10563 + (VUNSPEC_MVCR 12)
10564 + (VUNSPEC_MVRC 13)
10566 + (VUNSPEC_ALIGN 15)
10567 + (VUNSPEC_POOL_START 16)
10568 + (VUNSPEC_POOL_END 17)
10569 + (VUNSPEC_POOL_4 18)
10570 + (VUNSPEC_POOL_8 19)
10571 + (VUNSPEC_POOL_16 20)
10572 + (VUNSPEC_MUSFR 21)
10573 + (VUNSPEC_MUSTR 22)
10574 + (VUNSPEC_SYNC_CMPXCHG 23)
10575 + (VUNSPEC_SYNC_SET_LOCK_AND_LOAD 24)
10576 + (VUNSPEC_SYNC_STORE_IF_LOCK 25)
10577 + (VUNSPEC_EH_RETURN 26)
10585 + ;; Return Register = R12 = 15 - 12 = 3
10586 + (RETVAL_REGNUM 3)
10587 + ;; SP = R13 = 15 - 13 = 2
10589 + ;; LR = R14 = 15 - 14 = 1
10591 + ;; PC = R15 = 15 - 15 = 0
10593 + ;; FPSR = GENERAL_REGS + 1 = 17
10600 +;;******************************************************************************
10602 +;;******************************************************************************
10604 +;; Integer Modes for basic alu insns
10605 +(define_mode_macro INTM [SI HI QI])
10606 +(define_mode_attr alu_cc_attr [(SI "set_vncz") (HI "clobber") (QI "clobber")])
10608 +;; Move word modes
10609 +(define_mode_macro MOVM [SI V2HI V4QI])
10611 +;; For mov/addcc insns
10612 +(define_mode_macro ADDCC [SI HI QI])
10613 +(define_mode_macro MOVCC [SI HI QI])
10614 +(define_mode_macro CMP [DI SI HI QI])
10615 +(define_mode_attr cmp_constraint [(DI "rKu20") (SI "rKs21") (HI "r") (QI "r")])
10616 +(define_mode_attr cmp_predicate [(DI "register_immediate_operand")
10617 + (SI "register_immediate_operand")
10618 + (HI "register_operand")
10619 + (QI "register_operand")])
10621 +;; For all conditional insns
10622 +(define_code_macro any_cond [eq ne gt ge lt le gtu geu ltu leu])
10623 +(define_code_attr cond [(eq "eq") (ne "ne") (gt "gt") (ge "ge") (lt "lt") (le "le")
10624 + (gtu "hi") (geu "hs") (ltu "lo") (leu "ls")])
10625 +(define_code_attr invcond [(eq "ne") (ne "eq") (gt "le") (ge "lt") (lt "ge") (le "gt")
10626 + (gtu "ls") (geu "lo") (ltu "hs") (leu "hi")])
10628 +;; For logical operations
10629 +(define_code_macro logical [and ior xor])
10630 +(define_code_attr logical_insn [(and "and") (ior "or") (xor "eor")])
10632 +;; Load the predicates
10633 +(include "predicates.md")
10636 +;;******************************************************************************
10637 +;; Automaton pipeline description for avr32
10638 +;;******************************************************************************
10640 +(define_automaton "avr32_ap")
10643 +(define_cpu_unit "is" "avr32_ap")
10644 +(define_cpu_unit "a1,m1,da" "avr32_ap")
10645 +(define_cpu_unit "a2,m2,d" "avr32_ap")
10647 +;;Alu instructions
10648 +(define_insn_reservation "alu_op" 1
10649 + (and (eq_attr "pipeline" "ap")
10650 + (eq_attr "type" "alu"))
10653 +(define_insn_reservation "alu2_op" 2
10654 + (and (eq_attr "pipeline" "ap")
10655 + (eq_attr "type" "alu2"))
10656 + "is,is+a1,a1+a2,a2")
10658 +(define_insn_reservation "alu_sat_op" 2
10659 + (and (eq_attr "pipeline" "ap")
10660 + (eq_attr "type" "alu_sat"))
10664 +;;Mul instructions
10665 +(define_insn_reservation "mulhh_op" 2
10666 + (and (eq_attr "pipeline" "ap")
10667 + (eq_attr "type" "mulhh,mulwh"))
10670 +(define_insn_reservation "mulww_w_op" 3
10671 + (and (eq_attr "pipeline" "ap")
10672 + (eq_attr "type" "mulww_w"))
10673 + "is,m1,m1+m2,m2")
10675 +(define_insn_reservation "mulww_d_op" 5
10676 + (and (eq_attr "pipeline" "ap")
10677 + (eq_attr "type" "mulww_d"))
10678 + "is,m1,m1+m2,m1+m2,m2,m2")
10680 +(define_insn_reservation "div_op" 33
10681 + (and (eq_attr "pipeline" "ap")
10682 + (eq_attr "type" "div"))
10683 + "is,m1,m1*31 + m2*31,m2")
10685 +(define_insn_reservation "machh_w_op" 3
10686 + (and (eq_attr "pipeline" "ap")
10687 + (eq_attr "type" "machh_w"))
10691 +(define_insn_reservation "macww_w_op" 4
10692 + (and (eq_attr "pipeline" "ap")
10693 + (eq_attr "type" "macww_w"))
10697 +(define_insn_reservation "macww_d_op" 6
10698 + (and (eq_attr "pipeline" "ap")
10699 + (eq_attr "type" "macww_d"))
10700 + "is*2,m1,m1+m2,m1+m2,m2")
10702 +;;Bypasses for Mac instructions, because of accumulator cache.
10703 +;;Set latency as low as possible in order to let the compiler let
10704 +;;mul -> mac and mac -> mac combinations which use the same
10705 +;;accumulator cache be placed close together to avoid any
10706 +;;instructions which can ruin the accumulator cache come inbetween.
10707 +(define_bypass 4 "machh_w_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
10708 +(define_bypass 5 "macww_w_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
10709 +(define_bypass 7 "macww_d_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
10711 +(define_bypass 3 "mulhh_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
10712 +(define_bypass 4 "mulww_w_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
10713 +(define_bypass 6 "mulww_d_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
10716 +;;Bypasses for all mul/mac instructions followed by an instruction
10717 +;;which reads the output AND writes the result to the same register.
10718 +;;This will generate an Write After Write hazard which gives an
10719 +;;extra cycle before the result is ready.
10720 +(define_bypass 0 "machh_w_op" "machh_w_op" "avr32_valid_macmac_bypass")
10721 +(define_bypass 0 "macww_w_op" "macww_w_op" "avr32_valid_macmac_bypass")
10722 +(define_bypass 0 "macww_d_op" "macww_d_op" "avr32_valid_macmac_bypass")
10724 +(define_bypass 0 "mulhh_op" "machh_w_op" "avr32_valid_mulmac_bypass")
10725 +(define_bypass 0 "mulww_w_op" "macww_w_op" "avr32_valid_mulmac_bypass")
10726 +(define_bypass 0 "mulww_d_op" "macww_d_op" "avr32_valid_mulmac_bypass")
10728 +;;Branch and call instructions
10729 +;;We assume that all branches and rcalls are predicted correctly :-)
10730 +;;while calls use a lot of cycles.
10731 +(define_insn_reservation "branch_op" 0
10732 + (and (eq_attr "pipeline" "ap")
10733 + (eq_attr "type" "branch"))
10736 +(define_insn_reservation "call_op" 10
10737 + (and (eq_attr "pipeline" "ap")
10738 + (eq_attr "type" "call"))
10742 +;;Load store instructions
10743 +(define_insn_reservation "load_op" 2
10744 + (and (eq_attr "pipeline" "ap")
10745 + (eq_attr "type" "load"))
10748 +(define_insn_reservation "load_rm_op" 3
10749 + (and (eq_attr "pipeline" "ap")
10750 + (eq_attr "type" "load_rm"))
10754 +(define_insn_reservation "store_op" 0
10755 + (and (eq_attr "pipeline" "ap")
10756 + (eq_attr "type" "store"))
10760 +(define_insn_reservation "load_double_op" 3
10761 + (and (eq_attr "pipeline" "ap")
10762 + (eq_attr "type" "load2"))
10765 +(define_insn_reservation "load_quad_op" 4
10766 + (and (eq_attr "pipeline" "ap")
10767 + (eq_attr "type" "load4"))
10768 + "is,da,da+d,da+d,d")
10770 +(define_insn_reservation "store_double_op" 0
10771 + (and (eq_attr "pipeline" "ap")
10772 + (eq_attr "type" "store2"))
10776 +(define_insn_reservation "store_quad_op" 0
10777 + (and (eq_attr "pipeline" "ap")
10778 + (eq_attr "type" "store4"))
10779 + "is,da,da+d,da+d,d")
10781 +;;For store the operand to write to memory is read in d and
10782 +;;the real latency between any instruction and a store is therefore
10783 +;;one less than for the instructions which reads the operands in the first
10784 +;;excecution stage
10785 +(define_bypass 2 "load_double_op" "store_double_op" "avr32_store_bypass")
10786 +(define_bypass 3 "load_quad_op" "store_quad_op" "avr32_store_bypass")
10787 +(define_bypass 1 "load_op" "store_op" "avr32_store_bypass")
10788 +(define_bypass 2 "load_rm_op" "store_op" "avr32_store_bypass")
10789 +(define_bypass 1 "alu_sat_op" "store_op" "avr32_store_bypass")
10790 +(define_bypass 1 "alu2_op" "store_op" "avr32_store_bypass")
10791 +(define_bypass 1 "mulhh_op" "store_op" "avr32_store_bypass")
10792 +(define_bypass 2 "mulww_w_op" "store_op" "avr32_store_bypass")
10793 +(define_bypass 4 "mulww_d_op" "store_op" "avr32_store_bypass" )
10794 +(define_bypass 2 "machh_w_op" "store_op" "avr32_store_bypass")
10795 +(define_bypass 3 "macww_w_op" "store_op" "avr32_store_bypass")
10796 +(define_bypass 5 "macww_d_op" "store_op" "avr32_store_bypass")
10799 +; Bypass for load double operation. If only the first loaded word is needed
10800 +; then the latency is 2
10801 +(define_bypass 2 "load_double_op"
10802 + "load_op,load_rm_op,alu_sat_op, alu2_op, alu_op, mulhh_op, mulww_w_op,
10803 + mulww_d_op, machh_w_op, macww_w_op, macww_d_op"
10804 + "avr32_valid_load_double_bypass")
10806 +; Bypass for load quad operation. If only the first or second loaded word is needed
10807 +; we set the latency to 2
10808 +(define_bypass 2 "load_quad_op"
10809 + "load_op,load_rm_op,alu_sat_op, alu2_op, alu_op, mulhh_op, mulww_w_op,
10810 + mulww_d_op, machh_w_op, macww_w_op, macww_d_op"
10811 + "avr32_valid_load_quad_bypass")
10814 +;;******************************************************************************
10815 +;; End of Automaton pipeline description for avr32
10816 +;;******************************************************************************
10820 +;;=============================================================================
10822 +;;-----------------------------------------------------------------------------
10824 +;;== char - 8 bits ============================================================
10825 +(define_expand "movqi"
10826 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
10827 + (match_operand:QI 1 "general_operand" ""))]
10830 + if ( !no_new_pseudos ){
10831 + if (GET_CODE (operands[1]) == MEM && optimize){
10832 + rtx reg = gen_reg_rtx (SImode);
10834 + emit_insn (gen_zero_extendqisi2 (reg, operands[1]));
10835 + operands[1] = gen_lowpart (QImode, reg);
10838 + /* One of the ops has to be in a register. */
10839 + if (GET_CODE (operands[0]) == MEM)
10840 + operands[1] = force_reg (QImode, operands[1]);
10845 +(define_insn "*movqi_internal"
10846 + [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r")
10847 + (match_operand:QI 1 "general_operand" "rKs08,m,r,i"))]
10854 + [(set_attr "length" "2,4,4,4")
10855 + (set_attr "type" "alu,load_rm,store,alu")])
10859 +;;== short - 16 bits ==========================================================
10860 +(define_expand "movhi"
10861 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
10862 + (match_operand:HI 1 "general_operand" ""))]
10865 + if ( !no_new_pseudos ){
10866 + if (GET_CODE (operands[1]) == MEM && optimize){
10867 + rtx reg = gen_reg_rtx (SImode);
10869 + emit_insn (gen_extendhisi2 (reg, operands[1]));
10870 + operands[1] = gen_lowpart (HImode, reg);
10873 + /* One of the ops has to be in a register. */
10874 + if (GET_CODE (operands[0]) == MEM)
10875 + operands[1] = force_reg (HImode, operands[1]);
10880 +(define_insn "*movhi_internal"
10881 + [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r")
10882 + (match_operand:HI 1 "general_operand" "rKs08,m,r,i"))]
10889 + [(set_attr "length" "2,4,4,4")
10890 + (set_attr "type" "alu,load_rm,store,alu")])
10893 +;;== int - 32 bits ============================================================
10895 +(define_expand "movmisalignsi"
10896 + [(set (match_operand:SI 0 "nonimmediate_operand" "")
10897 + (match_operand:SI 1 "nonimmediate_operand" ""))]
10898 + "TARGET_UNALIGNED_WORD"
10903 +(define_expand "mov<mode>"
10904 + [(set (match_operand:MOVM 0 "register_operand" "")
10905 + (match_operand:MOVM 1 "general_operand" ""))]
10909 + /* One of the ops has to be in a register. */
10910 + if (GET_CODE (operands[0]) == MEM)
10911 + operands[1] = force_reg (<MODE>mode, operands[1]);
10914 + /* Check for out of range immediate constants as these may
10915 + occur during reloading, since it seems like reload does
10916 + not check if the immediate is legitimate. Don't know if
10917 + this is a bug? */
10918 + if ( reload_in_progress
10919 + && avr32_arch->arch_type != ARCH_TYPE_AVR32_UC
10920 + && GET_CODE(operands[1]) == CONST_INT
10921 + && !avr32_const_ok_for_constraint_p(INTVAL(operands[1]), 'K', "Ks21") ){
10922 + operands[1] = force_const_mem(SImode, operands[1]);
10925 + if ( (flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS)
10926 + && !avr32_legitimate_pic_operand_p(operands[1]) )
10927 + operands[1] = legitimize_pic_address (operands[1], <MODE>mode,
10928 + (no_new_pseudos ? operands[0] : 0));
10929 + else if ( flag_pic && avr32_address_operand(operands[1], GET_MODE(operands[1])) )
10930 + /* If we have an address operand then this function uses the pic register. */
10931 + current_function_uses_pic_offset_table = 1;
10935 +(define_insn "mov<mode>_internal"
10936 + [(set (match_operand:MOVM 0 "nonimmediate_operand" "=r, r, r,r,m,r")
10937 + (match_operand:MOVM 1 "general_operand" "rKs08,Ks21,n,m,r,W"))]
10940 + switch (which_alternative) {
10942 + case 1: return "mov\t%0, %1";
10943 + case 2: return "mov\t%0, lo(%1)\;orh\t%0,hi(%1)";
10945 + if ( (REG_P(XEXP(operands[1], 0))
10946 + && REGNO(XEXP(operands[1], 0)) == SP_REGNUM)
10947 + || (GET_CODE(XEXP(operands[1], 0)) == PLUS
10948 + && REGNO(XEXP(XEXP(operands[1], 0), 0)) == SP_REGNUM
10949 + && GET_CODE(XEXP(XEXP(operands[1], 0), 1)) == CONST_INT
10950 + && INTVAL(XEXP(XEXP(operands[1], 0), 1)) % 4 == 0
10951 + && INTVAL(XEXP(XEXP(operands[1], 0), 1)) <= 0x1FC) )
10952 + return "lddsp\t%0, %1";
10953 + else if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])) )
10954 + return "lddpc\t%0, %1";
10956 + return "ld.w\t%0, %1";
10958 + if ( (REG_P(XEXP(operands[0], 0))
10959 + && REGNO(XEXP(operands[0], 0)) == SP_REGNUM)
10960 + || (GET_CODE(XEXP(operands[0], 0)) == PLUS
10961 + && REGNO(XEXP(XEXP(operands[0], 0), 0)) == SP_REGNUM
10962 + && GET_CODE(XEXP(XEXP(operands[0], 0), 1)) == CONST_INT
10963 + && INTVAL(XEXP(XEXP(operands[0], 0), 1)) % 4 == 0
10964 + && INTVAL(XEXP(XEXP(operands[0], 0), 1)) <= 0x1FC) )
10965 + return "stdsp\t%0, %1";
10967 + return "st.w\t%0, %1";
10969 + if ( TARGET_HAS_ASM_ADDR_PSEUDOS )
10970 + return "lda.w\t%0, %1";
10972 + return "ld.w\t%0, r6[%1@got]";
10978 + [(set_attr "length" "2,4,8,4,4,8")
10979 + (set_attr "type" "alu,alu,alu2,load,store,load")
10980 + (set_attr "cc" "none,none,set_z,none,none,clobber")])
10983 +;; These instructions are for loading constants which cannot be loaded
10984 +;; directly from the constant pool because the offset is too large
10985 +;; high and lo_sum are used even tough for our case it should be
10986 +;; low and high sum :-)
10987 +(define_insn "mov_symbol_lo"
10988 + [(set (match_operand:SI 0 "register_operand" "=r")
10989 + (high:SI (match_operand:SI 1 "immediate_operand" "i" )))]
10991 + "mov\t%0, lo(%1)"
10992 + [(set_attr "type" "alu")
10993 + (set_attr "length" "4")]
10996 +(define_insn "add_symbol_hi"
10997 + [(set (match_operand:SI 0 "register_operand" "=r")
10998 + (lo_sum:SI (match_dup 0)
10999 + (match_operand:SI 1 "immediate_operand" "i" )))]
11001 + "orh\t%0, hi(%1)"
11002 + [(set_attr "type" "alu")
11003 + (set_attr "length" "4")]
11008 +;; When generating pic, we need to load the symbol offset into a register.
11009 +;; So that the optimizer does not confuse this with a normal symbol load
11010 +;; we use an unspec. The offset will be loaded from a constant pool entry,
11011 +;; since that is the only type of relocation we can use.
11012 +(define_insn "pic_load_addr"
11013 + [(set (match_operand:SI 0 "register_operand" "=r")
11014 + (unspec:SI [(match_operand:SI 1 "" "")] UNSPEC_PIC_SYM))]
11015 + "flag_pic && CONSTANT_POOL_ADDRESS_P(XEXP(operands[1], 0))"
11017 + [(set_attr "type" "load")
11018 + (set_attr "length" "4")]
11021 +(define_insn "pic_compute_got_from_pc"
11022 + [(set (match_operand:SI 0 "register_operand" "+r")
11023 + (unspec:SI [(minus:SI (pc)
11024 + (match_dup 0))] UNSPEC_PIC_BASE))
11025 + (use (label_ref (match_operand 1 "" "")))]
11028 + (*targetm.asm_out.internal_label) (asm_out_file, "L",
11029 + CODE_LABEL_NUMBER (operands[1]));
11030 + return \"rsub\t%0, pc\";
11032 + [(set_attr "cc" "clobber")
11033 + (set_attr "length" "2")]
11036 +;;== long long int - 64 bits ==================================================
11038 +(define_expand "movdi"
11039 + [(set (match_operand:DI 0 "nonimmediate_operand" "")
11040 + (match_operand:DI 1 "general_operand" ""))]
11044 + /* One of the ops has to be in a register. */
11045 + if (GET_CODE (operands[0]) != REG)
11046 + operands[1] = force_reg (DImode, operands[1]);
11051 +(define_insn_and_split "*movdi_internal"
11052 + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r, r, r,r,r,m")
11053 + (match_operand:DI 1 "general_operand" "r, Ks08,Ks21,G,n,m,r"))]
11056 + switch (which_alternative ){
11064 + if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])))
11065 + return "ld.d\t%0, pc[%1 - .]";
11067 + return "ld.d\t%0, %1";
11069 + return "st.d\t%0, %1";
11074 +;; Lets split all reg->reg or imm->reg transfers into two SImode transfers
11075 + "reload_completed &&
11076 + (REG_P (operands[0]) &&
11077 + (REG_P (operands[1])
11078 + || GET_CODE (operands[1]) == CONST_INT
11079 + || GET_CODE (operands[1]) == CONST_DOUBLE))"
11080 + [(set (match_dup 0) (match_dup 1))
11081 + (set (match_dup 2) (match_dup 3))]
11083 + operands[2] = gen_highpart (SImode, operands[0]);
11084 + operands[0] = gen_lowpart (SImode, operands[0]);
11085 + if ( REG_P(operands[1]) ){
11086 + operands[3] = gen_highpart(SImode, operands[1]);
11087 + operands[1] = gen_lowpart(SImode, operands[1]);
11088 + } else if ( GET_CODE(operands[1]) == CONST_DOUBLE
11089 + || GET_CODE(operands[1]) == CONST_INT ){
11090 + rtx split_const[2];
11091 + avr32_split_const_expr (DImode, SImode, operands[1], split_const);
11092 + operands[3] = split_const[1];
11093 + operands[1] = split_const[0];
11095 + internal_error("Illegal operand[1] for movdi split!");
11099 + [(set_attr "length" "*,*,*,*,*,4,4")
11100 + (set_attr "type" "*,*,*,*,*,load2,store2")
11101 + (set_attr "cc" "*,*,*,*,*,none,none")])
11104 +;;== 128 bits ==================================================
11105 +(define_expand "movti"
11106 + [(set (match_operand:TI 0 "nonimmediate_operand" "")
11107 + (match_operand:TI 1 "nonimmediate_operand" ""))]
11111 + /* One of the ops has to be in a register. */
11112 + if (GET_CODE (operands[0]) != REG)
11113 + operands[1] = force_reg (TImode, operands[1]);
11115 + /* We must fix any pre_dec for loads and post_inc stores */
11116 + if ( GET_CODE (operands[0]) == MEM
11117 + && GET_CODE (XEXP(operands[0],0)) == POST_INC ){
11118 + emit_move_insn(gen_rtx_MEM(TImode, XEXP(XEXP(operands[0],0),0)), operands[1]);
11119 + emit_insn(gen_addsi3(XEXP(XEXP(operands[0],0),0), XEXP(XEXP(operands[0],0),0), GEN_INT(GET_MODE_SIZE(TImode))));
11123 + if ( GET_CODE (operands[1]) == MEM
11124 + && GET_CODE (XEXP(operands[1],0)) == PRE_DEC ){
11125 + emit_insn(gen_addsi3(XEXP(XEXP(operands[1],0),0), XEXP(XEXP(operands[1],0),0), GEN_INT(-GET_MODE_SIZE(TImode))));
11126 + emit_move_insn(operands[0], gen_rtx_MEM(TImode, XEXP(XEXP(operands[1],0),0)));
11132 +(define_insn_and_split "*movti_internal"
11133 + [(set (match_operand:TI 0 "avr32_movti_dst_operand" "=r,r,<RKu00,r,r")
11134 + (match_operand:TI 1 "avr32_movti_src_operand" " r,RKu00>,r,n,m"))]
11137 + switch (which_alternative ){
11142 + return "ldm\t%p1, %0";
11144 + return "stm\t%p0, %1";
11146 + return "ld.d\t%U0, pc[%1 - .]\;ld.d\t%B0, pc[%1 - . + 8]";
11150 + "reload_completed &&
11151 + (REG_P (operands[0]) &&
11152 + (REG_P (operands[1])
11153 + || (GET_CODE (operands[1]) == MEM
11154 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
11155 + && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0)))
11156 + || GET_CODE (operands[1]) == CONST_INT
11157 + || GET_CODE (operands[1]) == CONST_DOUBLE))"
11158 + [(set (match_dup 0) (match_dup 1))
11159 + (set (match_dup 2) (match_dup 3))]
11161 + operands[2] = simplify_gen_subreg ( DImode, operands[0],
11163 + operands[0] = simplify_gen_subreg ( DImode, operands[0],
11165 + if ( REG_P(operands[1]) ){
11166 + operands[3] = simplify_gen_subreg ( DImode, operands[1],
11168 + operands[1] = simplify_gen_subreg ( DImode, operands[1],
11170 + } else if ( GET_CODE(operands[1]) == CONST_DOUBLE
11171 + || GET_CODE(operands[1]) == CONST_INT ){
11172 + rtx split_const[2];
11173 + avr32_split_const_expr (TImode, DImode, operands[1], split_const);
11174 + operands[3] = split_const[1];
11175 + operands[1] = split_const[0];
11176 + } else if (avr32_const_pool_ref_operand (operands[1], GET_MODE(operands[1]))){
11177 + rtx split_const[2];
11178 + rtx cop = avoid_constant_pool_reference (operands[1]);
11179 + if (operands[1] == cop)
11180 + cop = get_pool_constant (XEXP (operands[1], 0));
11181 + avr32_split_const_expr (TImode, DImode, cop, split_const);
11182 + operands[3] = force_const_mem (DImode, split_const[1]);
11183 + operands[1] = force_const_mem (DImode, split_const[0]);
11185 + internal_error("Illegal operand[1] for movdi split!");
11188 + [(set_attr "length" "*,4,4,*,8")
11189 + (set_attr "type" "*,load4,store4,*,load4")])
11192 +;;== float - 32 bits ==========================================================
11193 +(define_expand "movsf"
11194 + [(set (match_operand:SF 0 "nonimmediate_operand" "")
11195 + (match_operand:SF 1 "general_operand" ""))]
11200 + /* One of the ops has to be in a register. */
11201 + if (GET_CODE (operands[0]) != REG)
11202 + operands[1] = force_reg (SFmode, operands[1]);
11206 +(define_insn "*movsf_internal"
11207 + [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,r,r,m")
11208 + (match_operand:SF 1 "general_operand" "r, G,F,m,r"))]
11209 + "TARGET_SOFT_FLOAT"
11211 + switch (which_alternative) {
11213 + case 1: return "mov\t%0, %1";
11214 + case 2: return "mov\t%0, lo(%1)\;orh\t%0, hi(%1)";
11216 + if ( (REG_P(XEXP(operands[1], 0))
11217 + && REGNO(XEXP(operands[1], 0)) == SP_REGNUM)
11218 + || (GET_CODE(XEXP(operands[1], 0)) == PLUS
11219 + && REGNO(XEXP(XEXP(operands[1], 0), 0)) == SP_REGNUM
11220 + && GET_CODE(XEXP(XEXP(operands[1], 0), 1)) == CONST_INT
11221 + && INTVAL(XEXP(XEXP(operands[1], 0), 1)) % 4 == 0
11222 + && INTVAL(XEXP(XEXP(operands[1], 0), 1)) <= 0x1FC) )
11223 + return "lddsp\t%0, %1";
11224 + else if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])) )
11225 + return "lddpc\t%0, %1";
11227 + return "ld.w\t%0, %1";
11229 + if ( (REG_P(XEXP(operands[0], 0))
11230 + && REGNO(XEXP(operands[0], 0)) == SP_REGNUM)
11231 + || (GET_CODE(XEXP(operands[0], 0)) == PLUS
11232 + && REGNO(XEXP(XEXP(operands[0], 0), 0)) == SP_REGNUM
11233 + && GET_CODE(XEXP(XEXP(operands[0], 0), 1)) == CONST_INT
11234 + && INTVAL(XEXP(XEXP(operands[0], 0), 1)) % 4 == 0
11235 + && INTVAL(XEXP(XEXP(operands[0], 0), 1)) <= 0x1FC) )
11236 + return "stdsp\t%0, %1";
11238 + return "st.w\t%0, %1";
11244 + [(set_attr "length" "2,4,8,4,4")
11245 + (set_attr "type" "alu,alu,alu2,load,store")
11246 + (set_attr "cc" "none,none,clobber,none,none")])
11250 +;;== double - 64 bits =========================================================
11251 +(define_expand "movdf"
11252 + [(set (match_operand:DF 0 "nonimmediate_operand" "")
11253 + (match_operand:DF 1 "general_operand" ""))]
11256 + /* One of the ops has to be in a register. */
11257 + if (GET_CODE (operands[0]) != REG){
11258 + operands[1] = force_reg (DFmode, operands[1]);
11263 +(define_insn_and_split "*movdf_internal"
11264 + [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,r,r,m")
11265 + (match_operand:DF 1 "general_operand" " r,G,F,m,r"))]
11266 + "TARGET_SOFT_FLOAT"
11268 + switch (which_alternative ){
11274 + if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])))
11275 + return "ld.d\t%0, pc[%1 - .]";
11277 + return "ld.d\t%0, %1";
11279 + return "st.d\t%0, %1";
11284 + "TARGET_SOFT_FLOAT
11285 + && reload_completed
11286 + && (REG_P (operands[0])
11287 + && (REG_P (operands[1])
11288 + || GET_CODE (operands[1]) == CONST_DOUBLE))"
11289 + [(set (match_dup 0) (match_dup 1))
11290 + (set (match_dup 2) (match_dup 3))]
11293 + operands[2] = gen_highpart (SImode, operands[0]);
11294 + operands[0] = gen_lowpart (SImode, operands[0]);
11295 + operands[3] = gen_highpart(SImode, operands[1]);
11296 + operands[1] = gen_lowpart(SImode, operands[1]);
11300 + [(set_attr "length" "*,*,*,4,4")
11301 + (set_attr "type" "*,*,*,load2,store2")
11302 + (set_attr "cc" "*,*,*,none,none")])
11307 +;;=============================================================================
11308 +;; Move chunks of memory
11309 +;;=============================================================================
11311 +(define_expand "movmemsi"
11312 + [(match_operand:BLK 0 "general_operand" "")
11313 + (match_operand:BLK 1 "general_operand" "")
11314 + (match_operand:SI 2 "const_int_operand" "")
11315 + (match_operand:SI 3 "const_int_operand" "")]
11318 + if (avr32_gen_movmemsi (operands))
11327 +;;=============================================================================
11328 +;; Bit field instructions
11329 +;;-----------------------------------------------------------------------------
11330 +;; Instructions to insert or extract bit-fields
11331 +;;=============================================================================
11333 +(define_insn "insv"
11334 + [ (set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
11335 + (match_operand:SI 1 "immediate_operand" "Ku05")
11336 + (match_operand:SI 2 "immediate_operand" "Ku05"))
11337 + (match_operand 3 "register_operand" "r"))]
11339 + "bfins\t%0, %3, %2, %1"
11340 + [(set_attr "type" "alu")
11341 + (set_attr "length" "4")
11342 + (set_attr "cc" "set_ncz")])
11346 +(define_expand "extv"
11347 + [ (set (match_operand:SI 0 "register_operand" "")
11348 + (sign_extract:SI (match_operand:SI 1 "register_operand" "")
11349 + (match_operand:SI 2 "immediate_operand" "")
11350 + (match_operand:SI 3 "immediate_operand" "")))]
11353 + if ( INTVAL(operands[2]) >= 32 )
11358 +(define_expand "extzv"
11359 + [ (set (match_operand:SI 0 "register_operand" "")
11360 + (zero_extract:SI (match_operand:SI 1 "register_operand" "")
11361 + (match_operand:SI 2 "immediate_operand" "")
11362 + (match_operand:SI 3 "immediate_operand" "")))]
11365 + if ( INTVAL(operands[2]) >= 32 )
11370 +(define_insn "extv_internal"
11371 + [ (set (match_operand:SI 0 "register_operand" "=r")
11372 + (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
11373 + (match_operand:SI 2 "immediate_operand" "Ku05")
11374 + (match_operand:SI 3 "immediate_operand" "Ku05")))]
11375 + "INTVAL(operands[2]) < 32"
11376 + "bfexts\t%0, %1, %3, %2"
11377 + [(set_attr "type" "alu")
11378 + (set_attr "length" "4")
11379 + (set_attr "cc" "set_ncz")])
11382 +(define_insn "extzv_internal"
11383 + [ (set (match_operand:SI 0 "register_operand" "=r")
11384 + (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
11385 + (match_operand:SI 2 "immediate_operand" "Ku05")
11386 + (match_operand:SI 3 "immediate_operand" "Ku05")))]
11387 + "INTVAL(operands[2]) < 32"
11388 + "bfextu\t%0, %1, %3, %2"
11389 + [(set_attr "type" "alu")
11390 + (set_attr "length" "4")
11391 + (set_attr "cc" "set_ncz")])
11395 +;;=============================================================================
11396 +;; Some peepholes for avoiding unnecessary cast instructions
11397 +;; followed by bfins.
11398 +;;-----------------------------------------------------------------------------
11401 + [(set (match_operand:SI 0 "register_operand" "")
11402 + (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
11403 + (set (zero_extract:SI (match_operand 2 "register_operand" "")
11404 + (match_operand:SI 3 "immediate_operand" "")
11405 + (match_operand:SI 4 "immediate_operand" ""))
11407 + "((peep2_reg_dead_p(2, operands[0]) &&
11408 + (INTVAL(operands[3]) <= 8)))"
11409 + [(set (zero_extract:SI (match_dup 2)
11416 + [(set (match_operand:SI 0 "register_operand" "")
11417 + (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
11418 + (set (zero_extract:SI (match_operand 2 "register_operand" "")
11419 + (match_operand:SI 3 "immediate_operand" "")
11420 + (match_operand:SI 4 "immediate_operand" ""))
11422 + "((peep2_reg_dead_p(2, operands[0]) &&
11423 + (INTVAL(operands[3]) <= 16)))"
11424 + [(set (zero_extract:SI (match_dup 2)
11430 +;;=============================================================================
11432 +;;-----------------------------------------------------------------------------
11433 +;; Implements the push instruction
11434 +;;=============================================================================
11435 +(define_insn "pushm"
11436 + [(set (mem:BLK (pre_dec:BLK (reg:SI SP_REGNUM)))
11437 + (unspec:BLK [(match_operand 0 "const_int_operand" "")]
11441 + if (INTVAL(operands[0])) {
11442 + return "pushm\t%r0";
11447 + [(set_attr "type" "store")
11448 + (set_attr "length" "2")
11449 + (set_attr "cc" "none")])
11451 +(define_insn "stm"
11452 + [(unspec [(match_operand 0 "register_operand" "r")
11453 + (match_operand 1 "const_int_operand" "")
11454 + (match_operand 2 "const_int_operand" "")]
11458 + if (INTVAL(operands[1])) {
11459 + if (INTVAL(operands[2]) != 0)
11460 + return "stm\t--%0, %s1";
11462 + return "stm\t%0, %s1";
11467 + [(set_attr "type" "store")
11468 + (set_attr "length" "4")
11469 + (set_attr "cc" "none")])
11473 +(define_insn "popm"
11474 + [(unspec [(match_operand 0 "const_int_operand" "")]
11478 + if (INTVAL(operands[0])) {
11479 + return "popm %r0";
11484 + [(set_attr "type" "load")
11485 + (set_attr "length" "2")])
11489 +;;=============================================================================
11491 +;;-----------------------------------------------------------------------------
11492 +;; Adds reg1 with reg2 and puts the result in reg0.
11493 +;;=============================================================================
11494 +(define_insn "add<mode>3"
11495 + [(set (match_operand:INTM 0 "register_operand" "=r,r,r,r,r")
11496 + (plus:INTM (match_operand:INTM 1 "register_operand" "%0,r,0,r,0")
11497 + (match_operand:INTM 2 "avr32_add_operand" "r,r,Is08,Is16,Is21")))]
11506 + [(set_attr "length" "2,4,2,4,4")
11507 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11509 +(define_insn "add<mode>3_lsl"
11510 + [(set (match_operand:INTM 0 "register_operand" "=r")
11511 + (plus:INTM (ashift:INTM (match_operand:INTM 1 "register_operand" "r")
11512 + (match_operand:INTM 3 "avr32_add_shift_immediate_operand" "Ku02"))
11513 + (match_operand:INTM 2 "register_operand" "r")))]
11515 + "add %0, %2, %1 << %3"
11516 + [(set_attr "length" "4")
11517 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11519 +(define_insn "add<mode>3_lsl2"
11520 + [(set (match_operand:INTM 0 "register_operand" "=r")
11521 + (plus:INTM (match_operand:INTM 1 "register_operand" "r")
11522 + (ashift:INTM (match_operand:INTM 2 "register_operand" "r")
11523 + (match_operand:INTM 3 "avr32_add_shift_immediate_operand" "Ku02"))))]
11525 + "add %0, %1, %2 << %3"
11526 + [(set_attr "length" "4")
11527 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11531 +(define_insn "add<mode>3_mul"
11532 + [(set (match_operand:INTM 0 "register_operand" "=r")
11533 + (plus:INTM (mult:INTM (match_operand:INTM 1 "register_operand" "r")
11534 + (match_operand:INTM 3 "immediate_operand" "Ku04" ))
11535 + (match_operand:INTM 2 "register_operand" "r")))]
11536 + "(INTVAL(operands[3]) == 0) || (INTVAL(operands[3]) == 2) ||
11537 + (INTVAL(operands[3]) == 4) || (INTVAL(operands[3]) == 8)"
11538 + "add %0, %2, %1 << %p3"
11539 + [(set_attr "length" "4")
11540 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11542 +(define_insn "add<mode>3_mul2"
11543 + [(set (match_operand:INTM 0 "register_operand" "=r")
11544 + (plus:INTM (match_operand:INTM 1 "register_operand" "r")
11545 + (mult:INTM (match_operand:INTM 2 "register_operand" "r")
11546 + (match_operand:INTM 3 "immediate_operand" "Ku04" ))))]
11547 + "(INTVAL(operands[3]) == 0) || (INTVAL(operands[3]) == 2) ||
11548 + (INTVAL(operands[3]) == 4) || (INTVAL(operands[3]) == 8)"
11549 + "add %0, %1, %2 << %p3"
11550 + [(set_attr "length" "4")
11551 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11555 + [(set (match_operand:SI 0 "register_operand" "")
11556 + (ashift:SI (match_operand:SI 1 "register_operand" "")
11557 + (match_operand:SI 2 "immediate_operand" "")))
11558 + (set (match_operand:SI 3 "register_operand" "")
11559 + (plus:SI (match_dup 0)
11560 + (match_operand:SI 4 "register_operand" "")))]
11561 + "(peep2_reg_dead_p(2, operands[0]) &&
11562 + (INTVAL(operands[2]) < 4 && INTVAL(operands[2]) > 0))"
11563 + [(set (match_dup 3)
11564 + (plus:SI (ashift:SI (match_dup 1)
11570 + [(set (match_operand:SI 0 "register_operand" "")
11571 + (ashift:SI (match_operand:SI 1 "register_operand" "")
11572 + (match_operand:SI 2 "immediate_operand" "")))
11573 + (set (match_operand:SI 3 "register_operand" "")
11574 + (plus:SI (match_operand:SI 4 "register_operand" "")
11576 + "(peep2_reg_dead_p(2, operands[0]) &&
11577 + (INTVAL(operands[2]) < 4 && INTVAL(operands[2]) > 0))"
11578 + [(set (match_dup 3)
11579 + (plus:SI (ashift:SI (match_dup 1)
11584 +(define_insn "adddi3"
11585 + [(set (match_operand:DI 0 "register_operand" "=r,r")
11586 + (plus:DI (match_operand:DI 1 "register_operand" "%r,0")
11587 + (match_operand:DI 2 "register_operand" "r,r")))]
11590 + add %0, %1, %2\;adc %m0, %m1, %m2
11591 + add %0, %2\;adc %m0, %m0, %m2"
11592 + [(set_attr "length" "8,6")
11593 + (set_attr "type" "alu2")
11594 + (set_attr "cc" "set_vncz")])
11598 +;;=============================================================================
11600 +;;-----------------------------------------------------------------------------
11601 +;; Subtract reg2 or immediate value from reg0 and puts the result in reg0.
11602 +;;=============================================================================
11604 +(define_insn "sub<mode>3"
11605 + [(set (match_operand:INTM 0 "general_operand" "=r,r,r,r,r,r,r")
11606 + (minus:INTM (match_operand:INTM 1 "nonmemory_operand" "0,r,0,r,0,r,Ks08")
11607 + (match_operand:INTM 2 "nonmemory_operand" "r,r,Ks08,Ks16,Ks21,0,r")))]
11617 + [(set_attr "length" "2,4,2,4,4,2,4")
11618 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11620 +(define_insn "*sub<mode>3_mul"
11621 + [(set (match_operand:INTM 0 "register_operand" "=r,r,r")
11622 + (minus:INTM (match_operand:INTM 1 "register_operand" "r,0,r")
11623 + (mult:INTM (match_operand:INTM 2 "register_operand" "r,r,0")
11624 + (match_operand:SI 3 "immediate_operand" "Ku04,Ku04,Ku04" ))))]
11625 + "(INTVAL(operands[3]) == 0) || (INTVAL(operands[3]) == 2) ||
11626 + (INTVAL(operands[3]) == 4) || (INTVAL(operands[3]) == 8)"
11628 + sub %0, %1, %2 << %p3
11629 + sub %0, %0, %2 << %p3
11630 + sub %0, %1, %0 << %p3"
11631 + [(set_attr "length" "4,4,4")
11632 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11634 +(define_insn "*sub<mode>3_lsl"
11635 + [(set (match_operand:INTM 0 "register_operand" "=r")
11636 + (minus:INTM (match_operand:INTM 1 "register_operand" "r")
11637 + (ashift:INTM (match_operand:INTM 2 "register_operand" "r")
11638 + (match_operand:SI 3 "avr32_add_shift_immediate_operand" "Ku02"))))]
11640 + "sub %0, %1, %2 << %3"
11641 + [(set_attr "length" "4")
11642 + (set_attr "cc" "<INTM:alu_cc_attr>")])
11645 +(define_insn "subdi3"
11646 + [(set (match_operand:DI 0 "register_operand" "=r,r")
11647 + (minus:DI (match_operand:DI 1 "register_operand" "%r,0")
11648 + (match_operand:DI 2 "register_operand" "r,r")))]
11651 + sub %0, %1, %2\;sbc %m0, %m1, %m2
11652 + sub %0, %2\;sbc %m0, %m0, %m2"
11653 + [(set_attr "length" "8,6")
11654 + (set_attr "type" "alu2")
11655 + (set_attr "cc" "set_vncz")])
11659 +;;=============================================================================
11661 +;;-----------------------------------------------------------------------------
11662 +;; Multiply op1 and op2 and put the value in op0.
11663 +;;=============================================================================
11666 +(define_insn "mulqi3"
11667 + [(set (match_operand:QI 0 "register_operand" "=r,r,r")
11668 + (mult:QI (match_operand:QI 1 "register_operand" "%0,r,r")
11669 + (match_operand:QI 2 "avr32_mul_operand" "r,r,Ks08")))]
11672 + switch (which_alternative){
11674 + return "mul %0, %2";
11676 + return "mul %0, %1, %2";
11678 + return "mul %0, %1, %2";
11683 + [(set_attr "type" "mulww_w,mulww_w,mulwh")
11684 + (set_attr "length" "2,4,4")
11685 + (set_attr "cc" "none")])
11687 +(define_insn "mulsi3"
11688 + [(set (match_operand:SI 0 "register_operand" "=r,r,r")
11689 + (mult:SI (match_operand:SI 1 "register_operand" "%0,r,r")
11690 + (match_operand:SI 2 "avr32_mul_operand" "r,r,Ks08")))]
11693 + switch (which_alternative){
11695 + return "mul %0, %2";
11697 + return "mul %0, %1, %2";
11699 + return "mul %0, %1, %2";
11704 + [(set_attr "type" "mulww_w,mulww_w,mulwh")
11705 + (set_attr "length" "2,4,4")
11706 + (set_attr "cc" "none")])
11709 +(define_insn "mulhisi3"
11710 + [(set (match_operand:SI 0 "register_operand" "=r")
11712 + (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
11713 + (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
11715 + "mulhh.w %0, %1:b, %2:b"
11716 + [(set_attr "type" "mulhh")
11717 + (set_attr "length" "4")
11718 + (set_attr "cc" "none")])
11721 + [(match_scratch:DI 6 "r")
11722 + (set (match_operand:SI 0 "register_operand" "")
11724 + (sign_extend:SI (match_operand:HI 1 "register_operand" ""))
11725 + (sign_extend:SI (match_operand:HI 2 "register_operand" ""))))
11726 + (set (match_operand:SI 3 "register_operand" "")
11727 + (ashiftrt:SI (match_dup 0)
11728 + (const_int 16)))]
11730 + && (peep2_reg_dead_p(1, operands[0]) || (REGNO(operands[0]) == REGNO(operands[3])))"
11731 + [(set (match_dup 4) (sign_extend:SI (match_dup 1)))
11732 + (set (match_dup 6)
11733 + (ashift:DI (mult:DI (sign_extend:DI (match_dup 4))
11734 + (sign_extend:DI (match_dup 2)))
11736 + (set (match_dup 3) (match_dup 5))]
11739 + operands[4] = gen_rtx_REG(SImode, REGNO(operands[1]));
11740 + operands[5] = gen_highpart (SImode, operands[4]);
11744 +(define_insn "mulnhisi3"
11745 + [(set (match_operand:SI 0 "register_operand" "=r")
11747 + (sign_extend:SI (neg:HI (match_operand:HI 1 "register_operand" "r")))
11748 + (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
11750 + "mulnhh.w %0, %1:b, %2:b"
11751 + [(set_attr "type" "mulhh")
11752 + (set_attr "length" "4")
11753 + (set_attr "cc" "none")])
11755 +(define_insn "machisi3"
11756 + [(set (match_operand:SI 0 "register_operand" "+r")
11757 + (plus:SI (mult:SI
11758 + (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
11759 + (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))
11762 + "machh.w %0, %1:b, %2:b"
11763 + [(set_attr "type" "machh_w")
11764 + (set_attr "length" "4")
11765 + (set_attr "cc" "none")])
11769 +(define_insn "mulsidi3"
11770 + [(set (match_operand:DI 0 "register_operand" "=r")
11772 + (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
11773 + (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
11775 + "muls.d %0, %1, %2"
11776 + [(set_attr "type" "mulww_d")
11777 + (set_attr "length" "4")
11778 + (set_attr "cc" "none")])
11780 +(define_insn "umulsidi3"
11781 + [(set (match_operand:DI 0 "register_operand" "=r")
11783 + (zero_extend:DI (match_operand:SI 1 "register_operand" "%r"))
11784 + (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
11786 + "mulu.d %0, %1, %2"
11787 + [(set_attr "type" "mulww_d")
11788 + (set_attr "length" "4")
11789 + (set_attr "cc" "none")])
11791 +(define_insn "*mulaccsi3"
11792 + [(set (match_operand:SI 0 "register_operand" "+r")
11793 + (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "%r")
11794 + (match_operand:SI 2 "register_operand" "r"))
11798 + [(set_attr "type" "macww_w")
11799 + (set_attr "length" "4")
11800 + (set_attr "cc" "none")])
11802 +(define_insn "mulaccsidi3"
11803 + [(set (match_operand:DI 0 "register_operand" "+r")
11804 + (plus:DI (mult:DI
11805 + (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
11806 + (sign_extend:DI (match_operand:SI 2 "register_operand" "r")))
11809 + "macs.d %0, %1, %2"
11810 + [(set_attr "type" "macww_d")
11811 + (set_attr "length" "4")
11812 + (set_attr "cc" "none")])
11814 +(define_insn "umulaccsidi3"
11815 + [(set (match_operand:DI 0 "register_operand" "+r")
11816 + (plus:DI (mult:DI
11817 + (zero_extend:DI (match_operand:SI 1 "register_operand" "%r"))
11818 + (zero_extend:DI (match_operand:SI 2 "register_operand" "r")))
11821 + "macu.d %0, %1, %2"
11822 + [(set_attr "type" "macww_d")
11823 + (set_attr "length" "4")
11824 + (set_attr "cc" "none")])
11828 +;; Try to avoid Write-After-Write hazards for mul operations
11829 +;; if it can be done
11831 + [(set (match_operand:SI 0 "register_operand" "")
11833 + (sign_extend:SI (match_operand 1 "general_operand" ""))
11834 + (sign_extend:SI (match_operand 2 "general_operand" ""))))
11835 + (set (match_dup 0)
11836 + (match_operator:SI 3 "alu_operator" [(match_dup 0)
11837 + (match_operand 4 "general_operand" "")]))]
11838 + "peep2_reg_dead_p(1, operands[2])"
11839 + [(set (match_dup 5)
11841 + (sign_extend:SI (match_dup 1))
11842 + (sign_extend:SI (match_dup 2))))
11843 + (set (match_dup 0)
11844 + (match_op_dup 3 [(match_dup 5)
11845 + (match_dup 4)]))]
11846 + "{operands[5] = gen_rtx_REG(SImode, REGNO(operands[2]));}"
11851 +;;=============================================================================
11852 +;; DSP instructions
11853 +;;=============================================================================
11854 +(define_insn "mulsathh_h"
11855 + [(set (match_operand:HI 0 "register_operand" "=r")
11856 + (ss_truncate:HI (ashiftrt:SI (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
11857 + (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))
11858 + (const_int 15))))]
11860 + "mulsathh.h\t%0, %1:b, %2:b"
11861 + [(set_attr "length" "4")
11862 + (set_attr "cc" "none")
11863 + (set_attr "type" "mulhh")])
11865 +(define_insn "mulsatrndhh_h"
11866 + [(set (match_operand:HI 0 "register_operand" "=r")
11867 + (ss_truncate:HI (ashiftrt:SI
11868 + (plus:SI (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
11869 + (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))
11870 + (const_int 1073741824))
11871 + (const_int 15))))]
11873 + "mulsatrndhh.h\t%0, %1:b, %2:b"
11874 + [(set_attr "length" "4")
11875 + (set_attr "cc" "none")
11876 + (set_attr "type" "mulhh")])
11878 +(define_insn "mulsathh_w"
11879 + [(set (match_operand:SI 0 "register_operand" "=r")
11880 + (ss_truncate:SI (ashift:DI (mult:DI (sign_extend:DI (match_operand:HI 1 "register_operand" "%r"))
11881 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11882 + (const_int 1))))]
11884 + "mulsathh.w\t%0, %1:b, %2:b"
11885 + [(set_attr "length" "4")
11886 + (set_attr "cc" "none")
11887 + (set_attr "type" "mulhh")])
11889 +(define_insn "mulsatwh_w"
11890 + [(set (match_operand:SI 0 "register_operand" "=r")
11891 + (ss_truncate:SI (ashiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
11892 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11893 + (const_int 15))))]
11895 + "mulsatwh.w\t%0, %1, %2:b"
11896 + [(set_attr "length" "4")
11897 + (set_attr "cc" "none")
11898 + (set_attr "type" "mulwh")])
11900 +(define_insn "mulsatrndwh_w"
11901 + [(set (match_operand:SI 0 "register_operand" "=r")
11902 + (ss_truncate:SI (ashiftrt:DI (plus:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
11903 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11904 + (const_int 1073741824))
11905 + (const_int 15))))]
11907 + "mulsatrndwh.w\t%0, %1, %2:b"
11908 + [(set_attr "length" "4")
11909 + (set_attr "cc" "none")
11910 + (set_attr "type" "mulwh")])
11912 +(define_insn "macsathh_w"
11913 + [(set (match_operand:SI 0 "register_operand" "+r")
11914 + (plus:SI (match_dup 0)
11915 + (ss_truncate:SI (ashift:DI (mult:DI (sign_extend:DI (match_operand:HI 1 "register_operand" "%r"))
11916 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11917 + (const_int 1)))))]
11919 + "macsathh.w\t%0, %1:b, %2:b"
11920 + [(set_attr "length" "4")
11921 + (set_attr "cc" "none")
11922 + (set_attr "type" "mulhh")])
11925 +(define_insn "mulwh_d"
11926 + [(set (match_operand:DI 0 "register_operand" "=r")
11927 + (ashift:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
11928 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11929 + (const_int 16)))]
11931 + "mulwh.d\t%0, %1, %2:b"
11932 + [(set_attr "length" "4")
11933 + (set_attr "cc" "none")
11934 + (set_attr "type" "mulwh")])
11937 +(define_insn "mulnwh_d"
11938 + [(set (match_operand:DI 0 "register_operand" "=r")
11939 + (ashift:DI (mult:DI (not:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))
11940 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11941 + (const_int 16)))]
11943 + "mulnwh.d\t%0, %1, %2:b"
11944 + [(set_attr "length" "4")
11945 + (set_attr "cc" "none")
11946 + (set_attr "type" "mulwh")])
11948 +(define_insn "macwh_d"
11949 + [(set (match_operand:DI 0 "register_operand" "+r")
11950 + (plus:DI (match_dup 0)
11951 + (ashift:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
11952 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
11953 + (const_int 16))))]
11955 + "macwh.d\t%0, %1, %2:b"
11956 + [(set_attr "length" "4")
11957 + (set_attr "cc" "none")
11958 + (set_attr "type" "mulwh")])
11960 +(define_insn "machh_d"
11961 + [(set (match_operand:DI 0 "register_operand" "+r")
11962 + (plus:DI (match_dup 0)
11963 + (mult:DI (sign_extend:DI (match_operand:HI 1 "register_operand" "%r"))
11964 + (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))))]
11966 + "machh.d\t%0, %1:b, %2:b"
11967 + [(set_attr "length" "4")
11968 + (set_attr "cc" "none")
11969 + (set_attr "type" "mulwh")])
11971 +(define_insn "satadd_w"
11972 + [(set (match_operand:SI 0 "register_operand" "=r")
11973 + (ss_plus:SI (match_operand:SI 1 "register_operand" "r")
11974 + (match_operand:SI 2 "register_operand" "r")))]
11976 + "satadd.w\t%0, %1, %2"
11977 + [(set_attr "length" "4")
11978 + (set_attr "cc" "none")
11979 + (set_attr "type" "alu_sat")])
11981 +(define_insn "satsub_w"
11982 + [(set (match_operand:SI 0 "register_operand" "=r")
11983 + (ss_minus:SI (match_operand:SI 1 "register_operand" "r")
11984 + (match_operand:SI 2 "register_operand" "r")))]
11986 + "satsub.w\t%0, %1, %2"
11987 + [(set_attr "length" "4")
11988 + (set_attr "cc" "none")
11989 + (set_attr "type" "alu_sat")])
11991 +(define_insn "satadd_h"
11992 + [(set (match_operand:HI 0 "register_operand" "=r")
11993 + (ss_plus:HI (match_operand:HI 1 "register_operand" "r")
11994 + (match_operand:HI 2 "register_operand" "r")))]
11996 + "satadd.h\t%0, %1, %2"
11997 + [(set_attr "length" "4")
11998 + (set_attr "cc" "none")
11999 + (set_attr "type" "alu_sat")])
12001 +(define_insn "satsub_h"
12002 + [(set (match_operand:HI 0 "register_operand" "=r")
12003 + (ss_minus:HI (match_operand:HI 1 "register_operand" "r")
12004 + (match_operand:HI 2 "register_operand" "r")))]
12006 + "satsub.h\t%0, %1, %2"
12007 + [(set_attr "length" "4")
12008 + (set_attr "cc" "none")
12009 + (set_attr "type" "alu_sat")])
12012 +;;=============================================================================
12014 +;;-----------------------------------------------------------------------------
12015 +;; Set reg0 to the smallest value of reg1 and reg2. It is used for signed
12016 +;; values in the registers.
12017 +;;=============================================================================
12018 +(define_insn "sminsi3"
12019 + [(set (match_operand:SI 0 "register_operand" "=r")
12020 + (smin:SI (match_operand:SI 1 "register_operand" "r")
12021 + (match_operand:SI 2 "register_operand" "r")))]
12024 + [(set_attr "length" "4")
12025 + (set_attr "cc" "none")])
12027 +;;=============================================================================
12029 +;;-----------------------------------------------------------------------------
12030 +;; Set reg0 to the largest value of reg1 and reg2. It is used for signed
12031 +;; values in the registers.
12032 +;;=============================================================================
12033 +(define_insn "smaxsi3"
12034 + [(set (match_operand:SI 0 "register_operand" "=r")
12035 + (smax:SI (match_operand:SI 1 "register_operand" "r")
12036 + (match_operand:SI 2 "register_operand" "r")))]
12039 + [(set_attr "length" "4")
12040 + (set_attr "cc" "none")])
12043 +;;=============================================================================
12044 +;; Logical operations
12045 +;;-----------------------------------------------------------------------------
12047 +;; Split up simple DImode logical operations. Simply perform the logical
12048 +;; operation on the upper and lower halves of the registers.
12050 + [(set (match_operand:DI 0 "register_operand" "")
12051 + (match_operator:DI 6 "logical_binary_operator"
12052 + [(match_operand:DI 1 "register_operand" "")
12053 + (match_operand:DI 2 "register_operand" "")]))]
12054 + "reload_completed"
12055 + [(set (match_dup 0) (match_op_dup:SI 6 [(match_dup 1) (match_dup 2)]))
12056 + (set (match_dup 3) (match_op_dup:SI 6 [(match_dup 4) (match_dup 5)]))]
12059 + operands[3] = gen_highpart (SImode, operands[0]);
12060 + operands[0] = gen_lowpart (SImode, operands[0]);
12061 + operands[4] = gen_highpart (SImode, operands[1]);
12062 + operands[1] = gen_lowpart (SImode, operands[1]);
12063 + operands[5] = gen_highpart (SImode, operands[2]);
12064 + operands[2] = gen_lowpart (SImode, operands[2]);
12068 +;;=============================================================================
12069 +;; Logical operations with shifted operand
12070 +;;=============================================================================
12071 +(define_insn "<code>si_lshift"
12072 + [(set (match_operand:SI 0 "register_operand" "=r")
12073 + (logical:SI (match_operator:SI 4 "logical_shift_operator"
12074 + [(match_operand:SI 2 "register_operand" "r")
12075 + (match_operand:SI 3 "immediate_operand" "Ku05")])
12076 + (match_operand:SI 1 "register_operand" "r")))]
12079 + if ( GET_CODE(operands[4]) == ASHIFT )
12080 + return "<logical_insn>\t%0, %1, %2 << %3";
12082 + return "<logical_insn>\t%0, %1, %2 >> %3";
12085 + [(set_attr "cc" "set_z")]
12089 +;;************************************************
12090 +;; Peepholes for detecting logical operantions
12091 +;; with shifted operands
12092 +;;************************************************
12095 + [(set (match_operand:SI 3 "register_operand" "")
12096 + (match_operator:SI 5 "logical_shift_operator"
12097 + [(match_operand:SI 1 "register_operand" "")
12098 + (match_operand:SI 2 "immediate_operand" "")]))
12099 + (set (match_operand:SI 0 "register_operand" "")
12100 + (logical:SI (match_operand:SI 4 "register_operand" "")
12102 + "(dead_or_set_p(insn, operands[3])) || (REGNO(operands[3]) == REGNO(operands[0]))"
12104 + if ( GET_CODE(operands[5]) == ASHIFT )
12105 + return "<logical_insn>\t%0, %4, %1 << %2";
12107 + return "<logical_insn>\t%0, %4, %1 >> %2";
12109 + [(set_attr "cc" "set_z")]
12113 + [(set (match_operand:SI 3 "register_operand" "")
12114 + (match_operator:SI 5 "logical_shift_operator"
12115 + [(match_operand:SI 1 "register_operand" "")
12116 + (match_operand:SI 2 "immediate_operand" "")]))
12117 + (set (match_operand:SI 0 "register_operand" "")
12118 + (logical:SI (match_dup 3)
12119 + (match_operand:SI 4 "register_operand" "")))]
12120 + "(dead_or_set_p(insn, operands[3])) || (REGNO(operands[3]) == REGNO(operands[0]))"
12122 + if ( GET_CODE(operands[5]) == ASHIFT )
12123 + return "<logical_insn>\t%0, %4, %1 << %2";
12125 + return "<logical_insn>\t%0, %4, %1 >> %2";
12127 + [(set_attr "cc" "set_z")]
12132 + [(set (match_operand:SI 0 "register_operand" "")
12133 + (match_operator:SI 5 "logical_shift_operator"
12134 + [(match_operand:SI 1 "register_operand" "")
12135 + (match_operand:SI 2 "immediate_operand" "")]))
12136 + (set (match_operand:SI 3 "register_operand" "")
12137 + (logical:SI (match_operand:SI 4 "register_operand" "")
12139 + "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[3]) == REGNO(operands[0]))"
12141 + [(set (match_dup 3)
12142 + (logical:SI (match_op_dup:SI 5 [(match_dup 1) (match_dup 2)])
12149 + [(set (match_operand:SI 0 "register_operand" "")
12150 + (match_operator:SI 5 "logical_shift_operator"
12151 + [(match_operand:SI 1 "register_operand" "")
12152 + (match_operand:SI 2 "immediate_operand" "")]))
12153 + (set (match_operand:SI 3 "register_operand" "")
12154 + (logical:SI (match_dup 0)
12155 + (match_operand:SI 4 "register_operand" "")))]
12156 + "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[3]) == REGNO(operands[0]))"
12158 + [(set (match_dup 3)
12159 + (logical:SI (match_op_dup:SI 5 [(match_dup 1) (match_dup 2)])
12166 +;;=============================================================================
12168 +;;-----------------------------------------------------------------------------
12169 +;; Store the result after a bitwise logical-and between reg0 and reg2 in reg0.
12170 +;;=============================================================================
12172 +(define_insn "andnsi"
12173 + [(set (match_operand:SI 0 "register_operand" "=r")
12174 + (and:SI (match_operand:SI 1 "register_operand" "0")
12175 + (not:SI (match_operand:SI 2 "register_operand" "r"))))]
12178 + [(set_attr "cc" "set_z")
12179 + (set_attr "length" "2")]
12185 +(define_insn "andsi3"
12186 + [(set (match_operand:SI 0 "register_operand" "=r, r, r, r")
12187 + (and:SI (match_operand:SI 1 "register_operand" "%0, r, 0, r")
12188 + (match_operand:SI 2 "nonmemory_operand" "r, M, i, r")))]
12191 + switch (which_alternative){
12193 + return "and\t%0, %2";
12196 + int i, first_set = -1;
12197 + /* Search for first bit set in mask */
12198 + for ( i = 31; i >= 0; --i )
12199 + if ( INTVAL(operands[2]) & (1 << i) ){
12203 + operands[2] = gen_rtx_CONST_INT(SImode, first_set + 1);
12204 + return "bfextu\t%0, %1, 0, %2";
12207 + if ( one_bit_cleared_operand(operands[2], VOIDmode) ){
12209 + for ( bitpos = 0; bitpos < 32; bitpos++ )
12210 + if ( !(INTVAL(operands[2]) & (1 << bitpos)) )
12212 + operands[2] = gen_rtx_CONST_INT(SImode, bitpos);
12213 + return "cbr\t%0, %2";
12214 + } else if ( (INTVAL(operands[2]) >= 0) &&
12215 + (INTVAL(operands[2]) <= 65535) )
12216 + return "andl\t%0, %2, COH";
12217 + else if ( (INTVAL(operands[2]) < 0) &&
12218 + (INTVAL(operands[2]) >= -65536 ) )
12219 + return "andl\t%0, lo(%2)";
12220 + else if ( ((INTVAL(operands[2]) & 0xffff) == 0xffff) )
12221 + return "andh\t%0, hi(%2)";
12222 + else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
12223 + return "andh\t%0, hi(%2), COH";
12225 + return "andh\t%0, hi(%2)\;andl\t%0, lo(%2)";
12227 + return "and\t%0, %1, %2";
12233 + [(set_attr "length" "2,4,8,4")
12234 + (set_attr "cc" "set_z")])
12237 +(define_insn "anddi3"
12238 + [(set (match_operand:DI 0 "register_operand" "=&r,&r")
12239 + (and:DI (match_operand:DI 1 "register_operand" "%0,r")
12240 + (match_operand:DI 2 "register_operand" "r,r")))]
12243 + [(set_attr "length" "8")
12244 + (set_attr "cc" "clobber")]
12247 +;;=============================================================================
12249 +;;-----------------------------------------------------------------------------
12250 +;; Store the result after a bitwise inclusive-or between reg0 and reg2 in reg0.
12251 +;;=============================================================================
12253 +(define_insn "iorsi3"
12254 + [(set (match_operand:SI 0 "register_operand" "=r,r,r")
12255 + (ior:SI (match_operand:SI 1 "register_operand" "%0,0,r" )
12256 + (match_operand:SI 2 "nonmemory_operand" "r ,i,r")))]
12259 + switch (which_alternative){
12261 + return "or\t%0, %2";
12263 + if ( one_bit_set_operand(operands[2], VOIDmode) ){
12265 + for (bitpos = 0; bitpos < 32; bitpos++)
12266 + if (INTVAL(operands[2]) & (1 << bitpos))
12268 + operands[2] = gen_rtx_CONST_INT( SImode, bitpos);
12269 + return "sbr\t%0, %2";
12270 + } else if ( (INTVAL(operands[2]) >= 0) &&
12271 + (INTVAL(operands[2]) <= 65535) )
12272 + return "orl\t%0, %2";
12273 + else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
12274 + return "orh\t%0, hi(%2)";
12276 + return "orh\t%0, hi(%2)\;orl\t%0, lo(%2)";
12278 + return "or\t%0, %1, %2";
12283 + [(set_attr "length" "2,8,4")
12284 + (set_attr "cc" "set_z")])
12287 +;(define_insn "iorsi3"
12288 +; [(set (match_operand:SI 0 "register_operand" "=r, r, r")
12289 +; (ior:SI (match_operand:SI 1 "avr32_logical_insn_operand" "r, r, rA" )
12290 +; (match_operand:SI 2 "register_operand" "0, i, r")))]
12293 +; switch (which_alternative){
12295 +; return "or %0, %2";
12297 +; if ( one_bit_set_operand(operands[2], VOIDmode) ){
12299 +; for ( i = 0; i < 32; i++ )
12300 +; if ( INTVAL(operands[2]) & (1 << i) ){
12304 +; operands[2] = gen_rtx_CONST_INT( SImode, bitpos);
12305 +; return "sbr %0, %2";
12306 +; } else if ( (INTVAL(operands[2]) >= 0) &&
12307 +; (INTVAL(operands[2]) <= 65535) )
12308 +; return "orl %0, %2";
12309 +; else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
12310 +; return "orh %0, hi(%2)";
12312 +; return "orh %0, hi(%2)\;orl %0, lo(%2)";
12314 +; return "or %0, %2, %1";
12317 +; [(set_attr "length" "2,8,4")
12318 +; (set_attr "cc" "set_z")])
12320 +(define_insn "iordi3"
12321 + [(set (match_operand:DI 0 "register_operand" "=&r,&r")
12322 + (ior:DI (match_operand:DI 1 "register_operand" "%0,r")
12323 + (match_operand:DI 2 "register_operand" "r,r")))]
12326 + [(set_attr "length" "8")
12327 + (set_attr "cc" "clobber")]
12330 +;;=============================================================================
12332 +;;-----------------------------------------------------------------------------
12333 +;; Store the result after a bitwise exclusive-or between reg0 and reg2 in reg0.
12334 +;;=============================================================================
12336 +(define_insn "xorsi3"
12337 + [(set (match_operand:SI 0 "register_operand" "=r,r,r")
12338 + (xor:SI (match_operand:SI 1 "register_operand" "0,0,r")
12339 + (match_operand:SI 2 "nonmemory_operand" "r,i,r")))]
12342 + switch (which_alternative){
12344 + return "eor %0, %2";
12346 + if ( (INTVAL(operands[2]) >= 0) &&
12347 + (INTVAL(operands[2]) <= 65535) )
12348 + return "eorl %0, %2";
12349 + else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
12350 + return "eorh %0, hi(%2)";
12352 + return "eorh %0, hi(%2)\;eorl %0, lo(%2)";
12354 + return "eor %0, %1, %2";
12360 + [(set_attr "length" "2,8,4")
12361 + (set_attr "cc" "set_z")])
12363 +(define_insn "xordi3"
12364 + [(set (match_operand:DI 0 "register_operand" "=&r,&r")
12365 + (xor:DI (match_operand:DI 1 "register_operand" "%0,r")
12366 + (match_operand:DI 2 "register_operand" "r,r")))]
12369 + [(set_attr "length" "8")
12370 + (set_attr "cc" "clobber")]
12373 +;;=============================================================================
12375 +;;-----------------------------------------------------------------------------
12376 +;; Signed division that produces both a quotient and a remainder.
12377 +;;=============================================================================
12378 +(define_expand "divmodsi4"
12381 + (set (match_operand:SI 0 "register_operand" "=r")
12382 + (div:SI (match_operand:SI 1 "register_operand" "r")
12383 + (match_operand:SI 2 "register_operand" "r")))
12384 + (set (match_operand:SI 3 "register_operand" "=r")
12385 + (mod:SI (match_dup 1)
12386 + (match_dup 2)))])
12387 + (use (match_dup 4))])]
12390 + if (! no_new_pseudos) {
12391 + operands[4] = gen_reg_rtx (DImode);
12393 + emit_insn(gen_divmodsi4_internal(operands[4],operands[1],operands[2]));
12394 + emit_move_insn(operands[0], gen_rtx_SUBREG( SImode, operands[4], 4));
12395 + emit_move_insn(operands[3], gen_rtx_SUBREG( SImode, operands[4], 0));
12405 +(define_insn "divmodsi4_internal"
12406 + [(set (match_operand:DI 0 "register_operand" "=r")
12407 + (unspec:DI [(match_operand:SI 1 "register_operand" "r")
12408 + (match_operand:SI 2 "register_operand" "r")]
12409 + UNSPEC_DIVMODSI4_INTERNAL))]
12411 + "divs %0, %1, %2"
12412 + [(set_attr "type" "div")
12413 + (set_attr "cc" "none")])
12416 +;;=============================================================================
12418 +;;-----------------------------------------------------------------------------
12419 +;; Unsigned division that produces both a quotient and a remainder.
12420 +;;=============================================================================
12421 +(define_expand "udivmodsi4"
12424 + (set (match_operand:SI 0 "register_operand" "=r")
12425 + (udiv:SI (match_operand:SI 1 "register_operand" "r")
12426 + (match_operand:SI 2 "register_operand" "r")))
12427 + (set (match_operand:SI 3 "register_operand" "=r")
12428 + (umod:SI (match_dup 1)
12429 + (match_dup 2)))])
12430 + (use (match_dup 4))])]
12433 + if (! no_new_pseudos) {
12434 + operands[4] = gen_reg_rtx (DImode);
12436 + emit_insn(gen_udivmodsi4_internal(operands[4],operands[1],operands[2]));
12437 + emit_move_insn(operands[0], gen_rtx_SUBREG( SImode, operands[4], 4));
12438 + emit_move_insn(operands[3], gen_rtx_SUBREG( SImode, operands[4], 0));
12446 +(define_insn "udivmodsi4_internal"
12447 + [(set (match_operand:DI 0 "register_operand" "=r")
12448 + (unspec:DI [(match_operand:SI 1 "register_operand" "r")
12449 + (match_operand:SI 2 "register_operand" "r")]
12450 + UNSPEC_UDIVMODSI4_INTERNAL))]
12452 + "divu %0, %1, %2"
12453 + [(set_attr "type" "div")
12454 + (set_attr "cc" "none")])
12457 +;;=============================================================================
12458 +;; Arithmetic-shift left
12459 +;;-----------------------------------------------------------------------------
12460 +;; Arithmetic-shift reg0 left by reg2 or immediate value.
12461 +;;=============================================================================
12463 +(define_insn "ashlsi3"
12464 + [(set (match_operand:SI 0 "register_operand" "=r,r,r")
12465 + (ashift:SI (match_operand:SI 1 "register_operand" "r,0,r")
12466 + (match_operand:SI 2 "nonmemory_operand" "r,Ku05,Ku05")))]
12472 + [(set_attr "length" "4,2,4")
12473 + (set_attr "cc" "set_ncz")])
12475 +;;=============================================================================
12476 +;; Arithmetic-shift right
12477 +;;-----------------------------------------------------------------------------
12478 +;; Arithmetic-shift reg0 right by an immediate value.
12479 +;;=============================================================================
12481 +(define_insn "ashrsi3"
12482 + [(set (match_operand:SI 0 "register_operand" "=r,r,r")
12483 + (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,0,r")
12484 + (match_operand:SI 2 "nonmemory_operand" "r,Ku05,Ku05")))]
12490 + [(set_attr "length" "4,2,4")
12491 + (set_attr "cc" "set_ncz")])
12493 +;;=============================================================================
12494 +;; Logical shift right
12495 +;;-----------------------------------------------------------------------------
12496 +;; Logical shift reg0 right by an immediate value.
12497 +;;=============================================================================
12499 +(define_insn "lshrsi3"
12500 + [(set (match_operand:SI 0 "register_operand" "=r,r,r")
12501 + (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,0,r")
12502 + (match_operand:SI 2 "nonmemory_operand" "r,Ku05,Ku05")))]
12508 + [(set_attr "length" "4,2,4")
12509 + (set_attr "cc" "set_ncz")])
12512 +;;=============================================================================
12514 +;;-----------------------------------------------------------------------------
12515 +;; Negate operand 1 and store the result in operand 0.
12516 +;;=============================================================================
12517 +(define_insn "negsi2"
12518 + [(set (match_operand:SI 0 "register_operand" "=r")
12519 + (neg:SI (match_operand:SI 1 "register_operand" "0")))]
12522 + [(set_attr "length" "2")
12523 + (set_attr "cc" "set_vncz")])
12525 +;;=============================================================================
12527 +;;-----------------------------------------------------------------------------
12528 +;; Store the absolute value of operand 1 into operand 0.
12529 +;;=============================================================================
12530 +(define_insn "abssi2"
12531 + [(set (match_operand:SI 0 "register_operand" "=r")
12532 + (abs:SI (match_operand:SI 1 "register_operand" "0")))]
12535 + [(set_attr "length" "2")
12536 + (set_attr "cc" "set_z")])
12539 +;;=============================================================================
12541 +;;-----------------------------------------------------------------------------
12542 +;; Store the bitwise-complement of operand 1 into operand 0.
12543 +;;=============================================================================
12545 +(define_insn "one_cmplsi2"
12546 + [(set (match_operand:SI 0 "register_operand" "=r,r")
12547 + (not:SI (match_operand:SI 1 "register_operand" "r,0")))]
12552 + [(set_attr "length" "4,2")
12553 + (set_attr "cc" "set_z")])
12556 +;;=============================================================================
12558 +;;-----------------------------------------------------------------------------
12559 +;; Load a bit into Z and C flags
12560 +;;=============================================================================
12561 +(define_insn "bldsi"
12563 + (and:SI (match_operand:SI 0 "register_operand" "r")
12564 + (match_operand:SI 1 "one_bit_set_operand" "i")))]
12567 + [(set_attr "length" "4")
12568 + (set_attr "cc" "bld")]
12572 +;;=============================================================================
12574 +;;-----------------------------------------------------------------------------
12575 +;; Compare reg0 with reg1 or an immediate value.
12576 +;;=============================================================================
12578 +(define_expand "cmpqi"
12581 + (match_operand:QI 0 "general_operand" "")
12582 + (match_operand:QI 1 "general_operand" "")))]
12586 + if ( GET_CODE(operands[0]) != REG
12587 + && GET_CODE(operands[0]) != SUBREG)
12588 + operands[0] = force_reg(QImode, operands[0]);
12591 + if ( GET_CODE(operands[1]) != REG
12592 + && GET_CODE(operands[1]) != SUBREG )
12593 + operands[1] = force_reg(QImode, operands[1]);
12595 + avr32_compare_op0 = operands[0];
12596 + avr32_compare_op1 = operands[1];
12597 + emit_insn(gen_cmpqi_internal(operands[0], operands[1]));
12603 +(define_insn "cmpqi_internal"
12606 + (match_operand:QI 0 "register_operand" "r")
12607 + (match_operand:QI 1 "register_operand" "r")))]
12610 + set_next_insn_cond(insn,
12611 + avr32_output_cmp(get_next_insn_cond(insn), QImode, operands[0], operands[1]));
12614 + [(set_attr "length" "4")
12615 + (set_attr "cc" "compare")])
12617 +(define_expand "cmphi"
12620 + (match_operand:HI 0 "register_operand" "")
12621 + (match_operand:HI 1 "register_operand" "")))]
12625 + //if ( (GET_CODE(operands[0]) == REG
12626 + // || GET_CODE(operands[0]) == SUBREG)
12627 + // && (GET_CODE(operands[1]) == CONST_INT
12628 + // && avr32_const_ok_for_constraint_p (INTVAL(operands[1]), 'K', \"Ks21\")) ){
12629 + // operands[0] = convert_to_mode(SImode, operands[0], 0);
12630 + // avr32_compare_op0 = operands[0];
12631 + // avr32_compare_op1 = operands[1];
12632 + // emit_insn(gen_cmpsi_internal(operands[0], operands[1]));
12636 + if ( GET_CODE(operands[0]) != REG
12637 + && GET_CODE(operands[0]) != SUBREG )
12638 + operands[0] = force_reg(HImode, operands[0]);
12641 + if ( GET_CODE(operands[1]) != REG
12642 + && GET_CODE(operands[1]) != SUBREG)
12643 + operands[1] = force_reg(HImode, operands[1]);
12645 + avr32_compare_op0 = operands[0];
12646 + avr32_compare_op1 = operands[1];
12651 +(define_insn "cmphi_internal"
12654 + (match_operand:HI 0 "register_operand" "r")
12655 + (match_operand:HI 1 "register_operand" "r")))]
12658 + set_next_insn_cond(insn,
12659 + avr32_output_cmp(get_next_insn_cond(insn), HImode, operands[0], operands[1]));
12662 + [(set_attr "length" "4")
12663 + (set_attr "cc" "compare")])
12666 +(define_expand "cmpsi"
12669 + (match_operand:SI 0 "register_operand" "")
12670 + (match_operand:SI 1 "register_immediate_operand" "")))]
12673 + if ( GET_CODE(operands[0]) != REG
12674 + && GET_CODE(operands[0]) != SUBREG )
12675 + operands[0] = force_reg(SImode, operands[0]);
12677 + if ( GET_CODE(operands[1]) != REG
12678 + && GET_CODE(operands[1]) != SUBREG
12679 + && GET_CODE(operands[1]) != CONST_INT )
12680 + operands[1] = force_reg(SImode, operands[1]);
12682 + avr32_compare_op0 = operands[0];
12683 + avr32_compare_op1 = operands[1];
12689 +(define_insn "cmpsi_internal"
12692 + (match_operand:SI 0 "register_operand" "r, r, r")
12693 + (match_operand:SI 1 "register_immediate_operand" "r, Ks06, Ks21")))]
12696 + set_next_insn_cond(insn,
12697 + avr32_output_cmp(get_next_insn_cond(insn), SImode, operands[0], operands[1]));
12701 + [(set_attr "length" "2,2,4")
12702 + (set_attr "cc" "compare")])
12705 +(define_expand "cmpdi"
12708 + (match_operand:DI 0 "register_operand" "")
12709 + (match_operand:DI 1 "register_immediate_operand" "")))]
12712 + avr32_compare_op0 = operands[0];
12713 + avr32_compare_op1 = operands[1];
12717 +(define_insn "cmpdi_internal"
12720 + (match_operand:DI 0 "register_operand" "r")
12721 + (match_operand:DI 1 "register_immediate_operand" "rKu20")))]
12724 + set_next_insn_cond(insn,
12725 + avr32_output_cmp(get_next_insn_cond(insn), DImode, operands[0], operands[1]));
12729 + [(set_attr "length" "6")
12730 + (set_attr "type" "alu2")
12731 + (set_attr "cc" "compare")])
12735 +;;=============================================================================
12737 +;;-----------------------------------------------------------------------------
12738 +;; Compare reg against zero and set the condition codes.
12739 +;;=============================================================================
12742 +(define_expand "tstsi"
12744 + (match_operand:SI 0 "register_operand" ""))]
12747 + avr32_compare_op0 = operands[0];
12748 + avr32_compare_op1 = const0_rtx;
12752 +(define_insn "tstsi_internal"
12754 + (match_operand:SI 0 "register_operand" "r"))]
12757 + set_next_insn_cond(insn,
12758 + avr32_output_cmp(get_next_insn_cond(insn), SImode, operands[0], const0_rtx));
12762 + [(set_attr "length" "2")
12763 + (set_attr "cc" "compare")])
12766 +(define_expand "tstdi"
12768 + (match_operand:DI 0 "register_operand" ""))]
12771 + avr32_compare_op0 = operands[0];
12772 + avr32_compare_op1 = const0_rtx;
12776 +(define_insn "tstdi_internal"
12778 + (match_operand:DI 0 "register_operand" "r"))]
12781 + set_next_insn_cond(insn,
12782 + avr32_output_cmp(get_next_insn_cond(insn), DImode, operands[0], const0_rtx));
12785 + [(set_attr "length" "4")
12786 + (set_attr "type" "alu2")
12787 + (set_attr "cc" "compare")])
12791 +;;=============================================================================
12792 +;; Convert operands
12793 +;;-----------------------------------------------------------------------------
12795 +;;=============================================================================
12796 +(define_insn "truncdisi2"
12797 + [(set (match_operand:SI 0 "general_operand" "")
12798 + (truncate:SI (match_operand:DI 1 "general_operand" "")))]
12802 +;;=============================================================================
12804 +;;-----------------------------------------------------------------------------
12806 +;;=============================================================================
12809 +(define_insn "extendhisi2"
12810 + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
12811 + (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
12814 + switch ( which_alternative ){
12816 + return "casts.h\t%0";
12818 + return "bfexts\t%0, %1, 0, 16";
12821 + return "ld.sh\t%0, %1";
12826 + [(set_attr "length" "2,4,2,4")
12827 + (set_attr "cc" "set_ncz,set_ncz,none,none")
12828 + (set_attr "type" "alu,alu,load_rm,load_rm")])
12830 +(define_insn "extendqisi2"
12831 + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
12832 + (sign_extend:SI (match_operand:QI 1 "extendqi_operand" "0,r,RKu00,m")))]
12835 + switch ( which_alternative ){
12837 + return "casts.b\t%0";
12839 + return "bfexts\t%0, %1, 0, 8";
12842 + return "ld.sb\t%0, %1";
12847 + [(set_attr "length" "2,4,2,4")
12848 + (set_attr "cc" "set_ncz,set_ncz,none,none")
12849 + (set_attr "type" "alu,alu,load_rm,load_rm")])
12851 +(define_insn "extendqihi2"
12852 + [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
12853 + (sign_extend:HI (match_operand:QI 1 "extendqi_operand" "0,r,RKu00,m")))]
12856 + switch ( which_alternative ){
12858 + return "casts.b\t%0";
12860 + return "bfexts\t%0, %1, 0, 8";
12863 + return "ld.sb\t%0, %1";
12868 + [(set_attr "length" "2,4,2,4")
12869 + (set_attr "cc" "set_ncz,set_ncz,none,none")
12870 + (set_attr "type" "alu,alu,load_rm,load_rm")])
12873 +;;=============================================================================
12875 +;;-----------------------------------------------------------------------------
12877 +;;=============================================================================
12879 +(define_insn "zero_extendhisi2"
12880 + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
12881 + (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
12884 + switch ( which_alternative ){
12886 + return "castu.h\t%0";
12888 + return "bfextu\t%0, %1, 0, 16";
12891 + return "ld.uh\t%0, %1";
12897 + [(set_attr "length" "2,4,2,4")
12898 + (set_attr "cc" "set_ncz,set_ncz,none,none")
12899 + (set_attr "type" "alu,alu,load_rm,load_rm")])
12901 +(define_insn "zero_extendqisi2"
12902 + [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
12903 + (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
12906 + switch ( which_alternative ){
12908 + return "castu.b\t%0";
12910 + return "bfextu\t%0, %1, 0, 8";
12913 + return "ld.ub\t%0, %1";
12918 + [(set_attr "length" "2,4,2,4")
12919 + (set_attr "cc" "set_ncz, set_ncz, none, none")
12920 + (set_attr "type" "alu, alu, load_rm, load_rm")])
12922 +(define_insn "zero_extendqihi2"
12923 + [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
12924 + (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
12927 + switch ( which_alternative ){
12929 + return "castu.b\t%0";
12931 + return "bfextu\t%0, %1, 0, 8";
12934 + return "ld.ub\t%0, %1";
12939 + [(set_attr "length" "2,4,2,4")
12940 + (set_attr "cc" "set_ncz, set_ncz, none, none")
12941 + (set_attr "type" "alu, alu, load_rm, load_rm")])
12945 +;;=============================================================================
12946 +;; Conditional set register
12948 +;;-----------------------------------------------------------------------------
12950 +;;Because of the same issue as with conditional moves and adds we must
12951 +;;not separate the compare instrcution from the scc instruction as
12952 +;;they might be sheduled "badly".
12954 +(define_insn "s<code>"
12955 + [(set (match_operand:SI 0 "register_operand" "=r")
12956 + (any_cond:SI (cc0)
12960 + [(set_attr "length" "2")
12961 + (set_attr "cc" "none")])
12963 +(define_insn "smi"
12964 + [(set (match_operand:SI 0 "register_operand" "=r")
12965 + (unspec:SI [(cc0)
12966 + (const_int 0)] UNSPEC_COND_MI))]
12969 + [(set_attr "length" "2")
12970 + (set_attr "cc" "none")])
12972 +(define_insn "spl"
12973 + [(set (match_operand:SI 0 "register_operand" "=r")
12974 + (unspec:SI [(cc0)
12975 + (const_int 0)] UNSPEC_COND_PL))]
12978 + [(set_attr "length" "2")
12979 + (set_attr "cc" "none")])
12982 +;;=============================================================================
12983 +;; Conditional branch
12984 +;;-----------------------------------------------------------------------------
12985 +;; Branch to label if the specified condition codes are set.
12986 +;;=============================================================================
12987 +; branch if negative
12988 +(define_insn "bmi"
12990 + (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_MI)
12991 + (label_ref (match_operand 0 "" ""))
12995 + [(set_attr "type" "branch")
12996 + (set (attr "length")
12997 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
12998 + (le (minus (pc) (match_dup 0)) (const_int 256)))
12999 + (const_int 2)] ; use compact branch
13000 + (const_int 4))) ; use extended branch
13001 + (set_attr "cc" "none")])
13003 +(define_insn "*bmi-reverse"
13005 + (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_MI)
13007 + (label_ref (match_operand 0 "" ""))))]
13010 + [(set_attr "type" "branch")
13011 + (set (attr "length")
13012 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13013 + (le (minus (pc) (match_dup 0)) (const_int 256)))
13014 + (const_int 2)] ; use compact branch
13015 + (const_int 4))) ; use extended branch
13016 + (set_attr "cc" "none")])
13018 +; branch if positive
13019 +(define_insn "bpl"
13021 + (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_PL)
13022 + (label_ref (match_operand 0 "" ""))
13026 + [(set_attr "type" "branch")
13027 + (set (attr "length")
13028 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13029 + (le (minus (pc) (match_dup 0)) (const_int 256)))
13030 + (const_int 2)] ; use compact branch
13031 + (const_int 4))) ; use extended branch
13032 + (set_attr "cc" "none")])
13034 +(define_insn "*bpl-reverse"
13036 + (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_PL)
13038 + (label_ref (match_operand 0 "" ""))))]
13041 + [(set_attr "type" "branch")
13042 + (set (attr "length")
13043 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13044 + (le (minus (pc) (match_dup 0)) (const_int 256)))
13045 + (const_int 2)] ; use compact branch
13046 + (const_int 4))) ; use extended branch
13047 + (set_attr "cc" "none")])
13050 +(define_insn "b<code>"
13052 + (if_then_else (any_cond:CC (cc0)
13054 + (label_ref (match_operand 0 "" ""))
13058 + [(set_attr "type" "branch")
13059 + (set (attr "length")
13060 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13061 + (le (minus (pc) (match_dup 0)) (const_int 256)))
13062 + (const_int 2)] ; use compact branch
13063 + (const_int 4))) ; use extended branch
13064 + (set_attr "cc" "none")])
13067 +(define_insn "*b<code>-reverse"
13069 + (if_then_else (any_cond:CC (cc0)
13072 + (label_ref (match_operand 0 "" ""))))]
13074 + "br<invcond> %0 "
13075 + [(set_attr "type" "branch")
13076 + (set (attr "length")
13077 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13078 + (le (minus (pc) (match_dup 0)) (const_int 256)))
13079 + (const_int 2)] ; use compact branch
13080 + (const_int 4))) ; use extended branch
13081 + (set_attr "cc" "none")])
13085 +;=============================================================================
13086 +; Conditional Add/Subtract
13087 +;-----------------------------------------------------------------------------
13088 +; sub{cond4} Rd, imm
13089 +;=============================================================================
13092 +(define_expand "add<mode>cc"
13093 + [(set (match_operand:ADDCC 0 "register_operand" "")
13094 + (if_then_else:ADDCC (match_operator 1 "avr32_comparison_operator"
13097 + (match_operand:ADDCC 2 "register_operand" "")
13100 + (match_operand:ADDCC 3 "avr32_cond_immediate_operand" ""))))]
13103 + /* Delete compare instruction as it is merged into this instruction */
13104 + remove_insn (get_last_insn_anywhere ());
13106 + operands[4] = avr32_compare_op0;
13107 + operands[5] = avr32_compare_op1;
13112 +(define_insn "add<ADDCC:mode>cc_cmp<CMP:mode>"
13113 + [(set (match_operand:ADDCC 0 "register_operand" "=r")
13114 + (if_then_else:ADDCC (match_operator 1 "avr32_comparison_operator"
13115 + [(match_operand:CMP 4 "register_operand" "r")
13116 + (match_operand:CMP 5 "<CMP:cmp_predicate>" "<CMP:cmp_constraint>")])
13117 + (match_operand:ADDCC 2 "register_operand" "0")
13120 + (match_operand:ADDCC 3 "avr32_cond_immediate_operand" "Is08"))))]
13123 + operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[4]), operands[4], operands[5]);
13125 + return "sub%i1\t%0, -%3";
13127 + [(set_attr "length" "8")
13128 + (set_attr "cc" "cmp_cond_insn")])
13130 +;=============================================================================
13131 +; Conditional Move
13132 +;-----------------------------------------------------------------------------
13133 +; mov{cond4} Rd, (Rs/imm)
13134 +;=============================================================================
13135 +(define_expand "mov<mode>cc"
13136 + [(set (match_operand:MOVCC 0 "register_operand" "")
13137 + (if_then_else:MOVCC (match_operator 1 "avr32_comparison_operator"
13140 + (match_operand:MOVCC 2 "avr32_cond_register_immediate_operand" "")
13141 + (match_operand:MOVCC 3 "avr32_cond_register_immediate_operand" "")))]
13144 + /* Delete compare instruction as it is merged into this instruction */
13145 + remove_insn (get_last_insn_anywhere ());
13147 + operands[4] = avr32_compare_op0;
13148 + operands[5] = avr32_compare_op1;
13153 +(define_insn "mov<MOVCC:mode>cc_cmp<CMP:mode>"
13154 + [(set (match_operand:MOVCC 0 "register_operand" "=r,r,r")
13155 + (if_then_else:MOVCC (match_operator 1 "avr32_comparison_operator"
13156 + [(match_operand:CMP 4 "register_operand" "r,r,r")
13157 + (match_operand:CMP 5 "<CMP:cmp_predicate>" "<CMP:cmp_constraint>,<CMP:cmp_constraint>,<CMP:cmp_constraint>")])
13158 + (match_operand:MOVCC 2 "avr32_cond_register_immediate_operand" "0, rKs08,rKs08")
13159 + (match_operand:MOVCC 3 "avr32_cond_register_immediate_operand" "rKs08,0,rKs08")))]
13162 + operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[4]), operands[4], operands[5]);
13164 + switch( which_alternative ){
13166 + return "mov%i1 %0, %3";
13168 + return "mov%1 %0, %2";
13170 + return "mov%1 %0, %2\;mov%i1 %0, %3";
13177 + [(set_attr "length" "8,8,12")
13178 + (set_attr "cc" "cmp_cond_insn")])
13181 +;;=============================================================================
13183 +;;-----------------------------------------------------------------------------
13184 +;; Jump inside a function; an unconditional branch to a label.
13185 +;;=============================================================================
13186 +(define_insn "jump"
13188 + (label_ref (match_operand 0 "" "")))]
13191 + if (get_attr_length(insn) > 4)
13192 + return "Can't jump this far";
13193 + return (get_attr_length(insn) == 2 ?
13194 + "rjmp %0" : "bral %0");
13196 + [(set_attr "type" "branch")
13197 + (set (attr "length")
13198 + (cond [(and (le (minus (match_dup 0) (pc)) (const_int 1022))
13199 + (le (minus (pc) (match_dup 0)) (const_int 1024)))
13200 + (const_int 2) ; use rjmp
13201 + (le (match_dup 0) (const_int 1048575))
13202 + (const_int 4)] ; use bral
13203 + (const_int 8))) ; do something else
13204 + (set_attr "cc" "none")])
13206 +;;=============================================================================
13208 +;;-----------------------------------------------------------------------------
13209 +;; Subroutine call instruction returning no value.
13210 +;;=============================================================================
13211 +(define_insn "call_internal"
13212 + [(parallel [(call (mem:SI (match_operand:SI 0 "avr32_call_operand" "r,U,T,W"))
13213 + (match_operand 1 "" ""))
13214 + (clobber (reg:SI LR_REGNUM))])]
13217 + switch (which_alternative){
13219 + return "icall\t%0";
13221 + return "rcall\t%0";
13223 + return "mcall\t%0";
13225 + if ( TARGET_HAS_ASM_ADDR_PSEUDOS )
13226 + return "call\t%0";
13228 + return "mcall\tr6[%0@got]";
13233 + [(set_attr "type" "call")
13234 + (set_attr "length" "2,4,4,10")
13235 + (set_attr "cc" "clobber")])
13238 +(define_expand "call"
13239 + [(parallel [(call (match_operand:SI 0 "" "")
13240 + (match_operand 1 "" ""))
13241 + (clobber (reg:SI LR_REGNUM))])]
13244 + rtx call_address;
13245 + if ( GET_CODE(operands[0]) != MEM )
13248 + call_address = XEXP(operands[0], 0);
13250 + /* If assembler supports call pseudo insn and the call
13251 + address is a symbol then nothing special needs to be done. */
13252 + if ( TARGET_HAS_ASM_ADDR_PSEUDOS
13253 + && (GET_CODE(call_address) == SYMBOL_REF) ){
13254 + /* We must however mark the function as using the GOT if
13255 + flag_pic is set, since the call insn might turn into
13256 + a mcall using the GOT ptr register. */
13258 + current_function_uses_pic_offset_table = 1;
13259 + emit_call_insn(gen_call_internal(call_address, operands[1]));
13264 + GET_CODE(call_address) == SYMBOL_REF ){
13265 + current_function_uses_pic_offset_table = 1;
13266 + emit_call_insn(gen_call_internal(call_address, operands[1]));
13270 + if ( !SYMBOL_REF_RCALL_FUNCTION_P(operands[0]) ){
13271 + if ( optimize_size &&
13272 + GET_CODE(call_address) == SYMBOL_REF ){
13273 + call_address = force_const_mem(SImode, call_address);
13275 + call_address = force_reg(SImode, call_address);
13279 + emit_call_insn(gen_call_internal(call_address, operands[1]));
13284 +;;=============================================================================
13286 +;;-----------------------------------------------------------------------------
13287 +;; Subrutine call instruction returning a value.
13288 +;;=============================================================================
13289 +(define_expand "call_value"
13290 + [(parallel [(set (match_operand:SI 0 "" "")
13291 + (call (match_operand:SI 1 "" "")
13292 + (match_operand 2 "" "")))
13293 + (clobber (reg:SI LR_REGNUM))])]
13296 + rtx call_address;
13297 + if ( GET_CODE(operands[1]) != MEM )
13300 + call_address = XEXP(operands[1], 0);
13302 + /* If assembler supports call pseudo insn and the call
13303 + address is a symbol then nothing special needs to be done. */
13304 + if ( TARGET_HAS_ASM_ADDR_PSEUDOS
13305 + && (GET_CODE(call_address) == SYMBOL_REF) ){
13306 + /* We must however mark the function as using the GOT if
13307 + flag_pic is set, since the call insn might turn into
13308 + a mcall using the GOT ptr register. */
13309 + if ( flag_pic ) {
13310 + current_function_uses_pic_offset_table = 1;
13311 + emit_call_insn(gen_call_value_internal(operands[0], call_address, operands[2]));
13316 + GET_CODE(call_address) == SYMBOL_REF ){
13317 + current_function_uses_pic_offset_table = 1;
13318 + emit_call_insn(gen_call_value_internal(operands[0], call_address, operands[2]));
13322 + if ( !SYMBOL_REF_RCALL_FUNCTION_P(operands[1]) ){
13323 + if ( optimize_size &&
13324 + GET_CODE(call_address) == SYMBOL_REF){
13325 + call_address = force_const_mem(SImode, call_address);
13327 + call_address = force_reg(SImode, call_address);
13331 + emit_call_insn(gen_call_value_internal(operands[0], call_address,
13337 +(define_insn "call_value_internal"
13338 + [(parallel [(set (match_operand 0 "register_operand" "=r,r,r,r")
13339 + (call (mem:SI (match_operand:SI 1 "avr32_call_operand" "r,U,T,W"))
13340 + (match_operand 2 "" "")))
13341 + (clobber (reg:SI LR_REGNUM))])]
13342 + ;; Operand 2 not used on the AVR32.
13345 + switch (which_alternative){
13347 + return "icall\t%1";
13349 + return "rcall\t%1";
13351 + return "mcall\t%1";
13353 + if ( TARGET_HAS_ASM_ADDR_PSEUDOS )
13354 + return "call\t%1";
13356 + return "mcall\tr6[%1@got]";
13361 + [(set_attr "type" "call")
13362 + (set_attr "length" "2,4,4,10")
13363 + (set_attr "cc" "call_set")])
13366 +;;=============================================================================
13368 +;;-----------------------------------------------------------------------------
13369 +;; Subrutine call instruction returning a value of any type.
13370 +;; The code is copied from m68k.md (except gen_blockage is removed)
13372 +;;=============================================================================
13373 +(define_expand "untyped_call"
13374 + [(parallel [(call (match_operand 0 "avr32_call_operand" "")
13376 + (match_operand 1 "" "")
13377 + (match_operand 2 "" "")])]
13382 + emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
13384 + for (i = 0; i < XVECLEN (operands[2], 0); i++) {
13385 + rtx set = XVECEXP (operands[2], 0, i);
13386 + emit_move_insn (SET_DEST (set), SET_SRC (set));
13389 + /* The optimizer does not know that the call sets the function value
13390 + registers we stored in the result block. We avoid problems by
13391 + claiming that all hard registers are used and clobbered at this
13393 + emit_insn (gen_blockage ());
13399 +;;=============================================================================
13401 +;;=============================================================================
13403 +(define_insn "return"
13405 + "USE_RETURN_INSN (FALSE)"
13407 + avr32_output_return_instruction(TRUE, FALSE, NULL, NULL);
13410 + [(set_attr "length" "4")
13411 + (set_attr "type" "call")]
13414 +(define_insn "return_cond"
13416 + (if_then_else (match_operand 0 "avr32_comparison_operand" "")
13419 + "USE_RETURN_INSN (TRUE)"
13421 + [(set_attr "type" "call")])
13424 +(define_insn "return_imm"
13425 + [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
13426 + (use (reg RETVAL_REGNUM))
13428 + "USE_RETURN_INSN (FALSE) &&
13429 + ((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
13431 + avr32_output_return_instruction(TRUE, FALSE, NULL, operands[0]);
13434 + [(set_attr "length" "4")
13435 + (set_attr "type" "call")]
13438 +(define_insn "return_imm_cond"
13439 + [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
13440 + (use (reg RETVAL_REGNUM))
13442 + (if_then_else (match_operand 1 "avr32_comparison_operand" "")
13445 + "USE_RETURN_INSN (TRUE) &&
13446 + ((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
13448 + [(set_attr "type" "call")]
13451 +(define_insn "return_<mode>reg"
13452 + [(set (reg RETVAL_REGNUM) (match_operand:MOVM 0 "register_operand" "r"))
13453 + (use (reg RETVAL_REGNUM))
13455 + "USE_RETURN_INSN (TRUE)"
13457 + [(set_attr "type" "call")]
13460 +(define_insn "return_<mode>reg_cond"
13461 + [(set (reg RETVAL_REGNUM) (match_operand:MOVM 0 "register_operand" "r"))
13462 + (use (reg RETVAL_REGNUM))
13464 + (if_then_else (match_operator 1 "avr32_comparison_operator"
13465 + [(cc0) (const_int 0)])
13468 + "USE_RETURN_INSN (TRUE)"
13470 + [(set_attr "type" "call")])
13472 +;;=============================================================================
13474 +;;-----------------------------------------------------------------------------
13475 +;; No-op instruction.
13476 +;;=============================================================================
13477 +(define_insn "nop"
13481 + [(set_attr "length" "2")
13482 + (set_attr "type" "alu")
13483 + (set_attr "cc" "none")])
13485 +;;=============================================================================
13486 +;; nonlocal_goto_receiver
13487 +;;-----------------------------------------------------------------------------
13488 +;; For targets with a return stack we must make sure to flush the return stack
13489 +;; since it will be corrupt after a nonlocal goto.
13490 +;;=============================================================================
13491 +(define_expand "nonlocal_goto_receiver"
13493 + "TARGET_RETURN_STACK"
13496 + emit_insn ( gen_frs() );
13503 +;;=============================================================================
13504 +;; builtin_setjmp_receiver
13505 +;;-----------------------------------------------------------------------------
13506 +;; For pic code we need to reload the pic register.
13507 +;; For targets with a return stack we must make sure to flush the return stack
13508 +;; since it will probably be corrupted.
13509 +;;=============================================================================
13510 +(define_expand "builtin_setjmp_receiver"
13511 + [(label_ref (match_operand 0 "" ""))]
13515 + if ( TARGET_RETURN_STACK )
13516 + emit_insn ( gen_frs() );
13517 + avr32_load_pic_register ();
13524 +;;=============================================================================
13526 +;;-----------------------------------------------------------------------------
13527 +;; Jump to an address in reg or memory.
13528 +;;=============================================================================
13529 +(define_expand "indirect_jump"
13531 + (match_operand:SI 0 "general_operand" ""))]
13534 + /* One of the ops has to be in a register. */
13535 + if ( (flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS )
13536 + && !avr32_legitimate_pic_operand_p(operands[0]) )
13537 + operands[0] = legitimize_pic_address (operands[0], SImode, 0);
13538 + else if ( flag_pic && avr32_address_operand(operands[0], GET_MODE(operands[0])) )
13539 + /* If we have an address operand then this function uses the pic register. */
13540 + current_function_uses_pic_offset_table = 1;
13544 +(define_insn "indirect_jump_internal"
13546 + (match_operand:SI 0 "general_operand" "r,m,W"))]
13549 + switch( which_alternative ){
13551 + return "mov\tpc, %0";
13553 + if ( avr32_const_pool_ref_operand(operands[0], GET_MODE(operands[0])) )
13554 + return "lddpc\tpc, %0";
13556 + return "ld.w\tpc, %0";
13559 + return "ld.w\tpc, r6[%0@got]";
13561 + return "lda.w\tpc, %0";
13566 + [(set_attr "length" "2,4,8")
13567 + (set_attr "type" "call,call,call")
13568 + (set_attr "cc" "none,none,clobber")])
13571 +;;=============================================================================
13572 +;; casesi and tablejump
13573 +;;=============================================================================
13574 +(define_insn "tablejump_add"
13576 + (plus:SI (match_operand:SI 0 "register_operand" "r")
13577 + (mult:SI (match_operand:SI 1 "register_operand" "r")
13578 + (match_operand:SI 2 "immediate_operand" "Ku04" ))))
13579 + (use (label_ref (match_operand 3 "" "")))]
13581 + ((INTVAL(operands[2]) == 0) || (INTVAL(operands[2]) == 2) ||
13582 + (INTVAL(operands[2]) == 4) || (INTVAL(operands[2]) == 8))"
13583 + "add\tpc, %0, %1 << %p2"
13584 + [(set_attr "length" "4")
13585 + (set_attr "cc" "clobber")])
13587 +(define_insn "tablejump_insn"
13588 + [(set (pc) (match_operand:SI 0 "memory_operand" "m"))
13589 + (use (label_ref (match_operand 1 "" "")))]
13592 + [(set_attr "length" "4")
13593 + (set_attr "type" "call")
13594 + (set_attr "cc" "none")])
13596 +(define_expand "casesi"
13597 + [(match_operand:SI 0 "register_operand" "") ; index to jump on
13598 + (match_operand:SI 1 "const_int_operand" "") ; lower bound
13599 + (match_operand:SI 2 "const_int_operand" "") ; total range
13600 + (match_operand:SI 3 "" "") ; table label
13601 + (match_operand:SI 4 "" "")] ; Out of range label
13606 + rtx index = operands[0];
13607 + rtx low_bound = operands[1];
13608 + rtx range = operands[2];
13609 + rtx table_label = operands[3];
13610 + rtx oor_label = operands[4];
13612 + if (low_bound != const0_rtx)
13614 + if (!avr32_const_ok_for_constraint_p(INTVAL (low_bound), 'I', \"Is21\")){
13615 + reg = force_reg(SImode, GEN_INT (INTVAL (low_bound)));
13616 + emit_insn (gen_subsi3 (reg, index,
13619 + reg = gen_reg_rtx (SImode);
13620 + emit_insn (gen_addsi3 (reg, index,
13621 + GEN_INT (-INTVAL (low_bound))));
13626 + if (!avr32_const_ok_for_constraint_p (INTVAL (range), 'K', \"Ks21\"))
13627 + range = force_reg (SImode, range);
13629 + emit_cmp_and_jump_insns ( index, range, GTU, NULL_RTX, SImode, 1, oor_label );
13630 + reg = gen_reg_rtx (SImode);
13631 + emit_move_insn ( reg, gen_rtx_LABEL_REF (VOIDmode, table_label));
13634 + emit_jump_insn ( gen_tablejump_add ( reg, index, GEN_INT(4), table_label));
13637 + gen_tablejump_insn ( gen_rtx_MEM ( SImode,
13638 + gen_rtx_PLUS ( SImode,
13640 + gen_rtx_MULT ( SImode,
13650 +(define_insn "prefetch"
13651 + [(prefetch (match_operand:SI 0 "register_operand" "r")
13652 + (match_operand 1 "const_int_operand" "")
13653 + (match_operand 2 "const_int_operand" ""))]
13656 + return "pref\t%0[0]";
13659 + [(set_attr "length" "4")
13660 + (set_attr "type" "load")
13661 + (set_attr "cc" "none")])
13665 +;;=============================================================================
13667 +;;-----------------------------------------------------------------------------
13668 +;; This pattern, if defined, emits RTL for entry to a function. The function
13669 +;; entry i responsible for setting up the stack frame, initializing the frame
13670 +;; pointer register, saving callee saved registers, etc.
13671 +;;=============================================================================
13672 +(define_expand "prologue"
13673 + [(clobber (const_int 0))]
13676 + avr32_expand_prologue();
13681 +;;=============================================================================
13683 +;;-----------------------------------------------------------------------------
13684 +;; This pattern, if defined, affects the way __builtin_eh_return, and
13685 +;; thence the call frame exception handling library routines, are
13686 +;; built. It is intended to handle non-trivial actions needed along
13687 +;; the abnormal return path.
13689 +;; The address of the exception handler to which the function should
13690 +;; return is passed as operand to this pattern. It will normally need
13691 +;; to copied by the pattern to some special register or memory
13692 +;; location. If the pattern needs to determine the location of the
13693 +;; target call frame in order to do so, it may use
13694 +;; EH_RETURN_STACKADJ_RTX, if defined; it will have already been
13697 +;; If this pattern is not defined, the default action will be to
13698 +;; simply copy the return address to EH_RETURN_HANDLER_RTX. Either
13699 +;; that macro or this pattern needs to be defined if call frame
13700 +;; exception handling is to be used.
13702 +;; We can't expand this before we know where the link register is stored.
13703 +(define_insn_and_split "eh_return"
13704 + [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
13705 + VUNSPEC_EH_RETURN)
13706 + (clobber (match_scratch:SI 1 "=&r"))]
13709 + "reload_completed"
13713 + avr32_set_return_address (operands[0], operands[1]);
13718 +;;=============================================================================
13720 +;;-----------------------------------------------------------------------------
13721 +(define_insn "ffssi2"
13722 + [ (set (match_operand:SI 0 "register_operand" "=r")
13723 + (ffs:SI (match_operand:SI 1 "register_operand" "r"))) ]
13731 + [(set_attr "length" "18")
13732 + (set_attr "cc" "clobber")]
13737 +;;=============================================================================
13739 +;;-----------------------------------------------------------------------------
13740 +(define_insn "*swap_h"
13741 + [ (set (match_operand:SI 0 "register_operand" "=r")
13742 + (ior:SI (ashift:SI (match_dup 0) (const_int 16))
13743 + (lshiftrt:SI (match_dup 0) (const_int 16))))]
13746 + [(set_attr "length" "2")]
13749 +(define_insn_and_split "bswap_16"
13750 + [ (set (match_operand:HI 0 "avr32_bswap_operand" "=r,RKs13,r")
13751 + (ior:HI (and:HI (lshiftrt:HI (match_operand:HI 1 "avr32_bswap_operand" "r,r,RKs13")
13754 + (ashift:HI (and:HI (match_dup 1)
13756 + (const_int 8))))]
13759 + switch ( which_alternative ){
13761 + if ( REGNO(operands[0]) == REGNO(operands[1]))
13762 + return "swap.bh\t%0";
13764 + return "mov\t%0, %1\;swap.bh\t%0";
13766 + return "stswp.h\t%0, %1";
13768 + return "ldswp.sh\t%0, %1";
13774 + "(reload_completed &&
13775 + REG_P(operands[0]) && REG_P(operands[1])
13776 + && (REGNO(operands[0]) != REGNO(operands[1])))"
13777 + [(set (match_dup 0) (match_dup 1))
13778 + (set (match_dup 0)
13779 + (ior:HI (and:HI (lshiftrt:HI (match_dup 0)
13782 + (ashift:HI (and:HI (match_dup 0)
13784 + (const_int 8))))]
13787 + [(set_attr "length" "4,4,4")
13788 + (set_attr "type" "alu,store,load_rm")]
13791 +(define_insn_and_split "bswap_32"
13792 + [ (set (match_operand:SI 0 "avr32_bswap_operand" "=r,RKs14,r")
13793 + (ior:SI (ior:SI (lshiftrt:SI (and:SI (match_operand:SI 1 "avr32_bswap_operand" "=r,r,RKs14")
13794 + (const_int 4278190080))
13796 + (lshiftrt:SI (and:SI (match_dup 1)
13797 + (const_int 16711680))
13799 + (ior:SI (ashift:SI (and:SI (match_dup 1)
13800 + (const_int 65280))
13802 + (ashift:SI (and:SI (match_dup 1)
13804 + (const_int 24)))))]
13807 + switch ( which_alternative ){
13809 + if ( REGNO(operands[0]) == REGNO(operands[1]))
13810 + return "swap.b\t%0";
13812 + return "mov\t%0, %1\;swap.b\t%0";
13814 + return "stswp.w\t%0, %1";
13816 + return "ldswp.w\t%0, %1";
13821 + "(reload_completed &&
13822 + REG_P(operands[0]) && REG_P(operands[1])
13823 + && (REGNO(operands[0]) != REGNO(operands[1])))"
13824 + [(set (match_dup 0) (match_dup 1))
13825 + (set (match_dup 0)
13826 + (ior:SI (ior:SI (lshiftrt:SI (and:SI (match_dup 0)
13827 + (const_int 4278190080))
13829 + (lshiftrt:SI (and:SI (match_dup 0)
13830 + (const_int 16711680))
13832 + (ior:SI (ashift:SI (and:SI (match_dup 0)
13833 + (const_int 65280))
13835 + (ashift:SI (and:SI (match_dup 0)
13837 + (const_int 24)))))]
13840 + [(set_attr "length" "4,4,4")
13841 + (set_attr "type" "alu,store,load_rm")]
13845 +;;=============================================================================
13847 +;;-----------------------------------------------------------------------------
13848 +;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13849 +;; all of memory. This blocks insns from being moved across this point.
13851 +(define_insn "blockage"
13852 + [(unspec_volatile [(const_int 0)] VUNSPEC_BLOCKAGE)]
13855 + [(set_attr "length" "0")]
13858 +;;=============================================================================
13860 +;;-----------------------------------------------------------------------------
13861 +(define_insn "clzsi2"
13862 + [ (set (match_operand:SI 0 "register_operand" "=r")
13863 + (clz:SI (match_operand:SI 1 "register_operand" "r"))) ]
13866 + [(set_attr "length" "4")
13867 + (set_attr "cc" "set_z")]
13870 +;;=============================================================================
13872 +;;-----------------------------------------------------------------------------
13873 +(define_insn "ctzsi2"
13874 + [ (set (match_operand:SI 0 "register_operand" "=r,r")
13875 + (ctz:SI (match_operand:SI 1 "register_operand" "0,r"))) ]
13878 + brev\t%0\;clz\t%0, %0
13879 + mov\t%0, %1\;brev\t%0\;clz\t%0, %0"
13880 + [(set_attr "length" "8")
13881 + (set_attr "cc" "set_z")]
13884 +;;=============================================================================
13885 +;; cache instructions
13886 +;;-----------------------------------------------------------------------------
13887 +(define_insn "cache"
13888 + [ (unspec_volatile [(match_operand:SI 0 "register_operand" "r")
13889 + (match_operand:SI 1 "immediate_operand" "Ku05")] VUNSPEC_CACHE)]
13891 + "cache %0[0], %1"
13892 + [(set_attr "length" "4")]
13895 +(define_insn "sync"
13896 + [ (unspec_volatile [(match_operand:SI 0 "immediate_operand" "Ku08")] VUNSPEC_SYNC)]
13899 + [(set_attr "length" "4")]
13902 +;;=============================================================================
13903 +;; TLB instructions
13904 +;;-----------------------------------------------------------------------------
13905 +(define_insn "tlbr"
13906 + [ (unspec_volatile [(const_int 0)] VUNSPEC_TLBR)]
13909 + [(set_attr "length" "2")]
13912 +(define_insn "tlbw"
13913 + [ (unspec_volatile [(const_int 0)] VUNSPEC_TLBW)]
13916 + [(set_attr "length" "2")]
13919 +(define_insn "tlbs"
13920 + [ (unspec_volatile [(const_int 0)] VUNSPEC_TLBS)]
13923 + [(set_attr "length" "2")]
13926 +;;=============================================================================
13927 +;; Breakpoint instruction
13928 +;;-----------------------------------------------------------------------------
13929 +(define_insn "breakpoint"
13930 + [ (unspec_volatile [(const_int 0)] VUNSPEC_BREAKPOINT)]
13933 + [(set_attr "length" "2")]
13937 +;;=============================================================================
13938 +;; mtsr/mfsr instruction
13939 +;;-----------------------------------------------------------------------------
13940 +(define_insn "mtsr"
13941 + [ (unspec_volatile [(match_operand 0 "immediate_operand" "i")
13942 + (match_operand:SI 1 "register_operand" "r")] VUNSPEC_MTSR)]
13945 + [(set_attr "length" "4")]
13948 +(define_insn "mfsr"
13949 + [ (set (match_operand:SI 0 "register_operand" "=r")
13950 + (unspec_volatile:SI [(match_operand 1 "immediate_operand" "i")] VUNSPEC_MFSR)) ]
13953 + [(set_attr "length" "4")]
13956 +;;=============================================================================
13957 +;; mtdr/mfdr instruction
13958 +;;-----------------------------------------------------------------------------
13959 +(define_insn "mtdr"
13960 + [ (unspec_volatile [(match_operand 0 "immediate_operand" "i")
13961 + (match_operand:SI 1 "register_operand" "r")] VUNSPEC_MTDR)]
13964 + [(set_attr "length" "4")]
13967 +(define_insn "mfdr"
13968 + [ (set (match_operand:SI 0 "register_operand" "=r")
13969 + (unspec_volatile:SI [(match_operand 1 "immediate_operand" "i")] VUNSPEC_MFDR)) ]
13972 + [(set_attr "length" "4")]
13975 +;;=============================================================================
13977 +;;-----------------------------------------------------------------------------
13978 +(define_insn "musfr"
13979 + [ (unspec_volatile [(match_operand:SI 0 "register_operand" "r")] VUNSPEC_MUSFR)]
13982 + [(set_attr "length" "2")
13983 + (set_attr "cc" "clobber")]
13986 +(define_insn "mustr"
13987 + [ (set (match_operand:SI 0 "register_operand" "=r")
13988 + (unspec_volatile:SI [(const_int 0)] VUNSPEC_MUSTR)) ]
13991 + [(set_attr "length" "2")]
13994 +;;=============================================================================
13995 +;; Flush Return Stack instruction
13996 +;;-----------------------------------------------------------------------------
13997 +(define_insn "frs"
13998 + [ (unspec_volatile [(const_int 0)] VUNSPEC_FRS)]
14001 + [(set_attr "length" "2")
14002 + (set_attr "cc" "none")]
14006 +;;=============================================================================
14007 +;; Saturation Round Scale instruction
14008 +;;-----------------------------------------------------------------------------
14009 +(define_insn "sats"
14010 + [ (set (match_operand:SI 0 "register_operand" "+r")
14011 + (unspec:SI [(match_dup 0)
14012 + (match_operand 1 "immediate_operand" "Ku05")
14013 + (match_operand 2 "immediate_operand" "Ku05")]
14016 + "sats\t%0 >> %1, %2"
14017 + [(set_attr "type" "alu_sat")
14018 + (set_attr "length" "4")]
14021 +(define_insn "satu"
14022 + [ (set (match_operand:SI 0 "register_operand" "+r")
14023 + (unspec:SI [(match_dup 0)
14024 + (match_operand 1 "immediate_operand" "Ku05")
14025 + (match_operand 2 "immediate_operand" "Ku05")]
14028 + "satu\t%0 >> %1, %2"
14029 + [(set_attr "type" "alu_sat")
14030 + (set_attr "length" "4")]
14033 +(define_insn "satrnds"
14034 + [ (set (match_operand:SI 0 "register_operand" "+r")
14035 + (unspec:SI [(match_dup 0)
14036 + (match_operand 1 "immediate_operand" "Ku05")
14037 + (match_operand 2 "immediate_operand" "Ku05")]
14038 + UNSPEC_SATRNDS)) ]
14040 + "satrnds\t%0 >> %1, %2"
14041 + [(set_attr "type" "alu_sat")
14042 + (set_attr "length" "4")]
14045 +(define_insn "satrndu"
14046 + [ (set (match_operand:SI 0 "register_operand" "+r")
14047 + (unspec:SI [(match_dup 0)
14048 + (match_operand 1 "immediate_operand" "Ku05")
14049 + (match_operand 2 "immediate_operand" "Ku05")]
14050 + UNSPEC_SATRNDU)) ]
14052 + "sats\t%0 >> %1, %2"
14053 + [(set_attr "type" "alu_sat")
14054 + (set_attr "length" "4")]
14057 +;; Special patterns for dealing with the constant pool
14059 +(define_insn "align_4"
14060 + [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN)]
14063 + assemble_align (32);
14066 + [(set_attr "length" "2")]
14069 +(define_insn "consttable_start"
14070 + [(unspec_volatile [(const_int 0)] VUNSPEC_POOL_START)]
14075 + [(set_attr "length" "0")]
14078 +(define_insn "consttable_end"
14079 + [(unspec_volatile [(const_int 0)] VUNSPEC_POOL_END)]
14082 + making_const_table = FALSE;
14085 + [(set_attr "length" "0")]
14089 +(define_insn "consttable_4"
14090 + [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_4)]
14093 + making_const_table = TRUE;
14094 + switch (GET_MODE_CLASS (GET_MODE (operands[0])))
14098 + REAL_VALUE_TYPE r;
14099 + char real_string[1024];
14100 + REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
14101 + real_to_decimal(real_string, &r, 1024, 0, 1);
14102 + asm_fprintf (asm_out_file, "\t.float\t%s\n", real_string);
14106 + assemble_integer (operands[0], 4, 0, 1);
14111 + [(set_attr "length" "4")]
14114 +(define_insn "consttable_8"
14115 + [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_8)]
14118 + making_const_table = TRUE;
14119 + switch (GET_MODE_CLASS (GET_MODE (operands[0])))
14123 + REAL_VALUE_TYPE r;
14124 + char real_string[1024];
14125 + REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
14126 + real_to_decimal(real_string, &r, 1024, 0, 1);
14127 + asm_fprintf (asm_out_file, "\t.double\t%s\n", real_string);
14131 + assemble_integer(operands[0], 8, 0, 1);
14136 + [(set_attr "length" "8")]
14139 +(define_insn "consttable_16"
14140 + [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_16)]
14143 + making_const_table = TRUE;
14144 + assemble_integer(operands[0], 16, 0, 1);
14147 + [(set_attr "length" "16")]
14150 +;;=============================================================================
14151 +;; coprocessor instructions
14152 +;;-----------------------------------------------------------------------------
14153 +(define_insn "cop"
14154 + [ (unspec_volatile [(match_operand 0 "immediate_operand" "Ku03")
14155 + (match_operand 1 "immediate_operand" "Ku04")
14156 + (match_operand 2 "immediate_operand" "Ku04")
14157 + (match_operand 3 "immediate_operand" "Ku04")
14158 + (match_operand 4 "immediate_operand" "Ku07")] VUNSPEC_COP)]
14160 + "cop\tcp%0, cr%1, cr%2, cr%3, %4"
14161 + [(set_attr "length" "4")]
14164 +(define_insn "mvcrsi"
14165 + [ (set (match_operand:SI 0 "avr32_cop_move_operand" "=r,<,Z")
14166 + (unspec_volatile:SI [(match_operand 1 "immediate_operand" "Ku03,Ku03,Ku03")
14167 + (match_operand 2 "immediate_operand" "Ku04,Ku04,Ku04")]
14171 + mvcr.w\tcp%1, %0, cr%2
14172 + stcm.w\tcp%1, %0, cr%2
14173 + stc.w\tcp%1, %0, cr%2"
14174 + [(set_attr "length" "4")]
14177 +(define_insn "mvcrdi"
14178 + [ (set (match_operand:DI 0 "avr32_cop_move_operand" "=r,<,Z")
14179 + (unspec_volatile:DI [(match_operand 1 "immediate_operand" "Ku03,Ku03,Ku03")
14180 + (match_operand 2 "immediate_operand" "Ku04,Ku04,Ku04")]
14184 + mvcr.d\tcp%1, %0, cr%2
14185 + stcm.d\tcp%1, %0, cr%2-cr%i2
14186 + stc.d\tcp%1, %0, cr%2"
14187 + [(set_attr "length" "4")]
14190 +(define_insn "mvrcsi"
14191 + [ (unspec_volatile:SI [(match_operand 0 "immediate_operand" "Ku03,Ku03,Ku03")
14192 + (match_operand 1 "immediate_operand" "Ku04,Ku04,Ku04")
14193 + (match_operand:SI 2 "avr32_cop_move_operand" "r,>,Z")]
14197 + switch (which_alternative){
14199 + return "mvrc.w\tcp%0, cr%1, %2";
14201 + return "ldcm.w\tcp%0, %2, cr%1";
14203 + return "ldc.w\tcp%0, cr%1, %2";
14208 + [(set_attr "length" "4")]
14211 +(define_insn "mvrcdi"
14212 + [ (unspec_volatile:DI [(match_operand 0 "immediate_operand" "Ku03,Ku03,Ku03")
14213 + (match_operand 1 "immediate_operand" "Ku04,Ku04,Ku04")
14214 + (match_operand:DI 2 "avr32_cop_move_operand" "r,>,Z")]
14218 + switch (which_alternative){
14220 + return "mvrc.d\tcp%0, cr%1, %2";
14222 + return "ldcm.d\tcp%0, %2, cr%1-cr%i1";
14224 + return "ldc.d\tcp%0, cr%1, %2";
14229 + [(set_attr "length" "4")]
14232 +;;=============================================================================
14234 +;;-----------------------------------------------------------------------------
14235 +;; This pattern emits RTL for exit from a function. The function exit is
14236 +;; responsible for deallocating the stack frame, restoring callee saved
14237 +;; registers and emitting the return instruction.
14238 +;; ToDo: using TARGET_ASM_FUNCTION_PROLOGUE instead.
14239 +;;=============================================================================
14240 +(define_expand "epilogue"
14241 + [(unspec_volatile [(return)] VUNSPEC_EPILOGUE)]
14244 + if (USE_RETURN_INSN (FALSE)){
14245 + emit_jump_insn (gen_return ());
14248 + emit_jump_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode,
14250 + gen_rtx_RETURN (VOIDmode)),
14251 + VUNSPEC_EPILOGUE));
14256 +(define_insn "*epilogue_insns"
14257 + [(unspec_volatile [(return)] VUNSPEC_EPILOGUE)]
14260 + avr32_output_return_instruction (FALSE, FALSE, NULL, NULL);
14263 + ; Length is absolute worst case
14264 + [(set_attr "type" "branch")
14265 + (set_attr "length" "12")]
14268 +(define_insn "*epilogue_insns_ret_imm"
14269 + [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
14270 + (use (reg RETVAL_REGNUM))
14271 + (unspec_volatile [(return)] VUNSPEC_EPILOGUE)])]
14272 + "((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
14274 + avr32_output_return_instruction (FALSE, FALSE, NULL, operands[0]);
14277 + ; Length is absolute worst case
14278 + [(set_attr "type" "branch")
14279 + (set_attr "length" "12")]
14282 +(define_insn "sibcall_epilogue"
14283 + [(unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)]
14286 + avr32_output_return_instruction (FALSE, FALSE, NULL, NULL);
14289 +;; Length is absolute worst case
14290 + [(set_attr "type" "branch")
14291 + (set_attr "length" "12")]
14294 +(define_insn "*sibcall_epilogue_insns_ret_imm"
14295 + [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
14296 + (use (reg RETVAL_REGNUM))
14297 + (unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)])]
14298 + "((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
14300 + avr32_output_return_instruction (FALSE, FALSE, NULL, operands[0]);
14303 + ; Length is absolute worst case
14304 + [(set_attr "type" "branch")
14305 + (set_attr "length" "12")]
14308 +(define_insn "ldxi"
14309 + [(set (match_operand:SI 0 "register_operand" "=r")
14311 + (match_operand:SI 1 "register_operand" "r")
14312 + (mult:SI (zero_extract:SI (match_operand:SI 2 "register_operand" "r")
14314 + (match_operand:SI 3 "immediate_operand" "Ku05"))
14315 + (const_int 4)))))]
14316 + "(INTVAL(operands[3]) == 24 || INTVAL(operands[3]) == 16 || INTVAL(operands[3]) == 8
14317 + || INTVAL(operands[3]) == 0)"
14319 + switch ( INTVAL(operands[3]) ){
14321 + return "ld.w %0, %1[%2:b << 2]";
14323 + return "ld.w %0, %1[%2:l << 2]";
14325 + return "ld.w %0, %1[%2:u << 2]";
14327 + return "ld.w %0, %1[%2:t << 2]";
14329 + internal_error("illegal operand for ldxi");
14332 + [(set_attr "type" "load")
14333 + (set_attr "length" "4")
14334 + (set_attr "cc" "none")])
14341 +;;=============================================================================
14342 +;; Peephole optimizing
14343 +;;-----------------------------------------------------------------------------
14346 +;; st.w r8[0x0], r12
14349 +;; st.w r7[-0x8], r12
14350 +;;=============================================================================
14351 +; (set (reg:SI 9 r8)
14352 +; (plus:SI (reg/f:SI 6 r7)
14353 +; (const_int ...)))
14354 +; (set (mem:SI (reg:SI 9 r8))
14355 +; (reg:SI 12 r12))
14357 + [(set (match_operand:SI 0 "register_operand" "")
14358 + (plus:SI (match_operand:SI 1 "register_operand" "")
14359 + (match_operand:SI 2 "immediate_operand" "")))
14360 + (set (mem:SI (match_dup 0))
14361 + (match_operand:SI 3 "register_operand" ""))]
14362 + "REGNO(operands[0]) != REGNO(operands[1]) && avr32_const_ok_for_constraint_p(INTVAL(operands[2]), 'K', \"Ks16\")"
14363 + [(set (match_dup 0)
14364 + (plus:SI (match_dup 1)
14366 + (set (mem:SI (plus:SI (match_dup 1)
14371 +;;=============================================================================
14372 +;; Peephole optimizing
14373 +;;-----------------------------------------------------------------------------
14376 +;; ld.w r6, r6[0x0]
14379 +;; ld.w r6, r7[-0x4]
14380 +;;=============================================================================
14381 +; (set (reg:SI 7 r6)
14382 +; (plus:SI (reg/f:SI 6 r7)
14383 +; (const_int -4 [0xfffffffc])))
14384 +; (set (reg:SI 7 r6)
14385 +; (mem:SI (reg:SI 7 r6)))
14387 + [(set (match_operand:SI 0 "register_operand" "")
14388 + (plus:SI (match_operand:SI 1 "register_operand" "")
14389 + (match_operand:SI 2 "immediate_operand" "")))
14390 + (set (match_operand:SI 3 "register_operand" "")
14391 + (mem:SI (match_dup 0)))]
14392 + "REGNO(operands[0]) != REGNO(operands[1]) && avr32_const_ok_for_constraint_p(INTVAL(operands[2]), 'K', \"Ks16\")"
14393 + [(set (match_dup 0)
14394 + (plus:SI (match_dup 1)
14396 + (set (match_dup 3)
14397 + (mem:SI (plus:SI (match_dup 1)
14398 + (match_dup 2))))]
14401 +;;=============================================================================
14402 +;; Peephole optimizing
14403 +;;-----------------------------------------------------------------------------
14405 +;; ld.sb r0, r7[-0x6]
14408 +;; ld.sb r0, r7[-0x6]
14409 +;;=============================================================================
14411 + [(set (match_operand:QI 0 "register_operand" "")
14412 + (match_operand:QI 1 "load_sb_memory_operand" ""))
14413 + (set (match_operand:SI 2 "register_operand" "")
14414 + (sign_extend:SI (match_dup 0)))]
14415 + "(REGNO(operands[0]) == REGNO(operands[2]) || peep2_reg_dead_p(2, operands[0]))"
14416 + [(set (match_dup 2)
14417 + (sign_extend:SI (match_dup 1)))]
14420 +;;=============================================================================
14421 +;; Peephole optimizing
14422 +;;-----------------------------------------------------------------------------
14424 +;; ld.ub r0, r7[-0x6]
14427 +;; ld.ub r0, r7[-0x6]
14428 +;;=============================================================================
14430 + [(set (match_operand:QI 0 "register_operand" "")
14431 + (match_operand:QI 1 "memory_operand" ""))
14432 + (set (match_operand:SI 2 "register_operand" "")
14433 + (zero_extend:SI (match_dup 0)))]
14434 + "(REGNO(operands[0]) == REGNO(operands[2])) || peep2_reg_dead_p(2, operands[0])"
14435 + [(set (match_dup 2)
14436 + (zero_extend:SI (match_dup 1)))]
14439 +;;=============================================================================
14440 +;; Peephole optimizing
14441 +;;-----------------------------------------------------------------------------
14443 +;; ld.sh r0, r7[-0x6]
14446 +;; ld.sh r0, r7[-0x6]
14447 +;;=============================================================================
14449 + [(set (match_operand:HI 0 "register_operand" "")
14450 + (match_operand:HI 1 "memory_operand" ""))
14451 + (set (match_operand:SI 2 "register_operand" "")
14452 + (sign_extend:SI (match_dup 0)))]
14453 + "(REGNO(operands[0]) == REGNO(operands[2])) || peep2_reg_dead_p(2, operands[0])"
14454 + [(set (match_dup 2)
14455 + (sign_extend:SI (match_dup 1)))]
14458 +;;=============================================================================
14459 +;; Peephole optimizing
14460 +;;-----------------------------------------------------------------------------
14462 +;; ld.uh r0, r7[-0x6]
14465 +;; ld.uh r0, r7[-0x6]
14466 +;;=============================================================================
14468 + [(set (match_operand:HI 0 "register_operand" "")
14469 + (match_operand:HI 1 "memory_operand" ""))
14470 + (set (match_operand:SI 2 "register_operand" "")
14471 + (zero_extend:SI (match_dup 0)))]
14472 + "(REGNO(operands[0]) == REGNO(operands[2])) || peep2_reg_dead_p(2, operands[0])"
14473 + [(set (match_dup 2)
14474 + (zero_extend:SI (match_dup 1)))]
14477 +;;=============================================================================
14478 +;; Peephole optimizing
14479 +;;-----------------------------------------------------------------------------
14484 +;; mac rd2, rx, ry
14485 +;;=============================================================================
14487 + [(set (match_operand:SI 0 "register_operand" "")
14488 + (mult:SI (match_operand:SI 1 "register_operand" "")
14489 + (match_operand:SI 2 "register_operand" "")))
14490 + (set (match_operand:SI 3 "register_operand" "")
14491 + (plus:SI (match_dup 3)
14493 + "peep2_reg_dead_p(2, operands[0])"
14494 + [(set (match_dup 3)
14495 + (plus:SI (mult:SI (match_dup 1)
14502 +;;=============================================================================
14503 +;; Peephole optimizing
14504 +;;-----------------------------------------------------------------------------
14506 +;; bfextu rd, rs, k5, 1 or and(h/l) rd, one_bit_set_mask
14510 +;; If rd is dead after the operation.
14511 +;;=============================================================================
14513 + [ (set (match_operand:SI 0 "register_operand" "")
14514 + (zero_extract:SI (match_operand:SI 1 "register_operand" "")
14516 + (match_operand:SI 2 "immediate_operand" "")))
14519 + "peep2_reg_dead_p(2, operands[0])"
14521 + (and:SI (match_dup 1)
14523 + "operands[2] = GEN_INT(1 << INTVAL(operands[2]));")
14526 + [ (set (match_operand:SI 0 "register_operand" "")
14527 + (and:SI (match_operand:SI 1 "register_operand" "")
14528 + (match_operand:SI 2 "one_bit_set_operand" "")))
14531 + "peep2_reg_dead_p(2, operands[0])"
14533 + (and:SI (match_dup 1)
14537 +;;=============================================================================
14538 +;; Peephole optimizing
14539 +;;-----------------------------------------------------------------------------
14540 +;; Load with extracted index: ld.w Rd, Rb[Ri:{t/u/b/l} << 2]
14542 +;;=============================================================================
14546 + [(set (match_operand:SI 0 "register_operand" "")
14547 + (zero_extract:SI (match_operand:SI 1 "register_operand" "")
14549 + (match_operand:SI 2 "avr32_extract_shift_operand" "")))
14550 + (set (match_operand:SI 3 "register_operand" "")
14551 + (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14552 + (match_operand:SI 4 "register_operand" ""))))]
14554 + "(dead_or_set_p(insn, operands[0]))"
14556 + switch ( INTVAL(operands[2]) ){
14558 + return "ld.w %3, %4[%1:b << 2]";
14560 + return "ld.w %3, %4[%1:l << 2]";
14562 + return "ld.w %3, %4[%1:u << 2]";
14564 + return "ld.w %3, %4[%1:t << 2]";
14566 + internal_error("illegal operand for ldxi");
14569 + [(set_attr "type" "load")
14570 + (set_attr "length" "4")
14571 + (set_attr "cc" "clobber")]
14577 + [(set (match_operand:SI 0 "register_operand" "")
14578 + (and:SI (match_operand:SI 1 "register_operand" "") (const_int 255)))
14579 + (set (match_operand:SI 2 "register_operand" "")
14580 + (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14581 + (match_operand:SI 3 "register_operand" ""))))]
14583 + "(dead_or_set_p(insn, operands[0]))"
14585 + "ld.w %2, %3[%1:b << 2]"
14586 + [(set_attr "type" "load")
14587 + (set_attr "length" "4")
14588 + (set_attr "cc" "clobber")]
14593 + [(set (match_operand:SI 0 "register_operand" "")
14594 + (zero_extract:SI (match_operand:SI 1 "register_operand" "")
14596 + (match_operand:SI 2 "avr32_extract_shift_operand" "")))
14597 + (set (match_operand:SI 3 "register_operand" "")
14598 + (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14599 + (match_operand:SI 4 "register_operand" ""))))]
14601 + "(peep2_reg_dead_p(2, operands[0]))
14602 + || (REGNO(operands[0]) == REGNO(operands[3]))"
14603 + [(set (match_dup 3)
14606 + (mult:SI (zero_extract:SI (match_dup 1)
14609 + (const_int 4)))))]
14613 + [(set (match_operand:SI 0 "register_operand" "")
14614 + (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
14615 + (set (match_operand:SI 2 "register_operand" "")
14616 + (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14617 + (match_operand:SI 3 "register_operand" ""))))]
14619 + "(peep2_reg_dead_p(2, operands[0]))
14620 + || (REGNO(operands[0]) == REGNO(operands[2]))"
14621 + [(set (match_dup 2)
14624 + (mult:SI (zero_extract:SI (match_dup 1)
14627 + (const_int 4)))))]
14628 + "operands[1] = gen_rtx_REG(SImode, REGNO(operands[1]));"
14633 + [(set (match_operand:SI 0 "register_operand" "")
14634 + (and:SI (match_operand:SI 1 "register_operand" "")
14635 + (const_int 255)))
14636 + (set (match_operand:SI 2 "register_operand" "")
14637 + (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14638 + (match_operand:SI 3 "register_operand" ""))))]
14640 + "(peep2_reg_dead_p(2, operands[0]))
14641 + || (REGNO(operands[0]) == REGNO(operands[2]))"
14642 + [(set (match_dup 2)
14645 + (mult:SI (zero_extract:SI (match_dup 1)
14648 + (const_int 4)))))]
14655 + [(set (match_operand:SI 0 "register_operand" "")
14656 + (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
14658 + (set (match_operand:SI 2 "register_operand" "")
14659 + (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14660 + (match_operand:SI 3 "register_operand" ""))))]
14662 + "(peep2_reg_dead_p(2, operands[0]))
14663 + || (REGNO(operands[0]) == REGNO(operands[2]))"
14664 + [(set (match_dup 2)
14667 + (mult:SI (zero_extract:SI (match_dup 1)
14670 + (const_int 4)))))]
14675 +;;************************************************
14678 +;;************************************************
14682 + [(set (match_operand:SI 0 "register_operand" "")
14683 + (not:SI (match_operand:SI 1 "register_operand" "")))
14684 + (set (match_operand:SI 2 "register_operand" "")
14685 + (and:SI (match_dup 2)
14687 + "peep2_reg_dead_p(2, operands[0])"
14689 + [(set (match_dup 2)
14690 + (and:SI (match_dup 2)
14691 + (not:SI (match_dup 1))
14697 + [(set (match_operand:SI 0 "register_operand" "")
14698 + (not:SI (match_operand:SI 1 "register_operand" "")))
14699 + (set (match_operand:SI 2 "register_operand" "")
14700 + (and:SI (match_dup 0)
14703 + "peep2_reg_dead_p(2, operands[0])"
14705 + [(set (match_dup 2)
14706 + (and:SI (match_dup 2)
14707 + (not:SI (match_dup 1))
14714 +;;=================================================================
14715 +;; Addabs peephole
14716 +;;=================================================================
14719 + [(set (match_operand:SI 2 "register_operand" "=r")
14720 + (abs:SI (match_operand:SI 1 "register_operand" "r")))
14721 + (set (match_operand:SI 0 "register_operand" "=r")
14722 + (plus:SI (match_operand:SI 3 "register_operand" "r")
14724 + "dead_or_set_p(insn, operands[2])"
14725 + "addabs %0, %3, %1"
14726 + [(set_attr "length" "4")
14727 + (set_attr "cc" "set_z")])
14730 + [(set (match_operand:SI 2 "register_operand" "=r")
14731 + (abs:SI (match_operand:SI 1 "register_operand" "r")))
14732 + (set (match_operand:SI 0 "register_operand" "=r")
14733 + (plus:SI (match_dup 2)
14734 + (match_operand:SI 3 "register_operand" "r")))]
14735 + "dead_or_set_p(insn, operands[2])"
14736 + "addabs %0, %3, %1"
14737 + [(set_attr "length" "4")
14738 + (set_attr "cc" "set_z")])
14741 +;;=================================================================
14742 +;; Detect roundings
14743 +;;=================================================================
14745 +(define_insn "*round"
14746 + [(set (match_operand:SI 0 "register_operand" "=r")
14747 + (ashiftrt:SI (plus:SI (match_operand:SI 1 "register_operand" "0")
14748 + (match_operand:SI 2 "immediate_operand" "i"))
14749 + (match_operand:SI 3 "immediate_operand" "i")))]
14750 + "avr32_rnd_operands(operands[2], operands[3])"
14752 + "satrnds %0 >> %3, 31"
14754 + [(set_attr "type" "alu_sat")
14755 + (set_attr "length" "4")]
14761 + [(set (match_operand:SI 0 "register_operand" "")
14762 + (plus:SI (match_dup 0)
14763 + (match_operand:SI 1 "immediate_operand" "")))
14764 + (set (match_dup 0)
14765 + (ashiftrt:SI (match_dup 0)
14766 + (match_operand:SI 2 "immediate_operand" "")))]
14767 + "avr32_rnd_operands(operands[1], operands[2])"
14769 + [(set (match_dup 0)
14770 + (ashiftrt:SI (plus:SI (match_dup 0)
14776 + [(set (match_operand:SI 0 "register_operand" "r")
14777 + (plus:SI (match_dup 0)
14778 + (match_operand:SI 1 "immediate_operand" "i")))
14779 + (set (match_dup 0)
14780 + (ashiftrt:SI (match_dup 0)
14781 + (match_operand:SI 2 "immediate_operand" "i")))]
14782 + "avr32_rnd_operands(operands[1], operands[2])"
14784 + "satrnds %0 >> %2, 31"
14786 + [(set_attr "type" "alu_sat")
14787 + (set_attr "length" "4")
14788 + (set_attr "cc" "clobber")]
14793 +;;=================================================================
14795 +;;=================================================================
14797 + [(set (match_operand:SI 0 "register_operand" "")
14798 + (match_operand 1 "avr32_const_pool_ref_operand" ""))
14799 + (parallel [(call (mem:SI (match_dup 0))
14800 + (match_operand 2 "" ""))
14801 + (clobber (reg:SI LR_REGNUM))])]
14802 + "dead_or_set_p(insn, operands[0])"
14804 + [(set_attr "type" "call")
14805 + (set_attr "length" "4")
14806 + (set_attr "cc" "clobber")]
14810 + [(set (match_operand:SI 2 "register_operand" "")
14811 + (match_operand 1 "avr32_const_pool_ref_operand" ""))
14812 + (parallel [(set (match_operand 0 "register_operand" "")
14813 + (call (mem:SI (match_dup 2))
14814 + (match_operand 3 "" "")))
14815 + (clobber (reg:SI LR_REGNUM))])]
14816 + "dead_or_set_p(insn, operands[2])"
14818 + [(set_attr "type" "call")
14819 + (set_attr "length" "4")
14820 + (set_attr "cc" "call_set")]
14825 + [(set (match_operand:SI 0 "register_operand" "")
14826 + (match_operand 1 "avr32_const_pool_ref_operand" ""))
14827 + (parallel [(call (mem:SI (match_dup 0))
14828 + (match_operand 2 "" ""))
14829 + (clobber (reg:SI LR_REGNUM))])]
14830 + "peep2_reg_dead_p(2, operands[0])"
14831 + [(parallel [(call (mem:SI (match_dup 1))
14833 + (clobber (reg:SI LR_REGNUM))])]
14838 + [(set (match_operand:SI 0 "register_operand" "")
14839 + (match_operand 1 "avr32_const_pool_ref_operand" ""))
14840 + (parallel [(set (match_operand 2 "register_operand" "")
14841 + (call (mem:SI (match_dup 0))
14842 + (match_operand 3 "" "")))
14843 + (clobber (reg:SI LR_REGNUM))])]
14844 + "(peep2_reg_dead_p(2, operands[0]) || (REGNO(operands[2]) == REGNO(operands[0])))"
14845 + [(parallel [(set (match_dup 2)
14846 + (call (mem:SI (match_dup 1))
14848 + (clobber (reg:SI LR_REGNUM))])]
14852 +;;=================================================================
14853 +;; Returning a value
14854 +;;=================================================================
14858 + [(set (match_operand 0 "register_operand" "")
14859 + (match_operand 1 "register_operand" ""))
14861 + "USE_RETURN_INSN (TRUE) && (REGNO(operands[0]) == RETVAL_REGNUM)
14862 + && (REGNO(operands[1]) != LR_REGNUM)
14863 + && (REGNO_REG_CLASS(REGNO(operands[1])) == GENERAL_REGS)"
14865 + [(set_attr "type" "call")
14866 + (set_attr "length" "2")]
14871 + [(set (match_operand 0 "register_operand" "r")
14872 + (match_operand 1 "immediate_operand" "i"))
14874 + "(USE_RETURN_INSN (FALSE) && (REGNO(operands[0]) == RETVAL_REGNUM) &&
14875 + ((INTVAL(operands[1]) == -1) || (INTVAL(operands[1]) == 0) || (INTVAL(operands[1]) == 1)))"
14877 + avr32_output_return_instruction (TRUE, FALSE, NULL, operands[1]);
14880 + [(set_attr "type" "call")
14881 + (set_attr "length" "4")]
14885 + [(set (match_operand 0 "register_operand" "r")
14886 + (match_operand 1 "immediate_operand" "i"))
14887 + (unspec_volatile [(return)] VUNSPEC_EPILOGUE)]
14888 + "(REGNO(operands[0]) == RETVAL_REGNUM) &&
14889 + ((INTVAL(operands[1]) == -1) || (INTVAL(operands[1]) == 0) || (INTVAL(operands[1]) == 1))"
14891 + avr32_output_return_instruction (FALSE, FALSE, NULL, operands[1]);
14894 + ; Length is absolute worst case
14895 + [(set_attr "type" "branch")
14896 + (set_attr "length" "12")]
14900 + [(set (match_operand 0 "register_operand" "=r")
14901 + (if_then_else (match_operator 1 "avr32_comparison_operator"
14902 + [(match_operand 4 "register_operand" "r")
14903 + (match_operand 5 "register_immediate_operand" "rKs21")])
14904 + (match_operand 2 "avr32_cond_register_immediate_operand" "rKs08")
14905 + (match_operand 3 "avr32_cond_register_immediate_operand" "rKs08")))
14907 + "USE_RETURN_INSN (TRUE) && (REGNO(operands[0]) == RETVAL_REGNUM)"
14909 + operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[4]), operands[4], operands[5]);
14911 + if ( GET_CODE(operands[2]) == REG
14912 + && GET_CODE(operands[3]) == REG
14913 + && REGNO(operands[2]) != LR_REGNUM
14914 + && REGNO(operands[3]) != LR_REGNUM ){
14915 + return "ret%1 %2\;ret%i1 %3";
14916 + } else if ( GET_CODE(operands[2]) == REG
14917 + && GET_CODE(operands[3]) == CONST_INT ){
14918 + if ( INTVAL(operands[3]) == -1
14919 + || INTVAL(operands[3]) == 0
14920 + || INTVAL(operands[3]) == 1 ){
14921 + return "ret%1 %2\;ret%i1 %d3";
14923 + return "mov%1 r12, %2\;mov%i1 r12, %3\;retal r12";
14925 + } else if ( GET_CODE(operands[2]) == CONST_INT
14926 + && GET_CODE(operands[3]) == REG ){
14927 + if ( INTVAL(operands[2]) == -1
14928 + || INTVAL(operands[2]) == 0
14929 + || INTVAL(operands[2]) == 1 ){
14930 + return "ret%1 %d2\;ret%i1 %3";
14932 + return "mov%1 r12, %2\;mov%i1 r12, %3\;retal r12";
14935 + if ( (INTVAL(operands[2]) == -1
14936 + || INTVAL(operands[2]) == 0
14937 + || INTVAL(operands[2]) == 1 )
14938 + && (INTVAL(operands[3]) == -1
14939 + || INTVAL(operands[3]) == 0
14940 + || INTVAL(operands[3]) == 1 )){
14941 + return "ret%1 %d2\;ret%i1 %d3";
14943 + return "mov%1 r12, %2\;mov%i1 r12, %3\;retal r12";
14948 + [(set_attr "length" "10")
14949 + (set_attr "cc" "none")
14950 + (set_attr "type" "call")])
14953 +;;=================================================================
14955 +;;=================================================================
14958 + [(set (match_operand:HI 0 "register_operand" "")
14959 + (neg:HI (match_operand:HI 1 "register_operand" "")))
14960 + (set (match_operand:SI 2 "register_operand" "")
14962 + (sign_extend:SI (match_dup 0))
14963 + (sign_extend:SI (match_operand:HI 3 "register_operand" ""))))]
14964 + "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[2]) == REGNO(operands[0]))"
14965 + [ (set (match_dup 2)
14967 + (sign_extend:SI (neg:HI (match_dup 1)))
14968 + (sign_extend:SI (match_dup 3))))]
14973 + [(set (match_operand:HI 0 "register_operand" "")
14974 + (neg:HI (match_operand:HI 1 "register_operand" "")))
14975 + (set (match_operand:SI 2 "register_operand" "")
14977 + (sign_extend:SI (match_operand:HI 3 "register_operand" ""))
14978 + (sign_extend:SI (match_dup 0))))]
14979 + "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[2]) == REGNO(operands[0]))"
14980 + [ (set (match_dup 2)
14982 + (sign_extend:SI (neg:HI (match_dup 1)))
14983 + (sign_extend:SI (match_dup 3))))]
14989 +;;=================================================================
14990 +;; Vector set and extract operations
14991 +;;=================================================================
14992 +(define_insn "vec_setv2hi_hi"
14993 + [(set (match_operand:V2HI 0 "register_operand" "=r")
14996 + (vec_duplicate:V2HI
14997 + (match_operand:HI 1 "register_operand" "r"))
15000 + "bfins\t%0, %1, 16, 16"
15001 + [(set_attr "type" "alu")
15002 + (set_attr "length" "4")
15003 + (set_attr "cc" "clobber")])
15005 +(define_insn "vec_setv2hi_lo"
15006 + [(set (match_operand:V2HI 0 "register_operand" "+r")
15009 + (vec_duplicate:V2HI
15010 + (match_operand:HI 1 "register_operand" "r"))
15013 + "bfins\t%0, %1, 0, 16"
15014 + [(set_attr "type" "alu")
15015 + (set_attr "length" "4")
15016 + (set_attr "cc" "clobber")])
15018 +(define_expand "vec_setv2hi"
15019 + [(set (match_operand:V2HI 0 "register_operand" "")
15022 + (vec_duplicate:V2HI
15023 + (match_operand:HI 1 "register_operand" ""))
15024 + (match_operand 2 "immediate_operand" "")))]
15026 + { operands[2] = GEN_INT(INTVAL(operands[2]) + 1); }
15029 +(define_insn "vec_extractv2hi"
15030 + [(set (match_operand:HI 0 "register_operand" "=r")
15032 + (match_operand:V2HI 1 "register_operand" "r")
15033 + (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
15036 + if ( INTVAL(operands[2]) == 0 )
15037 + return "bfextu\t%0, %1, 16, 16";
15039 + return "bfextu\t%0, %1, 0, 16";
15041 + [(set_attr "type" "alu")
15042 + (set_attr "length" "4")
15043 + (set_attr "cc" "clobber")])
15045 +(define_insn "vec_extractv4qi"
15046 + [(set (match_operand:QI 0 "register_operand" "=r")
15048 + (match_operand:V4QI 1 "register_operand" "r")
15049 + (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
15052 + switch ( INTVAL(operands[2]) ){
15054 + return "bfextu\t%0, %1, 24, 8";
15056 + return "bfextu\t%0, %1, 16, 8";
15058 + return "bfextu\t%0, %1, 8, 8";
15060 + return "bfextu\t%0, %1, 0, 8";
15065 + [(set_attr "type" "alu")
15066 + (set_attr "length" "4")
15067 + (set_attr "cc" "clobber")])
15070 +(define_insn "concatv2hi"
15071 + [(set (match_operand:V2HI 0 "register_operand" "=r, r, r")
15073 + (match_operand:HI 1 "register_operand" "r, r, 0")
15074 + (match_operand:HI 2 "register_operand" "r, 0, r")))]
15077 + mov\t%0, %1\;bfins\t%0, %2, 0, 16
15078 + bfins\t%0, %2, 0, 16
15079 + bfins\t%0, %1, 16, 16"
15080 + [(set_attr "length" "6, 4, 4")
15081 + (set_attr "type" "alu")])
15084 +;; Load the atomic operation description
15085 +(include "sync.md")
15087 +;; Load the SIMD description
15088 +(include "simd.md")
15090 +;; Load the FP coprocessor patterns
15091 +(include "fpcp.md")
15092 Index: gcc-4.2.3/gcc/config/avr32/avr32-modes.def
15093 ===================================================================
15094 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15095 +++ gcc-4.2.3/gcc/config/avr32/avr32-modes.def 2008-05-21 13:45:54.165287871 +0200
15097 +VECTOR_MODES (INT, 4); /* V4QI V2HI */
15098 Index: gcc-4.2.3/gcc/config/avr32/avr32.opt
15099 ===================================================================
15100 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15101 +++ gcc-4.2.3/gcc/config/avr32/avr32.opt 2008-05-21 13:45:54.165287871 +0200
15103 +; Options for the ATMEL AVR32 port of the compiler.
15105 +; Copyright 2007 Atmel Corporation.
15107 +; This file is part of GCC.
15109 +; GCC is free software; you can redistribute it and/or modify it under
15110 +; the terms of the GNU General Public License as published by the Free
15111 +; Software Foundation; either version 2, or (at your option) any later
15114 +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15115 +; WARRANTY; without even the implied warranty of MERCHANTABILITY or
15116 +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15117 +; for more details.
15119 +; You should have received a copy of the GNU General Public License
15120 +; along with GCC; see the file COPYING. If not, write to the Free
15121 +; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
15122 +; 02110-1301, USA.
15124 +muse-rodata-section
15125 +Target Report Mask(USE_RODATA_SECTION)
15126 +Do not put readonly-data in .text section, but in .rodata.
15129 +Target Report Undocumented Mask(HARD_FLOAT)
15130 +Use floating point coprocessor instructions.
15133 +Target Report Undocumented InverseMask(HARD_FLOAT, SOFT_FLOAT)
15134 +Use software floating-point library for floating-point operations.
15136 +force-double-align
15137 +Target Report RejectNegative Mask(FORCE_DOUBLE_ALIGN)
15138 +Force double-word alignment for double-word memory accesses.
15141 +Target Report RejectNegative Mask(NO_INIT_GOT)
15142 +Do not initialize GOT register before using it when compiling PIC code.
15145 +Target Report Mask(RELAX)
15146 +Let invoked assembler and linker do relaxing (Enabled by default when optimization level is >1).
15149 +Target Report Undocumented Mask(MD_REORG_OPTIMIZATION)
15150 +Perform machine dependent optimizations in reorg stage.
15153 +Target Report Mask(HAS_ASM_ADDR_PSEUDOS)
15154 +Use assembler pseudo-instructions lda.w and call for handling direct addresses. (Enabled by default)
15157 +Target Report RejectNegative Joined Var(avr32_part_name)
15158 +Specify the AVR32 part name
15161 +Target Report RejectNegative Joined Undocumented Var(avr32_part_name)
15162 +Specify the AVR32 part name (deprecated)
15165 +Target Report RejectNegative Joined Var(avr32_arch_name)
15166 +Specify the AVR32 architecture name
15169 +Target Report Mask(FAST_FLOAT)
15170 +Enable fast floating-point library. Enabled by default if the -funsafe-math-optimizations switch is specified.
15172 +mimm-in-const-pool
15173 +Target Report Var(avr32_imm_in_const_pool) Init(-1)
15174 +Put large immediates in constant pool. This is enabled by default for archs with insn-cache.
15176 Index: gcc-4.2.3/gcc/config/avr32/avr32-protos.h
15177 ===================================================================
15178 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15179 +++ gcc-4.2.3/gcc/config/avr32/avr32-protos.h 2008-05-21 13:45:54.165287871 +0200
15182 + Prototypes for exported functions defined in avr32.c
15183 + Copyright 2003-2006 Atmel Corporation.
15185 + Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
15186 + Initial porting by Anders �dland.
15188 + This file is part of GCC.
15190 + This program is free software; you can redistribute it and/or modify
15191 + it under the terms of the GNU General Public License as published by
15192 + the Free Software Foundation; either version 2 of the License, or
15193 + (at your option) any later version.
15195 + This program is distributed in the hope that it will be useful,
15196 + but WITHOUT ANY WARRANTY; without even the implied warranty of
15197 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15198 + GNU General Public License for more details.
15200 + You should have received a copy of the GNU General Public License
15201 + along with this program; if not, write to the Free Software
15202 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
15205 +#ifndef AVR32_PROTOS_H
15206 +#define AVR32_PROTOS_H
15208 +extern const int swap_reg[];
15210 +extern int avr32_valid_macmac_bypass (rtx, rtx);
15211 +extern int avr32_valid_mulmac_bypass (rtx, rtx);
15213 +extern int avr32_decode_lcomm_symbol_offset (rtx, int *);
15214 +extern void avr32_encode_lcomm_symbol_offset (tree, char *, int);
15216 +extern const char *avr32_strip_name_encoding (const char *);
15218 +extern rtx avr32_get_note_reg_equiv (rtx insn);
15220 +extern int avr32_use_return_insn (int iscond);
15222 +extern void avr32_make_reglist16 (int reglist16_vect, char *reglist16_string);
15224 +extern void avr32_make_reglist8 (int reglist8_vect, char *reglist8_string);
15225 +extern void avr32_make_fp_reglist_w (int reglist_mask, char *reglist_string);
15226 +extern void avr32_make_fp_reglist_d (int reglist_mask, char *reglist_string);
15228 +extern void avr32_output_return_instruction (int single_ret_inst,
15229 + int iscond, rtx cond,
15231 +extern void avr32_expand_prologue (void);
15232 +extern void avr32_set_return_address (rtx source, rtx scratch);
15234 +extern int avr32_hard_regno_mode_ok (int regno, enum machine_mode mode);
15235 +extern int avr32_extra_constraint_s (rtx value, const int strict);
15236 +extern int avr32_eh_return_data_regno (const int n);
15237 +extern int avr32_initial_elimination_offset (const int from, const int to);
15238 +extern rtx avr32_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode,
15239 + tree type, int named);
15240 +extern void avr32_init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype,
15241 + rtx libname, tree fndecl);
15242 +extern void avr32_function_arg_advance (CUMULATIVE_ARGS * cum,
15243 + enum machine_mode mode,
15244 + tree type, int named);
15245 +#ifdef ARGS_SIZE_RTX
15246 +/* expr.h defines ARGS_SIZE_RTX and `enum direction'. */
15247 +extern enum direction avr32_function_arg_padding (enum machine_mode mode,
15249 +#endif /* ARGS_SIZE_RTX */
15250 +extern rtx avr32_function_value (tree valtype, tree func, bool outgoing);
15251 +extern rtx avr32_libcall_value (enum machine_mode mode);
15252 +extern int avr32_sched_use_dfa_pipeline_interface (void);
15253 +extern bool avr32_return_in_memory (tree type, tree fntype);
15254 +extern void avr32_regs_to_save (char *operand);
15255 +extern void avr32_target_asm_function_prologue (FILE * file,
15256 + HOST_WIDE_INT size);
15257 +extern void avr32_target_asm_function_epilogue (FILE * file,
15258 + HOST_WIDE_INT size);
15259 +extern void avr32_trampoline_template (FILE * file);
15260 +extern void avr32_initialize_trampoline (rtx addr, rtx fnaddr,
15261 + rtx static_chain);
15262 +extern int avr32_legitimate_address (enum machine_mode mode, rtx x,
15264 +extern int avr32_legitimate_constant_p (rtx x);
15266 +extern int avr32_legitimate_pic_operand_p (rtx x);
15268 +extern rtx avr32_find_symbol (rtx x);
15269 +extern void avr32_select_section (rtx exp, int reloc, int align);
15270 +extern void avr32_encode_section_info (tree decl, rtx rtl, int first);
15271 +extern void avr32_asm_file_end (FILE * stream);
15272 +extern void avr32_asm_output_ascii (FILE * stream, char *ptr, int len);
15273 +extern void avr32_asm_output_common (FILE * stream, const char *name,
15274 + int size, int rounded);
15275 +extern void avr32_asm_output_label (FILE * stream, const char *name);
15276 +extern void avr32_asm_declare_object_name (FILE * stream, char *name,
15278 +extern void avr32_asm_globalize_label (FILE * stream, const char *name);
15279 +extern void avr32_asm_weaken_label (FILE * stream, const char *name);
15280 +extern void avr32_asm_output_external (FILE * stream, tree decl,
15281 + const char *name);
15282 +extern void avr32_asm_output_external_libcall (FILE * stream, rtx symref);
15283 +extern void avr32_asm_output_labelref (FILE * stream, const char *name);
15284 +extern void avr32_notice_update_cc (rtx exp, rtx insn);
15285 +extern void avr32_print_operand (FILE * stream, rtx x, int code);
15286 +extern void avr32_print_operand_address (FILE * stream, rtx x);
15288 +extern int avr32_symbol (rtx x);
15290 +extern void avr32_select_rtx_section (enum machine_mode mode, rtx x,
15291 + unsigned HOST_WIDE_INT align);
15293 +extern int avr32_load_multiple_operation (rtx op, enum machine_mode mode);
15294 +extern int avr32_store_multiple_operation (rtx op, enum machine_mode mode);
15296 +extern int avr32_const_ok_for_constraint_p (HOST_WIDE_INT value, char c,
15297 + const char *str);
15299 +extern bool avr32_cannot_force_const_mem (rtx x);
15301 +extern void avr32_init_builtins (void);
15303 +extern rtx avr32_expand_builtin (tree exp, rtx target, rtx subtarget,
15304 + enum machine_mode mode, int ignore);
15306 +extern bool avr32_must_pass_in_stack (enum machine_mode mode, tree type);
15308 +extern bool avr32_strict_argument_naming (CUMULATIVE_ARGS * ca);
15310 +extern bool avr32_pass_by_reference (CUMULATIVE_ARGS * cum,
15311 + enum machine_mode mode,
15312 + tree type, bool named);
15314 +extern rtx avr32_gen_load_multiple (rtx * regs, int count, rtx from,
15315 + int write_back, int in_struct_p,
15317 +extern rtx avr32_gen_store_multiple (rtx * regs, int count, rtx to,
15318 + int in_struct_p, int scalar_p);
15319 +extern int avr32_gen_movmemsi (rtx * operands);
15321 +extern int avr32_rnd_operands (rtx add, rtx shift);
15322 +extern int avr32_adjust_insn_length (rtx insn, int length);
15324 +extern int symbol_mentioned_p (rtx x);
15325 +extern int label_mentioned_p (rtx x);
15326 +extern rtx legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg);
15327 +extern int avr32_address_register_rtx_p (rtx x, int strict_p);
15328 +extern int avr32_legitimate_index_p (enum machine_mode mode, rtx index,
15331 +extern int avr32_const_double_immediate (rtx value);
15332 +extern void avr32_init_expanders (void);
15333 +extern rtx avr32_return_addr (int count, rtx frame);
15334 +extern bool avr32_got_mentioned_p (rtx addr);
15336 +extern void avr32_final_prescan_insn (rtx insn, rtx * opvec, int noperands);
15338 +extern int avr32_expand_movcc (enum machine_mode mode, rtx operands[]);
15339 +extern int avr32_expand_addcc (enum machine_mode mode, rtx operands[]);
15341 +extern int avr32_expand_scc (RTX_CODE cond, rtx * operands);
15344 +extern int avr32_store_bypass (rtx insn_out, rtx insn_in);
15345 +extern int avr32_mul_waw_bypass (rtx insn_out, rtx insn_in);
15346 +extern int avr32_valid_load_double_bypass (rtx insn_out, rtx insn_in);
15347 +extern int avr32_valid_load_quad_bypass (rtx insn_out, rtx insn_in);
15348 +extern rtx avr32_output_cmp (rtx cond, enum machine_mode mode,
15349 + rtx op0, rtx op1);
15351 +rtx get_next_insn_cond (rtx cur_insn);
15352 +int set_next_insn_cond (rtx cur_insn, rtx cond);
15353 +void avr32_override_options (void);
15354 +void avr32_load_pic_register (void);
15355 +void avr32_optimization_options (int level, int size);
15356 +void avr32_split_const_expr (enum machine_mode mode,
15357 + enum machine_mode new_mode,
15359 + rtx *split_expr);
15360 +void avr32_get_intval (enum machine_mode mode,
15362 + HOST_WIDE_INT *val);
15365 +#endif /* AVR32_PROTOS_H */
15366 Index: gcc-4.2.3/gcc/config/avr32/crti.asm
15367 ===================================================================
15368 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15369 +++ gcc-4.2.3/gcc/config/avr32/crti.asm 2008-05-21 13:45:54.165287871 +0200
15372 + Init/fini stuff for AVR32.
15373 + Copyright 2003-2006 Atmel Corporation.
15375 + Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
15377 + This file is part of GCC.
15379 + This program is free software; you can redistribute it and/or modify
15380 + it under the terms of the GNU General Public License as published by
15381 + the Free Software Foundation; either version 2 of the License, or
15382 + (at your option) any later version.
15384 + This program is distributed in the hope that it will be useful,
15385 + but WITHOUT ANY WARRANTY; without even the implied warranty of
15386 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15387 + GNU General Public License for more details.
15389 + You should have received a copy of the GNU General Public License
15390 + along with this program; if not, write to the Free Software
15391 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
15394 +/* The code in sections .init and .fini is supposed to be a single
15395 + regular function. The function in .init is called directly from
15396 + start in crt1.asm. The function in .fini is atexit()ed in crt1.asm
15399 + crti.asm contributes the prologue of a function to these sections,
15400 + and crtn.asm comes up the epilogue. STARTFILE_SPEC should list
15401 + crti.o before any other object files that might add code to .init
15402 + or .fini sections, and ENDFILE_SPEC should list crtn.o after any
15403 + such object files. */
15408 +/* Just load the GOT */
15418 +1: .long 0b - _GLOBAL_OFFSET_TABLE_
15422 +/* Just load the GOT */
15432 +1: .long 0b - _GLOBAL_OFFSET_TABLE_
15435 Index: gcc-4.2.3/gcc/config/avr32/crtn.asm
15436 ===================================================================
15437 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15438 +++ gcc-4.2.3/gcc/config/avr32/crtn.asm 2008-05-21 13:45:54.165287871 +0200
15440 +/* Copyright (C) 2001 Free Software Foundation, Inc.
15441 + Written By Nick Clifton
15443 + This file is free software; you can redistribute it and/or modify it
15444 + under the terms of the GNU General Public License as published by the
15445 + Free Software Foundation; either version 2, or (at your option) any
15448 + In addition to the permissions in the GNU General Public License, the
15449 + Free Software Foundation gives you unlimited permission to link the
15450 + compiled version of this file with other programs, and to distribute
15451 + those programs without any restriction coming from the use of this
15452 + file. (The General Public License restrictions do apply in other
15453 + respects; for example, they cover modification of the file, and
15454 + distribution when not linked into another program.)
15456 + This file is distributed in the hope that it will be useful, but
15457 + WITHOUT ANY WARRANTY; without even the implied warranty of
15458 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15459 + General Public License for more details.
15461 + You should have received a copy of the GNU General Public License
15462 + along with this program; see the file COPYING. If not, write to
15463 + the Free Software Foundation, 59 Temple Place - Suite 330,
15464 + Boston, MA 02111-1307, USA.
15466 + As a special exception, if you link this library with files
15467 + compiled with GCC to produce an executable, this does not cause
15468 + the resulting executable to be covered by the GNU General Public License.
15469 + This exception does not however invalidate any other reasons why
15470 + the executable file might be covered by the GNU General Public License.
15484 Index: gcc-4.2.3/gcc/config/avr32/fpcp.md
15485 ===================================================================
15486 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15487 +++ gcc-4.2.3/gcc/config/avr32/fpcp.md 2008-05-21 13:45:54.169287542 +0200
15489 +;; AVR32 machine description file for Floating-Point instructions.
15490 +;; Copyright 2003-2006 Atmel Corporation.
15492 +;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
15494 +;; This file is part of GCC.
15496 +;; This program is free software; you can redistribute it and/or modify
15497 +;; it under the terms of the GNU General Public License as published by
15498 +;; the Free Software Foundation; either version 2 of the License, or
15499 +;; (at your option) any later version.
15501 +;; This program is distributed in the hope that it will be useful,
15502 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15503 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15504 +;; GNU General Public License for more details.
15506 +;; You should have received a copy of the GNU General Public License
15507 +;; along with this program; if not, write to the Free Software
15508 +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15510 +;; -*- Mode: Scheme -*-
15512 +;;******************************************************************************
15513 +;; Automaton pipeline description for floating-point coprocessor insns
15514 +;;******************************************************************************
15515 +(define_cpu_unit "fid,fm1,fm2,fm3,fm4,fwb,fcmp,fcast" "avr32_ap")
15517 +(define_insn_reservation "fmv_op" 1
15518 + (and (eq_attr "pipeline" "ap")
15519 + (eq_attr "type" "fmv"))
15520 + "is,da,d,fid,fwb")
15522 +(define_insn_reservation "fmul_op" 5
15523 + (and (eq_attr "pipeline" "ap")
15524 + (eq_attr "type" "fmul"))
15525 + "is,da,d,fid,fm1,fm2,fm3,fm4,fwb")
15527 +(define_insn_reservation "fcmps_op" 1
15528 + (and (eq_attr "pipeline" "ap")
15529 + (eq_attr "type" "fcmps"))
15530 + "is,da,d,fid,fcmp")
15532 +(define_insn_reservation "fcmpd_op" 2
15533 + (and (eq_attr "pipeline" "ap")
15534 + (eq_attr "type" "fcmpd"))
15535 + "is,da,d,fid*2,fcmp")
15537 +(define_insn_reservation "fcast_op" 3
15538 + (and (eq_attr "pipeline" "ap")
15539 + (eq_attr "type" "fcast"))
15540 + "is,da,d,fid,fcmp,fcast,fwb")
15542 +(define_insn_reservation "fmvcpu_op" 2
15543 + (and (eq_attr "pipeline" "ap")
15544 + (eq_attr "type" "fmvcpu"))
15547 +(define_insn_reservation "fldd_op" 1
15548 + (and (eq_attr "pipeline" "ap")
15549 + (eq_attr "type" "fldd"))
15552 +(define_insn_reservation "flds_op" 1
15553 + (and (eq_attr "pipeline" "ap")
15554 + (eq_attr "type" "flds"))
15557 +(define_insn_reservation "fsts_op" 0
15558 + (and (eq_attr "pipeline" "ap")
15559 + (eq_attr "type" "fsts"))
15562 +(define_insn_reservation "fstd_op" 0
15563 + (and (eq_attr "pipeline" "ap")
15564 + (eq_attr "type" "fstd"))
15568 +(define_insn "*movsf_fpcp"
15569 + [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,r,f,m,r,r,r,m")
15570 + (match_operand:SF 1 "general_operand" " f,r,f,m,f,r,G,m,r"))]
15571 + "TARGET_HARD_FLOAT"
15582 + [(set_attr "length" "4,4,4,4,4,2,4,4,4")
15583 + (set_attr "type" "fmv,flds,fmvcpu,flds,fsts,alu,alu,load,store")])
15585 +(define_insn_and_split "*movdf_fpcp"
15586 + [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,r,f,m,r,r,m")
15587 + (match_operand:DF 1 "general_operand" " f,r,f,m,f,r,m,r"))]
15588 + "TARGET_HARD_FLOAT"
15595 + mov\t%0, %1\;mov\t%m0, %m1
15599 + "TARGET_HARD_FLOAT
15600 + && reload_completed
15601 + && (REG_P(operands[0]) && (REGNO_REG_CLASS(REGNO(operands[0])) == GENERAL_REGS))
15602 + && (REG_P(operands[1]) && (REGNO_REG_CLASS(REGNO(operands[1])) == GENERAL_REGS))"
15603 + [(set (match_dup 0) (match_dup 1))
15604 + (set (match_dup 2) (match_dup 3))]
15607 + operands[2] = gen_highpart (SImode, operands[0]);
15608 + operands[0] = gen_lowpart (SImode, operands[0]);
15609 + operands[3] = gen_highpart(SImode, operands[1]);
15610 + operands[1] = gen_lowpart(SImode, operands[1]);
15614 + [(set_attr "length" "4,4,4,4,4,4,4,4")
15615 + (set_attr "type" "fmv,fldd,fmvcpu,fldd,fstd,alu2,load2,store2")])
15618 +(define_insn "mulsf3"
15619 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15620 + (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15621 + (match_operand:SF 2 "avr32_fp_register_operand" "f")))]
15622 + "TARGET_HARD_FLOAT"
15623 + "fmul.s\t%0, %1, %2"
15624 + [(set_attr "length" "4")
15625 + (set_attr "type" "fmul")])
15627 +(define_insn "nmulsf3"
15628 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15629 + (neg:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15630 + (match_operand:SF 2 "avr32_fp_register_operand" "f"))))]
15631 + "TARGET_HARD_FLOAT"
15632 + "fnmul.s\t%0, %1, %2"
15633 + [(set_attr "length" "4")
15634 + (set_attr "type" "fmul")])
15637 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "")
15638 + (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "")
15639 + (match_operand:SF 2 "avr32_fp_register_operand" "")))
15640 + (set (match_operand:SF 3 "avr32_fp_register_operand" "")
15641 + (neg:SF (match_dup 0)))]
15642 + "TARGET_HARD_FLOAT &&
15643 + (peep2_reg_dead_p(2, operands[0]) || (REGNO(operands[3]) == REGNO(operands[0])))"
15644 + [(set (match_dup 3)
15645 + (neg:SF (mult:SF (match_dup 1)
15646 + (match_dup 2))))]
15650 +(define_insn "macsf3"
15651 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15652 + (plus:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15653 + (match_operand:SF 2 "avr32_fp_register_operand" "f"))
15654 + (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
15655 + "TARGET_HARD_FLOAT"
15656 + "fmac.s\t%0, %1, %2"
15657 + [(set_attr "length" "4")
15658 + (set_attr "type" "fmul")])
15660 +(define_insn "nmacsf3"
15661 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15662 + (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15663 + (match_operand:SF 2 "avr32_fp_register_operand" "f")))
15664 + (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
15665 + "TARGET_HARD_FLOAT"
15666 + "fnmac.s\t%0, %1, %2"
15667 + [(set_attr "length" "4")
15668 + (set_attr "type" "fmul")])
15671 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "")
15672 + (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "")
15673 + (match_operand:SF 2 "avr32_fp_register_operand" "")))
15674 + (set (match_operand:SF 3 "avr32_fp_register_operand" "")
15678 + "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
15679 + [(set (match_dup 3)
15680 + (plus:SF (neg:SF (mult:SF (match_dup 1)
15686 +(define_insn "msubacsf3"
15687 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15688 + (minus:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15689 + (match_operand:SF 2 "avr32_fp_register_operand" "f"))
15690 + (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
15691 + "TARGET_HARD_FLOAT"
15692 + "fmsc.s\t%0, %1, %2"
15693 + [(set_attr "length" "4")
15694 + (set_attr "type" "fmul")])
15697 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "")
15698 + (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "")
15699 + (match_operand:SF 2 "avr32_fp_register_operand" "")))
15700 + (set (match_operand:SF 3 "avr32_fp_register_operand" "")
15704 + "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
15705 + [(set (match_dup 3)
15706 + (minus:SF (mult:SF (match_dup 1)
15711 +(define_insn "nmsubacsf3"
15712 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15713 + (minus:SF (neg:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15714 + (match_operand:SF 2 "avr32_fp_register_operand" "f")))
15715 + (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
15716 + "TARGET_HARD_FLOAT"
15717 + "fnmsc.s\t%0, %1, %2"
15718 + [(set_attr "length" "4")
15719 + (set_attr "type" "fmul")])
15723 +(define_insn "addsf3"
15724 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15725 + (plus:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15726 + (match_operand:SF 2 "avr32_fp_register_operand" "f")))]
15727 + "TARGET_HARD_FLOAT"
15728 + "fadd.s\t%0, %1, %2"
15729 + [(set_attr "length" "4")
15730 + (set_attr "type" "fmul")])
15732 +(define_insn "subsf3"
15733 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15734 + (minus:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
15735 + (match_operand:SF 2 "avr32_fp_register_operand" "f")))]
15736 + "TARGET_HARD_FLOAT"
15737 + "fsub.s\t%0, %1, %2"
15738 + [(set_attr "length" "4")
15739 + (set_attr "type" "fmul")])
15742 +(define_insn "negsf2"
15743 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15744 + (neg:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
15745 + "TARGET_HARD_FLOAT"
15747 + [(set_attr "length" "4")
15748 + (set_attr "type" "fmv")])
15750 +(define_insn "abssf2"
15751 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15752 + (abs:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
15753 + "TARGET_HARD_FLOAT"
15755 + [(set_attr "length" "4")
15756 + (set_attr "type" "fmv")])
15758 +(define_insn "truncdfsf2"
15759 + [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
15760 + (float_truncate:SF
15761 + (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
15762 + "TARGET_HARD_FLOAT"
15763 + "fcastd.s\t%0, %1"
15764 + [(set_attr "length" "4")
15765 + (set_attr "type" "fcast")])
15767 +(define_insn "extendsfdf2"
15768 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15770 + (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
15771 + "TARGET_HARD_FLOAT"
15772 + "fcasts.d\t%0, %1"
15773 + [(set_attr "length" "4")
15774 + (set_attr "type" "fcast")])
15776 +(define_insn "muldf3"
15777 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15778 + (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15779 + (match_operand:DF 2 "avr32_fp_register_operand" "f")))]
15780 + "TARGET_HARD_FLOAT"
15781 + "fmul.d\t%0, %1, %2"
15782 + [(set_attr "length" "4")
15783 + (set_attr "type" "fmul")])
15785 +(define_insn "nmuldf3"
15786 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15787 + (neg:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15788 + (match_operand:DF 2 "avr32_fp_register_operand" "f"))))]
15789 + "TARGET_HARD_FLOAT"
15790 + "fnmul.d\t%0, %1, %2"
15791 + [(set_attr "length" "4")
15792 + (set_attr "type" "fmul")])
15795 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "")
15796 + (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "")
15797 + (match_operand:DF 2 "avr32_fp_register_operand" "")))
15798 + (set (match_operand:DF 3 "avr32_fp_register_operand" "")
15799 + (neg:DF (match_dup 0)))]
15800 + "TARGET_HARD_FLOAT &&
15801 + (peep2_reg_dead_p(2, operands[0]) || (REGNO(operands[3]) == REGNO(operands[0])))"
15802 + [(set (match_dup 3)
15803 + (neg:DF (mult:DF (match_dup 1)
15804 + (match_dup 2))))]
15807 +(define_insn "macdf3"
15808 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15809 + (plus:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15810 + (match_operand:DF 2 "avr32_fp_register_operand" "f"))
15811 + (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
15812 + "TARGET_HARD_FLOAT"
15813 + "fmac.d\t%0, %1, %2"
15814 + [(set_attr "length" "4")
15815 + (set_attr "type" "fmul")])
15817 +(define_insn "msubacdf3"
15818 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15819 + (minus:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15820 + (match_operand:DF 2 "avr32_fp_register_operand" "f"))
15821 + (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
15822 + "TARGET_HARD_FLOAT"
15823 + "fmsc.d\t%0, %1, %2"
15824 + [(set_attr "length" "4")
15825 + (set_attr "type" "fmul")])
15828 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "")
15829 + (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "")
15830 + (match_operand:DF 2 "avr32_fp_register_operand" "")))
15831 + (set (match_operand:DF 3 "avr32_fp_register_operand" "")
15835 + "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
15836 + [(set (match_dup 3)
15837 + (minus:DF (mult:DF (match_dup 1)
15842 +(define_insn "nmsubacdf3"
15843 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15844 + (minus:DF (neg:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15845 + (match_operand:DF 2 "avr32_fp_register_operand" "f")))
15846 + (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
15847 + "TARGET_HARD_FLOAT"
15848 + "fnmsc.d\t%0, %1, %2"
15849 + [(set_attr "length" "4")
15850 + (set_attr "type" "fmul")])
15852 +(define_insn "nmacdf3"
15853 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15854 + (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15855 + (match_operand:DF 2 "avr32_fp_register_operand" "f")))
15856 + (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
15857 + "TARGET_HARD_FLOAT"
15858 + "fnmac.d\t%0, %1, %2"
15859 + [(set_attr "length" "4")
15860 + (set_attr "type" "fmul")])
15863 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "")
15864 + (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "")
15865 + (match_operand:DF 2 "avr32_fp_register_operand" "")))
15866 + (set (match_operand:DF 3 "avr32_fp_register_operand" "")
15870 + "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
15871 + [(set (match_dup 3)
15872 + (plus:DF (neg:DF (mult:DF (match_dup 1)
15877 +(define_insn "adddf3"
15878 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15879 + (plus:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15880 + (match_operand:DF 2 "avr32_fp_register_operand" "f")))]
15881 + "TARGET_HARD_FLOAT"
15882 + "fadd.d\t%0, %1, %2"
15883 + [(set_attr "length" "4")
15884 + (set_attr "type" "fmul")])
15886 +(define_insn "subdf3"
15887 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15888 + (minus:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
15889 + (match_operand:DF 2 "avr32_fp_register_operand" "f")))]
15890 + "TARGET_HARD_FLOAT"
15891 + "fsub.d\t%0, %1, %2"
15892 + [(set_attr "length" "4")
15893 + (set_attr "type" "fmul")])
15895 +(define_insn "negdf2"
15896 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15897 + (neg:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
15898 + "TARGET_HARD_FLOAT"
15900 + [(set_attr "length" "4")
15901 + (set_attr "type" "fmv")])
15903 +(define_insn "absdf2"
15904 + [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
15905 + (abs:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
15906 + "TARGET_HARD_FLOAT"
15908 + [(set_attr "length" "4")
15909 + (set_attr "type" "fmv")])
15912 +(define_expand "cmpdf"
15915 + (match_operand:DF 0 "general_operand" "")
15916 + (match_operand:DF 1 "general_operand" "")))]
15917 + "TARGET_HARD_FLOAT"
15920 + if ( !REG_P(operands[0]) )
15921 + operands[0] = force_reg(DFmode, operands[0]);
15923 + if ( !REG_P(operands[1]) )
15924 + operands[1] = force_reg(DFmode, operands[1]);
15926 + avr32_compare_op0 = operands[0];
15927 + avr32_compare_op1 = operands[1];
15929 + emit_insn(gen_cmpdf_internal(operands[0], operands[1]));
15931 + tmpreg = gen_reg_rtx(SImode);
15932 + emit_insn(gen_fpcc_to_reg(tmpreg));
15933 + emit_insn(gen_reg_to_cc(tmpreg));
15939 +(define_insn "cmpdf_internal"
15940 + [(set (reg:CC FPCC_REGNUM)
15942 + (match_operand:DF 0 "avr32_fp_register_operand" "f")
15943 + (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
15944 + "TARGET_HARD_FLOAT"
15946 + if (!rtx_equal_p(cc_prev_status.mdep.fpvalue, SET_SRC(PATTERN (insn))) )
15947 + return "fcmp.d\t%0, %1";
15950 + [(set_attr "length" "4")
15951 + (set_attr "type" "fcmpd")
15952 + (set_attr "cc" "fpcompare")])
15954 +(define_expand "cmpsf"
15957 + (match_operand:SF 0 "general_operand" "")
15958 + (match_operand:SF 1 "general_operand" "")))]
15959 + "TARGET_HARD_FLOAT"
15962 + if ( !REG_P(operands[0]) )
15963 + operands[0] = force_reg(SFmode, operands[0]);
15965 + if ( !REG_P(operands[1]) )
15966 + operands[1] = force_reg(SFmode, operands[1]);
15968 + avr32_compare_op0 = operands[0];
15969 + avr32_compare_op1 = operands[1];
15971 + emit_insn(gen_cmpsf_internal(operands[0], operands[1]));
15973 + tmpreg = gen_reg_rtx(SImode);
15974 + emit_insn(gen_fpcc_to_reg(tmpreg));
15975 + emit_insn(gen_reg_to_cc(tmpreg));
15981 +(define_insn "cmpsf_internal"
15982 + [(set (reg:CC FPCC_REGNUM)
15984 + (match_operand:SF 0 "avr32_fp_register_operand" "f")
15985 + (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
15986 + "TARGET_HARD_FLOAT"
15988 + if (!rtx_equal_p(cc_prev_status.mdep.fpvalue, SET_SRC(PATTERN (insn))) )
15989 + return "fcmp.s\t%0, %1";
15992 + [(set_attr "length" "4")
15993 + (set_attr "type" "fcmps")
15994 + (set_attr "cc" "fpcompare")])
15996 +(define_insn "fpcc_to_reg"
15997 + [(set (match_operand:SI 0 "register_operand" "=r")
15998 + (unspec:SI [(reg:CC FPCC_REGNUM)]
15999 + UNSPEC_FPCC_TO_REG))]
16000 + "TARGET_HARD_FLOAT"
16001 + "fmov.s\t%0, fsr"
16002 + [(set_attr "length" "4")
16003 + (set_attr "type" "fmvcpu")])
16005 +(define_insn "reg_to_cc"
16007 + (unspec:SI [(match_operand:SI 0 "register_operand" "r")]
16008 + UNSPEC_REG_TO_CC))]
16009 + "TARGET_HARD_FLOAT"
16011 + [(set_attr "length" "2")
16012 + (set_attr "type" "alu")
16013 + (set_attr "cc" "from_fpcc")])
16015 +(define_insn "stm_fp"
16016 + [(unspec [(match_operand 0 "register_operand" "r")
16017 + (match_operand 1 "const_int_operand" "")
16018 + (match_operand 2 "const_int_operand" "")]
16020 + "TARGET_HARD_FLOAT"
16022 + int cop_reglist = INTVAL(operands[1]);
16024 + if (INTVAL(operands[2]) != 0)
16025 + return "stcm.w\tcp0, --%0, %C1";
16027 + return "stcm.w\tcp0, %0, %C1";
16029 + if ( cop_reglist & ~0xff ){
16030 + operands[1] = GEN_INT(cop_reglist & ~0xff);
16031 + if (INTVAL(operands[2]) != 0)
16032 + return "stcm.d\tcp0, --%0, %D1";
16034 + return "stcm.d\tcp0, %0, %D1";
16037 + [(set_attr "type" "fstm")
16038 + (set_attr "length" "4")
16039 + (set_attr "cc" "none")])
16040 Index: gcc-4.2.3/gcc/config/avr32/lib1funcs.S
16041 ===================================================================
16042 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
16043 +++ gcc-4.2.3/gcc/config/avr32/lib1funcs.S 2008-05-21 13:45:54.173288052 +0200
16046 +/* Adjust the unpacked double number if it is a subnormal number.
16047 + The exponent and mantissa pair are stored
16048 + in [mant_hi,mant_lo] and [exp]. A register with the correct sign bit in
16049 + the MSB is passed in [sign]. Needs two scratch
16050 + registers [scratch1] and [scratch2]. An adjusted and packed double float
16051 + is present in [mant_hi,mant_lo] after macro has executed */
16052 +.macro adjust_subnormal_df exp, mant_lo, mant_hi, sign, scratch1, scratch2
16053 + /* We have an exponent which is <=0 indicating a subnormal number
16054 + As it should be stored as if the exponent was 1 (although the
16055 + exponent field is all zeros to indicate a subnormal number)
16056 + we have to shift down the mantissa to its correct position. */
16058 + sub \exp,-1 /* amount to shift down */
16060 + brlo 50f /* if more than 53 shift steps, the
16061 + entire mantissa will disappear
16062 + without any rounding to occur */
16067 + sub \exp,-10 /* do the shift to position the
16068 + mantissa at the same time
16069 + note! this does not include the
16070 + final 1 step shift to add the sign */
16072 + /* when shifting, save all shifted out bits in [scratch2]. we may need to
16073 + look at them to make correct rounding. */
16075 + rsub \scratch1,\exp,32 /* get inverted shift count */
16076 + cp.w \exp,32 /* handle shifts >= 32 separately */
16079 + /* small (<32) shift amount, both words are part of the shift */
16080 + lsl \scratch2,\mant_lo,\scratch1 /* save bits to shift out from lsw*/
16081 + lsl \scratch1,\mant_hi,\scratch1 /* get bits from msw destined for lsw*/
16082 + lsr \mant_lo,\mant_lo,\exp /* shift down lsw */
16083 + lsr \mant_hi,\mant_hi,\exp /* shift down msw */
16084 + or \mant_hi,\scratch1 /* add bits from msw with prepared lsw */
16087 + /* large (>=32) shift amount, only lsw will have bits left after shift.
16088 + note that shift operations will use ((shift count) mod 32) so
16089 + we do not need to subtract 32 from shift count. */
16091 + lsl \scratch2,\mant_hi,\scratch1 /* save bits to shift out from msw */
16092 + or \scratch2,\mant_lo /* also save all bits from lsw */
16093 + mov \mant_lo,\mant_hi /* msw -> lsw (i.e. "shift 32 first") */
16094 + mov \mant_hi,0 /* clear msw */
16095 + lsr \mant_lo,\mant_lo,\exp /* make rest of shift inside lsw */
16098 + /* result is almost ready to return, except that least significant bit
16099 + and the part we already shifted out may cause the result to be
16101 + bld \mant_lo,0 /* get bit to be shifted out */
16102 + brcc 51f /* if bit was 0, no rounding */
16104 + /* msb of part to remove is 1, so rounding depends on rest of bits */
16105 + tst \scratch2,\scratch2 /* get shifted out tail */
16106 + brne 50f /* if rest > 0, do round */
16107 + bld \mant_lo,1 /* we have to look at lsb in result */
16108 + brcc 51f /* if lsb is 0, don't round */
16111 + /* subnormal result requires rounding
16112 + rounding may cause subnormal to become smallest normal number
16113 + luckily, smallest normal number has exactly the representation
16114 + we got by rippling a one bit up from mantissa into exponent field. */
16116 + subcc \mant_hi,-1
16119 + /* shift and return packed double with correct sign */
16127 +/* Adjust subnormal single float number with exponent [exp]
16128 + and mantissa [mant] and round. */
16129 +.macro adjust_subnormal_sf sf, exp, mant, sign, scratch
16130 + /* subnormal number */
16131 + rsub \exp,\exp, 1 /* shift amount */
16134 + brhs 90f /* Return zero */
16135 + rsub \scratch, \exp, 32
16136 + lsl \scratch, \mant,\scratch/* Check if there are any bits set
16137 + in the bits discarded in the mantissa */
16138 + srne \scratch /* If so set the lsb of the shifted mantissa */
16139 + lsr \mant,\mant,\exp /* Shift the mantissa */
16140 + or \mant, \scratch /* Round lsb if any bits were shifted out */
16141 + /* Rounding : For explaination, see round_sf. */
16142 + mov \scratch, 0x7f /* Set rounding constant */
16144 + subeq \scratch, -1 /* For odd numbers use rounding constant 0x80 */
16145 + add \mant, \scratch /* Add rounding constant to mantissa */
16146 + /* We can't overflow because mantissa is at least shifted one position
16147 + to the right so the implicit bit is zero. We can however get the implicit
16148 + bit set after rounding which means that we have the lowest normal number
16149 + but this is ok since this bit has the same position as the LSB of the
16151 + lsr \sf, \mant, 7
16152 + /* Rotate in sign */
16159 +/* Round the unpacked df number with exponent [exp] and
16160 + mantissa [mant_hi, mant_lo]. Uses scratch register
16162 +.macro round_df exp, mant_lo, mant_hi, scratch
16163 + mov \scratch, 0x3ff /* Rounding constant */
16164 + bld \mant_lo,11 /* Check if lsb in the final result is
16166 + subeq \scratch, -1 /* Adjust rounding constant to 0x400
16167 + if rounding 0.5 upwards */
16168 + add \mant_lo, \scratch /* Round */
16169 + acr \mant_hi /* If overflowing we know that
16170 + we have all zeros in the bits not
16171 + scaled out so we can leave them
16172 + but we must increase the exponent with
16173 + two since we had an implicit bit
16174 + which is lost + the extra overflow bit */
16175 + subcs \exp, -2 /* Update exponent */
16178 +/* Round single float number stored in [mant] and [exp] */
16179 +.macro round_sf exp, mant, scratch
16181 + For 0.5 we round to nearest even integer
16182 + for all other cases we round to nearest integer.
16183 + This means that if the digit left of the "point" (.)
16184 + is 1 we can add 0x80 to the mantissa since the
16185 + corner case 0x180 will round up to 0x200. If the
16186 + digit left of the "point" is 0 we will have to
16187 + add 0x7f since this will give 0xff and hence a
16188 + truncation/rounding downwards for the corner
16189 + case when the 9 lowest bits are 0x080 */
16190 + mov \scratch, 0x7f /* Set rounding constant */
16191 + /* Check if the mantissa is even or odd */
16193 + subeq \scratch, -1 /* Rounding constant should be 0x80 */
16194 + add \mant, \scratch
16195 + subcs \exp, -2 /* Adjust exponent if we overflowed */
16198 +/* Scale mantissa [mant_hi, mant_lo] with amount [shift_count].
16199 + Uses scratch registers [scratch1] and [scratch2] */
16200 +.macro scale_df shift_count, mant_lo, mant_hi, scratch1, scratch2
16201 + /* Scale [mant_hi, mant_lo] with shift_amount.
16202 + Must not forget the sticky bits we intend to shift out. */
16204 + rsub \scratch1,\shift_count,32/* get (32 - shift count)
16205 + (if shift count > 32 we get a
16206 + negative value, but that will
16207 + work as well in the code below.) */
16209 + cp.w \shift_count,32 /* handle shifts >= 32 separately */
16212 + /* small (<32) shift amount, both words are part of the shift
16213 + first remember whether part that is lost contains any 1 bits ... */
16214 + lsl \scratch2,\mant_lo,\scratch1 /*shift away bits that are part of
16215 + final mantissa. only part that goes
16216 + to scratch2 are bits that will be lost */
16218 + /* ... and now to the actual shift */
16219 + lsl \scratch1,\mant_hi,\scratch1 /* get bits from msw destined for lsw*/
16220 + lsr \mant_lo,\mant_lo,\shift_count /* shift down lsw of mantissa */
16221 + lsr \mant_hi,\mant_hi,\shift_count /* shift down msw of mantissa */
16222 + or \mant_lo,\scratch1 /* combine these bits with prepared lsw*/
16225 + /* large (>=32) shift amount, only lsw will have bits left after shift.
16226 + note that shift operations will use ((shift count) mod 32) so
16227 + we do not need to subtract 32 from shift count. */
16229 + /* first remember whether part that is lost contains any 1 bits ... */
16230 + lsl \scratch2,\mant_hi,\scratch1 /* save all lost bits from msw */
16231 + or \scratch2,\mant_lo /* also save lost bits (all) from lsw
16232 + now scratch2<>0 if we lose any bits */
16234 + /* ... and now to the actual shift */
16235 + mov \mant_lo,\mant_hi /* msw -> lsw (i.e. "shift 32 first")*/
16236 + mov \mant_hi,0 /* clear msw */
16237 + lsr \mant_lo,\mant_lo,\shift_count /* make rest of shift inside lsw*/
16240 + cp.w \scratch2,0 /* if any '1' bit in part we lost ...*/
16243 + sbr \mant_lo,0 /* ... we need to set sticky bit*/
16247 +/* Unpack exponent and mantissa from the double number
16248 + stored in [df_hi,df_lo]. The exponent is stored in [exp]
16249 + while the mantissa is stored in [df_hi,df_lo]. */
16251 +.macro unpack_df exp, df_lo, df_hi
16252 + lsr \exp, \df_hi,21 /* Extract exponent */
16253 + lsl \df_hi,10 /* Get mantissa */
16254 + or \df_hi,\df_hi,\df_lo>>21
16257 + neg \exp /* Fix implicit bit */
16260 + neg \exp /* negate back exponent */
16263 +/* Unpack exponent and mantissa from the single float number
16264 + stored in [sf]. The exponent is stored in [exp]
16265 + while the mantissa is stored in [sf]. */
16266 +.macro unpack_sf exp, sf
16267 + lsr \exp, \sf, 24
16269 + /* Fix subnormal number */
16277 + sbr \sf, 31 /*Implicit bit*/
16283 +/* Pack a single float number stored in [mant] and [exp]
16284 + into a single float number in [sf] */
16285 +.macro pack_sf sf, exp, mant
16286 + bld \mant,31 /* implicit bit to z */
16287 + subne \exp,1 /* if subnormal (implicit bit 0)
16288 + adjust exponent to storage format */
16290 + lsr \sf, \mant, 7
16291 + bfins \sf, \exp, 24, 8
16294 +/* Pack exponent [exp] and mantissa [mant_hi, mant_lo]
16295 + into [df_hi, df_lo]. [df_hi] is shifted
16296 + one bit up so the sign bit can be shifted into it */
16298 +.macro pack_df exp, mant_lo, mant_hi, df_lo, df_hi
16299 + bld \mant_hi,31 /* implicit bit to z */
16300 + subne \exp,1 /* if subnormal (implicit bit 0)
16301 + adjust exponent to storage format */
16303 + lsr \mant_lo,11 /* shift back lsw */
16304 + or \df_lo,\mant_lo,\mant_hi<<21 /* combine with low bits from msw */
16305 + lsl \mant_hi,1 /* get rid of implicit bit */
16306 + lsr \mant_hi,11 /* shift back msw except for one step*/
16307 + or \df_hi,\mant_hi,\exp<<21 /* combine msw with exponent */
16310 +/* Normalize single float number stored in [mant] and [exp]
16311 + using scratch register [scratch] */
16312 +.macro normalize_sf exp, mant, scratch
16313 + /* Adjust exponent and mantissa */
16314 + clz \scratch, \mant
16315 + sub \exp, \scratch
16316 + lsl \mant, \mant, \scratch
16319 +/* Normalize the exponent and mantissa pair stored
16320 + in [mant_hi,mant_lo] and [exp]. Needs two scratch
16321 + registers [scratch1] and [scratch2]. */
16322 +.macro normalize_df exp, mant_lo, mant_hi, scratch1, scratch2
16323 + clz \scratch1,\mant_hi /* Check if we have zeros in high bits */
16324 + breq 80f /* No need for scaling if no zeros in high bits */
16325 + brcs 81f /* Check for all zeros */
16327 + /* shift amount is smaller than 32, and involves both msw and lsw*/
16328 + rsub \scratch2,\scratch1,32 /* shift mantissa */
16329 + lsl \mant_hi,\mant_hi,\scratch1
16330 + lsr \scratch2,\mant_lo,\scratch2
16331 + or \mant_hi,\scratch2
16332 + lsl \mant_lo,\mant_lo,\scratch1
16333 + sub \exp,\scratch1 /* adjust exponent */
16334 + rjmp 80f /* Finished */
16336 + /* shift amount is greater than 32 */
16337 + clz \scratch1,\mant_lo /* shift mantissa */
16338 + movcs \scratch1, 0
16339 + subcc \scratch1,-32
16340 + mov \mant_hi,\mant_lo
16341 + lsl \mant_hi,\mant_hi,\scratch1
16343 + sub \exp,\scratch1 /* adjust exponent */
16348 +/* Fast but approximate multiply of two 64-bit numbers to give a 64 bit result.
16349 + The multiplication of [al]x[bl] is discarded.
16350 + Operands in [ah], [al], [bh], [bl].
16351 + Scratch registers in [sh], [sl].
16352 + Returns results in registers [rh], [rl].*/
16353 +.macro mul_approx_df ah, al, bh, bl, rh, rl, sh, sl
16354 + mulu.d \sl, \ah, \bl
16355 + macu.d \sl, \al, \bh
16356 + mulu.d \rl, \ah, \bh
16364 +#ifdef L_avr32_f64_mul
16366 + .global __avr32_f64_mul
16367 + .type __avr32_f64_mul,@function
16371 + or r12, r10, r11 << 1
16372 + breq __avr32_f64_mul_op1_zero
16374 + stm --sp, r5,r6,r7,lr
16375 + /* op1 in {r11,r10}*/
16376 + /* op2 in {r9,r8}*/
16377 + eor lr, r11, r9 /* MSB(lr) = Sign(op1) ^ Sign(op2) */
16381 + /* sf: r11, r10 */
16382 + lsr r7, r11, 20 /* Extract exponent */
16384 + lsl r11, 11 /* Extract mantissa, leave room for implicit bit */
16385 + or r11, r11, r10>>21
16387 + sbr r11, 31 /* Insert implicit bit */
16389 + cbr r7, 11 /* Clear sign bit */
16390 + /* Check if normalization is needed */
16391 + breq __avr32_f64_mul_op1_subnormal /*If number is subnormal, normalize it */
16397 + lsr r6, r9, 20 /* Extract exponent */
16399 + lsl r9, 11 /* Extract mantissa, leave room for implicit bit */
16400 + or r9, r9, r8>>21
16402 + sbr r9, 31 /* Insert implicit bit */
16404 + cbr r6, 11 /* Clear sign bit */
16405 + /* Check if normalization is needed */
16406 + breq __avr32_f64_mul_op2_subnormal /*If number is subnormal, normalize it */
16409 + /* Check if any operands are NaN or INF */
16411 + breq __avr32_f64_mul_op_nan_or_inf /* Check op1 for NaN or Inf */
16413 + breq __avr32_f64_mul_op_nan_or_inf /* Check op2 for NaN or Inf */
16416 + /* Calculate new exponent in r12*/
16418 + sub r12, (1023-1)
16420 + /* Do the multiplication using approximate calculation.
16421 + Place result in r11, r10. Use r7, r6 as scratch registers */
16422 + mul_approx_df r11 /*ah*/, r10 /*al*/, r9 /*bh*/, r8 /*bl*/, r11 /*rh*/, r10 /*rl*/, r7 /*sh*/, r6 /*sl*/
16424 + /* Check if result is zero */
16425 + breq __avr32_f64_mul_res_subnormal
16427 + /* Adjust exponent and mantissa */
16428 + /* [r12]:exp, [r11, r10]:mant, [r9,r8,r7]:scratch*/
16429 + /* Mantissa may be of the format 0.xxxx or 1.xxxx. */
16430 + /* In the first case, shift one pos to left.*/
16440 + breq __avr32_f64_mul_res_subnormal /*Result was subnormal. Flush-to-zero and return zero*/
16442 + /* Check for Inf. */
16444 + brge __avr32_f64_mul_res_inf
16446 + /* Result was not subnormal. Perform rounding. */
16447 + /* Because of performance optimization, we have no sticky bit, */
16448 + /* so round-to-even won't work as specified in the IEEE standard.*/
16449 + /* [r12]:exp, [r11, r10]:mant */
16450 + /* Mantissa is in 0.64 format. Round by adding 1<<(64-(52+2))=1<<10*/
16451 + /* That is, 1 in the MSB of the part that will be discarded in final packing.*/
16455 + /* Adjust exponent if we overflowed.*/
16459 + /* Pack final result*/
16460 + /* Input: [r12]:exp, [r11, r10]:mant */
16461 + /* Result in [r11,r10] */
16462 + /* Insert mantissa */
16463 + cbr r11, 31 /*Clear implicit bit*/
16465 + or r10, r10, r11<<21
16467 + /* Insert exponent and sign bit*/
16468 + or r11, r11, r12<<20
16472 + /* Return result in [r11,r10] */
16473 + ldm sp++, r5, r6, r7,pc
16476 +__avr32_f64_mul_op1_subnormal:
16477 + cbr r11, 31 /* Clear implicit bit. */
16478 + normalize_df r7 /*exp*/, r10, r11 /*Mantissa*/, r5, r12 /*scratch*/
16481 +__avr32_f64_mul_op2_subnormal:
16482 + cbr r9, 31 /* Clear implicit bit. */
16483 + normalize_df r6 /*exp*/, r8, r9 /*Mantissa*/, r5, r12 /*scratch*/
16487 +__avr32_f64_mul_op_nan_or_inf:
16488 + /* Same code for OP1 and OP2*/
16489 + /* Since we are here, at least one of the OPs were NaN or INF*/
16490 + /* Shift out implicit bit of both operands' mantissa */
16493 + /* Merge the regs in each operand to check for zero*/
16494 + or r11, r10 /* op1 */
16495 + or r9, r8 /* op2 */
16496 + /* Check if op1 is NaN or INF */
16498 + brne __avr32_f64_mul_op1_not_naninf
16499 + /* op1 was NaN or INF.*/
16501 + brne __avr32_f64_mul_res_nan /* op1 was NaN. Result will be NaN*/
16502 + /*op1 was INF. check if op2 is NaN or INF*/
16504 + brne __avr32_f64_mul_res_inf /*op1 was INF, op2 was neither NaN nor INF*/
16505 + /* op1 is INF, op2 is either NaN or INF*/
16507 + breq __avr32_f64_mul_res_inf /*op2 was also INF*/
16508 + rjmp __avr32_f64_mul_res_nan /*op2 was NaN*/
16510 +__avr32_f64_mul_op1_not_naninf:
16511 + /* op1 was not NaN nor INF. Then op2 must be NaN or INF*/
16513 + breq __avr32_f64_mul_res_inf /*op2 was INF, return INF*/
16514 + rjmp __avr32_f64_mul_res_nan /*else return NaN*/
16516 +__avr32_f64_mul_res_subnormal:/* Multiply result was subnormal. Return zero. */
16517 + mov r11, lr /*Get correct sign*/
16518 + andh r11, 0x8000, COH
16520 + ldm sp++, r5, r6, r7,pc
16522 +__avr32_f64_mul_res_nan: /* Return NaN. */
16525 + ldm sp++, r5, r6, r7,pc
16527 +__avr32_f64_mul_res_inf: /* Return INF. */
16533 + ldm sp++, r5, r6, r7,pc
16535 +__avr32_f64_mul_op1_zero:
16538 + andh r11, 0x8000, COH
16539 + /* Check if op2 is Inf or NaN. */
16540 + bfextu r12, r9, 20, 11
16542 + retne r12 /* Return 0.0 */
16553 +#if defined(L_avr32_f64_addsub) || defined(L_avr32_f64_addsub_fast)
16556 +__avr32_f64_sub_from_add:
16557 + /* Switch sign on op2 */
16560 +#if defined(L_avr32_f64_addsub_fast)
16561 + .global __avr32_f64_sub_fast
16562 + .type __avr32_f64_sub_fast,@function
16563 +__avr32_f64_sub_fast:
16565 + .global __avr32_f64_sub
16566 + .type __avr32_f64_sub,@function
16570 + /* op1 in {r11,r10}*/
16571 + /* op2 in {r9,r8}*/
16573 +#if defined(L_avr32_f64_addsub_fast)
16574 + /* If op2 is zero just return op1 */
16575 + or r12, r8, r9 << 1
16579 + /* Check signs */
16581 + /* Different signs, use addition. */
16582 + brmi __avr32_f64_add_from_sub
16584 + stm --sp, r5, r6, r7, lr
16586 + /* Get sign of op1 into r12 */
16588 + andh r12, 0x8000, COH
16590 + /* Remove sign from operands */
16594 + /* Put the number with the largest exponent in [r11, r10]
16595 + and the number with the smallest exponent in [r9, r8] */
16597 + brhs 1f /* Skip swap if operands already correctly ordered*/
16598 + /* Operands were not correctly ordered, swap them*/
16605 + eorh r12, 0x8000 /* Invert sign in r12*/
16607 + /* Unpack largest operand - opH */
16609 + /* sf: r11, r10 */
16610 + lsr r7, r11, 20 /* Extract exponent */
16611 + cbr r7, 11 /* Clear sign bit */
16612 + lsl r11, 11 /* Extract mantissa, leave room for implicit bit */
16613 + or r11, r11, r10>>21
16615 + sbr r11, 31 /* Insert implicit bit */
16618 + /* Unpack smallest operand - opL */
16621 + lsr r6, r9, 20 /* Extract exponent */
16622 + cbr r6, 11 /* Clear sign bit */
16623 + breq __avr32_f64_sub_opL_subnormal /* If either zero or subnormal */
16624 + lsl r9, 11 /* Extract mantissa, leave room for implicit bit */
16625 + or r9, r9, r8>>21
16627 + sbr r9, 31 /* Insert implicit bit */
16630 +__avr32_f64_sub_opL_subnormal_done:
16631 + /* opH is NaN or Inf. */
16633 + breq __avr32_f64_sub_opH_nan_or_inf
16635 + /* Get shift amount to scale mantissa of op2. */
16637 + breq __avr32_f64_sub_shift_done /* No need to shift, exponents are equal*/
16639 + /* Scale mantissa [r9, r8] with amount [r6].
16640 + Uses scratch registers [r5] and [lr].
16641 + In IEEE mode:Must not forget the sticky bits we intend to shift out. */
16643 + rsub r5,r6,32 /* get (32 - shift count)
16644 + (if shift count > 32 we get a
16645 + negative value, but that will
16646 + work as well in the code below.) */
16648 + cp.w r6,32 /* handle shifts >= 32 separately */
16649 + brhs __avr32_f64_sub_longshift
16651 + /* small (<32) shift amount, both words are part of the shift
16652 + first remember whether part that is lost contains any 1 bits ... */
16653 + lsl lr,r8,r5 /* shift away bits that are part of
16654 + final mantissa. only part that goes
16655 + to lr are bits that will be lost */
16657 + /* ... and now to the actual shift */
16658 + lsl r5,r9,r5 /* get bits from msw destined for lsw*/
16659 + lsr r8,r8,r6 /* shift down lsw of mantissa */
16660 + lsr r9,r9,r6 /* shift down msw of mantissa */
16661 + or r8,r5 /* combine these bits with prepared lsw*/
16662 +#if defined(L_avr32_f64_addsub)
16663 + cp.w lr,0 /* if any '1' bit in part we lost ...*/
16665 + or r8, lr /* ... we need to set sticky bit*/
16668 +__avr32_f64_sub_shift_done:
16669 + /* Now subtract the mantissas. */
16673 + /* Normalize the exponent and mantissa pair stored in
16674 + [r11,r10] and exponent in [r7]. Needs two scratch registers [r6] and [lr]. */
16675 + clz r6,r11 /* Check if we have zeros in high bits */
16676 + breq __avr32_f64_sub_longnormalize_done /* No need for scaling if no zeros in high bits */
16677 + brcs __avr32_f64_sub_longnormalize
16679 + /* shift amount is smaller than 32, and involves both msw and lsw*/
16680 + rsub lr,r6,32 /* shift mantissa */
16685 + sub r7,r6 /* adjust exponent */
16686 + brle __avr32_f64_sub_subnormal_result
16688 +__avr32_f64_sub_longnormalize_done:
16690 +#if defined(L_avr32_f64_addsub)
16691 + /* Insert the bits we will remove from the mantissa r9[31:21] */
16692 + lsl r9, r10, (32 - 11)
16694 + /* Keep the last bit shifted out. */
16695 + bfextu r9, r10, 10, 1
16698 + /* Pack final result*/
16699 + /* Input: [r7]:exp, [r11, r10]:mant, [r12]:sign in MSB */
16700 + /* Result in [r11,r10] */
16701 + /* Insert mantissa */
16702 + cbr r11, 31 /*Clear implicit bit*/
16704 + or r10, r10, r11<<21
16706 + /* Insert exponent and sign bit*/
16707 + or r11, r11, r7<<20
16712 +__avr32_f64_sub_round:
16713 +#if defined(L_avr32_f64_addsub)
16725 + /* Return result in [r11,r10] */
16726 + ldm sp++, r5, r6, r7,pc
16730 +__avr32_f64_sub_opL_subnormal:
16731 + /* Extract the of mantissa */
16732 + lsl r9, 11 /* Extract mantissa, leave room for implicit bit */
16733 + or r9, r9, r8>>21
16736 + /* Set exponent to 1 if we do not have a zero. */
16740 + /* Check if opH is also subnormal. If so, clear implicit bit in r11*/
16745 + /* Check if op1 is zero, if so set exponent to 0. */
16749 + rjmp __avr32_f64_sub_opL_subnormal_done
16751 +__avr32_f64_sub_opH_nan_or_inf:
16752 + /* Check if opH is NaN, if so return NaN */
16755 + brne __avr32_f64_sub_return_nan
16757 + /* opH is Inf. */
16758 + /* Check if opL is Inf. or NaN */
16760 + breq __avr32_f64_sub_opL_nan_or_inf
16761 + ldm sp++, r5, r6, r7, pc/* opL not Inf or NaN, return opH */
16762 +__avr32_f64_sub_opL_nan_or_inf:
16765 + brne __avr32_f64_sub_return_nan
16766 + mov r10, 0 /* Generate Inf in r11, r10 */
16769 + ldm sp++, r5, r6, r7, pc/* opL Inf, return Inf */
16770 +__avr32_f64_sub_return_nan:
16771 + mov r10, -1 /* Generate NaN in r11, r10 */
16773 + ldm sp++, r5, r6, r7, pc/* opL Inf or NaN, return NaN */
16776 +__avr32_f64_sub_subnormal_result:
16777 + /* Just flush subnormals to zero. */
16780 + ldm sp++, r5, r6, r7, pc
16783 +__avr32_f64_sub_longshift:
16784 + /* large (>=32) shift amount, only lsw will have bits left after shift.
16785 + note that shift operations will use ((shift count=r6) mod 32) so
16786 + we do not need to subtract 32 from shift count. */
16787 + /* Saturate the shift amount to 63. If the amount
16788 + is any larger op2 is insignificant. */
16790 +#if defined(L_avr32_f64_addsub)
16791 + /* first remember whether part that is lost contains any 1 bits ... */
16792 + lsl lr,r9,r5 /* save all lost bits from msw */
16793 + or lr,r8 /* also save lost bits (all) from lsw
16794 + now lr != 0 if we lose any bits */
16796 + /* ... and now to the actual shift */
16797 + mov r8,r9 /* msw -> lsw (i.e. "shift 32 first")*/
16798 + mov r9,0 /* clear msw */
16799 + lsr r8,r8,r6 /* make rest of shift inside lsw*/
16800 +#if defined(L_avr32_f64_addsub)
16801 + cp.w lr,0 /* if any '1' bit in part we lost ...*/
16803 + or r8, lr /* ... we need to set sticky bit*/
16805 + rjmp __avr32_f64_sub_shift_done
16807 +__avr32_f64_sub_longnormalize:
16808 + /* shift amount is greater than 32 */
16809 + clz r6,r10 /* shift mantissa */
16810 + /* If the resulting mantissa is zero the result is
16811 + zero so force exponent to zero. */
16818 + sub r7,r6 /* adjust exponent */
16819 + brle __avr32_f64_sub_subnormal_result
16820 + rjmp __avr32_f64_sub_longnormalize_done
16825 +__avr32_f64_add_from_sub:
16826 + /* Switch sign on op2 */
16829 +#if defined(L_avr32_f64_addsub_fast)
16830 + .global __avr32_f64_add_fast
16831 + .type __avr32_f64_add_fast,@function
16832 +__avr32_f64_add_fast:
16834 + .global __avr32_f64_add
16835 + .type __avr32_f64_add,@function
16839 + /* op1 in {r11,r10}*/
16840 + /* op2 in {r9,r8}*/
16842 +#if defined(L_avr32_f64_addsub_fast)
16843 + /* If op2 is zero just return op1 */
16844 + or r12, r8, r9 << 1
16848 + /* Check signs */
16850 + /* Different signs, use subtraction. */
16851 + brmi __avr32_f64_sub_from_add
16853 + stm --sp, r5, r6, r7, lr
16855 + /* Get sign of op1 into r12 */
16857 + andh r12, 0x8000, COH
16859 + /* Remove sign from operands */
16863 + /* Put the number with the largest exponent in [r11, r10]
16864 + and the number with the smallest exponent in [r9, r8] */
16866 + brhs 1f /* Skip swap if operands already correctly ordered*/
16867 + /* Operands were not correctly ordered, swap them*/
16875 + /* Unpack largest operand - opH */
16877 + /* sf: r11, r10 */
16878 + lsr r7, r11, 20 /* Extract exponent */
16879 + cbr r7, 11 /* Clear sign bit */
16880 + lsl r11, 11 /* Extract mantissa, leave room for implicit bit */
16881 + or r11, r11, r10>>21
16883 + sbr r11, 31 /* Insert implicit bit */
16886 + /* Unpack smallest operand - opL */
16889 + lsr r6, r9, 20 /* Extract exponent */
16890 + cbr r6, 11 /* Clear sign bit */
16891 + breq __avr32_f64_add_opL_subnormal /* If either zero or subnormal */
16892 + lsl r9, 11 /* Extract mantissa, leave room for implicit bit */
16893 + or r9, r9, r8>>21
16895 + sbr r9, 31 /* Insert implicit bit */
16898 +__avr32_f64_add_opL_subnormal_done:
16899 + /* opH is NaN or Inf. */
16901 + breq __avr32_f64_add_opH_nan_or_inf
16903 + /* Get shift amount to scale mantissa of op2. */
16905 + breq __avr32_f64_add_shift_done /* No need to shift, exponents are equal*/
16907 + /* Scale mantissa [r9, r8] with amount [r6].
16908 + Uses scratch registers [r5] and [lr].
16909 + In IEEE mode:Must not forget the sticky bits we intend to shift out. */
16910 + rsub r5,r6,32 /* get (32 - shift count)
16911 + (if shift count > 32 we get a
16912 + negative value, but that will
16913 + work as well in the code below.) */
16915 + cp.w r6,32 /* handle shifts >= 32 separately */
16916 + brhs __avr32_f64_add_longshift
16918 + /* small (<32) shift amount, both words are part of the shift
16919 + first remember whether part that is lost contains any 1 bits ... */
16920 + lsl lr,r8,r5 /* shift away bits that are part of
16921 + final mantissa. only part that goes
16922 + to lr are bits that will be lost */
16924 + /* ... and now to the actual shift */
16925 + lsl r5,r9,r5 /* get bits from msw destined for lsw*/
16926 + lsr r8,r8,r6 /* shift down lsw of mantissa */
16927 + lsr r9,r9,r6 /* shift down msw of mantissa */
16928 + or r8,r5 /* combine these bits with prepared lsw*/
16929 +#if defined(L_avr32_f64_addsub)
16930 + cp.w lr,0 /* if any '1' bit in part we lost ...*/
16932 + or r8, lr /* ... we need to set sticky bit*/
16935 +__avr32_f64_add_shift_done:
16936 + /* Now add the mantissas. */
16940 + /* Check if we overflowed. */
16941 + brcs __avr32_f64_add_res_of
16943 +__avr32_f64_add_res_of_done:
16945 +#if defined(L_avr32_f64_addsub)
16946 + /* Insert the bits we will remove from the mantissa r9[31:21] */
16947 + lsl r9, r10, (32 - 11)
16949 + /* Keep the last bit shifted out. */
16950 + bfextu r9, r10, 10, 1
16953 + /* Pack final result*/
16954 + /* Input: [r7]:exp, [r11, r10]:mant, [r12]:sign in MSB */
16955 + /* Result in [r11,r10] */
16956 + /* Insert mantissa */
16957 + cbr r11, 31 /*Clear implicit bit*/
16959 + or r10, r10, r11<<21
16961 + /* Insert exponent and sign bit*/
16962 + or r11, r11, r7<<20
16967 +__avr32_f64_add_round:
16968 +#if defined(L_avr32_f64_addsub)
16980 + /* Return result in [r11,r10] */
16981 + ldm sp++, r5, r6, r7,pc
16985 +__avr32_f64_add_opL_subnormal:
16986 + /* Extract the of mantissa */
16987 + lsl r9, 11 /* Extract mantissa, leave room for implicit bit */
16988 + or r9, r9, r8>>21
16991 + /* Set exponent to 1 if we do not have a zero. */
16995 + /* Check if opH is also subnormal. If so, clear implicit bit in r11*/
17000 + /* Check if op1 is zero, if so set exponent to 0. */
17004 + rjmp __avr32_f64_add_opL_subnormal_done
17006 +__avr32_f64_add_opH_nan_or_inf:
17007 + /* Check if opH is NaN, if so return NaN */
17010 + brne __avr32_f64_add_return_nan
17012 + /* opH is Inf. */
17013 + /* Check if opL is Inf. or NaN */
17015 + breq __avr32_f64_add_opL_nan_or_inf
17016 + ldm sp++, r5, r6, r7, pc/* opL not Inf or NaN, return opH */
17017 +__avr32_f64_add_opL_nan_or_inf:
17020 + brne __avr32_f64_add_return_nan
17021 + mov r10, 0 /* Generate Inf in r11, r10 */
17024 + ldm sp++, r5, r6, r7, pc/* opL Inf, return Inf */
17025 +__avr32_f64_add_return_nan:
17026 + mov r10, -1 /* Generate NaN in r11, r10 */
17028 + ldm sp++, r5, r6, r7, pc/* opL Inf or NaN, return NaN */
17031 +__avr32_f64_add_longshift:
17032 + /* large (>=32) shift amount, only lsw will have bits left after shift.
17033 + note that shift operations will use ((shift count=r6) mod 32) so
17034 + we do not need to subtract 32 from shift count. */
17035 + /* Saturate the shift amount to 63. If the amount
17036 + is any larger op2 is insignificant. */
17038 +#if defined(L_avr32_f64_addsub)
17039 + /* first remember whether part that is lost contains any 1 bits ... */
17040 + lsl lr,r9,r5 /* save all lost bits from msw */
17041 + or lr,r8 /* also save lost bits (all) from lsw
17042 + now lr != 0 if we lose any bits */
17044 + /* ... and now to the actual shift */
17045 + mov r8,r9 /* msw -> lsw (i.e. "shift 32 first")*/
17046 + mov r9,0 /* clear msw */
17047 + lsr r8,r8,r6 /* make rest of shift inside lsw*/
17048 +#if defined(L_avr32_f64_addsub)
17049 + cp.w lr,0 /* if any '1' bit in part we lost ...*/
17051 + or r8, lr /* ... we need to set sticky bit*/
17053 + rjmp __avr32_f64_add_shift_done
17055 +__avr32_f64_add_res_of:
17056 + /* We overflowed. Increase exponent and shift mantissa.*/
17057 + /* [r7]:exp, [r11, r10]:mant */
17062 + /* Clear mantissa to set result to Inf if the exponent is 255. */
17066 + rjmp __avr32_f64_add_res_of_done
17071 +#ifdef L_avr32_f64_to_u32
17072 + /* This goes into L_fixdfsi */
17076 +#ifdef L_avr32_f64_to_s32
17077 + .global __avr32_f64_to_u32
17078 + .type __avr32_f64_to_u32,@function
17079 +__avr32_f64_to_u32:
17081 + retmi 0 /* Negative returns 0 */
17083 + /* Fallthrough to df to signed si conversion */
17084 + .global __avr32_f64_to_s32
17085 + .type __avr32_f64_to_s32,@function
17086 +__avr32_f64_to_s32:
17088 + lsr r12,21 /* extract exponent*/
17089 + sub r12,1023 /* convert to unbiased exponent.*/
17090 + retlo 0 /* too small exponent implies zero. */
17093 + rsub r12,r12,31 /* shift count = 31 - exponent */
17094 + mov r9,r11 /* save sign for later...*/
17095 + lsl r11,11 /* remove exponent and sign*/
17096 + sbr r11,31 /* add implicit bit*/
17097 + or r11,r11,r10>>21 /* get rest of bits from lsw of double */
17098 + lsr r11,r11,r12 /* shift down mantissa to final place */
17099 + lsl r9,1 /* sign -> carry */
17100 + retcc r11 /* if positive, we are done */
17101 + neg r11 /* if negative float, negate result */
17104 +#endif /* L_fixdfsi*/
17106 +#ifdef L_avr32_f64_to_u64
17107 + /* Actual function is in L_fixdfdi */
17110 +#ifdef L_avr32_f64_to_s64
17111 + .global __avr32_f64_to_u64
17112 + .type __avr32_f64_to_u64,@function
17113 +__avr32_f64_to_u64:
17115 + /* Negative numbers return zero */
17122 + /* Fallthrough */
17123 + .global __avr32_f64_to_s64
17124 + .type __avr32_f64_to_s64,@function
17125 +__avr32_f64_to_s64:
17127 + lsr r9,21 /* get exponent*/
17128 + sub r9,1023 /* convert to correct range*/
17129 + /* Return zero if exponent to small */
17134 + mov r8,r11 /* save sign for later...*/
17136 + lsl r11,11 /* remove exponent */
17137 + sbr r11,31 /* add implicit bit*/
17138 + or r11,r11,r10>>21 /* get rest of bits from lsw of double*/
17139 + lsl r10,11 /* align lsw correctly as well */
17140 + rsub r9,r9,63 /* shift count = 63 - exponent */
17143 + cp.w r9,32 /* is shift count more than one reg? */
17146 + mov r12,r11 /* save msw */
17147 + lsr r10,r10,r9 /* small shift count, shift down lsw */
17148 + lsr r11,r11,r9 /* small shift count, shift down msw */
17149 + rsub r9,r9,32 /* get 32-size of shifted out tail */
17150 + lsl r12,r12,r9 /* align part to move from msw to lsw */
17151 + or r10,r12 /* combine to get new lsw */
17155 + lsr r10,r11,r9 /* large shift count,only lsw get bits
17156 + note that shift count is modulo 32*/
17157 + mov r11,0 /* msw will be 0 */
17160 + lsl r8,1 /* sign -> carry */
17161 + retcc r11 /* if positive, we are done */
17163 + neg r11 /* if negative float, negate result */
17170 +#ifdef L_avr32_u32_to_f64
17171 + /* Code located in L_floatsidf */
17174 +#ifdef L_avr32_s32_to_f64
17175 + .global __avr32_u32_to_f64
17176 + .type __avr32_u32_to_f64,@function
17177 +__avr32_u32_to_f64:
17178 + sub r11, r12, 0 /* Move to r11 and force Z flag to be updated */
17179 + mov r12, 0 /* always positive */
17180 + rjmp 0f /* Jump to common code for floatsidf */
17182 + .global __avr32_s32_to_f64
17183 + .type __avr32_s32_to_f64,@function
17184 +__avr32_s32_to_f64:
17185 + mov r11, r12 /* Keep original value in r12 for sign */
17186 + abs r11 /* Absolute value if r12 */
17188 + mov r10,0 /* let remaining bits be zero */
17189 + reteq r11 /* zero long will return zero float */
17192 + mov r9,31+1023 /* set exponent */
17194 + normalize_df r9 /*exp*/, r10, r11 /* mantissa */, r8, lr /* scratch */
17196 + /* Check if a subnormal result was created */
17200 + adjust_subnormal_df r9 /* exp */, r10, r11 /* Mantissa */, r12 /*sign*/, r8, lr /* scratch */
17204 + /* Round result */
17205 + round_df r9 /*exp*/, r10, r11 /* Mantissa */, r8 /*scratch*/
17208 + /*Return infinity */
17212 + rjmp __floatsidf_return_op1
17217 + pack_df r9 /*exp*/, r10, r11 /* mantissa */, r10, r11 /* Output df number*/
17218 +__floatsidf_return_op1:
17219 + lsl r12,1 /* shift in sign bit */
17226 +#ifdef L_avr32_f32_cmp_eq
17227 + .global __avr32_f32_cmp_eq
17228 + .type __avr32_f32_cmp_eq,@function
17229 +__avr32_f32_cmp_eq:
17232 + /* If not equal check for +/-0 */
17233 + /* Or together the two values and shift out the sign bit.
17234 + If the result is zero, then the two values are both zero. */
17240 + /* Numbers were equal. Check for NaN or Inf */
17245 + srls r12 /* 0 if NaN, 1 otherwise */
17249 +#if defined(L_avr32_f32_cmp_ge) || defined(L_avr32_f32_cmp_lt)
17250 +#ifdef L_avr32_f32_cmp_ge
17251 + .global __avr32_f32_cmp_ge
17252 + .type __avr32_f32_cmp_ge,@function
17253 +__avr32_f32_cmp_ge:
17255 +#ifdef L_avr32_f32_cmp_lt
17256 + .global __avr32_f32_cmp_lt
17257 + .type __avr32_f32_cmp_lt,@function
17258 +__avr32_f32_cmp_lt:
17260 + lsl r10, r12, 1 /* Remove sign bits */
17265 + rethi 0 /* Op0 is NaN */
17267 + rethi 0 /* Op1 is Nan */
17271 +#ifdef L_avr32_f32_cmp_ge
17272 + srcc r8 /* Set result to true if op0 is positive*/
17274 +#ifdef L_avr32_f32_cmp_lt
17275 + srcs r8 /* Set result to true if op0 is negative*/
17277 + retmi r8 /* Return if signs are different */
17278 + brcs 0f /* Both signs negative? */
17280 + /* Both signs positive */
17282 +#ifdef L_avr32_f32_cmp_ge
17285 +#ifdef L_avr32_f32_cmp_lt
17290 + /* Both signs negative */
17292 +#ifdef L_avr32_f32_cmp_ge
17295 +#ifdef L_avr32_f32_cmp_lt
17302 +#ifdef L_avr32_f64_cmp_eq
17303 + .global __avr32_f64_cmp_eq
17304 + .type __avr32_f64_cmp_eq,@function
17305 +__avr32_f64_cmp_eq:
17310 + /* Args were not equal*/
17311 + /* Both args could be zero with different sign bits */
17312 + lsl r11,1 /* get rid of sign bits */
17314 + or r11,r10 /* Check if all bits are zero */
17317 + sreq r12 /* If all zeros the arguments are equal
17318 + so return 1 else return 0 */
17321 + /* check for NaN */
17326 + cpc r11,r12 /* check if nan or inf */
17327 + srls r12 /* If Arg is NaN return 0 else 1*/
17328 + ret r12 /* Return */
17333 +#if defined(L_avr32_f64_cmp_ge) || defined(L_avr32_f64_cmp_lt)
17335 +#ifdef L_avr32_f64_cmp_ge
17336 + .global __avr32_f64_cmp_ge
17337 + .type __avr32_f64_cmp_ge,@function
17338 +__avr32_f64_cmp_ge:
17340 +#ifdef L_avr32_f64_cmp_lt
17341 + .global __avr32_f64_cmp_lt
17342 + .type __avr32_f64_cmp_lt,@function
17343 +__avr32_f64_cmp_lt:
17346 + /* compare magnitude of op1 and op2 */
17349 + lsl r11,1 /* Remove sign bit of op1 */
17350 + srcs lr /* Sign op1 to lsb of lr*/
17351 + lsl r9,1 /* Remove sign bit of op2 */
17352 + rol lr /* Sign op2 to lsb of lr, sign bit op1 bit 1 of lr*/
17354 + /* Check for Nan */
17359 + movhi r12, 0 /* Return false for NaN */
17360 + brhi 0f /* We have NaN */
17363 + movhi r12, 0 /* Return false for NaN */
17364 + brhi 0f /* We have NaN */
17366 + cp.w lr,3 /* both operands negative ?*/
17369 + cp.w lr,1 /* both operands positive? */
17372 + /* Different signs. If sign of op1 is negative the difference
17373 + between op1 and op2 will always be negative, and if op1 is
17374 + positive the difference will always be positive */
17375 +#ifdef L_avr32_f64_cmp_ge
17378 +#ifdef L_avr32_f64_cmp_lt
17385 + /* Both operands positive. Just compute the difference */
17388 +#ifdef L_avr32_f64_cmp_ge
17391 +#ifdef L_avr32_f64_cmp_lt
17397 + /* Both operands negative. Compute the difference with operands switched */
17400 +#ifdef L_avr32_f64_cmp_ge
17403 +#ifdef L_avr32_f64_cmp_lt
17412 +#ifdef L_avr32_f64_div
17414 + .global __avr32_f64_div
17415 + .type __avr32_f64_div,@function
17418 + stm --sp, r0, r1, r2, r3, r4, r5, r6, r7,lr
17419 + /* op1 in {r11,r10}*/
17420 + /* op2 in {r9,r8}*/
17421 + eor lr, r11, r9 /* MSB(lr) = Sign(op1) ^ Sign(op2) */
17424 + /* Unpack op1 to 2.62 format*/
17426 + /* sf: r11, r10 */
17427 + lsr r7, r11, 20 /* Extract exponent */
17429 + lsl r11, 9 /* Extract mantissa, leave room for implicit bit */
17430 + or r11, r11, r10>>23
17432 + sbr r11, 29 /* Insert implicit bit */
17433 + andh r11, 0x3fff /*Mask last part of exponent since we use 2.62 format*/
17435 + cbr r7, 11 /* Clear sign bit */
17436 + /* Check if normalization is needed */
17437 + breq 11f /*If number is subnormal, normalize it */
17440 + brhs 2f /* Check op1 for NaN or Inf */
17442 + /* Unpack op2 to 2.62 format*/
17445 + lsr r6, r9, 20 /* Extract exponent */
17447 + lsl r9, 9 /* Extract mantissa, leave room for implicit bit */
17448 + or r9, r9, r8>>23
17450 + sbr r9, 29 /* Insert implicit bit */
17451 + andh r9, 0x3fff /*Mask last part of exponent since we use 2.62 format*/
17453 + cbr r6, 11 /* Clear sign bit */
17454 + /* Check if normalization is needed */
17455 + breq 13f /*If number is subnormal, normalize it */
17458 + brhs 3f /* Check op2 for NaN or Inf */
17460 + /* Calculate new exponent */
17465 + /* Approximating 1/d with the following recurrence: */
17466 + /* R[j+1] = R[j]*(2-R[j]*d) */
17467 + /* Using 2.62 format */
17469 + /* d = op2 = divisor (2.62 format): r9,r8 */
17470 + /* Multiply result : r5, r4 */
17471 + /* Initial guess : r3, r2 */
17472 + /* New approximations : r3, r2 */
17473 + /* op1 = Dividend (2.62 format) : r11, r10 */
17475 + mov r12, 1 /* Load TWO */
17478 + /* Load initial guess, using look-up table */
17479 + /* Initial guess is of format 01.XY, where XY is constructed as follows: */
17480 + /* Let d be of following format: 00.1xy....., then XY=~xy */
17481 + /* For d=00.100 = 0,5 -> initial guess=01.11 = 1,75 */
17482 + /* For d=00.101 = 0,625 -> initial guess=01.11 = 1,5 */
17483 + /* For d=00.110 = 0,75 -> initial guess=01.11 = 1,25 */
17484 + /* For d=00.111 = 0,875 -> initial guess=01.11 = 1,0 */
17485 + /* r2 is also part of the reg pair forming initial guess, but it*/
17486 + /* is kept uninitialized to save one cycle since it has so low significance*/
17489 + bfextu r4, r9, 27, 2
17491 + bfins r3, r4, 28, 2
17493 + /* First approximation */
17494 + /* Approximating to 32 bits */
17495 + /* r5 = R[j]*d */
17496 + mulu.d r4, r3, r9
17497 + /* r5 = 2-R[j]*d */
17498 + sub r5, r12, r5<<2
17499 + /* r3 = R[j]*(2-R[j]*d) */
17500 + mulu.d r4, r3, r5
17503 + /* Second approximation */
17504 + /* Approximating to 32 bits */
17505 + /* r5 = R[j]*d */
17506 + mulu.d r4, r3, r9
17507 + /* r5 = 2-R[j]*d */
17508 + sub r5, r12, r5<<2
17509 + /* r3 = R[j]*(2-R[j]*d) */
17510 + mulu.d r4, r3, r5
17513 + /* Third approximation */
17514 + /* Approximating to 32 bits */
17515 + /* r5 = R[j]*d */
17516 + mulu.d r4, r3, r9
17517 + /* r5 = 2-R[j]*d */
17518 + sub r5, r12, r5<<2
17519 + /* r3 = R[j]*(2-R[j]*d) */
17520 + mulu.d r4, r3, r5
17523 + /* Fourth approximation */
17524 + /* Approximating to 64 bits */
17525 + /* r5,r4 = R[j]*d */
17526 + mul_approx_df r3 /*ah*/, r2 /*al*/, r9 /*bh*/, r8 /*bl*/, r5 /*rh*/, r4 /*rl*/, r1 /*sh*/, r0 /*sl*/
17528 + or r5, r5, r4>>30
17530 + /* r5,r4 = 2-R[j]*d */
17533 + /* r3,r2 = R[j]*(2-R[j]*d) */
17534 + mul_approx_df r3 /*ah*/, r2 /*al*/, r5 /*bh*/, r4 /*bl*/, r5 /*rh*/, r4 /*rl*/, r1 /*sh*/, r0 /*sl*/
17536 + or r3, r3, r4>>30
17540 + /* Fifth approximation */
17541 + /* Approximating to 64 bits */
17542 + /* r5,r4 = R[j]*d */
17543 + mul_approx_df r3 /*ah*/, r2 /*al*/, r9 /*bh*/, r8 /*bl*/, r5 /*rh*/, r4 /*rl*/, r1 /*sh*/, r0 /*sl*/
17545 + or r5, r5, r4>>30
17547 + /* r5,r4 = 2-R[j]*d */
17550 + /* r3,r2 = R[j]*(2-R[j]*d) */
17551 + mul_approx_df r3 /*ah*/, r2 /*al*/, r5 /*bh*/, r4 /*bl*/, r5 /*rh*/, r4 /*rl*/, r1 /*sh*/, r0 /*sl*/
17553 + or r3, r3, r4>>30
17557 + /* Multiply with dividend to get quotient */
17558 + mul_approx_df r3 /*ah*/, r2 /*al*/, r11 /*bh*/, r10 /*bl*/, r3 /*rh*/, r2 /*rl*/, r1 /*sh*/, r0 /*sl*/
17560 + /* Shift by 3 to get result in 1.63 format, as required by the exponent. */
17561 + /* Note that 1.63 format is already used by the exponent in r7, since */
17562 + /* a bias of 1023 was added to the result exponent, even though the implicit */
17563 + /* bit was inserted. This gives the exponent an additional bias of 1, which */
17564 + /* supports 1.63 format. */
17566 + or r3, r3, r2>>29
17569 + /* To increase speed, this result is not corrected before final rounding.*/
17570 + /* This may give a difference to IEEE compliant code of 1 ULP.*/
17572 + /* Adjust exponent and mantissa */
17573 + /* r7:exp, [r3, r2]:mant, [r12,r11,r10]:scratch*/
17574 + /* Mantissa may be of the format 0.xxxx or 1.xxxx. */
17575 + /* In the first case, shift one pos to left.*/
17585 + breq 15f /*Result was subnormal. Flush-to-zero and return zero*/
17587 + /* Result was not subnormal. Perform rounding. */
17588 + /* Note that the tie case (for round-to-even) can not occur in division. */
17589 + /* [r7]:exp, [r3, r2]:mant */
17590 + /* Mantissa is in 0.64 format. Round by adding 1<<(64-(52+2))=1<<10*/
17594 + /* Adjust exponent if we overflowed.*/
17599 + /* Pack final result*/
17600 + /* Input: [r7]:exp, [r3, r2]:mant */
17601 + /* Result in [r11,r10] */
17602 + /* Insert exponent and sign bit*/
17606 + /* Insert mantissa */
17607 + cbr r3, 31 /*Clear implicit bit*/
17608 + or r11, r11, r3>>11
17610 + or r10, r10, r3<<21
17611 + /* Return result in [r11,r10] */
17612 + ldm sp++, r0, r1, r2, r3, r4, r5, r6, r7,pc
17616 + /* Op1 is NaN or inf */
17617 + andh r11, 0x000f /* Extract mantissa */
17619 + brne 16f /* Return NaN if op1 is NaN */
17620 + /* Op1 is inf check op2 */
17621 + lsr r6, r9, 20 /* Extract exponent */
17622 + cbr r6, 8 /* Clear sign bit */
17624 + brne 17f /* Inf/number gives inf, return inf */
17625 + rjmp 16f /* The rest gives NaN*/
17628 + /* Op1 is a valid number. Op 2 is NaN or inf */
17629 + andh r9, 0x000f /* Extract mantissa */
17631 + brne 16f /* Return NaN if op2 is NaN */
17632 + rjmp 15f /* Op2 was inf, return zero*/
17634 +11: /* Op1 was denormal. Fix it. */
17636 + or r11, r11, r10 >> 30
17639 + /* Check if op1 is zero. */
17641 + breq __avr32_f64_div_op1_zero
17642 + normalize_df r7 /*exp*/, r10, r11 /*Mantissa*/, r4, r5 /*scratch*/
17644 + or r10, r10, r11 << 30
17649 +13: /* Op2 was denormal. Fix it */
17651 + or r9, r9, r8 >> 30
17654 + /* Check if op2 is zero. */
17656 + breq 17f /* Divisor is zero -> return Inf */
17657 + normalize_df r6 /*exp*/, r8, r9 /*Mantissa*/, r4, r5 /*scratch*/
17659 + or r8, r8, r9 << 30
17664 +15: /* Divide result was subnormal. Return zero. */
17665 + mov r11, lr /*Get correct sign*/
17666 + andh r11, 0x8000, COH
17668 + ldm sp++, r0, r1, r2, r3, r4, r5, r6, r7,pc
17670 +16: /* Return NaN. */
17673 + ldm sp++, r0, r1, r2, r3, r4, r5, r6, r7,pc
17675 +17: /* Return INF. */
17676 + mov r11, lr /*Get correct sign*/
17677 + andh r11, 0x8000, COH
17680 + ldm sp++, r0, r1, r2, r3, r4, r5, r6, r7,pc
17682 +__avr32_f64_div_op1_zero:
17683 + or r5, r8, r9 << 1
17684 + breq 16b /* 0.0/0.0 -> NaN */
17685 + bfextu r4, r9, 20, 11
17687 + brne 15b /* Return zero */
17688 + /* Check if divisor is Inf or NaN */
17689 + or r5, r8, r9 << 12
17690 + breq 15b /* Divisor is inf -> return zero */
17691 + rjmp 16b /* Return NaN */
17698 +#if defined(L_avr32_f32_addsub) || defined(L_avr32_f32_addsub_fast)
17701 +__avr32_f32_sub_from_add:
17702 + /* Switch sign on op2 */
17705 +#if defined(L_avr32_f32_addsub_fast)
17706 + .global __avr32_f32_sub_fast
17707 + .type __avr32_f32_sub_fast,@function
17708 +__avr32_f32_sub_fast:
17710 + .global __avr32_f32_sub
17711 + .type __avr32_f32_sub,@function
17715 + /* Check signs */
17717 + /* Different signs, use subtraction. */
17718 + brmi __avr32_f32_add_from_sub
17720 + /* Get sign of op1 */
17722 + andh r12, 0x8000, COH
17724 + /* Remove sign from operands */
17726 +#if defined(L_avr32_f32_addsub_fast)
17727 + reteq r8 /* If op2 is zero return op1 */
17731 + /* Put the number with the largest exponent in r10
17732 + and the number with the smallest exponent in r9 */
17735 + cp r10, r8 /*If largest operand (in R10) is not equal to op1*/
17736 + subne r12, 1 /* Subtract 1 from sign, which will invert MSB of r12*/
17737 + andh r12, 0x8000, COH /*Mask all but MSB*/
17739 + /* Unpack exponent and mantissa of op1 */
17741 + sbr r8, 31 /* Set implicit bit. */
17744 + /* op1 is NaN or Inf. */
17746 + breq __avr32_f32_sub_op1_nan_or_inf
17748 + /* Unpack exponent and mantissa of op2 */
17750 + sbr r11, 31 /* Set implicit bit. */
17753 +#if defined(L_avr32_f32_addsub)
17754 + /* Keep sticky bit for correct IEEE rounding */
17757 + /* op2 is either zero or subnormal. */
17758 + breq __avr32_f32_sub_op2_subnormal
17760 + /* Get shift amount to scale mantissa of op2. */
17763 + /* Saturate the shift amount to 31. If the amount
17764 + is any larger op2 is insignificant. */
17767 + /* Shift mantissa of op2 to same decimal point as the mantissa
17771 + /* Put the remainding bits into r11[23:..].*/
17772 + rsub r9, r9, (32-8)
17775 + /* Now subtract the mantissas. */
17780 + /* Normalize resulting mantissa. */
17784 + brle __avr32_f32_sub_subnormal_result
17786 + /* Insert the bits we will remove from the mantissa into r11[31:24] */
17787 + bfins r11, r8, 24, 8
17789 + /* Ignore sticky bit to simplify and speed up rounding */
17790 + /* op2 is either zero or subnormal. */
17791 + breq __avr32_f32_sub_op2_subnormal
17793 + /* Get shift amount to scale mantissa of op2. */
17796 + /* Saturate the shift amount to 31. If the amount
17797 + is any larger op2 is insignificant. */
17800 + /* Shift mantissa of op2 to same decimal point as the mantissa
17804 + /* Now subtract the mantissas. */
17807 + /* Normalize resulting mantissa. */
17811 + brle __avr32_f32_sub_subnormal_result
17814 + /* Pack result. */
17815 + or r12, r12, r8 >> 8
17816 + bfins r12, r10, 23, 8
17819 +__avr32_f32_sub_round:
17820 +#if defined(L_avr32_f32_addsub)
17835 +__avr32_f32_sub_op2_subnormal:
17836 + /* Fix implicit bit and adjust exponent of subnormals. */
17838 + /* Set exponent to 1 if we do not have a zero. */
17841 + /* Check if op1 is also subnormal. */
17846 + /* If op1 is not zero set exponent to 1. */
17851 +__avr32_f32_sub_op1_nan_or_inf:
17852 + /* Check if op1 is NaN, if so return NaN */
17856 + /* op1 is Inf. */
17857 + bfins r12, r10, 23, 8 /* Generate Inf in r12 */
17859 + /* Check if op2 is Inf. or NaN */
17862 + retne r12 /* op2 not Inf or NaN, return op1 */
17864 + ret -1 /* op2 Inf or NaN, return NaN */
17866 +__avr32_f32_sub_subnormal_result:
17867 + /* Check if the number is so small that
17868 + it will be represented with zero. */
17873 + /* Shift the mantissa into the correct position.*/
17875 + /* Add sign bit. */
17878 + /* Put the shifted out bits in the most significant part
17882 +#if defined(L_avr32_f32_addsub)
17883 + /* Add all the remainder bits used for rounding into r11 */
17889 + rjmp __avr32_f32_sub_round
17894 +__avr32_f32_add_from_sub:
17895 + /* Switch sign on op2 */
17898 +#if defined(L_avr32_f32_addsub_fast)
17899 + .global __avr32_f32_add_fast
17900 + .type __avr32_f32_add_fast,@function
17901 +__avr32_f32_add_fast:
17903 + .global __avr32_f32_add
17904 + .type __avr32_f32_add,@function
17908 + /* Check signs */
17910 + /* Different signs, use subtraction. */
17911 + brmi __avr32_f32_sub_from_add
17913 + /* Get sign of op1 */
17915 + andh r12, 0x8000, COH
17917 + /* Remove sign from operands */
17919 +#if defined(L_avr32_f32_addsub_fast)
17920 + reteq r8 /* If op2 is zero return op1 */
17924 + /* Put the number with the largest exponent in r10
17925 + and the number with the smallest exponent in r9 */
17929 + /* Unpack exponent and mantissa of op1 */
17931 + sbr r8, 31 /* Set implicit bit. */
17934 + /* op1 is NaN or Inf. */
17936 + breq __avr32_f32_add_op1_nan_or_inf
17938 + /* Unpack exponent and mantissa of op2 */
17940 + sbr r11, 31 /* Set implicit bit. */
17943 +#if defined(L_avr32_f32_addsub)
17944 + /* Keep sticky bit for correct IEEE rounding */
17947 + /* op2 is either zero or subnormal. */
17948 + breq __avr32_f32_add_op2_subnormal
17950 + /* Get shift amount to scale mantissa of op2. */
17953 + /* Saturate the shift amount to 31. If the amount
17954 + is any larger op2 is insignificant. */
17957 + /* Shift mantissa of op2 to same decimal point as the mantissa
17961 + /* Put the remainding bits into r11[23:..].*/
17962 + rsub r9, r9, (32-8)
17964 + /* Insert the bits we will remove from the mantissa into r11[31:24] */
17965 + bfins r11, r12, 24, 8
17967 + /* Now add the mantissas. */
17972 + /* Ignore sticky bit to simplify and speed up rounding */
17973 + /* op2 is either zero or subnormal. */
17974 + breq __avr32_f32_add_op2_subnormal
17976 + /* Get shift amount to scale mantissa of op2. */
17979 + /* Saturate the shift amount to 31. If the amount
17980 + is any larger op2 is insignificant. */
17983 + /* Shift mantissa of op2 to same decimal point as the mantissa
17987 + /* Now add the mantissas. */
17991 + /* Check if we overflowed. */
17992 + brcs __avr32_f32_add_res_of
17994 + /* Pack result. */
17995 + or r12, r12, r8 >> 8
17996 + bfins r12, r10, 23, 8
17999 +#if defined(L_avr32_f32_addsub)
18013 +__avr32_f32_add_op2_subnormal:
18014 + /* Fix implicit bit and adjust exponent of subnormals. */
18016 + /* Set exponent to 1 if we do not have a zero. */
18019 + /* Check if op1 is also subnormal. */
18024 + /* If op1 is not zero set exponent to 1. */
18029 +__avr32_f32_add_op1_nan_or_inf:
18030 + /* Check if op1 is NaN, if so return NaN */
18034 + /* op1 is Inf. */
18035 + bfins r12, r10, 23, 8 /* Generate Inf in r12 */
18037 + /* Check if op2 is Inf. or NaN */
18040 + retne r12 /* op2 not Inf or NaN, return op1 */
18043 + reteq r12 /* op2 Inf return op1 */
18044 + ret -1 /* op2 is NaN, return NaN */
18046 +__avr32_f32_add_res_of:
18047 + /* We overflowed. Increase exponent and shift mantissa.*/
18051 + /* Clear mantissa to set result to Inf if the exponent is 255. */
18061 +#if defined(L_avr32_f32_div) || defined(L_avr32_f32_div_fast)
18064 +#if defined(L_avr32_f32_div_fast)
18065 + .global __avr32_f32_div_fast
18066 + .type __avr32_f32_div_fast,@function
18067 +__avr32_f32_div_fast:
18069 + .global __avr32_f32_div
18070 + .type __avr32_f32_div,@function
18074 + eor r8, r11, r12 /* MSB(r8) = Sign(op1) ^ Sign(op2) */
18078 + reteq 0 /* Return zero if op1 is zero */
18080 + breq 4f /* Check op2 for zero */
18086 + breq 11f /*If number is subnormal*/
18088 + brhs 2f /* Check op1 for NaN or Inf */
18090 + sbr r12, 31 /*Implicit bit*/
18097 + breq 13f /*If number is subnormal*/
18099 + brhs 3f /* Check op2 for NaN or Inf */
18102 + sbr r11, 31 /*Implicit bit*/
18105 + /* For UC3, store with predecrement is faster than stm */
18109 + /* Calculate new exponent */
18114 + /* Approximating 1/d with the following recurrence: */
18115 + /* R[j+1] = R[j]*(2-R[j]*d) */
18116 + /* Using 2.30 format */
18119 + /* Multiply result : r6, r7 */
18120 + /* Initial guess : r11 */
18121 + /* New approximations : r11 */
18122 + /* Dividend : r12 */
18124 + mov r10, 1 /* Load TWO */
18127 + lsr r12, 2 /* Get significand of Op1 in 2.30 format */
18128 + lsr r5, r11, 2 /* Get significand of Op2 (=d) in 2.30 format */
18130 + /* Load initial guess, using look-up table */
18131 + /* Initial guess is of format 01.XY, where XY is constructed as follows: */
18132 + /* Let d be of following format: 00.1xy....., then XY=~xy */
18133 + /* For d=00.100 = 0,5 -> initial guess=01.11 = 1,75 */
18134 + /* For d=00.101 = 0,625 -> initial guess=01.11 = 1,5 */
18135 + /* For d=00.110 = 0,75 -> initial guess=01.11 = 1,25 */
18136 + /* For d=00.111 = 0,875 -> initial guess=01.11 = 1,0 */
18139 + bfextu r6, r5, 27, 2
18141 + bfins r11, r6, 28, 2
18143 + /* First approximation */
18144 + /* r7 = R[j]*d */
18145 + mulu.d r6, r11, r5
18146 + /* r7 = 2-R[j]*d */
18147 + sub r7, r10, r7<<2
18148 + /* r11 = R[j]*(2-R[j]*d) */
18149 + mulu.d r6, r11, r7
18152 + /* Second approximation */
18153 + /* r7 = R[j]*d */
18154 + mulu.d r6, r11, r5
18155 + /* r7 = 2-R[j]*d */
18156 + sub r7, r10, r7<<2
18157 + /* r11 = R[j]*(2-R[j]*d) */
18158 + mulu.d r6, r11, r7
18161 + /* Third approximation */
18162 + /* r7 = R[j]*d */
18163 + mulu.d r6, r11, r5
18164 + /* r7 = 2-R[j]*d */
18165 + sub r7, r10, r7<<2
18166 + /* r11 = R[j]*(2-R[j]*d) */
18167 + mulu.d r6, r11, r7
18170 + /* Fourth approximation */
18171 + /* r7 = R[j]*d */
18172 + mulu.d r6, r11, r5
18173 + /* r7 = 2-R[j]*d */
18174 + sub r7, r10, r7<<2
18175 + /* r11 = R[j]*(2-R[j]*d) */
18176 + mulu.d r6, r11, r7
18180 + /* Multiply with dividend to get quotient, r7 = sf(op1)/sf(op2) */
18181 + mulu.d r6, r11, r12
18183 + /* Shift by 3 to get result in 1.31 format, as required by the exponent. */
18184 + /* Note that 1.31 format is already used by the exponent in r9, since */
18185 + /* a bias of 127 was added to the result exponent, even though the implicit */
18186 + /* bit was inserted. This gives the exponent an additional bias of 1, which */
18187 + /* supports 1.31 format. */
18190 +#if defined(L_avr32_f32_div)
18191 + /* To perform correct rounding, check for nonzero remainder, */
18192 + /* and set LSB in quot if remainder != 0 */
18193 + /* Remainder = dividend(r12) - divisor(r5)*quotient(r10) */
18195 + lsl r5, 1 /* Transform divisor from 2.30 to 1.31 format */
18196 + /* Mask all bits lower than guard in quotient. */
18197 + /* These bits are inexact due to approximative algorithm */
18199 + /* Add 1 in least significant bit pos to make sure approximation is from above */
18201 + mulu.d r6, r5, r10
18202 + /* If remainder < 0, truncated quotient is too large, so the */
18203 + /* delta added must be subtracted to get the correct truncated quotient. */
18204 + sub r12, r7 /* Calculate remainder and implicitly set flags */
18208 + /* For UC3, load with postincrement is faster than ldm */
18212 + /* Adjust exponent and mantissa */
18213 + /* r9:exp, r10:mant, r11:scratch*/
18216 + breq 16f /*Result was subnormal*/
18217 + lsl r10, r10, r11
18219 + /* Result was not subnormal. Perform rounding. */
18220 + /* Note that the tie case (for round-to-even) can not occur in division. */
18221 + /* r9:exp, r10:mant*/
18222 + sub r10, -1*(0x80)
18223 + /* Adjust exponent if we overflowed. Note that we must use {cc}
18224 + since we perform the add using a sub insn. */
18227 + /* Pack final result*/
18229 + bfins r12, r9, 24, 8
18230 +__divsf_return_op1:
18237 + /* Op1 is NaN or inf */
18238 + retne -1 /* Return NaN if op1 is NaN */
18239 + /* Op1 is inf check op2 */
18243 + brlo __divsf_return_op1 /* inf/number gives inf */
18244 + ret -1 /* The rest gives NaN*/
18246 + /* Op1 is NaN or inf */
18247 + reteq 0 /* Return zero if number/inf*/
18248 + ret -1 /* Return NaN*/
18250 + /* Op2 is zero ? */
18252 + reteq -1 /* 0.0/0.0 is NaN */
18253 + /* Nonzero/0.0 is Inf. Sign bit will be shifted in before returning*/
18256 + rjmp __divsf_return_op1
18258 +11: /* Op1 was denormal. Fix it. */
18265 +13: /* Op2 was denormal. Fix it. */
18273 +16: /* Divide result was subnormal. Fix it and return. */
18274 +#if defined(L_avr32_f32_div)
18275 + lsl r10, r10, r11 /*Perform shift required by adjustment of exponent and mantissa*/
18276 + adjust_subnormal_sf r12 /*sf*/, r9 /*exp*/, r10 /*mant*/, r8 /*sign*/,r11 /*scratch*/
18278 + /*Flush to zero*/
18285 +#ifdef L_avr32_f32_mul
18286 + .global __avr32_f32_mul
18287 + .type __avr32_f32_mul,@function
18292 + eor r12, r11 /* MSB(r8) = Sign(op1) ^ Sign(op2) */
18293 + andh r12, 0x8000, COH
18295 + /* arrange operands so that that op1 >= op2 */
18297 + breq __avr32_f32_mul_op1_zero
18300 + /* Put the number with the largest exponent in r10
18301 + and the number with the smallest exponent in r9 */
18305 + /* Unpack exponent and mantissa of op1 */
18307 + sbr r8, 31 /* Set implicit bit. */
18310 + /* op1 is NaN or Inf. */
18312 + breq __avr32_f32_mul_op1_nan_or_inf
18314 + /* Unpack exponent and mantissa of op2 */
18316 + sbr r11, 31 /* Set implicit bit. */
18319 + /* op2 is either zero or subnormal. */
18320 + breq __avr32_f32_mul_op2_subnormal
18322 + /* Calculate new exponent */
18325 + /* Do the multiplication */
18326 + mulu.d r10,r8,r11
18328 + /* We might need to scale up by two if the MSB of the result is
18334 + /* Put the shifted out bits of the mantissa into r10 */
18336 + bfins r10, r11, 24, 8
18338 + sub r9,(127-1) /* remove extra exponent bias */
18339 + brle __avr32_f32_mul_res_subnormal
18341 + /* Check for Inf. */
18345 + /* Pack result. */
18346 + or r12, r12, r11 >> 8
18347 + bfins r12, r9, 23, 8
18350 +__avr32_f32_mul_round:
18366 +__avr32_f32_mul_op2_subnormal:
18369 + retcs 0 /* op2 is zero. Return 0 */
18373 + /* Check if op2 is subnormal. */
18377 + /* op2 is subnormal */
18380 + retcs 0 /* op1 is zero. Return 0 */
18387 +__avr32_f32_mul_op1_nan_or_inf:
18388 + /* Check if op1 is NaN, if so return NaN */
18392 + /* op1 is Inf. */
18394 + reteq -1 /* Inf * 0 -> NaN */
18396 + bfins r12, r10, 23, 8 /* Generate Inf in r12 */
18398 + /* Check if op2 is Inf. or NaN */
18401 + retne r12 /* op2 not Inf or NaN, return Info */
18404 + reteq r12 /* op2 Inf return Inf */
18405 + ret -1 /* op2 is NaN, return NaN */
18407 +__avr32_f32_mul_res_subnormal:
18408 + /* Check if the number is so small that
18409 + it will be represented with zero. */
18414 + /* Shift the mantissa into the correct position.*/
18416 + /* Add sign bit. */
18418 + /* Put the shifted out bits in the most significant part
18422 + /* Add all the remainder bits used for rounding into r11 */
18425 + rjmp __avr32_f32_mul_round
18427 +__avr32_f32_mul_op1_zero:
18428 + bfextu r10, r11, 23, 8
18436 +#ifdef L_avr32_s32_to_f32
18437 + .global __avr32_s32_to_f32
18438 + .type __avr32_s32_to_f32,@function
18439 +__avr32_s32_to_f32:
18441 + reteq r12 /* If zero then return zero float */
18442 + mov r11, r12 /* Keep the sign */
18443 + abs r12 /* Compute the absolute value */
18444 + mov r10, 31 + 127 /* Set the correct exponent */
18447 + normalize_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18449 + /* Check for subnormal result */
18451 + brle __avr32_s32_to_f32_subnormal
18453 + round_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18454 + pack_sf r12 /*sf*/, r10 /*exp*/, r12 /*mant*/
18459 +__avr32_s32_to_f32_subnormal:
18460 + /* Adjust a subnormal result */
18461 + adjust_subnormal_sf r12/*sf*/, r10 /*exp*/, r12 /*mant*/, r11/*sign*/, r9 /*scratch*/
18466 +#ifdef L_avr32_u32_to_f32
18467 + .global __avr32_u32_to_f32
18468 + .type __avr32_u32_to_f32,@function
18469 +__avr32_u32_to_f32:
18471 + reteq r12 /* If zero then return zero float */
18472 + mov r10, 31 + 127 /* Set the correct exponent */
18475 + normalize_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18477 + /* Check for subnormal result */
18479 + brle __avr32_u32_to_f32_subnormal
18481 + round_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18482 + pack_sf r12 /*sf*/, r10 /*exp*/, r12 /*mant*/
18483 + lsr r12,1 /* Sign bit is 0 for unsigned int */
18486 +__avr32_u32_to_f32_subnormal:
18487 + /* Adjust a subnormal result */
18489 + adjust_subnormal_sf r12/*sf*/,r10 /*exp*/, r12 /*mant*/,r8/*sign*/, r9 /*scratch*/
18496 +#ifdef L_avr32_f32_to_s32
18497 + .global __avr32_f32_to_s32
18498 + .type __avr32_f32_to_s32,@function
18499 +__avr32_f32_to_s32:
18500 + bfextu r11, r12, 23, 8
18501 + sub r11,127 /* Fix bias */
18502 + retlo 0 /* Negative exponent yields zero integer */
18504 + /* Shift mantissa into correct position */
18505 + rsub r11,r11,31 /* Shift amount */
18506 + lsl r10,r12,8 /* Get mantissa */
18507 + sbr r10,31 /* Add implicit bit */
18508 + lsr r10,r10,r11 /* Perform shift */
18509 + lsl r12,1 /* Check sign */
18510 + retcc r10 /* if positive, we are done */
18511 + neg r10 /* if negative float, negate result */
18516 +#ifdef L_avr32_f32_to_u32
18517 + .global __avr32_f32_to_u32
18518 + .type __avr32_f32_to_u32,@function
18519 +__avr32_f32_to_u32:
18521 + retmi 0 /* Negative numbers gives 0 */
18522 + bfextu r11, r12, 23, 8 /* Extract exponent */
18523 + sub r11,127 /* Fix bias */
18524 + retlo 0 /* Negative exponent yields zero integer */
18526 + /* Shift mantissa into correct position */
18527 + rsub r11,r11,31 /* Shift amount */
18528 + lsl r12,8 /* Get mantissa */
18529 + sbr r12,31 /* Add implicit bit */
18530 + lsr r12,r12,r11 /* Perform shift */
18535 +#ifdef L_avr32_f32_to_f64
18536 + .global __avr32_f32_to_f64
18537 + .type __avr32_f32_to_f64,@function
18539 +__avr32_f32_to_f64:
18540 + lsl r11,r12,1 /* Remove sign bit, keep original value in r12*/
18542 + reteq r11 /* Return zero if input is zero */
18544 + bfextu r9,r11,24,8 /* Get exponent */
18545 + cp.w r9,0xff /* check for NaN or inf */
18548 + lsl r11,7 /* Convert sf mantissa to df format */
18551 + /* Check if implicit bit should be set */
18553 + subeq r9,-1 /* Adjust exponent if it was 0 */
18555 + or r11, r11, r8 << 31 /* Set implicit bit if needed */
18556 + sub r9,(127-0x3ff) /* Convert exponent to df format exponent */
18558 + /*We know that low register of mantissa is 0, and will be unaffected by normalization.*/
18559 + /*We can therefore use the faster normalize_sf function instead of normalize_df.*/
18560 + normalize_sf r9 /*exp*/, r11 /*mantissa*/, r8 /*scratch*/
18561 + pack_df r9 /*exp*/, r10, r11 /*mantissa*/, r10, r11 /*df*/
18563 +__extendsfdf_return_op1:
18564 + /* Rotate in sign bit */
18573 + lsl r11,8 /* check mantissa */
18574 + movne r11, -1 /* Return NaN */
18575 + moveq r11, r10 /* Return inf */
18576 + rjmp __extendsfdf_return_op1
18580 +#ifdef L_avr32_f64_to_f32
18581 + .global __avr32_f64_to_f32
18582 + .type __avr32_f64_to_f32,@function
18584 +__avr32_f64_to_f32:
18586 + lsl r9,r11,1 /* Unpack exponent */
18589 + reteq 0 /* If exponent is 0 the number is so small
18590 + that the conversion to single float gives
18593 + lsl r8,r11,10 /* Adjust mantissa */
18594 + or r12,r8,r10>>22
18596 + lsl r10,10 /* Check if there are any remaining bits
18597 + in the low part of the mantissa.*/
18599 + rol r12 /* If there were remaining bits then set lsb
18600 + of mantissa to 1 */
18603 + breq 2f /* Check for NaN or inf */
18605 + sub r9,(0x3ff-127) /* Adjust bias of exponent */
18606 + sbr r12,31 /* set the implicit bit.*/
18608 + cp.w r9, 0 /* Check for subnormal number */
18611 + round_sf r9 /*exp*/, r12 /*mant*/, r10 /*scratch*/
18612 + pack_sf r12 /*sf*/, r9 /*exp*/, r12 /*mant*/
18613 +__truncdfsf_return_op1:
18614 + /* Rotate in sign bit */
18621 + cbr r12,31 /* clear implicit bit */
18622 + retne -1 /* Return NaN if mantissa not zero */
18625 + ret r12 /* Return inf */
18627 +3: /* Result is subnormal. Adjust it.*/
18628 + adjust_subnormal_sf r12/*sf*/,r9 /*exp*/, r12 /*mant*/, r11/*sign*/, r10 /*scratch*/
18634 \ No newline at end of file
18635 Index: gcc-4.2.3/gcc/config/avr32/lib2funcs.S
18636 ===================================================================
18637 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
18638 +++ gcc-4.2.3/gcc/config/avr32/lib2funcs.S 2008-05-21 13:45:54.173288052 +0200
18641 + .global __nonlocal_goto
18642 + .type __nonlocal_goto,@function
18644 +/* __nonlocal_goto: This function handles nonlocal_goto's in gcc.
18646 + parameter 0 (r12) = New Frame Pointer
18647 + parameter 1 (r11) = Address to goto
18648 + parameter 2 (r10) = New Stack Pointer
18650 + This function invalidates the return stack, since it returns from a
18651 + function without using a return instruction.
18656 + frs # Flush return stack
18661 Index: gcc-4.2.3/gcc/config/avr32/linux-elf.h
18662 ===================================================================
18663 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
18664 +++ gcc-4.2.3/gcc/config/avr32/linux-elf.h 2008-05-21 13:45:54.173288052 +0200
18667 + Linux/Elf specific definitions.
18668 + Copyright 2003-2006 Atmel Corporation.
18670 + Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
18671 + and H�vard Skinnemoen, Atmel Norway, <hskinnemoen@atmel.com>
18673 + This file is part of GCC.
18675 + This program is free software; you can redistribute it and/or modify
18676 + it under the terms of the GNU General Public License as published by
18677 + the Free Software Foundation; either version 2 of the License, or
18678 + (at your option) any later version.
18680 + This program is distributed in the hope that it will be useful,
18681 + but WITHOUT ANY WARRANTY; without even the implied warranty of
18682 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18683 + GNU General Public License for more details.
18685 + You should have received a copy of the GNU General Public License
18686 + along with this program; if not, write to the Free Software
18687 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18691 +/* elfos.h should have already been included. Now just override
18692 + any conflicting definitions and add any extras. */
18694 +/* Run-time Target Specification. */
18695 +#undef TARGET_VERSION
18696 +#define TARGET_VERSION fputs (" (AVR32 GNU/Linux with ELF)", stderr);
18698 +/* Do not assume anything about header files. */
18699 +#define NO_IMPLICIT_EXTERN_C
18701 +/* The GNU C++ standard library requires that these macros be defined. */
18702 +#undef CPLUSPLUS_CPP_SPEC
18703 +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
18705 +/* Now we define the strings used to build the spec file. */
18707 +#define LIB_SPEC \
18708 + "%{pthread:-lpthread} \
18710 + %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
18712 +/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
18713 + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
18714 + provides part of the support for getting C++ file-scope static
18715 + object constructed before entering `main'. */
18717 +#undef STARTFILE_SPEC
18718 +#define STARTFILE_SPEC \
18720 + %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
18721 + %{!p:%{profile:gcrt1.o%s} \
18722 + %{!profile:crt1.o%s}}}} \
18723 + crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
18725 +/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
18726 + the GNU/Linux magical crtend.o file (see crtstuff.c) which
18727 + provides part of the support for getting C++ file-scope static
18728 + object constructed before entering `main', followed by a normal
18729 + GNU/Linux "finalizer" file, `crtn.o'. */
18731 +#undef ENDFILE_SPEC
18732 +#define ENDFILE_SPEC \
18733 + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
18736 +#define ASM_SPEC "%{!mno-pic:--pic} %{mrelax|O*:%{mno-relax|O0|O1: ;:--linkrelax}} %{mcpu=*:-mcpu=%*}"
18739 +#define LINK_SPEC "%{version:-v} \
18740 + %{static:-Bstatic} \
18741 + %{shared:-shared} \
18742 + %{symbolic:-Bsymbolic} \
18743 + %{rdynamic:-export-dynamic} \
18744 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
18745 + %{mrelax|O*:%{mno-relax|O0|O1: ;:--relax}}"
18747 +#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
18749 +/* This is how we tell the assembler that two symbols have the same value. */
18750 +#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
18753 + assemble_name (FILE, NAME1); \
18754 + fputs (" = ", FILE); \
18755 + assemble_name (FILE, NAME2); \
18756 + fputc ('\n', FILE); \
18763 +#define CC1_SPEC "%{profile:-p}"
18765 +/* Target CPU builtins. */
18766 +#define TARGET_CPU_CPP_BUILTINS() \
18769 + builtin_define ("__avr32__"); \
18770 + builtin_define ("__AVR32__"); \
18771 + builtin_define ("__AVR32_LINUX__"); \
18772 + builtin_define (avr32_part->macro); \
18773 + builtin_define (avr32_arch->macro); \
18774 + if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A) \
18775 + builtin_define ("__AVR32_AVR32A__"); \
18777 + builtin_define ("__AVR32_AVR32B__"); \
18778 + if (TARGET_UNALIGNED_WORD) \
18779 + builtin_define ("__AVR32_HAS_UNALIGNED_WORD__"); \
18780 + if (TARGET_SIMD) \
18781 + builtin_define ("__AVR32_HAS_SIMD__"); \
18782 + if (TARGET_DSP) \
18783 + builtin_define ("__AVR32_HAS_DSP__"); \
18784 + if (TARGET_RMW) \
18785 + builtin_define ("__AVR32_HAS_RMW__"); \
18786 + if (TARGET_BRANCH_PRED) \
18787 + builtin_define ("__AVR32_HAS_BRANCH_PRED__"); \
18788 + if (TARGET_FAST_FLOAT) \
18789 + builtin_define ("__AVR32_FAST_FLOAT__"); \
18792 + builtin_define ("__PIC__"); \
18793 + builtin_define ("__pic__"); \
18800 +/* Call the function profiler with a given profile label. */
18801 +#undef FUNCTION_PROFILER
18802 +#define FUNCTION_PROFILER(STREAM, LABELNO) \
18805 + fprintf (STREAM, "\tmov\tlr, lo(mcount)\n\torh\tlr, hi(mcount)\n"); \
18806 + fprintf (STREAM, "\ticall lr\n"); \
18810 +#define NO_PROFILE_COUNTERS 1
18812 +/* For dynamic libraries to work */
18813 +/* #define PLT_REG_CALL_CLOBBERED 1 */
18814 +#define AVR32_ALWAYS_PIC 1
18816 +/* uclibc does not implement sinf, cosf etc. */
18817 +#undef TARGET_C99_FUNCTIONS
18818 +#define TARGET_C99_FUNCTIONS 0
18820 +#define LINK_GCC_C_SEQUENCE_SPEC \
18821 + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
18822 Index: gcc-4.2.3/gcc/config/avr32/predicates.md
18823 ===================================================================
18824 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
18825 +++ gcc-4.2.3/gcc/config/avr32/predicates.md 2008-05-21 13:45:54.173288052 +0200
18827 +;; AVR32 predicates file.
18828 +;; Copyright 2003-2006 Atmel Corporation.
18830 +;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
18832 +;; This file is part of GCC.
18834 +;; This program is free software; you can redistribute it and/or modify
18835 +;; it under the terms of the GNU General Public License as published by
18836 +;; the Free Software Foundation; either version 2 of the License, or
18837 +;; (at your option) any later version.
18839 +;; This program is distributed in the hope that it will be useful,
18840 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18841 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18842 +;; GNU General Public License for more details.
18844 +;; You should have received a copy of the GNU General Public License
18845 +;; along with this program; if not, write to the Free Software
18846 +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18849 +;; True if the operand is a memory reference which contains an
18850 +;; Address consisting of a single pointer register
18851 +(define_predicate "avr32_indirect_register_operand"
18852 + (and (match_code "mem")
18853 + (match_test "register_operand(XEXP(op, 0), SImode)")))
18857 +;; Address expression with a base pointer offset with
18858 +;; a register displacement
18859 +(define_predicate "avr32_indexed_memory_operand"
18860 + (and (match_code "mem")
18861 + (match_test "GET_CODE(XEXP(op, 0)) == PLUS"))
18864 + rtx op0 = XEXP(XEXP(op, 0), 0);
18865 + rtx op1 = XEXP(XEXP(op, 0), 1);
18867 + return ((avr32_address_register_rtx_p (op0, 0)
18868 + && avr32_legitimate_index_p (GET_MODE(op), op1, 0))
18869 + || (avr32_address_register_rtx_p (op1, 0)
18870 + && avr32_legitimate_index_p (GET_MODE(op), op0, 0)));
18874 +;; Operand suitable for the ld.sb instruction
18875 +(define_predicate "load_sb_memory_operand"
18876 + (ior (match_operand 0 "avr32_indirect_register_operand")
18877 + (match_operand 0 "avr32_indexed_memory_operand")))
18880 +;; Operand suitable as operand to insns sign extending QI values
18881 +(define_predicate "extendqi_operand"
18882 + (ior (match_operand 0 "load_sb_memory_operand")
18883 + (match_operand 0 "register_operand")))
18885 +(define_predicate "post_inc_memory_operand"
18886 + (and (match_code "mem")
18887 + (match_test "(GET_CODE(XEXP(op, 0)) == POST_INC)
18888 + && REG_P(XEXP(XEXP(op, 0), 0))")))
18890 +(define_predicate "pre_dec_memory_operand"
18891 + (and (match_code "mem")
18892 + (match_test "(GET_CODE(XEXP(op, 0)) == PRE_DEC)
18893 + && REG_P(XEXP(XEXP(op, 0), 0))")))
18895 +;; Operand suitable for add instructions
18896 +(define_predicate "avr32_add_operand"
18897 + (ior (match_operand 0 "register_operand")
18898 + (and (match_operand 0 "immediate_operand")
18899 + (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'I', \"Is21\")"))))
18901 +;; Operand is a power of two immediate
18902 +(define_predicate "power_of_two_operand"
18903 + (match_code "const_int")
18905 + HOST_WIDE_INT value = INTVAL (op);
18907 + return value != 0 && (value & (value - 1)) == 0;
18910 +;; Operand is a multiple of 8 immediate
18911 +(define_predicate "multiple_of_8_operand"
18912 + (match_code "const_int")
18914 + HOST_WIDE_INT value = INTVAL (op);
18916 + return (value & 0x7) == 0 ;
18919 +;; Operand is a multiple of 16 immediate
18920 +(define_predicate "multiple_of_16_operand"
18921 + (match_code "const_int")
18923 + HOST_WIDE_INT value = INTVAL (op);
18925 + return (value & 0xf) == 0 ;
18928 +;; Operand is a mask used for masking away upper bits of a reg
18929 +(define_predicate "avr32_mask_upper_bits_operand"
18930 + (match_code "const_int")
18932 + HOST_WIDE_INT value = INTVAL (op) + 1;
18934 + return value != 1 && value != 0 && (value & (value - 1)) == 0;
18938 +;; Operand suitable for mul instructions
18939 +(define_predicate "avr32_mul_operand"
18940 + (ior (match_operand 0 "register_operand")
18941 + (and (match_operand 0 "immediate_operand")
18942 + (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'K', \"Ks08\")"))))
18944 +;; True for logical binary operators.
18945 +(define_predicate "logical_binary_operator"
18946 + (match_code "ior,xor,and"))
18948 +;; True for logical shift operators
18949 +(define_predicate "logical_shift_operator"
18950 + (match_code "ashift,lshiftrt"))
18952 +;; True for shift operand for logical and, or and eor insns
18953 +(define_predicate "avr32_logical_shift_operand"
18954 + (and (match_code "ashift,lshiftrt")
18955 + (ior (and (match_test "GET_CODE(XEXP(op, 1)) == CONST_INT")
18956 + (match_test "register_operand(XEXP(op, 0), GET_MODE(XEXP(op, 0)))"))
18957 + (and (match_test "GET_CODE(XEXP(op, 0)) == CONST_INT")
18958 + (match_test "register_operand(XEXP(op, 1), GET_MODE(XEXP(op, 1)))"))))
18965 +;; Predicate for second operand to and, ior and xor insn patterns
18966 +(define_predicate "avr32_logical_insn_operand"
18967 + (ior (match_operand 0 "register_operand")
18968 + (match_operand 0 "avr32_logical_shift_operand"))
18975 +;; True for avr32 comparison operators
18976 +(define_predicate "avr32_comparison_operator"
18977 + (ior (match_code "eq, ne, gt, ge, lt, le, gtu, geu, ltu, leu")
18978 + (and (match_code "unspec")
18979 + (match_test "(XINT(op, 1) == UNSPEC_COND_MI)
18980 + || (XINT(op, 1) == UNSPEC_COND_PL)"))))
18982 +;; True for avr32 comparison operand
18983 +(define_predicate "avr32_comparison_operand"
18984 + (ior (and (match_code "eq, ne, gt, ge, lt, le, gtu, geu, ltu, leu")
18985 + (match_test "(rtx_equal_p (XEXP(op,0), cc0_rtx) && rtx_equal_p (XEXP(op,1), const0_rtx))"))
18986 + (and (match_code "unspec")
18987 + (match_test "(XINT(op, 1) == UNSPEC_COND_MI)
18988 + || (XINT(op, 1) == UNSPEC_COND_PL)"))))
18990 +;; True if this is a const_int with one bit set
18991 +(define_predicate "one_bit_set_operand"
18992 + (match_code "const_int")
18998 + value = INTVAL(op);
18999 + for ( i = 0 ; i < 32; i++ ){
19000 + if ( value & ( 1 << i ) ){
19005 + return ( ones == 1 );
19009 +;; True if this is a const_int with one bit cleared
19010 +(define_predicate "one_bit_cleared_operand"
19011 + (match_code "const_int")
19017 + value = INTVAL(op);
19018 + for ( i = 0 ; i < 32; i++ ){
19019 + if ( !(value & ( 1 << i )) ){
19024 + return ( zeroes == 1 );
19028 +;; True if this is a register or immediate operand
19029 +(define_predicate "register_immediate_operand"
19030 + (ior (match_operand 0 "register_operand")
19031 + (match_operand 0 "immediate_operand")))
19034 +;; True is this is an operand containing a label_ref
19035 +(define_predicate "avr32_label_ref_operand"
19036 + (and (match_code "mem")
19037 + (match_test "avr32_find_symbol(op)
19038 + && (GET_CODE(avr32_find_symbol(op)) == LABEL_REF)")))
19040 +;; True is this is a valid symbol pointing to the constant pool
19041 +(define_predicate "avr32_const_pool_operand"
19042 + (and (match_code "symbol_ref")
19043 + (match_test "CONSTANT_POOL_ADDRESS_P(op)"))
19045 + return (flag_pic ? (!(symbol_mentioned_p (get_pool_constant (op))
19046 + || label_mentioned_p (get_pool_constant (op)))
19047 + || avr32_got_mentioned_p(get_pool_constant (op)))
19052 +;; True is this is a memory reference to the constant or mini pool
19053 +(define_predicate "avr32_const_pool_ref_operand"
19054 + (ior (match_operand 0 "avr32_label_ref_operand")
19055 + (and (match_code "mem")
19056 + (match_test "avr32_const_pool_operand(XEXP(op,0), GET_MODE(XEXP(op,0)))"))))
19059 +;; Legal source operand for movti insns
19060 +(define_predicate "avr32_movti_src_operand"
19061 + (ior (match_operand 0 "avr32_const_pool_ref_operand")
19062 + (ior (ior (match_operand 0 "register_immediate_operand")
19063 + (match_operand 0 "avr32_indirect_register_operand"))
19064 + (match_operand 0 "post_inc_memory_operand"))))
19066 +;; Legal destination operand for movti insns
19067 +(define_predicate "avr32_movti_dst_operand"
19068 + (ior (ior (match_operand 0 "register_operand")
19069 + (match_operand 0 "avr32_indirect_register_operand"))
19070 + (match_operand 0 "pre_dec_memory_operand")))
19073 +;; True is this is a k12 offseted memory operand
19074 +(define_predicate "avr32_k12_memory_operand"
19075 + (and (match_code "mem")
19076 + (ior (match_test "REG_P(XEXP(op, 0))")
19077 + (match_test "GET_CODE(XEXP(op, 0)) == PLUS
19078 + && REG_P(XEXP(XEXP(op, 0), 0))
19079 + && (GET_CODE(XEXP(XEXP(op, 0), 1)) == CONST_INT)
19080 + && (CONST_OK_FOR_CONSTRAINT_P(INTVAL(XEXP(XEXP(op, 0), 0)),
19081 + 'K', (mode == SImode) ? \"Ks14\" : ((mode == HImode) ? \"Ks13\" : \"Ks12\")))"))))
19083 +;; True is this is a memory operand with an immediate displacement
19084 +(define_predicate "avr32_imm_disp_memory_operand"
19085 + (and (match_code "mem")
19086 + (match_test "GET_CODE(XEXP(op, 0)) == PLUS
19087 + && REG_P(XEXP(XEXP(op, 0), 0))
19088 + && (GET_CODE(XEXP(XEXP(op, 0), 1)) == CONST_INT)")))
19090 +;; True is this is a bswap operand
19091 +(define_predicate "avr32_bswap_operand"
19092 + (ior (match_operand 0 "avr32_k12_memory_operand")
19093 + (match_operand 0 "register_operand")))
19095 +;; True is this is a valid coprocessor insn memory operand
19096 +(define_predicate "avr32_cop_memory_operand"
19097 + (and (match_operand 0 "memory_operand")
19098 + (not (match_test "GET_CODE(XEXP(op, 0)) == PLUS
19099 + && REG_P(XEXP(XEXP(op, 0), 0))
19100 + && (GET_CODE(XEXP(XEXP(op, 0), 1)) == CONST_INT)
19101 + && !(CONST_OK_FOR_CONSTRAINT_P(INTVAL(XEXP(XEXP(op, 0), 0)), 'K', \"Ku10\"))"))))
19103 +;; True is this is a valid source/destination operand
19104 +;; for moving values to/from a coprocessor
19105 +(define_predicate "avr32_cop_move_operand"
19106 + (ior (match_operand 0 "register_operand")
19107 + (match_operand 0 "avr32_cop_memory_operand")))
19110 +;; True is this is a valid extract byte offset for use in
19111 +;; load extracted index insns
19112 +(define_predicate "avr32_extract_shift_operand"
19113 + (and (match_operand 0 "const_int_operand")
19114 + (match_test "(INTVAL(op) == 0) || (INTVAL(op) == 8)
19115 + || (INTVAL(op) == 16) || (INTVAL(op) == 24)")))
19117 +;; True is this is a floating-point register
19118 +(define_predicate "avr32_fp_register_operand"
19119 + (and (match_operand 0 "register_operand")
19120 + (match_test "REGNO_REG_CLASS(REGNO(op)) == FP_REGS")))
19122 +;; True is this is valid avr32 symbol operand
19123 +(define_predicate "avr32_symbol_operand"
19124 + (ior (match_code "label_ref, symbol_ref")
19125 + (and (match_code "const")
19126 + (match_test "avr32_find_symbol(op)"))))
19128 +;; True is this is valid operand for the lda.w and call pseudo insns
19129 +(define_predicate "avr32_address_operand"
19130 + (and (match_code "label_ref, symbol_ref")
19131 + (ior (match_test "TARGET_HAS_ASM_ADDR_PSEUDOS")
19132 + (match_test "flag_pic")) ))
19134 +;; True if this is a avr32 call operand
19135 +(define_predicate "avr32_call_operand"
19136 + (ior (ior (match_operand 0 "register_operand")
19137 + (ior (match_operand 0 "avr32_const_pool_ref_operand")
19138 + (match_operand 0 "avr32_address_operand")))
19139 + (match_test "SYMBOL_REF_RCALL_FUNCTION_P(op)")))
19141 +;; Return true for operators performing ALU operations
19143 +(define_predicate "alu_operator"
19144 + (match_code "ior, xor, and, plus, minus, ashift, lshiftrt, ashiftrt"))
19146 +(define_predicate "avr32_add_shift_immediate_operand"
19147 + (and (match_operand 0 "immediate_operand")
19148 + (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'K', \"Ku02\")")))
19150 +(define_predicate "avr32_cond_register_immediate_operand"
19151 + (ior (match_operand 0 "register_operand")
19152 + (and (match_operand 0 "immediate_operand")
19153 + (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'K', \"Ks08\")"))))
19155 +(define_predicate "avr32_cond_immediate_operand"
19156 + (and (match_operand 0 "immediate_operand")
19157 + (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'I', \"Is08\")")))
19158 Index: gcc-4.2.3/gcc/config/avr32/simd.md
19159 ===================================================================
19160 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
19161 +++ gcc-4.2.3/gcc/config/avr32/simd.md 2008-05-21 13:45:54.173288052 +0200
19163 +;; AVR32 machine description file for SIMD instructions.
19164 +;; Copyright 2003-2006 Atmel Corporation.
19166 +;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
19168 +;; This file is part of GCC.
19170 +;; This program is free software; you can redistribute it and/or modify
19171 +;; it under the terms of the GNU General Public License as published by
19172 +;; the Free Software Foundation; either version 2 of the License, or
19173 +;; (at your option) any later version.
19175 +;; This program is distributed in the hope that it will be useful,
19176 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19177 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19178 +;; GNU General Public License for more details.
19180 +;; You should have received a copy of the GNU General Public License
19181 +;; along with this program; if not, write to the Free Software
19182 +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19184 +;; -*- Mode: Scheme -*-
19188 +(define_mode_macro VECM [V2HI V4QI])
19189 +(define_mode_attr size [(V2HI "h") (V4QI "b")])
19191 +(define_insn "add<mode>3"
19192 + [(set (match_operand:VECM 0 "register_operand" "=r")
19193 + (plus:VECM (match_operand:VECM 1 "register_operand" "r")
19194 + (match_operand:VECM 2 "register_operand" "r")))]
19196 + "padd.<size>\t%0, %1, %2"
19197 + [(set_attr "length" "4")
19198 + (set_attr "type" "alu")])
19201 +(define_insn "sub<mode>3"
19202 + [(set (match_operand:VECM 0 "register_operand" "=r")
19203 + (minus:VECM (match_operand:VECM 1 "register_operand" "r")
19204 + (match_operand:VECM 2 "register_operand" "r")))]
19206 + "psub.<size>\t%0, %1, %2"
19207 + [(set_attr "length" "4")
19208 + (set_attr "type" "alu")])
19211 +(define_insn "abs<mode>2"
19212 + [(set (match_operand:VECM 0 "register_operand" "=r")
19213 + (abs:VECM (match_operand:VECM 1 "register_operand" "r")))]
19215 + "pabs.s<size>\t%0, %1"
19216 + [(set_attr "length" "4")
19217 + (set_attr "type" "alu")])
19219 +(define_insn "ashl<mode>3"
19220 + [(set (match_operand:VECM 0 "register_operand" "=r")
19221 + (ashift:VECM (match_operand:VECM 1 "register_operand" "r")
19222 + (match_operand:SI 2 "immediate_operand" "Ku04")))]
19224 + "plsl.<size>\t%0, %1, %2"
19225 + [(set_attr "length" "4")
19226 + (set_attr "type" "alu")])
19228 +(define_insn "ashr<mode>3"
19229 + [(set (match_operand:VECM 0 "register_operand" "=r")
19230 + (ashiftrt:VECM (match_operand:VECM 1 "register_operand" "r")
19231 + (match_operand:SI 2 "immediate_operand" "Ku04")))]
19233 + "pasr.<size>\t%0, %1, %2"
19234 + [(set_attr "length" "4")
19235 + (set_attr "type" "alu")])
19237 +(define_insn "lshr<mode>3"
19238 + [(set (match_operand:VECM 0 "register_operand" "=r")
19239 + (lshiftrt:VECM (match_operand:VECM 1 "register_operand" "r")
19240 + (match_operand:SI 2 "immediate_operand" "Ku04")))]
19242 + "plsr.<size>\t%0, %1, %2"
19243 + [(set_attr "length" "4")
19244 + (set_attr "type" "alu")])
19246 +(define_insn "smaxv2hi3"
19247 + [(set (match_operand:V2HI 0 "register_operand" "=r")
19248 + (smax:V2HI (match_operand:V2HI 1 "register_operand" "r")
19249 + (match_operand:V2HI 2 "register_operand" "r")))]
19252 + "pmax.sh\t%0, %1, %2"
19253 + [(set_attr "length" "4")
19254 + (set_attr "type" "alu")])
19256 +(define_insn "sminv2hi3"
19257 + [(set (match_operand:V2HI 0 "register_operand" "=r")
19258 + (smin:V2HI (match_operand:V2HI 1 "register_operand" "r")
19259 + (match_operand:V2HI 2 "register_operand" "r")))]
19262 + "pmin.sh\t%0, %1, %2"
19263 + [(set_attr "length" "4")
19264 + (set_attr "type" "alu")])
19266 +(define_insn "umaxv4qi3"
19267 + [(set (match_operand:V4QI 0 "register_operand" "=r")
19268 + (umax:V4QI (match_operand:V4QI 1 "register_operand" "r")
19269 + (match_operand:V4QI 2 "register_operand" "r")))]
19272 + "pmax.ub\t%0, %1, %2"
19273 + [(set_attr "length" "4")
19274 + (set_attr "type" "alu")])
19276 +(define_insn "uminv4qi3"
19277 + [(set (match_operand:V4QI 0 "register_operand" "=r")
19278 + (umin:V4QI (match_operand:V4QI 1 "register_operand" "r")
19279 + (match_operand:V4QI 2 "register_operand" "r")))]
19282 + "pmin.ub\t%0, %1, %2"
19283 + [(set_attr "length" "4")
19284 + (set_attr "type" "alu")])
19287 +(define_insn "addsubv2hi"
19288 + [(set (match_operand:V2HI 0 "register_operand" "=r")
19290 + (plus:HI (match_operand:HI 1 "register_operand" "r")
19291 + (match_operand:HI 2 "register_operand" "r"))
19292 + (minus:HI (match_dup 1) (match_dup 2))))]
19294 + "paddsub.h\t%0, %1:b, %2:b"
19295 + [(set_attr "length" "4")
19296 + (set_attr "type" "alu")])
19298 +(define_insn "subaddv2hi"
19299 + [(set (match_operand:V2HI 0 "register_operand" "=r")
19301 + (minus:HI (match_operand:HI 1 "register_operand" "r")
19302 + (match_operand:HI 2 "register_operand" "r"))
19303 + (plus:HI (match_dup 1) (match_dup 2))))]
19305 + "psubadd.h\t%0, %1:b, %2:b"
19306 + [(set_attr "length" "4")
19307 + (set_attr "type" "alu")])
19308 Index: gcc-4.2.3/gcc/config/avr32/sync.md
19309 ===================================================================
19310 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
19311 +++ gcc-4.2.3/gcc/config/avr32/sync.md 2008-05-21 13:45:54.177287723 +0200
19313 +;;=================================================================
19314 +;; Atomic operations
19315 +;;=================================================================
19318 +(define_insn "sync_compare_and_swapsi"
19319 + [(set (match_operand:SI 0 "register_operand" "=&r,&r")
19320 + (match_operand:SI 1 "memory_operand" "+RKs16,+RKs16"))
19321 + (set (match_dup 1)
19322 + (unspec_volatile:SI
19324 + (match_operand:SI 2 "register_immediate_operand" "r,Ks21")
19325 + (match_operand:SI 3 "register_operand" "r,r")]
19326 + VUNSPEC_SYNC_CMPXCHG)) ]
19337 + [(set_attr "length" "16,18")
19338 + (set_attr "cc" "clobber")]
19342 +(define_code_macro atomic_op [plus minus and ior xor])
19343 +(define_code_attr atomic_asm_insn [(plus "add") (minus "sub") (and "and") (ior "or") (xor "eor")])
19344 +(define_code_attr atomic_insn [(plus "add") (minus "sub") (and "and") (ior "ior") (xor "xor")])
19346 +(define_insn "sync_loadsi"
19347 + [(set (match_operand:SI 0 "register_operand" "=r")
19348 + (unspec_volatile:SI
19349 + [(match_operand:SI 1 "memory_operand" "RKs16")
19350 + (label_ref (match_operand 2 "" ""))]
19351 + VUNSPEC_SYNC_SET_LOCK_AND_LOAD) )]
19356 + [(set_attr "length" "6")
19357 + (set_attr "cc" "clobber")]
19360 +(define_insn "sync_store_if_lock"
19361 + [(set (match_operand:SI 0 "memory_operand" "=RKs16")
19362 + (unspec_volatile:SI
19363 + [(match_operand:SI 1 "register_operand" "r")
19364 + (label_ref (match_operand 2 "" ""))]
19365 + VUNSPEC_SYNC_STORE_IF_LOCK) )]
19369 + [(set_attr "length" "6")
19370 + (set_attr "cc" "clobber")]
19374 +(define_expand "sync_<atomic_insn>si"
19375 + [(set (match_dup 2)
19376 + (unspec_volatile:SI
19377 + [(match_operand:SI 0 "memory_operand" "")
19379 + VUNSPEC_SYNC_SET_LOCK_AND_LOAD))
19380 + (set (match_dup 2)
19381 + (atomic_op:SI (match_dup 2)
19382 + (match_operand:SI 1 "register_immediate_operand" "")))
19383 + (set (match_dup 0)
19384 + (unspec_volatile:SI
19387 + VUNSPEC_SYNC_STORE_IF_LOCK) )]
19390 + operands[2] = gen_reg_rtx (SImode);
19391 + operands[3] = gen_rtx_LABEL_REF(Pmode, gen_label_rtx ());
19397 +(define_expand "sync_old_<atomic_insn>si"
19398 + [(set (match_operand:SI 0 "register_operand" "")
19399 + (unspec_volatile:SI
19400 + [(match_operand:SI 1 "memory_operand" "")
19402 + VUNSPEC_SYNC_SET_LOCK_AND_LOAD))
19403 + (set (match_dup 3)
19404 + (atomic_op:SI (match_dup 0)
19405 + (match_operand:SI 2 "register_immediate_operand" "")))
19406 + (set (match_dup 1)
19407 + (unspec_volatile:SI
19410 + VUNSPEC_SYNC_STORE_IF_LOCK) )]
19413 + operands[3] = gen_reg_rtx (SImode);
19414 + operands[4] = gen_rtx_LABEL_REF(Pmode, gen_label_rtx ());
19418 +(define_expand "sync_new_<atomic_insn>si"
19419 + [(set (match_operand:SI 0 "register_operand" "")
19420 + (unspec_volatile:SI
19421 + [(match_operand:SI 1 "memory_operand" "")
19423 + VUNSPEC_SYNC_SET_LOCK_AND_LOAD))
19424 + (set (match_dup 0)
19425 + (atomic_op:SI (match_dup 0)
19426 + (match_operand:SI 2 "register_immediate_operand" "")))
19427 + (set (match_dup 1)
19428 + (unspec_volatile:SI
19431 + VUNSPEC_SYNC_STORE_IF_LOCK) )]
19434 + operands[3] = gen_rtx_LABEL_REF(Pmode, gen_label_rtx ());
19439 +;(define_insn "sync_<atomic_insn>si"
19440 +; [(set (match_operand:SI 0 "memory_operand" "+RKs16")
19441 +; (unspec_volatile:SI
19442 +; [(atomic_op:SI (match_dup 0)
19443 +; (match_operand:SI 1 "register_operand" "r"))]
19444 +; VUNSPEC_SYNC_CMPXCHG))
19445 +; (clobber (match_scratch:SI 2 "=&r"))]
19450 +; <atomic_asm_insn>\t%2,%1
19454 +; [(set_attr "length" "14")
19455 +; (set_attr "cc" "clobber")]
19458 +;(define_insn "sync_new_<atomic_insn>si"
19459 +; [(set (match_operand:SI 1 "memory_operand" "+RKs16")
19460 +; (unspec_volatile:SI
19461 +; [(atomic_op:SI (match_dup 1)
19462 +; (match_operand:SI 2 "register_operand" "r"))]
19463 +; VUNSPEC_SYNC_CMPXCHG))
19464 +; (set (match_operand:SI 0 "register_operand" "=&r")
19465 +; (atomic_op:SI (match_dup 1)
19466 +; (match_dup 2)))]
19471 +; <atomic_asm_insn>\t%0,%2
19475 +; [(set_attr "length" "14")
19476 +; (set_attr "cc" "clobber")]
19479 +(define_insn "sync_lock_test_and_setsi"
19480 + [ (set (match_operand:SI 0 "register_operand" "=&r")
19481 + (match_operand:SI 1 "memory_operand" "+RKu00"))
19482 + (set (match_dup 1)
19483 + (match_operand:SI 2 "register_operand" "r")) ]
19485 + "xchg\t%0, %p1, %2"
19486 + [(set_attr "length" "4")]
19488 Index: gcc-4.2.3/gcc/config/avr32/t-avr32
19489 ===================================================================
19490 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
19491 +++ gcc-4.2.3/gcc/config/avr32/t-avr32 2008-05-21 13:45:54.177287723 +0200
19494 +MD_INCLUDES= $(srcdir)/config/avr32/avr32.md \
19495 + $(srcdir)/config/avr32/sync.md \
19496 + $(srcdir)/config/avr32/fpcp.md \
19497 + $(srcdir)/config/avr32/simd.md \
19498 + $(srcdir)/config/avr32/predicates.md
19500 +s-config s-conditions s-flags s-codes s-constants s-emit s-recog s-preds \
19501 + s-opinit s-extract s-peep s-attr s-attrtab s-output: $(MD_INCLUDES)
19503 +# We want fine grained libraries, so use the new code
19504 +# to build the floating point emulation libraries.
19508 +LIB1ASMSRC = avr32/lib1funcs.S
19509 +LIB1ASMFUNCS = _avr32_f64_mul _avr32_f64_addsub _avr32_f64_addsub_fast _avr32_f64_to_u32 \
19510 + _avr32_f64_to_s32 _avr32_f64_to_u64 _avr32_f64_to_s64 _avr32_u32_to_f64 \
19511 + _avr32_s32_to_f64 _avr32_f64_cmp_eq _avr32_f64_cmp_ge _avr32_f64_cmp_lt \
19512 + _avr32_f32_cmp_eq _avr32_f32_cmp_ge _avr32_f32_cmp_lt _avr32_f64_div \
19513 + _avr32_f32_div _avr32_f32_div_fast _avr32_f32_addsub _avr32_f32_addsub_fast \
19514 + _avr32_f32_mul _avr32_s32_to_f32 _avr32_u32_to_f32 _avr32_f32_to_s32 \
19515 + _avr32_f32_to_u32 _avr32_f32_to_f64 _avr32_f64_to_f32
19517 +#LIB2FUNCS_EXTRA += $(srcdir)/config/avr32/lib2funcs.S
19519 +MULTILIB_OPTIONS = march=ap/march=uc
19520 +MULTILIB_DIRNAMES = ap uc
19521 +MULTILIB_EXCEPTIONS =
19522 +MULTILIB_MATCHES = march?ap=mcpu?ap7000
19523 +MULTILIB_MATCHES += march?ap=mcpu?ap7010
19524 +MULTILIB_MATCHES += march?ap=mcpu?ap7020
19525 +MULTILIB_MATCHES += march?uc=mcpu?uc3a0256
19526 +MULTILIB_MATCHES += march?uc=mcpu?uc3a0512
19527 +MULTILIB_MATCHES += march?uc=mcpu?uc3a1128
19528 +MULTILIB_MATCHES += march?uc=mcpu?uc3a1256
19529 +MULTILIB_MATCHES += march?uc=mcpu?uc3a1512
19530 +MULTILIB_MATCHES += march?uc=mcpu?uc3b064
19531 +MULTILIB_MATCHES += march?uc=mcpu?uc3b0128
19532 +MULTILIB_MATCHES += march?uc=mcpu?uc3b0256
19533 +MULTILIB_MATCHES += march?uc=mcpu?uc3b164
19534 +MULTILIB_MATCHES += march?uc=mcpu?uc3b1128
19535 +MULTILIB_MATCHES += march?uc=mcpu?uc3b1256
19536 +MULTILIB_MATCHES += march?ap=mpart?ap7000
19537 +MULTILIB_MATCHES += march?ap=mpart?ap7010
19538 +MULTILIB_MATCHES += march?ap=mpart?ap7020
19539 +MULTILIB_MATCHES += march?uc=mpart?uc3a0256
19540 +MULTILIB_MATCHES += march?uc=mpart?uc3a0512
19541 +MULTILIB_MATCHES += march?uc=mpart?uc3a1128
19542 +MULTILIB_MATCHES += march?uc=mpart?uc3a1256
19543 +MULTILIB_MATCHES += march?uc=mpart?uc3a1512
19544 +MULTILIB_MATCHES += march?uc=mpart?uc3b064
19545 +MULTILIB_MATCHES += march?uc=mpart?uc3b0128
19546 +MULTILIB_MATCHES += march?uc=mpart?uc3b0256
19547 +MULTILIB_MATCHES += march?uc=mpart?uc3b164
19548 +MULTILIB_MATCHES += march?uc=mpart?uc3b1128
19549 +MULTILIB_MATCHES += march?uc=mpart?uc3b1256
19551 +EXTRA_MULTILIB_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crti.o crtn.o
19553 +CRTSTUFF_T_CFLAGS = -mrelax
19554 +CRTSTUFF_T_CFLAGS_S = -mrelax -fPIC
19555 +TARGET_LIBGCC2_CFLAGS += -mrelax
19557 +LIBGCC = stmp-multilib
19558 +INSTALL_LIBGCC = install-multilib
19560 +fp-bit.c: $(srcdir)/config/fp-bit.c
19561 + echo '#define FLOAT' > fp-bit.c
19562 + cat $(srcdir)/config/fp-bit.c >> fp-bit.c
19564 +dp-bit.c: $(srcdir)/config/fp-bit.c
19565 + cat $(srcdir)/config/fp-bit.c > dp-bit.c
19569 Index: gcc-4.2.3/gcc/config/avr32/t-elf
19570 ===================================================================
19571 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
19572 +++ gcc-4.2.3/gcc/config/avr32/t-elf 2008-05-21 13:45:54.177287723 +0200
19575 +# Assemble startup files.
19576 +$(T)crti.o: $(srcdir)/config/avr32/crti.asm $(GCC_PASSES)
19577 + $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) $(INCLUDES) \
19578 + -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/avr32/crti.asm
19580 +$(T)crtn.o: $(srcdir)/config/avr32/crtn.asm $(GCC_PASSES)
19581 + $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) $(INCLUDES) \
19582 + -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/avr32/crtn.asm
19585 +# Build the libraries for both hard and soft floating point
19586 +EXTRA_MULTILIB_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crti.o crtn.o
19588 +LIBGCC = stmp-multilib
19589 +INSTALL_LIBGCC = install-multilib
19590 Index: gcc-4.2.3/gcc/config/avr32/uclinux-elf.h
19591 ===================================================================
19592 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
19593 +++ gcc-4.2.3/gcc/config/avr32/uclinux-elf.h 2008-05-21 13:45:54.177287723 +0200
19596 +/* Run-time Target Specification. */
19597 +#undef TARGET_VERSION
19598 +#define TARGET_VERSION fputs (" (AVR32 uClinux with ELF)", stderr)
19600 +/* We don't want a .jcr section on uClinux. As if this makes a difference... */
19601 +#define TARGET_USE_JCR_SECTION 0
19603 +/* Here we go. Drop the crtbegin/crtend stuff completely. */
19604 +#undef STARTFILE_SPEC
19605 +#define STARTFILE_SPEC \
19606 + "%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s}" \
19607 + " %{!p:%{profile:gcrt1.o%s}" \
19608 + " %{!profile:crt1.o%s}}}} crti.o%s"
19610 +#undef ENDFILE_SPEC
19611 +#define ENDFILE_SPEC "crtn.o%s"
19613 +#undef TARGET_DEFAULT
19614 +#define TARGET_DEFAULT (AVR32_FLAG_NO_INIT_GOT)
19615 Index: gcc-4.2.3/gcc/config/host-linux.c
19616 ===================================================================
19617 --- gcc-4.2.3.orig/gcc/config/host-linux.c 2007-09-01 17:28:30.000000000 +0200
19618 +++ gcc-4.2.3/gcc/config/host-linux.c 2008-05-21 13:45:54.177287723 +0200
19620 #include "hosthooks.h"
19621 #include "hosthooks-def.h"
19624 +#define SSIZE_MAX LONG_MAX
19627 /* Linux has a feature called exec-shield-randomize that perturbs the
19628 address of non-fixed mapped segments by a (relatively) small amount.
19629 Index: gcc-4.2.3/gcc/config.gcc
19630 ===================================================================
19631 --- gcc-4.2.3.orig/gcc/config.gcc 2008-05-21 13:45:53.353287795 +0200
19632 +++ gcc-4.2.3/gcc/config.gcc 2008-05-21 13:45:54.181287953 +0200
19633 @@ -790,6 +790,24 @@
19634 tm_file="avr/avr.h dbxelf.h"
19638 + tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/avr32.h "
19639 + tmake_file="t-linux avr32/t-avr32 avr32/t-elf"
19640 + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
19641 + extra_modes=avr32/avr32-modes.def
19644 +avr32*-*-uclinux*)
19645 + tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/uclinux-elf.h avr32/avr32.h"
19646 + tmake_file="t-linux avr32/t-avr32 avr32/t-elf"
19647 + extra_modes=avr32/avr32-modes.def
19651 + tm_file="dbxelf.h elfos.h avr32/avr32.h avr32/avr32-elf.h"
19652 + tmake_file="avr32/t-avr32 avr32/t-elf"
19653 + extra_modes=avr32/avr32-modes.def
19656 tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h"
19657 tmake_file=bfin/t-bfin-elf
19658 @@ -1690,6 +1708,9 @@
19665 # port not yet contributed
19666 #powerpc-*-openbsd*)
19667 # tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-fprules-fpbit "
19668 @@ -2726,6 +2747,32 @@
19673 + supported_defaults="part arch"
19675 + case "$with_part" in
19677 + | "ap7000" | "ap7010" | "ap7020" | "uc3a0256" | "uc3a0512" | "uc3a1128" | "uc3a1256" | "uc3a1512" )
19681 + echo "Unknown part used in --with-part=$with_part" 1>&2
19686 + case "$with_arch" in
19692 + echo "Unknown arch used in --with-arch=$with_arch" 1>&2
19699 supported_defaults=cpu
19700 case "$with_cpu" in
19701 Index: gcc-4.2.3/gcc/doc/extend.texi
19702 ===================================================================
19703 --- gcc-4.2.3.orig/gcc/doc/extend.texi 2008-02-01 02:40:49.000000000 +0100
19704 +++ gcc-4.2.3/gcc/doc/extend.texi 2008-05-21 13:45:54.222289824 +0200
19705 @@ -1981,7 +1981,7 @@
19708 @cindex interrupt handler functions
19709 -Use this attribute on the ARM, AVR, C4x, CRX, M32C, M32R/D, MS1, and Xstormy16
19710 +Use this attribute on the ARM, AVR, AVR32, C4x, CRX, M32C, M32R/D, MS1, and Xstormy16
19711 ports to indicate that the specified function is an interrupt handler.
19712 The compiler will generate function entry and exit sequences suitable
19713 for use in an interrupt handler when this attribute is present.
19714 @@ -2000,6 +2000,15 @@
19716 Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF@.
19718 +Note, for the AVR32, you can specify which banking scheme is used for
19719 +the interrupt mode this interrupt handler is used in like this:
19722 +void f () __attribute__ ((interrupt ("FULL")));
19725 +Permissible values for this parameter are: FULL, HALF, NONE and UNDEF.
19727 @item interrupt_handler
19728 @cindex interrupt handler functions on the Blackfin, m68k, H8/300 and SH processors
19729 Use this attribute on the Blackfin, m68k, H8/300, H8/300H, H8S, and SH to
19730 @@ -6175,6 +6184,7 @@
19732 * Alpha Built-in Functions::
19733 * ARM Built-in Functions::
19734 +* AVR32 Built-in Functions::
19735 * Blackfin Built-in Functions::
19736 * FR-V Built-in Functions::
19737 * X86 Built-in Functions::
19738 @@ -6413,6 +6423,54 @@
19739 long long __builtin_arm_wzero ()
19742 +@node AVR32 Built-in Functions
19743 +@subsection AVR32 Built-in Functions
19748 +int __builtin_sats (int /*Rd*/,int /*sa*/, int /*bn*/)
19749 +int __builtin_satu (int /*Rd*/,int /*sa*/, int /*bn*/)
19750 +int __builtin_satrnds (int /*Rd*/,int /*sa*/, int /*bn*/)
19751 +int __builtin_satrndu (int /*Rd*/,int /*sa*/, int /*bn*/)
19752 +short __builtin_mulsathh_h (short, short)
19753 +int __builtin_mulsathh_w (short, short)
19754 +short __builtin_mulsatrndhh_h (short, short)
19755 +int __builtin_mulsatrndwh_w (int, short)
19756 +int __builtin_mulsatwh_w (int, short)
19757 +int __builtin_macsathh_w (int, short, short)
19758 +short __builtin_satadd_h (short, short)
19759 +short __builtin_satsub_h (short, short)
19760 +int __builtin_satadd_w (int, int)
19761 +int __builtin_satsub_w (int, int)
19762 +long long __builtin_mulwh_d(int, short)
19763 +long long __builtin_mulnwh_d(int, short)
19764 +long long __builtin_macwh_d(long long, int, short)
19765 +long long __builtin_machh_d(long long, short, short)
19767 +void __builtin_musfr(int);
19768 +int __builtin_mustr(void);
19769 +int __builtin_mfsr(int /*Status Register Address*/)
19770 +void __builtin_mtsr(int /*Status Register Address*/, int /*Value*/)
19771 +int __builtin_mfdr(int /*Debug Register Address*/)
19772 +void __builtin_mtdr(int /*Debug Register Address*/, int /*Value*/)
19773 +void __builtin_cache(void * /*Address*/, int /*Cache Operation*/)
19774 +void __builtin_sync(int /*Sync Operation*/)
19775 +void __builtin_tlbr(void)
19776 +void __builtin_tlbs(void)
19777 +void __builtin_tlbw(void)
19778 +void __builtin_breakpoint(void)
19779 +int __builtin_xchg(void * /*Address*/, int /*Value*/ )
19780 +short __builtin_bswap_16(short)
19781 +int __builtin_bswap_32(int)
19782 +void __builtin_cop(int/*cpnr*/, int/*crd*/, int/*crx*/, int/*cry*/, int/*op*/)
19783 +int __builtin_mvcr_w(int/*cpnr*/, int/*crs*/)
19784 +void __builtin_mvrc_w(int/*cpnr*/, int/*crd*/, int/*value*/)
19785 +long long __builtin_mvcr_d(int/*cpnr*/, int/*crs*/)
19786 +void __builtin_mvrc_d(int/*cpnr*/, int/*crd*/, long long/*value*/)
19790 @node Blackfin Built-in Functions
19791 @subsection Blackfin Built-in Functions
19793 Index: gcc-4.2.3/gcc/doc/invoke.texi
19794 ===================================================================
19795 --- gcc-4.2.3.orig/gcc/doc/invoke.texi 2008-01-31 19:40:58.000000000 +0100
19796 +++ gcc-4.2.3/gcc/doc/invoke.texi 2008-05-21 13:45:54.274288067 +0200
19797 @@ -190,7 +190,7 @@
19798 -fno-default-inline -fvisibility-inlines-hidden @gol
19799 -Wabi -Wctor-dtor-privacy @gol
19800 -Wnon-virtual-dtor -Wreorder @gol
19801 --Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol
19802 +-Weffc++ -Wno-deprecated @gol
19803 -Wno-non-template-friend -Wold-style-cast @gol
19804 -Woverloaded-virtual -Wno-pmf-conversions @gol
19806 @@ -590,6 +590,12 @@
19807 -mauto-incdec -minmax -mlong-calls -mshort @gol
19808 -msoft-reg-count=@var{count}}
19810 +@emph{AVR32 Options}
19811 +@gccoptlist{-muse-rodata-section -mhard-float -msoft-float -mrelax @gol
19812 +-mforce-double-align -mno-init-got -mpart=@var{part} -mcpu=@var{cpu} @gol
19813 +-march=@var{arch} -mfast-float -masm-addr-pseudos -mno-asm-addr-pseudos -mno-pic
19816 @emph{MCore Options}
19817 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
19818 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
19819 @@ -1869,14 +1875,6 @@
19820 @opindex Wno-deprecated
19821 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
19823 -@item -Wstrict-null-sentinel @r{(C++ only)}
19824 -@opindex Wstrict-null-sentinel
19825 -Warn also about the use of an uncasted @code{NULL} as sentinel. When
19826 -compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
19827 -to @code{__null}. Although it is a null pointer constant not a null pointer,
19828 -it is guaranteed to of the same size as a pointer. But this use is
19829 -not portable across different compilers.
19831 @item -Wno-non-template-friend @r{(C++ only)}
19832 @opindex Wno-non-template-friend
19833 Disable warnings when non-templatized friend functions are declared
19834 @@ -2733,13 +2731,11 @@
19835 If you want to warn about code which uses the uninitialized value of the
19836 variable in its own initializer, use the @option{-Winit-self} option.
19838 -These warnings occur for individual uninitialized or clobbered
19839 -elements of structure, union or array variables as well as for
19840 -variables which are uninitialized or clobbered as a whole. They do
19841 -not occur for variables or elements declared @code{volatile}. Because
19842 -these warnings depend on optimization, the exact variables or elements
19843 -for which there are warnings will depend on the precise optimization
19844 -options and version of GCC used.
19845 +These warnings occur only for variables that are candidates for
19846 +register allocation. Therefore, they do not occur for a variable that
19847 +is declared @code{volatile}, or whose address is taken, or whose size
19848 +is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
19849 +structures, unions or arrays, even when they are in registers.
19851 Note that there may be no warning about a variable that is used only
19852 to compute a value that itself is never used, because such
19853 @@ -6228,10 +6224,6 @@
19854 we always try to remove unnecessary ivs from the set during its
19855 optimization when a new iv is added to the set.
19857 -@item scev-max-expr-size
19858 -Bound on size of expressions used in the scalar evolutions analyzer.
19859 -Large expressions slow the analyzer.
19861 @item vect-max-version-checks
19862 The maximum number of runtime checks that can be performed when doing
19863 loop versioning in the vectorizer. See option ftree-vect-loop-version
19864 @@ -7429,7 +7421,7 @@
19868 -* Blackfin Options::
19873 @@ -7894,81 +7886,68 @@
19877 -@node Blackfin Options
19878 -@subsection Blackfin Options
19879 -@cindex Blackfin Options
19880 +@node AVR32 Options
19881 +@subsection AVR32 Options
19882 +@cindex AVR32 Options
19884 +These options are defined for AVR32 implementations:
19887 -@item -momit-leaf-frame-pointer
19888 -@opindex momit-leaf-frame-pointer
19889 -Don't keep the frame pointer in a register for leaf functions. This
19890 -avoids the instructions to save, set up and restore frame pointers and
19891 -makes an extra register available in leaf functions. The option
19892 -@option{-fomit-frame-pointer} removes the frame pointer for all functions
19893 -which might make debugging harder.
19894 +@item -muse-rodata-section
19895 +@opindex muse-rodata-section
19896 +Use section @samp{.rodata} for read-only data instead of @samp{.text}.
19898 -@item -mspecld-anomaly
19899 -@opindex mspecld-anomaly
19900 -When enabled, the compiler will ensure that the generated code does not
19901 -contain speculative loads after jump instructions. This option is enabled
19904 -@item -mno-specld-anomaly
19905 -@opindex mno-specld-anomaly
19906 -Don't generate extra code to prevent speculative loads from occurring.
19908 -@item -mcsync-anomaly
19909 -@opindex mcsync-anomaly
19910 -When enabled, the compiler will ensure that the generated code does not
19911 -contain CSYNC or SSYNC instructions too soon after conditional branches.
19912 -This option is enabled by default.
19914 -@item -mno-csync-anomaly
19915 -@opindex mno-csync-anomaly
19916 -Don't generate extra code to prevent CSYNC or SSYNC instructions from
19917 -occurring too soon after a conditional branch.
19921 -When enabled, the compiler is free to take advantage of the knowledge that
19922 -the entire program fits into the low 64k of memory.
19924 -@item -mno-low-64k
19925 -@opindex mno-low-64k
19926 -Assume that the program is arbitrarily large. This is the default.
19929 +Enable relaxing in linker. This means that when the address of symbols
19930 +are known at link time, the linker can optimize @samp{icall} and @samp{mcall}
19931 +instructions into a @samp{rcall} instruction if possible. Loading the address
19932 +of a symbol can also be optimized.
19934 +@item -mforce-double-align
19935 +@opindex mforce-double-align
19936 +Force double-word alignment for double-word memory accesses.
19938 +@item -mno-init-got
19939 +@opindex mno-init-got
19940 +Do not initialize the GOT register before using it when compiling PIC
19943 -@item -mid-shared-library
19944 -@opindex mid-shared-library
19945 -Generate code that supports shared libraries via the library ID method.
19946 -This allows for execute in place and shared libraries in an environment
19947 -without virtual memory management. This option implies @option{-fPIC}.
19950 +Do not emit position-independent code (will break dynamic linking.)
19952 -@item -mno-id-shared-library
19953 -@opindex mno-id-shared-library
19954 -Generate code that doesn't assume ID based shared libraries are being used.
19955 -This is the default.
19956 +@item -masm-addr-pseudos
19957 +@opindex masm-addr-pseudos
19958 +Use assembler pseudo-instructions lda.w and call for handling direct
19959 +addresses. (Enabled by default)
19961 +@item -mno-asm-addr-pseudos
19962 +@opindex mno-asm-addr-pseudos
19963 +Do not use assembler pseudo-instructions lda.w and call for handling direct addresses.
19965 +@item -mpart=@var{part}
19967 +Generate code for the specified part. Permissible parts are: @samp{ap7000},
19968 +@samp{ap7010},@samp{ap7020},@samp{uc3a0256}, @samp{uc3a0512},
19969 +@samp{uc3a1128}, @samp{uc3a1256}, @samp{uc3a1512}.
19971 -@item -mshared-library-id=n
19972 -@opindex mshared-library-id
19973 -Specified the identification number of the ID based shared library being
19974 -compiled. Specifying a value of 0 will generate more compact code, specifying
19975 -other values will force the allocation of that number to the current
19976 -library but is no more space or time efficient than omitting this option.
19977 +@item -mcpu=@var{cpu-type}
19979 +Same as -mpart. Obsolete.
19981 +@item -march=@var{arch}
19983 +Generate code for the specified architecture. Permissible architectures are:
19984 +@samp{ap} and @samp{uc}.
19986 +@item -mfast-float
19987 +@opindex mfast-float
19988 +Enable fast floating-point library that does not conform to ieee but is still good enough
19989 +for most applications. The fast floating-point library does not round to the nearest even
19990 +but away from zero. Enabled by default if the -funsafe-math-optimizations switch is specified.
19992 -@item -mlong-calls
19993 -@itemx -mno-long-calls
19994 -@opindex mlong-calls
19995 -@opindex mno-long-calls
19996 -Tells the compiler to perform function calls by first loading the
19997 -address of the function into a register and then performing a subroutine
19998 -call on this register. This switch is needed if the target function
19999 -will lie outside of the 24 bit addressing range of the offset based
20000 -version of subroutine call instruction.
20002 -This feature is not enabled by default. Specifying
20003 -@option{-mno-long-calls} will restore the default behavior. Note these
20004 -switches have no effect on how the compiler generates code to handle
20005 -function calls via function pointers.
20009 @@ -11879,6 +11858,7 @@
20010 Application Binary Interface, PowerPC processor supplement. This is the
20011 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20014 @item -mcall-sysv-eabi
20015 @opindex mcall-sysv-eabi
20016 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20017 @@ -14181,4 +14161,4 @@
20018 exist, because otherwise they won't get converted.
20020 @xref{Protoize Caveats}, for more information on how to use
20021 -@code{protoize} successfully.
20022 +@code{protoize} successfully.
20023 \ No newline at end of file
20024 Index: gcc-4.2.3/gcc/doc/md.texi
20025 ===================================================================
20026 --- gcc-4.2.3.orig/gcc/doc/md.texi 2007-04-04 03:24:10.000000000 +0200
20027 +++ gcc-4.2.3/gcc/doc/md.texi 2008-05-21 13:45:54.302287723 +0200
20029 @c This is part of the GCC manual.
20030 @c For copying conditions, see the file gcc.texi.
20035 @chapter Machine Descriptions
20036 @@ -1681,6 +1682,58 @@
20037 A memory reference suitable for the ARMv4 ldrsb instruction.
20040 +@item AVR32 family---@file{avr32.h}
20043 +Floating-point registers (f0 to f15)
20045 +@item Ku@var{bits}
20046 +Unsigned constant representable with @var{bits} number of bits (Must be
20047 +two digits). I.e: An unsigned 8-bit constant is written as @samp{Ku08}
20049 +@item Ks@var{bits}
20050 +Signed constant representable with @var{bits} number of bits (Must be
20051 +two digits). I.e: A signed 12-bit constant is written as @samp{Ks12}
20053 +@item Is@var{bits}
20054 +The negated range of a signed constant representable with @var{bits}
20055 +number of bits. The same as @samp{Ks@var{bits}} with a negated range.
20056 +This means that the constant must be in the range @math{-2^{bits-1}-1} to @math{2^{bits-1}}
20059 +A single/double precision floating-point immediate or 64-bit integer
20060 +immediate where the least and most significant words both can be
20061 +loaded with a move instruction. That is the the integer form of the
20062 +values in the least and most significant words both are in the range
20063 +@math{-2^{20}} to @math{2^{20}-1}.
20065 +@item RKs@var{bits}
20066 +A memory reference where the address consists of a base register
20067 +plus a signed immediate displacement with range given by @samp{Ks@var{bits}}
20068 +which has the same format as for the signed immediate integer constraint
20071 +@item RKu@var{bits}
20072 +A memory reference where the address consists of a base register
20073 +plus an unsigned immediate displacement with range given by @samp{Ku@var{bits}}
20074 +which has the same format as for the unsigned immediate integer constraint
20078 +A memory reference with an immediate or register offset
20081 +A memory reference to a constant pool entry
20084 +A valid operand for use in the @samp{lda.w} instruction macro when
20085 +relaxing is enabled
20088 +A memory reference valid for coprocessor memory instructions
20092 @item AVR family---@file{config/avr/constraints.md}
20095 Index: gcc-4.2.3/gcc/expmed.c
20096 ===================================================================
20097 --- gcc-4.2.3.orig/gcc/expmed.c 2007-09-01 17:28:30.000000000 +0200
20098 +++ gcc-4.2.3/gcc/expmed.c 2008-05-21 13:45:54.306288512 +0200
20102 #include "langhooks.h"
20103 +#include "target.h"
20105 static void store_fixed_bit_field (rtx, unsigned HOST_WIDE_INT,
20106 unsigned HOST_WIDE_INT,
20107 @@ -454,9 +455,18 @@
20108 ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
20109 || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
20110 && byte_offset % GET_MODE_SIZE (fieldmode) == 0)
20111 - : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
20112 - || (offset * BITS_PER_UNIT % bitsize == 0
20113 - && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0))))
20116 + /* NB! Added for AVR32, and I think this should be true for
20117 + all targets not using narrow volatile bitfields. If the
20118 + bitfield is volatile then we need to perform an access
20119 + consistent with the container type. */
20120 + !(MEM_VOLATILE_P (op0)
20121 + && GET_MODE_BITSIZE (GET_MODE (op0)) != bitsize
20122 + && !targetm.narrow_volatile_bitfield ())
20123 + && (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
20124 + || (offset * BITS_PER_UNIT % bitsize == 0
20125 + && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0)))))
20128 op0 = adjust_address (op0, fieldmode, offset);
20129 @@ -1256,6 +1266,13 @@
20130 && GET_MODE_SIZE (mode1) != 0
20131 && byte_offset % GET_MODE_SIZE (mode1) == 0)
20133 + /* NB! Added for AVR32, and I think this should be true for
20134 + all targets not using narrow volatile bitfields. If the
20135 + bitfield is volatile then we need to perform an access
20136 + consistent with the container type. */
20137 + && !(MEM_VOLATILE_P (op0)
20138 + && GET_MODE_BITSIZE (GET_MODE (op0)) != bitsize
20139 + && !targetm.narrow_volatile_bitfield ())
20140 && (! SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (op0))
20141 || (offset * BITS_PER_UNIT % bitsize == 0
20142 && MEM_ALIGN (op0) % bitsize == 0)))))
20143 Index: gcc-4.2.3/gcc/expr.c
20144 ===================================================================
20145 --- gcc-4.2.3.orig/gcc/expr.c 2008-01-22 20:39:39.000000000 +0100
20146 +++ gcc-4.2.3/gcc/expr.c 2008-05-21 13:45:54.330288217 +0200
20147 @@ -3549,18 +3549,19 @@
20151 + emit_move_insn (stack_pointer_rtx,
20152 + expand_binop (Pmode,
20153 #ifdef STACK_GROWS_DOWNWARD
20154 - /* ??? This seems wrong if STACK_PUSH_CODE == POST_DEC. */
20155 - dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
20156 - GEN_INT (-(HOST_WIDE_INT) rounded_size));
20159 - /* ??? This seems wrong if STACK_PUSH_CODE == POST_INC. */
20160 - dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
20161 - GEN_INT (rounded_size));
20164 - dest_addr = gen_rtx_PRE_MODIFY (Pmode, stack_pointer_rtx, dest_addr);
20165 + stack_pointer_rtx,
20166 + GEN_INT (rounded_size),
20167 + NULL_RTX, 0, OPTAB_LIB_WIDEN));
20168 + dest_addr = stack_pointer_rtx;
20172 dest = gen_rtx_MEM (mode, dest_addr);
20175 @@ -5539,7 +5540,16 @@
20176 is a bit field, we cannot use addressing to access it.
20177 Use bit-field techniques or SUBREG to store in it. */
20179 - if (mode == VOIDmode
20181 + /* NB! Added for AVR32, and I think this should be true for
20182 + all targets not using narrow volatile bitfields. If the
20183 + bitfield is volatile then we need to perform an access
20184 + consistent with the container type. */
20186 + && MEM_VOLATILE_P (target)
20187 + && GET_MODE_BITSIZE (GET_MODE (target)) > bitsize
20188 + && !targetm.narrow_volatile_bitfield ())
20189 + || mode == VOIDmode
20190 || (mode != BLKmode && ! direct_store[(int) mode]
20191 && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
20192 && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
20193 @@ -7590,7 +7600,16 @@
20194 by doing the extract into an object as wide as the field
20195 (which we know to be the width of a basic mode), then
20196 storing into memory, and changing the mode to BLKmode. */
20197 - if (mode1 == VOIDmode
20199 + /* NB! Added for AVR32, and I think this should be true for
20200 + all targets not using narrow volatile bitfields. If the
20201 + bitfield is volatile then we need to perform an access
20202 + consistent with the container type. */
20204 + && MEM_VOLATILE_P (op0)
20205 + && GET_MODE_BITSIZE (GET_MODE (op0)) > bitsize
20206 + && !targetm.narrow_volatile_bitfield ())
20207 + || mode1 == VOIDmode
20208 || REG_P (op0) || GET_CODE (op0) == SUBREG
20209 || (mode1 != BLKmode && ! direct_load[(int) mode1]
20210 && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
20211 Index: gcc-4.2.3/gcc/function.c
20212 ===================================================================
20213 --- gcc-4.2.3.orig/gcc/function.c 2007-09-01 17:28:30.000000000 +0200
20214 +++ gcc-4.2.3/gcc/function.c 2008-05-21 13:45:54.334287888 +0200
20215 @@ -2676,8 +2676,12 @@
20216 SET_DECL_RTL (parm, parmreg);
20218 /* Copy the value into the register. */
20219 - if (data->nominal_mode != data->passed_mode
20220 - || promoted_nominal_mode != data->promoted_mode)
20221 + if ( (data->nominal_mode != data->passed_mode
20222 + /* Added for AVR32: If passed_mode is equal
20223 + to promoted nominal mode why should be convert?
20224 + The conversion should make no difference. */
20225 + && data->passed_mode != promoted_nominal_mode)
20226 + || promoted_nominal_mode != data->promoted_mode)
20228 int save_tree_used;
20230 Index: gcc-4.2.3/gcc/genemit.c
20231 ===================================================================
20232 --- gcc-4.2.3.orig/gcc/genemit.c 2007-09-01 17:28:30.000000000 +0200
20233 +++ gcc-4.2.3/gcc/genemit.c 2008-05-21 13:45:54.342288908 +0200
20234 @@ -121,6 +121,24 @@
20238 +gen_vararg_prologue(int operands)
20242 + if (operands > 1)
20244 + for (i = 1; i < operands; i++)
20245 + printf(" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
20247 + printf(" va_list args;\n\n");
20248 + printf(" va_start(args, operand0);\n");
20249 + for (i = 1; i < operands; i++)
20250 + printf(" operand%d = va_arg(args, rtx);\n", i);
20251 + printf(" va_end(args);\n\n");
20256 print_code (RTX_CODE code)
20259 @@ -405,18 +423,16 @@
20260 fatal ("match_dup operand number has no match_operand");
20262 /* Output the function name and argument declarations. */
20263 - printf ("rtx\ngen_%s (", XSTR (insn, 0));
20264 + printf ("rtx\ngen_%s ", XSTR (insn, 0));
20267 - for (i = 0; i < operands; i++)
20269 - printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
20271 - printf ("rtx operand%d ATTRIBUTE_UNUSED", i);
20272 + printf("(rtx operand0 ATTRIBUTE_UNUSED, ...)\n");
20276 + printf("(void)\n");
20279 + gen_vararg_prologue(operands);
20281 /* Output code to construct and return the rtl for the instruction body. */
20283 if (XVECLEN (insn, 1) == 1)
20284 @@ -456,16 +472,12 @@
20285 operands = max_operand_vec (expand, 1);
20287 /* Output the function name and argument declarations. */
20288 - printf ("rtx\ngen_%s (", XSTR (expand, 0));
20289 + printf ("rtx\ngen_%s ", XSTR (expand, 0));
20291 - for (i = 0; i < operands; i++)
20293 - printf (",\n\trtx operand%d", i);
20295 - printf ("rtx operand%d", i);
20296 + printf("(rtx operand0 ATTRIBUTE_UNUSED, ...)\n");
20300 + printf("(void)\n");
20304 /* If we don't have any C code to write, only one insn is being written,
20305 @@ -475,6 +487,8 @@
20306 && operands > max_dup_opno
20307 && XVECLEN (expand, 1) == 1)
20309 + gen_vararg_prologue(operands);
20311 printf (" return ");
20312 gen_exp (XVECEXP (expand, 1, 0), DEFINE_EXPAND, NULL);
20313 printf (";\n}\n\n");
20314 @@ -488,6 +502,7 @@
20315 for (; i <= max_scratch_opno; i++)
20316 printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
20317 printf (" rtx _val = 0;\n");
20318 + gen_vararg_prologue(operands);
20319 printf (" start_sequence ();\n");
20321 /* The fourth operand of DEFINE_EXPAND is some code to be executed
20322 Index: gcc-4.2.3/gcc/genflags.c
20323 ===================================================================
20324 --- gcc-4.2.3.orig/gcc/genflags.c 2007-09-01 17:28:30.000000000 +0200
20325 +++ gcc-4.2.3/gcc/genflags.c 2008-05-21 13:45:54.346288020 +0200
20326 @@ -127,7 +127,6 @@
20327 gen_proto (rtx insn)
20329 int num = num_operands (insn);
20331 const char *name = XSTR (insn, 0);
20332 int truth = maybe_eval_c_test (XSTR (insn, 2));
20334 @@ -158,12 +157,7 @@
20336 fputs ("void", stdout);
20339 - for (i = 1; i < num; i++)
20340 - fputs ("rtx, ", stdout);
20342 - fputs ("rtx", stdout);
20344 + fputs("rtx, ...", stdout);
20348 @@ -173,12 +167,7 @@
20350 printf ("static inline rtx\ngen_%s", name);
20354 - for (i = 0; i < num-1; i++)
20355 - printf ("rtx ARG_UNUSED (%c), ", 'a' + i);
20356 - printf ("rtx ARG_UNUSED (%c))\n", 'a' + i);
20358 + puts("(rtx ARG_UNUSED(a), ...)");
20361 puts ("{\n return 0;\n}");
20362 Index: gcc-4.2.3/gcc/genoutput.c
20363 ===================================================================
20364 --- gcc-4.2.3.orig/gcc/genoutput.c 2007-09-01 17:28:30.000000000 +0200
20365 +++ gcc-4.2.3/gcc/genoutput.c 2008-05-21 13:45:54.354290436 +0200
20366 @@ -386,7 +386,7 @@
20369 if (d->name && d->name[0] != '*')
20370 - printf (" (insn_gen_fn) gen_%s,\n", d->name);
20371 + printf (" gen_%s,\n", d->name);
20375 Index: gcc-4.2.3/gcc/ifcvt.c
20376 ===================================================================
20377 --- gcc-4.2.3.orig/gcc/ifcvt.c 2007-10-30 05:32:06.000000000 +0100
20378 +++ gcc-4.2.3/gcc/ifcvt.c 2008-05-21 13:45:54.358287873 +0200
20379 @@ -1050,7 +1050,11 @@
20382 rtx cond = if_info->cond;
20383 - enum rtx_code code = reversed_comparison_code (cond, if_info->jump);
20384 + /* This generates wrong code for AVR32. The cond code need not be reversed
20385 + since the addmodecc patterns add if the condition is NOT met. */
20386 + /* enum rtx_code code = reversed_comparison_code (cond, if_info->jump);*/
20387 + enum rtx_code code = GET_CODE(cond);
20390 /* First try to use addcc pattern. */
20391 if (general_operand (XEXP (cond, 0), VOIDmode)
20392 Index: gcc-4.2.3/gcc/longlong.h
20393 ===================================================================
20394 --- gcc-4.2.3.orig/gcc/longlong.h 2007-09-01 17:28:30.000000000 +0200
20395 +++ gcc-4.2.3/gcc/longlong.h 2008-05-21 13:45:54.358287873 +0200
20396 @@ -226,6 +226,39 @@
20397 #define UDIV_TIME 100
20398 #endif /* __arm__ */
20400 +#if defined (__avr32__) && W_TYPE_SIZE == 32
20401 +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
20402 + __asm__ ("add\t%1, %4, %5\n\tadc\t%0, %2, %3" \
20403 + : "=r" ((USItype) (sh)), \
20404 + "=&r" ((USItype) (sl)) \
20405 + : "r" ((USItype) (ah)), \
20406 + "r" ((USItype) (bh)), \
20407 + "r" ((USItype) (al)), \
20408 + "r" ((USItype) (bl)) __CLOBBER_CC)
20409 +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
20410 + __asm__ ("sub\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
20411 + : "=r" ((USItype) (sh)), \
20412 + "=&r" ((USItype) (sl)) \
20413 + : "r" ((USItype) (ah)), \
20414 + "r" ((USItype) (bh)), \
20415 + "r" ((USItype) (al)), \
20416 + "r" ((USItype) (bl)) __CLOBBER_CC)
20418 +#define __umulsidi3(a,b) ((UDItype)(a) * (UDItype)(b))
20420 +#define umul_ppmm(w1, w0, u, v) \
20423 + __w.ll = __umulsidi3 (u, v); \
20424 + w1 = __w.s.high; \
20425 + w0 = __w.s.low; \
20428 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
20429 +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
20430 +#define COUNT_LEADING_ZEROS_0 32
20433 #if defined (__hppa) && W_TYPE_SIZE == 32
20434 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
20435 __asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \
20436 Index: gcc-4.2.3/gcc/optabs.h
20437 ===================================================================
20438 --- gcc-4.2.3.orig/gcc/optabs.h 2007-09-01 17:28:30.000000000 +0200
20439 +++ gcc-4.2.3/gcc/optabs.h 2008-05-21 13:45:54.358287873 +0200
20440 @@ -431,7 +431,7 @@
20441 extern GTY(()) optab code_to_optab[NUM_RTX_CODE + 1];
20444 -typedef rtx (*rtxfun) (rtx);
20445 +typedef rtx (*rtxfun) (rtx, ...);
20447 /* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
20448 gives the gen_function to make a branch to test that condition. */
20449 Index: gcc-4.2.3/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c
20450 ===================================================================
20451 --- gcc-4.2.3.orig/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c 2005-02-19 20:48:02.000000000 +0100
20452 +++ gcc-4.2.3/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c 2008-05-21 13:45:54.358287873 +0200
20454 -/* Test no newline at eof warning when Mac line ending is used*/
/* { dg-do compile } */
int main() { return 0; }
20455 \ No newline at end of file
20456 +/* Test no newline at eof warning when Mac line ending is used*/
20457 +/* { dg-do compile } */
20458 +int main() { return 0; }
20459 Index: gcc-4.2.3/gcc/testsuite/gcc.dg/sibcall-3.c
20460 ===================================================================
20461 --- gcc-4.2.3.orig/gcc/testsuite/gcc.dg/sibcall-3.c 2005-07-20 08:39:38.000000000 +0200
20462 +++ gcc-4.2.3/gcc/testsuite/gcc.dg/sibcall-3.c 2008-05-21 13:45:54.358287873 +0200
20464 Copyright (C) 2002 Free Software Foundation Inc.
20465 Contributed by Hans-Peter Nilsson <hp@bitrange.com> */
20467 -/* { dg-do run { xfail arc-*-* avr-*-* c4x-*-* cris-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* m681?-*-* m680*-*-* m68k-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
20468 +/* { dg-do run { xfail arc-*-* avr-*-* avr32-*-* c4x-*-* cris-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* m681?-*-* m680*-*-* m68k-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
20469 /* { dg-options "-O2 -foptimize-sibling-calls" } */
20471 /* The option -foptimize-sibling-calls is the default, but serves as
20472 Index: gcc-4.2.3/gcc/testsuite/gcc.dg/sibcall-4.c
20473 ===================================================================
20474 --- gcc-4.2.3.orig/gcc/testsuite/gcc.dg/sibcall-4.c 2005-07-20 08:39:38.000000000 +0200
20475 +++ gcc-4.2.3/gcc/testsuite/gcc.dg/sibcall-4.c 2008-05-21 13:45:54.362288662 +0200
20477 Copyright (C) 2002 Free Software Foundation Inc.
20478 Contributed by Hans-Peter Nilsson <hp@bitrange.com> */
20480 -/* { dg-do run { xfail arc-*-* avr-*-* c4x-*-* cris-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* m681?-*-* m680*-*-* m68k-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
20481 +/* { dg-do run { xfail arc-*-* avr-*-* avr32-*-* c4x-*-* cris-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* m681?-*-* m680*-*-* m68k-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
20482 /* { dg-options "-O2 -foptimize-sibling-calls" } */
20484 /* The option -foptimize-sibling-calls is the default, but serves as
20485 Index: gcc-4.2.3/gcc/testsuite/gcc.dg/trampoline-1.c
20486 ===================================================================
20487 --- gcc-4.2.3.orig/gcc/testsuite/gcc.dg/trampoline-1.c 2004-08-03 10:22:26.000000000 +0200
20488 +++ gcc-4.2.3/gcc/testsuite/gcc.dg/trampoline-1.c 2008-05-21 13:45:54.362288662 +0200
20493 +#ifndef NO_TRAMPOLINES
20498 Index: gcc-4.2.3/gcc/testsuite/gfortran.dg/char_pointer_assign.f90
20499 ===================================================================
20500 --- gcc-4.2.3.orig/gcc/testsuite/gfortran.dg/char_pointer_assign.f90 2005-05-29 18:03:43.000000000 +0200
20501 +++ gcc-4.2.3/gcc/testsuite/gfortran.dg/char_pointer_assign.f90 2008-05-21 13:45:54.362288662 +0200
20505 program char_pointer_assign
20506 ! Test character pointer assignments, required
20507 ! to fix PR18890 and PR21297
20509 character*4, target :: t2(4) =(/"lmno","lmno","lmno","lmno"/)
20510 character*4 :: const
20511 character*4, pointer :: c1, c3
20512 - character*4, pointer :: c2(:), c4(:)
20513 + character*4, pointer :: c2(:), c4(:)
20514 allocate (c3, c4(4))
20516 c3 = "lmno" ! pointer = constant
20517 @@ -24,13 +24,13 @@
20520 c4 = "lmno" ! pointer = constant
20521 - t2 = c4 ! target = pointer
20522 - c2 => t2 ! pointer =>target
20524 + t2 = c4 ! target = pointer
20525 + c2 => t2 ! pointer =>target
20527 const(2:3) ="nm" ! c2(:)(2:3) = "nm" is still broken
20529 c4 = c2 ! pointer = pointer
20532 const(1:1) ="o" ! c4(:)(1:1) = "o" is still broken
20533 const(4:4) ="l" ! c4(:)(4:4) = "l" is still broken
20535 Index: gcc-4.2.3/gcc/testsuite/g++.old-deja/g++.pt/static11.C
20536 ===================================================================
20537 --- gcc-4.2.3.orig/gcc/testsuite/g++.old-deja/g++.pt/static11.C 2006-02-22 10:05:07.000000000 +0100
20538 +++ gcc-4.2.3/gcc/testsuite/g++.old-deja/g++.pt/static11.C 2008-05-21 13:45:54.362288662 +0200
20540 // in their dejagnu baseboard description) require that the status is
20541 // final when exit is entered (or main returns), and not "overruled" by a
20542 // destructor calling _exit. It's not really worth it to handle that.
20543 -// { dg-do run { xfail mmix-knuth-mmixware xtensa-*-elf* arm*-*-elf arm*-*-eabi m68k-*-elf } }
20544 +// { dg-do run { xfail mmix-knuth-mmixware xtensa-*-elf* avr32-*-elf arm*-*-elf arm*-*-eabi m68k-*-elf } }
20546 // Bug: g++ was failing to destroy C<int>::a because it was using two
20547 // different sentry variables for construction and destruction.
20548 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/copying.txt
20549 ===================================================================
20550 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/copying.txt 2006-03-10 14:25:35.000000000 +0100
20551 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/copying.txt 2008-05-21 13:45:54.362288662 +0200
20553 -Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
20554 -All rights reserved.
20556 -Redistribution and use in source and binary forms, with or without
20557 -modification, are permitted provided that the following conditions are
20560 - Redistributions of source code must retain the above copyright
20561 - notice, this list of conditions and the following disclaimer.
20563 - Redistributions in binary form must reproduce the above copyright
20564 - notice, this list of conditions and the following disclaimer in
20565 - the documentation and/or other materials provided with the
20568 - Neither the names of the copyright holders nor the names of its
20569 - contributors may be used to endorse or promote products derived
20570 - from this software without specific prior written permission.
20572 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20573 -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20574 -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20575 -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
20576 -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20577 -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20578 -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20579 -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
20580 -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20581 -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20582 -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20583 +Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
20584 +All rights reserved.
20586 +Redistribution and use in source and binary forms, with or without
20587 +modification, are permitted provided that the following conditions are
20590 + Redistributions of source code must retain the above copyright
20591 + notice, this list of conditions and the following disclaimer.
20593 + Redistributions in binary form must reproduce the above copyright
20594 + notice, this list of conditions and the following disclaimer in
20595 + the documentation and/or other materials provided with the
20598 + Neither the names of the copyright holders nor the names of its
20599 + contributors may be used to endorse or promote products derived
20600 + from this software without specific prior written permission.
20602 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20603 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20604 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20605 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
20606 +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20607 +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20608 +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20609 +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
20610 +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20611 +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20612 +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20613 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java
20614 ===================================================================
20615 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java 2006-03-10 14:25:35.000000000 +0100
20616 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java 2008-05-21 13:45:54.362288662 +0200
20618 -package org.relaxng.datatype;
20621 - * Creates a user-defined type by adding parameters to
20622 - * the pre-defined type.
20624 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
20625 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
20627 -public interface DatatypeBuilder {
20630 - * Adds a new parameter.
20633 - * The name of the parameter to be added.
20634 - * @param strValue
20635 - * The raw value of the parameter. Caller may not normalize
20636 - * this value because any white space is potentially significant.
20638 - * The context information which can be used by the callee to
20639 - * acquire additional information. This context object is
20640 - * valid only during this method call. The callee may not
20641 - * keep a reference to this object.
20642 - * @exception DatatypeException
20643 - * When the given parameter is inappropriate for some reason.
20644 - * The callee is responsible to recover from this error.
20645 - * That is, the object should behave as if no such error
20648 - void addParameter( String name, String strValue, ValidationContext context )
20649 - throws DatatypeException;
20652 - * Derives a new Datatype from a Datatype by parameters that
20653 - * were already set through the addParameter method.
20655 - * @exception DatatypeException
20656 - * DatatypeException must be thrown if the derivation is
20657 - * somehow invalid. For example, a required parameter is missing,
20658 - * etc. The exception should contain a diagnosis message
20661 - Datatype createDatatype() throws DatatypeException;
20663 +package org.relaxng.datatype;
20666 + * Creates a user-defined type by adding parameters to
20667 + * the pre-defined type.
20669 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
20670 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
20672 +public interface DatatypeBuilder {
20675 + * Adds a new parameter.
20678 + * The name of the parameter to be added.
20679 + * @param strValue
20680 + * The raw value of the parameter. Caller may not normalize
20681 + * this value because any white space is potentially significant.
20683 + * The context information which can be used by the callee to
20684 + * acquire additional information. This context object is
20685 + * valid only during this method call. The callee may not
20686 + * keep a reference to this object.
20687 + * @exception DatatypeException
20688 + * When the given parameter is inappropriate for some reason.
20689 + * The callee is responsible to recover from this error.
20690 + * That is, the object should behave as if no such error
20693 + void addParameter( String name, String strValue, ValidationContext context )
20694 + throws DatatypeException;
20697 + * Derives a new Datatype from a Datatype by parameters that
20698 + * were already set through the addParameter method.
20700 + * @exception DatatypeException
20701 + * DatatypeException must be thrown if the derivation is
20702 + * somehow invalid. For example, a required parameter is missing,
20703 + * etc. The exception should contain a diagnosis message
20706 + Datatype createDatatype() throws DatatypeException;
20708 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java
20709 ===================================================================
20710 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java 2006-03-10 14:25:35.000000000 +0100
20711 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java 2008-05-21 13:45:54.366287774 +0200
20713 -package org.relaxng.datatype;
20716 - * Signals Datatype related exceptions.
20718 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
20719 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
20721 -public class DatatypeException extends Exception {
20723 - public DatatypeException( int index, String msg ) {
20725 - this.index = index;
20727 - public DatatypeException( String msg ) {
20728 - this(UNKNOWN,msg);
20731 - * A constructor for those datatype libraries which don't support any
20732 - * diagnostic information at all.
20734 - public DatatypeException() {
20735 - this(UNKNOWN,null);
20739 - private final int index;
20741 - public static final int UNKNOWN = -1;
20744 - * Gets the index of the content where the error occured.
20745 - * UNKNOWN can be returned to indicate that no index information
20748 - public int getIndex() {
20752 +package org.relaxng.datatype;
20755 + * Signals Datatype related exceptions.
20757 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
20758 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
20760 +public class DatatypeException extends Exception {
20762 + public DatatypeException( int index, String msg ) {
20764 + this.index = index;
20766 + public DatatypeException( String msg ) {
20767 + this(UNKNOWN,msg);
20770 + * A constructor for those datatype libraries which don't support any
20771 + * diagnostic information at all.
20773 + public DatatypeException() {
20774 + this(UNKNOWN,null);
20778 + private final int index;
20780 + public static final int UNKNOWN = -1;
20783 + * Gets the index of the content where the error occured.
20784 + * UNKNOWN can be returned to indicate that no index information
20787 + public int getIndex() {
20791 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java
20792 ===================================================================
20793 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java 2006-03-10 14:25:35.000000000 +0100
20794 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java 2008-05-21 13:45:54.366287774 +0200
20795 @@ -1,237 +1,237 @@
20796 -package org.relaxng.datatype;
20799 - * Datatype object.
20801 - * This object has the following functionality:
20804 - * <li> functionality to identify a class of character sequences. This is
20805 - * done through the isValid method.
20807 - * <li> functionality to produce a "value object" from a character sequence and
20808 - * context information.
20810 - * <li> functionality to test the equality of two value objects.
20813 - * This interface also defines the createStreamingValidator method,
20814 - * which is intended to efficiently support the validation of
20815 - * large character sequences.
20817 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
20818 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
20820 -public interface Datatype {
20823 - * Checks if the specified 'literal' matches this Datatype
20824 - * with respect to the current context.
20827 - * the lexical representation to be checked.
20829 - * If this datatype is context-dependent
20830 - * (i.e. the {@link #isContextDependent} method returns true),
20831 - * then the caller must provide a non-null valid context object.
20832 - * Otherwise, the caller can pass null.
20835 - * true if the 'literal' is a member of this Datatype;
20836 - * false if it's not a member of this Datatype.
20838 - boolean isValid( String literal, ValidationContext context );
20841 - * Similar to the isValid method but throws an exception with diagnosis
20842 - * in case of errors.
20845 - * If the specified 'literal' is a valid lexical representation for this
20846 - * datatype, then this method must return without throwing any exception.
20847 - * If not, the callee must throw an exception (with diagnosis message,
20851 - * The application can use this method to provide detailed error message
20852 - * to users. This method is kept separate from the isValid method to
20853 - * achieve higher performance during normal validation.
20855 - * @exception DatatypeException
20856 - * If the given literal is invalid, then this exception is thrown.
20857 - * If the callee supports error diagnosis, then the exception should
20858 - * contain a diagnosis message.
20860 - void checkValid( String literal, ValidationContext context )
20861 - throws DatatypeException;
20864 - * Creates an instance of a streaming validator for this type.
20867 - * By using streaming validators instead of the isValid method,
20868 - * the caller can avoid keeping the entire string, which is
20869 - * sometimes quite big, in memory.
20872 - * If this datatype is context-dependent
20873 - * (i.e. the {@link #isContextDependent} method returns true),
20874 - * then the caller must provide a non-null valid context object.
20875 - * Otherwise, the caller can pass null.
20876 - * The callee may keep a reference to this context object
20877 - * only while the returned streaming validator is being used.
20879 - DatatypeStreamingValidator createStreamingValidator( ValidationContext context );
20882 - * Converts lexcial value and the current context to the corresponding
20886 - * The caller cannot generally assume that the value object is
20887 - * a meaningful Java object. For example, the caller cannot expect
20888 - * this method to return <code>java.lang.Number</code> type for
20889 - * the "integer" type of XML Schema Part 2.
20892 - * Also, the caller cannot assume that the equals method and
20893 - * the hashCode method of the value object are consistent with
20894 - * the semantics of the datatype. For that purpose, the sameValue
20895 - * method and the valueHashCode method have to be used. Note that
20896 - * this means you cannot use classes like
20897 - * <code>java.util.Hashtable</code> to store the value objects.
20900 - * The returned value object should be used solely for the sameValue
20901 - * and valueHashCode methods.
20904 - * If this datatype is context-dependent
20905 - * (when the {@link #isContextDependent} method returns true),
20906 - * then the caller must provide a non-null valid context object.
20907 - * Otherwise, the caller can pass null.
20910 - * when the given lexical value is not a valid lexical
20911 - * value for this type.
20913 - Object createValue( String literal, ValidationContext context );
20916 - * Tests the equality of two value objects which were originally
20917 - * created by the createValue method of this object.
20919 - * The behavior is undefined if objects not created by this type
20920 - * are passed. It is the caller's responsibility to ensure that
20921 - * value objects belong to this type.
20924 - * true if two value objects are considered equal according to
20925 - * the definition of this datatype; false if otherwise.
20927 - boolean sameValue( Object value1, Object value2 );
20931 - * Computes the hash code for a value object,
20932 - * which is consistent with the sameValue method.
20935 - * hash code for the specified value object.
20937 - int valueHashCode( Object value );
20943 - * Indicates that the datatype doesn't have ID/IDREF semantics.
20945 - * This value is one of the possible return values of the
20946 - * {@link #getIdType} method.
20948 - public static final int ID_TYPE_NULL = 0;
20951 - * Indicates that RELAX NG compatibility processors should
20952 - * treat this datatype as having ID semantics.
20954 - * This value is one of the possible return values of the
20955 - * {@link #getIdType} method.
20957 - public static final int ID_TYPE_ID = 1;
20960 - * Indicates that RELAX NG compatibility processors should
20961 - * treat this datatype as having IDREF semantics.
20963 - * This value is one of the possible return values of the
20964 - * {@link #getIdType} method.
20966 - public static final int ID_TYPE_IDREF = 2;
20969 - * Indicates that RELAX NG compatibility processors should
20970 - * treat this datatype as having IDREFS semantics.
20972 - * This value is one of the possible return values of the
20973 - * {@link #getIdType} method.
20975 - public static final int ID_TYPE_IDREFS = 3;
20978 - * Checks if the ID/IDREF semantics is associated with this
20982 - * This method is introduced to support the RELAX NG DTD
20983 - * compatibility spec. (Of course it's always free to use
20984 - * this method for other purposes.)
20987 - * If you are implementing a datatype library and have no idea about
20988 - * the "RELAX NG DTD compatibility" thing, just return
20989 - * <code>ID_TYPE_NULL</code> is fine.
20992 - * If this datatype doesn't have any ID/IDREF semantics,
20993 - * it returns {@link #ID_TYPE_NULL}. If it has such a semantics
20994 - * (for example, XSD:ID, XSD:IDREF and comp:ID type), then
20995 - * it returns {@link #ID_TYPE_ID}, {@link #ID_TYPE_IDREF} or
20996 - * {@link #ID_TYPE_IDREFS}.
20998 - public int getIdType();
21002 - * Checks if this datatype may need a context object for
21003 - * the validation.
21006 - * The callee must return true even when the context
21007 - * is not always necessary. (For example, the "QName" type
21008 - * doesn't need a context object when validating unprefixed
21009 - * string. But nonetheless QName must return true.)
21012 - * XSD's <code>string</code> and <code>short</code> types
21013 - * are examples of context-independent datatypes.
21014 - * Its <code>QName</code> and <code>ENTITY</code> types
21015 - * are examples of context-dependent datatypes.
21018 - * When a datatype is context-independent, then
21019 - * the {@link #isValid} method, the {@link #checkValid} method,
21020 - * the {@link #createStreamingValidator} method and
21021 - * the {@link #createValue} method can be called without
21022 - * providing a context object.
21025 - * <b>true</b> if this datatype is context-dependent
21026 - * (it needs a context object sometimes);
21028 - * <b>false</b> if this datatype is context-<b>in</b>dependent
21029 - * (it never needs a context object).
21031 - public boolean isContextDependent();
21033 +package org.relaxng.datatype;
21036 + * Datatype object.
21038 + * This object has the following functionality:
21041 + * <li> functionality to identify a class of character sequences. This is
21042 + * done through the isValid method.
21044 + * <li> functionality to produce a "value object" from a character sequence and
21045 + * context information.
21047 + * <li> functionality to test the equality of two value objects.
21050 + * This interface also defines the createStreamingValidator method,
21051 + * which is intended to efficiently support the validation of
21052 + * large character sequences.
21054 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21055 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21057 +public interface Datatype {
21060 + * Checks if the specified 'literal' matches this Datatype
21061 + * with respect to the current context.
21064 + * the lexical representation to be checked.
21066 + * If this datatype is context-dependent
21067 + * (i.e. the {@link #isContextDependent} method returns true),
21068 + * then the caller must provide a non-null valid context object.
21069 + * Otherwise, the caller can pass null.
21072 + * true if the 'literal' is a member of this Datatype;
21073 + * false if it's not a member of this Datatype.
21075 + boolean isValid( String literal, ValidationContext context );
21078 + * Similar to the isValid method but throws an exception with diagnosis
21079 + * in case of errors.
21082 + * If the specified 'literal' is a valid lexical representation for this
21083 + * datatype, then this method must return without throwing any exception.
21084 + * If not, the callee must throw an exception (with diagnosis message,
21088 + * The application can use this method to provide detailed error message
21089 + * to users. This method is kept separate from the isValid method to
21090 + * achieve higher performance during normal validation.
21092 + * @exception DatatypeException
21093 + * If the given literal is invalid, then this exception is thrown.
21094 + * If the callee supports error diagnosis, then the exception should
21095 + * contain a diagnosis message.
21097 + void checkValid( String literal, ValidationContext context )
21098 + throws DatatypeException;
21101 + * Creates an instance of a streaming validator for this type.
21104 + * By using streaming validators instead of the isValid method,
21105 + * the caller can avoid keeping the entire string, which is
21106 + * sometimes quite big, in memory.
21109 + * If this datatype is context-dependent
21110 + * (i.e. the {@link #isContextDependent} method returns true),
21111 + * then the caller must provide a non-null valid context object.
21112 + * Otherwise, the caller can pass null.
21113 + * The callee may keep a reference to this context object
21114 + * only while the returned streaming validator is being used.
21116 + DatatypeStreamingValidator createStreamingValidator( ValidationContext context );
21119 + * Converts lexcial value and the current context to the corresponding
21123 + * The caller cannot generally assume that the value object is
21124 + * a meaningful Java object. For example, the caller cannot expect
21125 + * this method to return <code>java.lang.Number</code> type for
21126 + * the "integer" type of XML Schema Part 2.
21129 + * Also, the caller cannot assume that the equals method and
21130 + * the hashCode method of the value object are consistent with
21131 + * the semantics of the datatype. For that purpose, the sameValue
21132 + * method and the valueHashCode method have to be used. Note that
21133 + * this means you cannot use classes like
21134 + * <code>java.util.Hashtable</code> to store the value objects.
21137 + * The returned value object should be used solely for the sameValue
21138 + * and valueHashCode methods.
21141 + * If this datatype is context-dependent
21142 + * (when the {@link #isContextDependent} method returns true),
21143 + * then the caller must provide a non-null valid context object.
21144 + * Otherwise, the caller can pass null.
21147 + * when the given lexical value is not a valid lexical
21148 + * value for this type.
21150 + Object createValue( String literal, ValidationContext context );
21153 + * Tests the equality of two value objects which were originally
21154 + * created by the createValue method of this object.
21156 + * The behavior is undefined if objects not created by this type
21157 + * are passed. It is the caller's responsibility to ensure that
21158 + * value objects belong to this type.
21161 + * true if two value objects are considered equal according to
21162 + * the definition of this datatype; false if otherwise.
21164 + boolean sameValue( Object value1, Object value2 );
21168 + * Computes the hash code for a value object,
21169 + * which is consistent with the sameValue method.
21172 + * hash code for the specified value object.
21174 + int valueHashCode( Object value );
21180 + * Indicates that the datatype doesn't have ID/IDREF semantics.
21182 + * This value is one of the possible return values of the
21183 + * {@link #getIdType} method.
21185 + public static final int ID_TYPE_NULL = 0;
21188 + * Indicates that RELAX NG compatibility processors should
21189 + * treat this datatype as having ID semantics.
21191 + * This value is one of the possible return values of the
21192 + * {@link #getIdType} method.
21194 + public static final int ID_TYPE_ID = 1;
21197 + * Indicates that RELAX NG compatibility processors should
21198 + * treat this datatype as having IDREF semantics.
21200 + * This value is one of the possible return values of the
21201 + * {@link #getIdType} method.
21203 + public static final int ID_TYPE_IDREF = 2;
21206 + * Indicates that RELAX NG compatibility processors should
21207 + * treat this datatype as having IDREFS semantics.
21209 + * This value is one of the possible return values of the
21210 + * {@link #getIdType} method.
21212 + public static final int ID_TYPE_IDREFS = 3;
21215 + * Checks if the ID/IDREF semantics is associated with this
21219 + * This method is introduced to support the RELAX NG DTD
21220 + * compatibility spec. (Of course it's always free to use
21221 + * this method for other purposes.)
21224 + * If you are implementing a datatype library and have no idea about
21225 + * the "RELAX NG DTD compatibility" thing, just return
21226 + * <code>ID_TYPE_NULL</code> is fine.
21229 + * If this datatype doesn't have any ID/IDREF semantics,
21230 + * it returns {@link #ID_TYPE_NULL}. If it has such a semantics
21231 + * (for example, XSD:ID, XSD:IDREF and comp:ID type), then
21232 + * it returns {@link #ID_TYPE_ID}, {@link #ID_TYPE_IDREF} or
21233 + * {@link #ID_TYPE_IDREFS}.
21235 + public int getIdType();
21239 + * Checks if this datatype may need a context object for
21240 + * the validation.
21243 + * The callee must return true even when the context
21244 + * is not always necessary. (For example, the "QName" type
21245 + * doesn't need a context object when validating unprefixed
21246 + * string. But nonetheless QName must return true.)
21249 + * XSD's <code>string</code> and <code>short</code> types
21250 + * are examples of context-independent datatypes.
21251 + * Its <code>QName</code> and <code>ENTITY</code> types
21252 + * are examples of context-dependent datatypes.
21255 + * When a datatype is context-independent, then
21256 + * the {@link #isValid} method, the {@link #checkValid} method,
21257 + * the {@link #createStreamingValidator} method and
21258 + * the {@link #createValue} method can be called without
21259 + * providing a context object.
21262 + * <b>true</b> if this datatype is context-dependent
21263 + * (it needs a context object sometimes);
21265 + * <b>false</b> if this datatype is context-<b>in</b>dependent
21266 + * (it never needs a context object).
21268 + public boolean isContextDependent();
21270 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java
21271 ===================================================================
21272 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java 2006-03-10 14:25:35.000000000 +0100
21273 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java 2008-05-21 13:45:54.366287774 +0200
21275 -package org.relaxng.datatype;
21278 - * Factory class for the DatatypeLibrary class.
21281 - * The datatype library should provide the implementation of
21282 - * this interface if it wants to be found by the schema processors.
21283 - * The implementor also have to place a file in your jar file.
21284 - * See the reference datatype library implementation for detail.
21286 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21287 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21289 -public interface DatatypeLibraryFactory
21292 - * Creates a new instance of a DatatypeLibrary that supports
21293 - * the specified namespace URI.
21296 - * <code>null</code> if the specified namespace URI is not
21299 - DatatypeLibrary createDatatypeLibrary( String namespaceURI );
21301 +package org.relaxng.datatype;
21304 + * Factory class for the DatatypeLibrary class.
21307 + * The datatype library should provide the implementation of
21308 + * this interface if it wants to be found by the schema processors.
21309 + * The implementor also have to place a file in your jar file.
21310 + * See the reference datatype library implementation for detail.
21312 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21313 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21315 +public interface DatatypeLibraryFactory
21318 + * Creates a new instance of a DatatypeLibrary that supports
21319 + * the specified namespace URI.
21322 + * <code>null</code> if the specified namespace URI is not
21325 + DatatypeLibrary createDatatypeLibrary( String namespaceURI );
21327 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java
21328 ===================================================================
21329 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java 2006-03-10 14:25:35.000000000 +0100
21330 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java 2008-05-21 13:45:54.366287774 +0200
21332 -package org.relaxng.datatype;
21335 - * A Datatype library
21337 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21338 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21340 -public interface DatatypeLibrary {
21343 - * Creates a new instance of DatatypeBuilder.
21345 - * The callee should throw a DatatypeException in case of an error.
21347 - * @param baseTypeLocalName
21348 - * The local name of the base type.
21351 - * A non-null valid datatype object.
21353 - DatatypeBuilder createDatatypeBuilder( String baseTypeLocalName )
21354 - throws DatatypeException;
21357 - * Gets or creates a pre-defined type.
21359 - * This is just a short-cut of
21360 - * <code>createDatatypeBuilder(typeLocalName).createDatatype();</code>
21362 - * The callee should throw a DatatypeException in case of an error.
21365 - * A non-null valid datatype object.
21367 - Datatype createDatatype( String typeLocalName ) throws DatatypeException;
21369 +package org.relaxng.datatype;
21372 + * A Datatype library
21374 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21375 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21377 +public interface DatatypeLibrary {
21380 + * Creates a new instance of DatatypeBuilder.
21382 + * The callee should throw a DatatypeException in case of an error.
21384 + * @param baseTypeLocalName
21385 + * The local name of the base type.
21388 + * A non-null valid datatype object.
21390 + DatatypeBuilder createDatatypeBuilder( String baseTypeLocalName )
21391 + throws DatatypeException;
21394 + * Gets or creates a pre-defined type.
21396 + * This is just a short-cut of
21397 + * <code>createDatatypeBuilder(typeLocalName).createDatatype();</code>
21399 + * The callee should throw a DatatypeException in case of an error.
21402 + * A non-null valid datatype object.
21404 + Datatype createDatatype( String typeLocalName ) throws DatatypeException;
21406 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java
21407 ===================================================================
21408 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java 2006-03-10 14:25:35.000000000 +0100
21409 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java 2008-05-21 13:45:54.366287774 +0200
21411 -package org.relaxng.datatype;
21414 - * Datatype streaming validator.
21417 - * The streaming validator is an optional feature that is useful for
21418 - * certain Datatypes. It allows the caller to incrementally provide
21421 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21422 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21424 -public interface DatatypeStreamingValidator {
21427 - * Passes an additional fragment of the literal.
21430 - * The application can call this method several times, then call
21431 - * the isValid method (or the checkValid method) to check the validity
21432 - * of the accumulated characters.
21434 - void addCharacters( char[] buf, int start, int len );
21437 - * Tells if the accumulated literal is valid with respect to
21438 - * the underlying Datatype.
21441 - * True if it is valid. False if otherwise.
21443 - boolean isValid();
21446 - * Similar to the isValid method, but this method throws
21447 - * Exception (with possibly diagnostic information), instead of
21448 - * returning false.
21450 - * @exception DatatypeException
21451 - * If the callee supports the diagnosis and the accumulated
21452 - * literal is invalid, then this exception that possibly
21453 - * contains diagnosis information is thrown.
21455 - void checkValid() throws DatatypeException;
21457 +package org.relaxng.datatype;
21460 + * Datatype streaming validator.
21463 + * The streaming validator is an optional feature that is useful for
21464 + * certain Datatypes. It allows the caller to incrementally provide
21467 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
21468 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
21470 +public interface DatatypeStreamingValidator {
21473 + * Passes an additional fragment of the literal.
21476 + * The application can call this method several times, then call
21477 + * the isValid method (or the checkValid method) to check the validity
21478 + * of the accumulated characters.
21480 + void addCharacters( char[] buf, int start, int len );
21483 + * Tells if the accumulated literal is valid with respect to
21484 + * the underlying Datatype.
21487 + * True if it is valid. False if otherwise.
21489 + boolean isValid();
21492 + * Similar to the isValid method, but this method throws
21493 + * Exception (with possibly diagnostic information), instead of
21494 + * returning false.
21496 + * @exception DatatypeException
21497 + * If the callee supports the diagnosis and the accumulated
21498 + * literal is invalid, then this exception that possibly
21499 + * contains diagnosis information is thrown.
21501 + void checkValid() throws DatatypeException;
21503 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java
21504 ===================================================================
21505 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java 2006-03-10 14:25:35.000000000 +0100
21506 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java 2008-05-21 13:45:54.370287167 +0200
21507 @@ -1,262 +1,262 @@
21509 - * Copyright (c) 2001, Thai Open Source Software Center Ltd
21510 - * All rights reserved.
21512 - * Redistribution and use in source and binary forms, with or without
21513 - * modification, are permitted provided that the following conditions are
21516 - * Redistributions of source code must retain the above copyright
21517 - * notice, this list of conditions and the following disclaimer.
21519 - * Redistributions in binary form must reproduce the above copyright
21520 - * notice, this list of conditions and the following disclaimer in
21521 - * the documentation and/or other materials provided with the
21524 - * Neither the name of the Thai Open Source Software Center Ltd nor
21525 - * the names of its contributors may be used to endorse or promote
21526 - * products derived from this software without specific prior written
21529 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21530 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21531 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21532 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21533 - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21534 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21535 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21536 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21537 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21538 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21539 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21541 -package org.relaxng.datatype.helpers;
21543 -import org.relaxng.datatype.DatatypeLibraryFactory;
21544 -import org.relaxng.datatype.DatatypeLibrary;
21545 -import java.util.Enumeration;
21546 -import java.util.NoSuchElementException;
21547 -import java.util.Vector;
21548 -import java.io.Reader;
21549 -import java.io.InputStream;
21550 -import java.io.InputStreamReader;
21551 -import java.io.BufferedReader;
21552 -import java.io.IOException;
21553 -import java.io.UnsupportedEncodingException;
21554 -import java.net.URL;
21557 - * Discovers the datatype library implementation from the classpath.
21560 - * The call of the createDatatypeLibrary method finds an implementation
21561 - * from a given datatype library URI at run-time.
21563 -public class DatatypeLibraryLoader implements DatatypeLibraryFactory {
21564 - private final Service service = new Service(DatatypeLibraryFactory.class);
21566 - public DatatypeLibrary createDatatypeLibrary(String uri) {
21567 - for (Enumeration e = service.getProviders();
21568 - e.hasMoreElements();) {
21569 - DatatypeLibraryFactory factory
21570 - = (DatatypeLibraryFactory)e.nextElement();
21571 - DatatypeLibrary library = factory.createDatatypeLibrary(uri);
21572 - if (library != null)
21578 - private static class Service {
21579 - private final Class serviceClass;
21580 - private final Enumeration configFiles;
21581 - private Enumeration classNames = null;
21582 - private final Vector providers = new Vector();
21583 - private Loader loader;
21585 - private class ProviderEnumeration implements Enumeration {
21586 - private int nextIndex = 0;
21588 - public boolean hasMoreElements() {
21589 - return nextIndex < providers.size() || moreProviders();
21592 - public Object nextElement() {
21594 - return providers.elementAt(nextIndex++);
21596 - catch (ArrayIndexOutOfBoundsException e) {
21597 - throw new NoSuchElementException();
21602 - private static class Singleton implements Enumeration {
21603 - private Object obj;
21604 - private Singleton(Object obj) {
21608 - public boolean hasMoreElements() {
21609 - return obj != null;
21612 - public Object nextElement() {
21614 - throw new NoSuchElementException();
21615 - Object tem = obj;
21622 - private static class Loader {
21623 - Enumeration getResources(String resName) {
21624 - ClassLoader cl = Loader.class.getClassLoader();
21627 - url = ClassLoader.getSystemResource(resName);
21629 - url = cl.getResource(resName);
21630 - return new Singleton(url);
21633 - Class loadClass(String name) throws ClassNotFoundException {
21634 - return Class.forName(name);
21639 - private static class Loader2 extends Loader {
21640 - private ClassLoader cl;
21643 - cl = Loader2.class.getClassLoader();
21644 - // If the thread context class loader has the class loader
21645 - // of this class as an ancestor, use the thread context class
21646 - // loader. Otherwise, the thread context class loader
21647 - // probably hasn't been set up properly, so don't use it.
21648 - ClassLoader clt = Thread.currentThread().getContextClassLoader();
21649 - for (ClassLoader tem = clt; tem != null; tem = tem.getParent())
21656 - Enumeration getResources(String resName) {
21658 - return cl.getResources(resName);
21660 - catch (IOException e) {
21661 - return new Singleton(null);
21665 - Class loadClass(String name) throws ClassNotFoundException {
21666 - return Class.forName(name, true, cl);
21670 - public Service(Class cls) {
21672 - loader = new Loader2();
21674 - catch (NoSuchMethodError e) {
21675 - loader = new Loader();
21677 - serviceClass = cls;
21678 - String resName = "META-INF/services/" + serviceClass.getName();
21679 - configFiles = loader.getResources(resName);
21682 - public Enumeration getProviders() {
21683 - return new ProviderEnumeration();
21686 - synchronized private boolean moreProviders() {
21688 - while (classNames == null) {
21689 - if (!configFiles.hasMoreElements())
21691 - classNames = parseConfigFile((URL)configFiles.nextElement());
21693 - while (classNames.hasMoreElements()) {
21694 - String className = (String)classNames.nextElement();
21696 - Class cls = loader.loadClass(className);
21697 - Object obj = cls.newInstance();
21698 - if (serviceClass.isInstance(obj)) {
21699 - providers.addElement(obj);
21703 - catch (ClassNotFoundException e) { }
21704 - catch (InstantiationException e) { }
21705 - catch (IllegalAccessException e) { }
21706 - catch (LinkageError e) { }
21708 - classNames = null;
21712 - private static final int START = 0;
21713 - private static final int IN_NAME = 1;
21714 - private static final int IN_COMMENT = 2;
21716 - private static Enumeration parseConfigFile(URL url) {
21718 - InputStream in = url.openStream();
21721 - r = new InputStreamReader(in, "UTF-8");
21723 - catch (UnsupportedEncodingException e) {
21724 - r = new InputStreamReader(in, "UTF8");
21726 - r = new BufferedReader(r);
21727 - Vector tokens = new Vector();
21728 - StringBuffer tokenBuf = new StringBuffer();
21729 - int state = START;
21731 - int n = r.read();
21734 - char c = (char)n;
21744 - state = IN_COMMENT;
21747 - if (state != IN_COMMENT) {
21749 - tokenBuf.append(c);
21753 - if (tokenBuf.length() != 0 && state != IN_NAME) {
21754 - tokens.addElement(tokenBuf.toString());
21755 - tokenBuf.setLength(0);
21758 - if (tokenBuf.length() != 0)
21759 - tokens.addElement(tokenBuf.toString());
21760 - return tokens.elements();
21762 - catch (IOException e) {
21771 + * Copyright (c) 2001, Thai Open Source Software Center Ltd
21772 + * All rights reserved.
21774 + * Redistribution and use in source and binary forms, with or without
21775 + * modification, are permitted provided that the following conditions are
21778 + * Redistributions of source code must retain the above copyright
21779 + * notice, this list of conditions and the following disclaimer.
21781 + * Redistributions in binary form must reproduce the above copyright
21782 + * notice, this list of conditions and the following disclaimer in
21783 + * the documentation and/or other materials provided with the
21786 + * Neither the name of the Thai Open Source Software Center Ltd nor
21787 + * the names of its contributors may be used to endorse or promote
21788 + * products derived from this software without specific prior written
21791 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21792 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21793 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21794 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21795 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21796 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21797 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21798 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21799 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21800 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21801 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21803 +package org.relaxng.datatype.helpers;
21805 +import org.relaxng.datatype.DatatypeLibraryFactory;
21806 +import org.relaxng.datatype.DatatypeLibrary;
21807 +import java.util.Enumeration;
21808 +import java.util.NoSuchElementException;
21809 +import java.util.Vector;
21810 +import java.io.Reader;
21811 +import java.io.InputStream;
21812 +import java.io.InputStreamReader;
21813 +import java.io.BufferedReader;
21814 +import java.io.IOException;
21815 +import java.io.UnsupportedEncodingException;
21816 +import java.net.URL;
21819 + * Discovers the datatype library implementation from the classpath.
21822 + * The call of the createDatatypeLibrary method finds an implementation
21823 + * from a given datatype library URI at run-time.
21825 +public class DatatypeLibraryLoader implements DatatypeLibraryFactory {
21826 + private final Service service = new Service(DatatypeLibraryFactory.class);
21828 + public DatatypeLibrary createDatatypeLibrary(String uri) {
21829 + for (Enumeration e = service.getProviders();
21830 + e.hasMoreElements();) {
21831 + DatatypeLibraryFactory factory
21832 + = (DatatypeLibraryFactory)e.nextElement();
21833 + DatatypeLibrary library = factory.createDatatypeLibrary(uri);
21834 + if (library != null)
21840 + private static class Service {
21841 + private final Class serviceClass;
21842 + private final Enumeration configFiles;
21843 + private Enumeration classNames = null;
21844 + private final Vector providers = new Vector();
21845 + private Loader loader;
21847 + private class ProviderEnumeration implements Enumeration {
21848 + private int nextIndex = 0;
21850 + public boolean hasMoreElements() {
21851 + return nextIndex < providers.size() || moreProviders();
21854 + public Object nextElement() {
21856 + return providers.elementAt(nextIndex++);
21858 + catch (ArrayIndexOutOfBoundsException e) {
21859 + throw new NoSuchElementException();
21864 + private static class Singleton implements Enumeration {
21865 + private Object obj;
21866 + private Singleton(Object obj) {
21870 + public boolean hasMoreElements() {
21871 + return obj != null;
21874 + public Object nextElement() {
21876 + throw new NoSuchElementException();
21877 + Object tem = obj;
21884 + private static class Loader {
21885 + Enumeration getResources(String resName) {
21886 + ClassLoader cl = Loader.class.getClassLoader();
21889 + url = ClassLoader.getSystemResource(resName);
21891 + url = cl.getResource(resName);
21892 + return new Singleton(url);
21895 + Class loadClass(String name) throws ClassNotFoundException {
21896 + return Class.forName(name);
21901 + private static class Loader2 extends Loader {
21902 + private ClassLoader cl;
21905 + cl = Loader2.class.getClassLoader();
21906 + // If the thread context class loader has the class loader
21907 + // of this class as an ancestor, use the thread context class
21908 + // loader. Otherwise, the thread context class loader
21909 + // probably hasn't been set up properly, so don't use it.
21910 + ClassLoader clt = Thread.currentThread().getContextClassLoader();
21911 + for (ClassLoader tem = clt; tem != null; tem = tem.getParent())
21918 + Enumeration getResources(String resName) {
21920 + return cl.getResources(resName);
21922 + catch (IOException e) {
21923 + return new Singleton(null);
21927 + Class loadClass(String name) throws ClassNotFoundException {
21928 + return Class.forName(name, true, cl);
21932 + public Service(Class cls) {
21934 + loader = new Loader2();
21936 + catch (NoSuchMethodError e) {
21937 + loader = new Loader();
21939 + serviceClass = cls;
21940 + String resName = "META-INF/services/" + serviceClass.getName();
21941 + configFiles = loader.getResources(resName);
21944 + public Enumeration getProviders() {
21945 + return new ProviderEnumeration();
21948 + synchronized private boolean moreProviders() {
21950 + while (classNames == null) {
21951 + if (!configFiles.hasMoreElements())
21953 + classNames = parseConfigFile((URL)configFiles.nextElement());
21955 + while (classNames.hasMoreElements()) {
21956 + String className = (String)classNames.nextElement();
21958 + Class cls = loader.loadClass(className);
21959 + Object obj = cls.newInstance();
21960 + if (serviceClass.isInstance(obj)) {
21961 + providers.addElement(obj);
21965 + catch (ClassNotFoundException e) { }
21966 + catch (InstantiationException e) { }
21967 + catch (IllegalAccessException e) { }
21968 + catch (LinkageError e) { }
21970 + classNames = null;
21974 + private static final int START = 0;
21975 + private static final int IN_NAME = 1;
21976 + private static final int IN_COMMENT = 2;
21978 + private static Enumeration parseConfigFile(URL url) {
21980 + InputStream in = url.openStream();
21983 + r = new InputStreamReader(in, "UTF-8");
21985 + catch (UnsupportedEncodingException e) {
21986 + r = new InputStreamReader(in, "UTF8");
21988 + r = new BufferedReader(r);
21989 + Vector tokens = new Vector();
21990 + StringBuffer tokenBuf = new StringBuffer();
21991 + int state = START;
21993 + int n = r.read();
21996 + char c = (char)n;
22006 + state = IN_COMMENT;
22009 + if (state != IN_COMMENT) {
22011 + tokenBuf.append(c);
22015 + if (tokenBuf.length() != 0 && state != IN_NAME) {
22016 + tokens.addElement(tokenBuf.toString());
22017 + tokenBuf.setLength(0);
22020 + if (tokenBuf.length() != 0)
22021 + tokens.addElement(tokenBuf.toString());
22022 + return tokens.elements();
22024 + catch (IOException e) {
22032 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java
22033 ===================================================================
22034 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java 2006-03-10 14:25:35.000000000 +0100
22035 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java 2008-05-21 13:45:54.370287167 +0200
22037 -package org.relaxng.datatype.helpers;
22039 -import org.relaxng.datatype.*;
22042 - * Dummy implementation of {@link DatatypeBuilder}.
22044 - * This implementation can be used for Datatypes which have no parameters.
22045 - * Any attempt to add parameters will be rejected.
22048 - * Typical usage would be:
22050 - * class MyDatatypeLibrary implements DatatypeLibrary {
22052 - * DatatypeBuilder createDatatypeBuilder( String typeName ) {
22053 - * return new ParameterleessDatatypeBuilder(createDatatype(typeName));
22059 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
22061 -public final class ParameterlessDatatypeBuilder implements DatatypeBuilder {
22063 - /** This type object is returned for the derive method. */
22064 - private final Datatype baseType;
22066 - public ParameterlessDatatypeBuilder( Datatype baseType ) {
22067 - this.baseType = baseType;
22070 - public void addParameter( String name, String strValue, ValidationContext context )
22071 - throws DatatypeException {
22072 - throw new DatatypeException();
22075 - public Datatype createDatatype() throws DatatypeException {
22079 +package org.relaxng.datatype.helpers;
22081 +import org.relaxng.datatype.*;
22084 + * Dummy implementation of {@link DatatypeBuilder}.
22086 + * This implementation can be used for Datatypes which have no parameters.
22087 + * Any attempt to add parameters will be rejected.
22090 + * Typical usage would be:
22092 + * class MyDatatypeLibrary implements DatatypeLibrary {
22094 + * DatatypeBuilder createDatatypeBuilder( String typeName ) {
22095 + * return new ParameterleessDatatypeBuilder(createDatatype(typeName));
22101 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
22103 +public final class ParameterlessDatatypeBuilder implements DatatypeBuilder {
22105 + /** This type object is returned for the derive method. */
22106 + private final Datatype baseType;
22108 + public ParameterlessDatatypeBuilder( Datatype baseType ) {
22109 + this.baseType = baseType;
22112 + public void addParameter( String name, String strValue, ValidationContext context )
22113 + throws DatatypeException {
22114 + throw new DatatypeException();
22117 + public Datatype createDatatype() throws DatatypeException {
22121 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java
22122 ===================================================================
22123 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java 2006-03-10 14:25:35.000000000 +0100
22124 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java 2008-05-21 13:45:54.370287167 +0200
22126 -package org.relaxng.datatype.helpers;
22128 -import org.relaxng.datatype.*;
22131 - * Dummy implementation of {@link DatatypeStreamingValidator}.
22134 - * This implementation can be used as a quick hack when the performance
22135 - * of streaming validation is not important. And this implementation
22136 - * also shows you how to implement the DatatypeStreamingValidator interface.
22139 - * Typical usage would be:
22141 - * class MyDatatype implements Datatype {
22143 - * public DatatypeStreamingValidator createStreamingValidator( ValidationContext context ) {
22144 - * return new StreamingValidatorImpl(this,context);
22150 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
22152 -public final class StreamingValidatorImpl implements DatatypeStreamingValidator {
22154 - /** This buffer accumulates characters. */
22155 - private final StringBuffer buffer = new StringBuffer();
22157 - /** Datatype obejct that creates this streaming validator. */
22158 - private final Datatype baseType;
22160 - /** The current context. */
22161 - private final ValidationContext context;
22163 - public void addCharacters( char[] buf, int start, int len ) {
22164 - // append characters to the current buffer.
22165 - buffer.append(buf,start,len);
22168 - public boolean isValid() {
22169 - return baseType.isValid(buffer.toString(),context);
22172 - public void checkValid() throws DatatypeException {
22173 - baseType.checkValid(buffer.toString(),context);
22176 - public StreamingValidatorImpl( Datatype baseType, ValidationContext context ) {
22177 - this.baseType = baseType;
22178 - this.context = context;
22181 +package org.relaxng.datatype.helpers;
22183 +import org.relaxng.datatype.*;
22186 + * Dummy implementation of {@link DatatypeStreamingValidator}.
22189 + * This implementation can be used as a quick hack when the performance
22190 + * of streaming validation is not important. And this implementation
22191 + * also shows you how to implement the DatatypeStreamingValidator interface.
22194 + * Typical usage would be:
22196 + * class MyDatatype implements Datatype {
22198 + * public DatatypeStreamingValidator createStreamingValidator( ValidationContext context ) {
22199 + * return new StreamingValidatorImpl(this,context);
22205 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
22207 +public final class StreamingValidatorImpl implements DatatypeStreamingValidator {
22209 + /** This buffer accumulates characters. */
22210 + private final StringBuffer buffer = new StringBuffer();
22212 + /** Datatype obejct that creates this streaming validator. */
22213 + private final Datatype baseType;
22215 + /** The current context. */
22216 + private final ValidationContext context;
22218 + public void addCharacters( char[] buf, int start, int len ) {
22219 + // append characters to the current buffer.
22220 + buffer.append(buf,start,len);
22223 + public boolean isValid() {
22224 + return baseType.isValid(buffer.toString(),context);
22227 + public void checkValid() throws DatatypeException {
22228 + baseType.checkValid(buffer.toString(),context);
22231 + public StreamingValidatorImpl( Datatype baseType, ValidationContext context ) {
22232 + this.baseType = baseType;
22233 + this.context = context;
22236 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java
22237 ===================================================================
22238 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java 2006-03-10 14:25:35.000000000 +0100
22239 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java 2008-05-21 13:45:54.370287167 +0200
22241 -package org.relaxng.datatype;
22244 - * An interface that must be implemented by caller to
22245 - * provide context information that is necessary to
22246 - * perform validation of some Datatypes.
22248 - * @author <a href="mailto:jjc@jclark.com">James Clark</a>
22249 - * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
22251 -public interface ValidationContext {
22254 - * Resolves a namespace prefix to the corresponding namespace URI.
22256 - * This method is used for validating the QName type, for example.
22259 - * If the prefix is "" (empty string), it indicates
22260 - * an unprefixed value. The callee
22261 - * should resolve it as for an unprefixed
22262 - * element, rather than for an unprefixed attribute.
22265 - * If the prefix is "xml", then the callee must resolve
22266 - * this prefix into "http://www.w3.org/XML/1998/namespace",
22267 - * as defined in the XML Namespaces Recommendation.
22270 - * namespace URI of this prefix.
22271 - * If the specified prefix is not declared,
22272 - * the implementation must return null.
22274 - String resolveNamespacePrefix( String prefix );
22277 - * Returns the base URI of the context. The null string may be returned
22278 - * if no base URI is known.
22280 - String getBaseUri();
22283 - * Checks if an unparsed entity is declared with the
22284 - * specified name.
22288 - * if the DTD has an unparsed entity declaration for
22289 - * the specified name.
22293 - boolean isUnparsedEntity( String entityName );
22296 - * Checks if a notation is declared with the
22297 - * specified name.
22301 - * if the DTD has a notation declaration for the specified name.
22305 - boolean isNotation( String notationName );
22307 +package org.relaxng.datatype;
22310 + * An interface that must be implemented by caller to
22311 + * provide context information that is necessary to
22312 + * perform validation of some Datatypes.
22314 + * @author <a href="mailto:jjc@jclark.com">James Clark</a>
22315 + * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
22317 +public interface ValidationContext {
22320 + * Resolves a namespace prefix to the corresponding namespace URI.
22322 + * This method is used for validating the QName type, for example.
22325 + * If the prefix is "" (empty string), it indicates
22326 + * an unprefixed value. The callee
22327 + * should resolve it as for an unprefixed
22328 + * element, rather than for an unprefixed attribute.
22331 + * If the prefix is "xml", then the callee must resolve
22332 + * this prefix into "http://www.w3.org/XML/1998/namespace",
22333 + * as defined in the XML Namespaces Recommendation.
22336 + * namespace URI of this prefix.
22337 + * If the specified prefix is not declared,
22338 + * the implementation must return null.
22340 + String resolveNamespacePrefix( String prefix );
22343 + * Returns the base URI of the context. The null string may be returned
22344 + * if no base URI is known.
22346 + String getBaseUri();
22349 + * Checks if an unparsed entity is declared with the
22350 + * specified name.
22354 + * if the DTD has an unparsed entity declaration for
22355 + * the specified name.
22359 + boolean isUnparsedEntity( String entityName );
22362 + * Checks if a notation is declared with the
22363 + * specified name.
22367 + * if the DTD has a notation declaration for the specified name.
22371 + boolean isNotation( String notationName );
22373 Index: gcc-4.2.3/libjava/classpath/external/relaxngDatatype/README.txt
22374 ===================================================================
22375 --- gcc-4.2.3.orig/libjava/classpath/external/relaxngDatatype/README.txt 2006-03-10 14:25:35.000000000 +0100
22376 +++ gcc-4.2.3/libjava/classpath/external/relaxngDatatype/README.txt 2008-05-21 13:45:54.370287167 +0200
22378 -======================================================================
22379 - README FILE FOR DATATYPE INTERFACES FOR RELAX NG
22380 -======================================================================
22384 -RELAX NG supports multiple datatype vocabularies. To achive this, an
22385 -interface between datatype vocabularies and schema processors is
22386 -necessary. This interface is intended to be a standard Java interface
22390 -----------------------------------------------------------------------
22392 -----------------------------------------------------------------------
22396 -Note: this license is the BSD license.
22400 -----------------------------------------------------------------------
22402 -----------------------------------------------------------------------
22404 -If you are planning to implement a datatype library, A sample datatype
22405 -library implementation by James Clark is available at [1], which
22406 -comes with documentation and source code.
22408 -If you are planning to implement a schema processor, then don't forget
22409 -to check out org.relaxng.datatype.helpers.DatatypeLibraryLoader, as
22410 -this allows you to dynamically locate datatype implementations.
22413 -----------------------------------------------------------------------
22415 -----------------------------------------------------------------------
22417 -* OASIS RELAX NG TC
22418 - http://www.oasis-open.org/committees/relax-ng/
22420 - http://www.xml.gr.jp/relax/
22423 -----------------------------------------------------------------------
22425 -----------------------------------------------------------------------
22426 -[1] Sample datatype library implementation by James Clark
22427 - http://www.thaiopensource.com/relaxng/datatype-sample.zip
22429 -Document written by Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
22430 -======================================================================
22432 +======================================================================
22433 + README FILE FOR DATATYPE INTERFACES FOR RELAX NG
22434 +======================================================================
22438 +RELAX NG supports multiple datatype vocabularies. To achive this, an
22439 +interface between datatype vocabularies and schema processors is
22440 +necessary. This interface is intended to be a standard Java interface
22444 +----------------------------------------------------------------------
22446 +----------------------------------------------------------------------
22450 +Note: this license is the BSD license.
22454 +----------------------------------------------------------------------
22456 +----------------------------------------------------------------------
22458 +If you are planning to implement a datatype library, A sample datatype
22459 +library implementation by James Clark is available at [1], which
22460 +comes with documentation and source code.
22462 +If you are planning to implement a schema processor, then don't forget
22463 +to check out org.relaxng.datatype.helpers.DatatypeLibraryLoader, as
22464 +this allows you to dynamically locate datatype implementations.
22467 +----------------------------------------------------------------------
22469 +----------------------------------------------------------------------
22471 +* OASIS RELAX NG TC
22472 + http://www.oasis-open.org/committees/relax-ng/
22474 + http://www.xml.gr.jp/relax/
22477 +----------------------------------------------------------------------
22479 +----------------------------------------------------------------------
22480 +[1] Sample datatype library implementation by James Clark
22481 + http://www.thaiopensource.com/relaxng/datatype-sample.zip
22483 +Document written by Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
22484 +======================================================================
22486 Index: gcc-4.2.3/libstdc++-v3/config/os/gnu-linux/ctype_base.h
22487 ===================================================================
22488 --- gcc-4.2.3.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2006-12-01 13:56:23.000000000 +0100
22489 +++ gcc-4.2.3/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2008-05-21 13:45:54.370287167 +0200
22492 // ISO C++ 14882: 22.1 Locales
22494 +#include <features.h>
22495 +#include <ctype.h>
22497 /** @file ctype_base.h
22498 * This is an internal header file, included by other library headers.
22502 // Non-standard typedefs.
22503 - typedef const int* __to_type;
22506 + typedef const __ctype_touplow_t* __to_type;
22508 + typedef const int* __to_type;
22511 // NB: Offsets into ctype<char>::_M_table force a particular size
22512 // on the mask type. Because of this, we don't use an enum.
22513 typedef unsigned short mask;
22514 Index: gcc-4.2.3/libstdc++-v3/include/Makefile.in
22515 ===================================================================
22516 --- gcc-4.2.3.orig/libstdc++-v3/include/Makefile.in 2007-07-05 13:46:00.000000000 +0200
22517 +++ gcc-4.2.3/libstdc++-v3/include/Makefile.in 2008-05-21 13:45:54.374287956 +0200
22519 build_triplet = @build@
22520 host_triplet = @host@
22521 target_triplet = @target@
22523 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
22524 $(top_srcdir)/fragment.am
22526 Index: gcc-4.2.3/libstdc++-v3/libmath/Makefile.in
22527 ===================================================================
22528 --- gcc-4.2.3.orig/libstdc++-v3/libmath/Makefile.in 2006-10-16 21:08:22.000000000 +0200
22529 +++ gcc-4.2.3/libstdc++-v3/libmath/Makefile.in 2008-05-21 13:45:54.374287956 +0200
22531 build_triplet = @build@
22532 host_triplet = @host@
22533 target_triplet = @target@
22536 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
22537 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
22538 Index: gcc-4.2.3/libstdc++-v3/libsupc++/Makefile.in
22539 ===================================================================
22540 --- gcc-4.2.3.orig/libstdc++-v3/libsupc++/Makefile.in 2006-10-16 21:08:22.000000000 +0200
22541 +++ gcc-4.2.3/libstdc++-v3/libsupc++/Makefile.in 2008-05-21 13:45:54.374287956 +0200
22543 build_triplet = @build@
22544 host_triplet = @host@
22545 target_triplet = @target@
22547 DIST_COMMON = $(glibcxxinstall_HEADERS) $(srcdir)/Makefile.am \
22548 $(srcdir)/Makefile.in $(top_srcdir)/fragment.am
22550 Index: gcc-4.2.3/libstdc++-v3/Makefile.in
22551 ===================================================================
22552 --- gcc-4.2.3.orig/libstdc++-v3/Makefile.in 2006-10-16 21:08:22.000000000 +0200
22553 +++ gcc-4.2.3/libstdc++-v3/Makefile.in 2008-05-21 13:45:54.374287956 +0200
22555 build_triplet = @build@
22556 host_triplet = @host@
22557 target_triplet = @target@
22559 DIST_COMMON = README $(am__configure_deps) $(srcdir)/../config.guess \
22560 $(srcdir)/../config.sub $(srcdir)/../install-sh \
22561 $(srcdir)/../ltmain.sh $(srcdir)/../missing \
22562 Index: gcc-4.2.3/libstdc++-v3/po/Makefile.in
22563 ===================================================================
22564 --- gcc-4.2.3.orig/libstdc++-v3/po/Makefile.in 2006-10-16 21:08:22.000000000 +0200
22565 +++ gcc-4.2.3/libstdc++-v3/po/Makefile.in 2008-05-21 13:45:54.378287906 +0200
22567 build_triplet = @build@
22568 host_triplet = @host@
22569 target_triplet = @target@
22571 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
22572 $(top_srcdir)/fragment.am
22574 Index: gcc-4.2.3/libstdc++-v3/src/Makefile.in
22575 ===================================================================
22576 --- gcc-4.2.3.orig/libstdc++-v3/src/Makefile.in 2008-05-21 13:45:47.465287535 +0200
22577 +++ gcc-4.2.3/libstdc++-v3/src/Makefile.in 2008-05-21 13:45:54.378287906 +0200
22579 build_triplet = @build@
22580 host_triplet = @host@
22581 target_triplet = @target@
22583 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
22584 $(top_srcdir)/fragment.am
22586 Index: gcc-4.2.3/libstdc++-v3/acinclude.m4
22587 ===================================================================
22588 --- gcc-4.2.3.orig/libstdc++-v3/acinclude.m4 2008-05-21 13:45:43.925289703 +0200
22589 +++ gcc-4.2.3/libstdc++-v3/acinclude.m4 2008-05-21 13:45:54.378287906 +0200
22590 @@ -1392,8 +1392,8 @@
22594 - const char __one[] = "Äuglein Augmen";
22595 - const char __two[] = "Äuglein";
22596 + const char __one[] = "Äuglein Augmen";
22597 + const char __two[] = "Äuglein";