+2001-12-02 Zack Weinberg <zack@codesourcery.com>
+
+ * config/rs6000/rs6000.h (MASK_ALTIVEC_ABI,
+ MASK_LONG_DOUBLE_128): Delete.
+ (MASK_AIX_STRUCT_RET, MASK_AIX_STRUCT_RET_SET,
+ TARGET_AIX_STRUCT_RET): New flags.
+ (TARGET_SWITCHES): Remove entries for -mlong-double-128 and
+ -mlong-double-64. Add entries for -m(no-)aix-struct-return
+ and -m(no-)svr4-struct-return.
+ (TARGET_OPTIONS): Add entry for -mlong-double-.
+ (rs6000_long_double_size_string, rs6000_long_double_type_size,
+ rs6000_altivec_abi): Declare.
+ (TARGET_LONG_DOUBLE_128, TARGET_ALTIVEC_ABI,
+ LONG_DOUBLE_TYPE_SIZE): Change definitions to match.
+ (RETURN_IN_MEMORY): If !TARGET_AIX_STRUCT_RET, return
+ structures of size <= 8 bytes in registers.
+ (PRINT_OPERAND_PUNCT_VALID_P): Take out '$' and '*'.
+
+ * config/rs6000/rs6000.c (rs6000_long_double_size_string,
+ rs6000_long_double_type_size, rs6000_altivec_abi): New
+ globals.
+ (rs6000_override_options): Set rs6000_long_double_type_size
+ from rs6000_long_double_size_string, if nonzero. Set the
+ MASK_AIX_STRUCT_RET bit in target_flags from DEFAULT_ABI, if
+ not already set.
+ (rs6000_parse_abi_options): Set rs6000_altivec_abi, not a
+ target_flags bit.
+ (rs6000_init_builtins): This hook now takes no arguments.
+
+ * config/rs6000/netbsd.h, config/rs6000/linux.h: Define
+ DRAFT_V4_STRUCT_RET to 1.
+
2001-12-03 Joseph S. Myers <jsm28@cam.ac.uk>
* c-typeck.c (really_start_incremental_init, push_init_level):
* emit-rtl.c (component_ref_for_mem_expr): New.
(set_mem_attributes): Use it.
(set_mem_offset): New.
- * expr.c (expand_assignment): Call set_mem_attributes for
+ * expr.c (expand_assignment): Call set_mem_attributes for
inner references; adjust the memory offset as needed.
* print-rtl.c (print_mem_expr): New.
(print_rtx): Use it.
2001-11-30 Daniel Berlin <dan@cgsoftware.com>
- * config/rs6000/rs6000.c (altivec_expand_builtin): add
- ALTIVEC_BUILTIN_LD_INTERNAL_4sf and ALTIVEC_BUILTIN_ST_INTERNAL_4sf,
+ * config/rs6000/rs6000.c (altivec_expand_builtin): add
+ ALTIVEC_BUILTIN_LD_INTERNAL_4sf and ALTIVEC_BUILTIN_ST_INTERNAL_4sf,
*_16qi,_8hi, rename existing V4SI ones to *_4si.
(altivec_init_builtins): Ditto.
(bdesc_2arg): Rename CODE_FOR_* to match changes in MD file.
-
+
* config/rs6000/rs6000.md: Add attribute types vecsimple,
- veccomplex, vecfloat, and vecperm, for altivec instructions.
+ veccomplex, vecfloat, and vecperm, for altivec instructions.
Modify altivec patterns to use approriate attribute type.
Modify altivec patterns to match RTL operations where approriate
(IE no unspec where we can avoid it).
Add vector unit scheduling for ppc7450.
- Rename patterns to what they are where approriate
+ Rename patterns to what they are where approriate
(altivec_vaddfp->addv4sf3, etc)
* config/rs6000/rs6000.h (enum rs6000_builtins): Change VRS->VSR.
* config/rs6000/sysv4.h: Add -mcpu=7450.
- * testsuite/gcc.dg/altivec-1.c: Update test to take into account renamed
+ * testsuite/gcc.dg/altivec-1.c: Update test to take into account renamed
_builtin_altivec_ld_interal function.
2001-11-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
2001-11-30 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/rs6000.h (STARTING_FRAME_OFFSET): Adjust for altivec.
- (STACK_DYNAMIC_OFFSET): Same.
+ (STACK_DYNAMIC_OFFSET): Same.
2001-11-30 Richard Henderson <rth@redhat.com>
2001-11-30 Aldy Hernandez <aldyh@redhat.com>
- * config/rs6000/rs6000.h (CALL_REALLY_USED_REGISTERS): New.
- (CONDITIONAL_REGISTER_USAGE): Set call_really_used_registers to
- the values in call_used_registers.
+ * config/rs6000/rs6000.h (CALL_REALLY_USED_REGISTERS): New.
+ (CONDITIONAL_REGISTER_USAGE): Set call_really_used_registers to
+ the values in call_used_registers.
Fri Nov 30 12:48:26 2001 Jeffrey A Law (law@cygnus.com)
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
+/* For backward compatibility, we must continue to use the AIX
+ structure return convention. */
+#undef DRAFT_V4_STRUCT_RET
+#define DRAFT_V4_STRUCT_RET 1
+
/* Do code reading to identify a signal frame, and set the frame
state data appropriately. See unwind-dw2.c for the structs. */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (PowerPC NetBSD/ELF)");
+
+/* For backward compatibility, we must continue to use the AIX
+ structure return convention. */
+#undef DRAFT_V4_STRUCT_RET
+#define DRAFT_V4_STRUCT_RET 1
{ (const char *)0, "-mtune=", 1, 0 },
};
+/* Size of long double */
+const char *rs6000_long_double_size_string;
+int rs6000_long_double_type_size;
+
+/* Whether -mabi=altivec has appeared */
+int rs6000_altivec_abi;
+
/* Set to non-zero once AIX common-mode calls have been defined. */
static int common_mode_defined;
static int rs6000_adjust_priority PARAMS ((rtx, int));
static int rs6000_issue_rate PARAMS ((void));
-static void rs6000_init_builtins PARAMS ((tree));
+static void rs6000_init_builtins PARAMS ((void));
static void altivec_init_builtins PARAMS ((void));
static rtx rs6000_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
static rtx altivec_expand_builtin PARAMS ((tree, rtx));
error ("Unknown -mdebug-%s switch", rs6000_debug_name);
}
+ /* Set size of long double */
+ rs6000_long_double_type_size = 64;
+ if (rs6000_long_double_size_string)
+ {
+ char *tail;
+ int size = strtol (rs6000_long_double_size_string, &tail, 10);
+ if (*tail != '\0' || (size != 64 && size != 128))
+ error ("Unknown switch -mlong-double-%s",
+ rs6000_long_double_size_string);
+ else
+ rs6000_long_double_type_size = size;
+ }
+
/* Handle -mabi= options. */
rs6000_parse_abi_options ();
SUBTARGET_OVERRIDE_OPTIONS;
#endif
+ /* Set TARGET_AIX_STRUCT_RET last, after the ABI is determined.
+ If -maix-struct-return or -msvr4-struct-return was explicitly
+ used, don't override with the ABI default. */
+ if (!(target_flags & MASK_AIX_STRUCT_RET_SET))
+ {
+ if (DEFAULT_ABI == ABI_V4 && !DRAFT_V4_STRUCT_RET)
+ target_flags = (target_flags & ~MASK_AIX_STRUCT_RET);
+ else
+ target_flags |= MASK_AIX_STRUCT_RET;
+ }
+
/* Register global variables with the garbage collector. */
rs6000_add_gc_roots ();
if (rs6000_abi_string == 0)
return;
else if (! strcmp (rs6000_abi_string, "altivec"))
- target_flags |= MASK_ALTIVEC_ABI;
+ rs6000_altivec_abi = 1;
else
error ("Unknown ABI specified: '%s'", rs6000_abi_string);
}
}
static void
-rs6000_init_builtins (list_node)
- tree list_node ATTRIBUTE_UNUSED;
+rs6000_init_builtins ()
{
if (TARGET_ALTIVEC)
altivec_init_builtins ();
/* Use AltiVec instructions. */
#define MASK_ALTIVEC 0x00080000
-/* Enhance the current ABI with AltiVec extensions. */
-#define MASK_ALTIVEC_ABI 0x00100000
+/* Return small structures in memory (as the AIX ABI requires). */
+#define MASK_AIX_STRUCT_RET 0x00100000
+#define MASK_AIX_STRUCT_RET_SET 0x00200000
-/* Use 128-bit long double. */
-#define MASK_LONG_DOUBLE_128 0x00200000
+/* The only remaining free bit is 0x00400000. sysv4.h uses
+ 0x00800000 -> 0x40000000, and 0x80000000 is not available
+ because target_flags is signed. */
#define TARGET_POWER (target_flags & MASK_POWER)
#define TARGET_POWER2 (target_flags & MASK_POWER2)
#define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)
#define TARGET_SCHED_PROLOG (target_flags & MASK_SCHED_PROLOG)
#define TARGET_ALTIVEC (target_flags & MASK_ALTIVEC)
-#define TARGET_ALTIVEC_ABI (target_flags & MASK_ALTIVEC_ABI)
-#define TARGET_LONG_DOUBLE_128 (target_flags & MASK_LONG_DOUBLE_128)
+#define TARGET_AIX_STRUCT_RET (target_flags & MASK_AIX_STRUCT_RET)
#define TARGET_32BIT (! TARGET_64BIT)
#define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
N_("Generate fused multiply/add instructions")},\
{"no-fused-madd", MASK_NO_FUSED_MADD, \
N_("Don't generate fused multiply/add instructions")},\
- {"long-double-64", -MASK_LONG_DOUBLE_128, \
- N_("Use 64 bit long doubles") }, \
- {"long-double-128", MASK_LONG_DOUBLE_128, \
- N_("Use 128 bit long doubles") }, \
{"sched-prolog", MASK_SCHED_PROLOG, \
""}, \
{"no-sched-prolog", -MASK_SCHED_PROLOG, \
""}, \
{"no-sched-epilog", -MASK_SCHED_PROLOG, \
""}, \
+ {"aix-struct-return", MASK_AIX_STRUCT_RET | MASK_AIX_STRUCT_RET_SET, \
+ N_("Return all structures in memory (AIX default)")},\
+ {"svr4-struct-return", - MASK_AIX_STRUCT_RET,\
+ N_("Return small structures in registers (SVR4 default)")},\
+ {"svr4-struct-return",MASK_AIX_STRUCT_RET_SET,\
+ ""},\
+ {"no-aix-struct-return", - MASK_AIX_STRUCT_RET,\
+ ""},\
+ {"no-aix-struct-return", MASK_AIX_STRUCT_RET_SET,\
+ ""},\
+ {"no-svr4-struct-return", MASK_AIX_STRUCT_RET | MASK_AIX_STRUCT_RET_SET,\
+ ""},\
SUBTARGET_SWITCHES \
{"", TARGET_DEFAULT | MASK_SCHED_PROLOG, \
""}}
N_("Schedule code for given CPU") }, \
{"debug=", &rs6000_debug_name, N_("Enable debug output") }, \
{"abi=", &rs6000_abi_string, N_("Specify ABI to use") }, \
+ {"long-double-", &rs6000_long_double_size_string, \
+ N_("Specify size of long double (64 or 128 bits)") }, \
SUBTARGET_OPTIONS \
}
#define TARGET_DEBUG_STACK rs6000_debug_stack
#define TARGET_DEBUG_ARG rs6000_debug_arg
+/* These are separate from target_flags because we've run out of bits
+ there. */
+extern const char *rs6000_long_double_size_string;
+extern int rs6000_long_double_type_size;
+extern int rs6000_altivec_abi;
+
+#define TARGET_LONG_DOUBLE_128 (rs6000_long_double_type_size == 128)
+#define TARGET_ALTIVEC_ABI rs6000_altivec_abi
+
/* Sometimes certain combinations of command options do not make sense
on a particular target machine. You can define a macro
`OVERRIDE_OPTIONS' to take account of this. This macro, if
/* A C expression for the size in bits of the type `long double' on
the target machine. If you don't define this, the default is two
words. */
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
+#define LONG_DOUBLE_TYPE_SIZE rs6000_long_double_type_size
/* Constant which presents upper bound of the above value. */
#define MAX_LONG_DOUBLE_TYPE_SIZE 128
&& TARGET_HARD_FLOAT \
? FP_ARG_RETURN : GP_ARG_RETURN)
-/* The definition of this macro implies that there are cases where
- a scalar value cannot be returned in registers.
-
- For the RS/6000, any structure or union type is returned in memory.
- (FIXME: Except for V.4, where those <= 8 bytes are returned in
- registers. Can't change this without breaking compatibility.) */
+/* The AIX ABI for the RS/6000 specifies that all structures are
+ returned in memory. The Darwin ABI does the same. The SVR4 ABI
+ specifies that structures <= 8 bytes are returned in r3/r4, but a
+ draft put them in memory, and GCC used to implement the draft
+ instead of the final standard. Therefore, TARGET_AIX_STRUCT_RET
+ controls this instead of DEFAULT_ABI; V.4 targets needing backward
+ compatibility can change DRAFT_V4_STRUCT_RET to override the
+ default, and -m switches get the final word. See
+ rs6000_override_options for more details. */
+
+#define RETURN_IN_MEMORY(TYPE) \
+ (AGGREGATE_TYPE_P (TYPE) && \
+ (TARGET_AIX_STRUCT_RET || int_size_in_bytes (TYPE) > 8))
-#define RETURN_IN_MEMORY(TYPE) AGGREGATE_TYPE_P (TYPE)
+/* DRAFT_V4_STRUCT_RET defaults off. */
+#define DRAFT_V4_STRUCT_RET 0
/* Let RETURN_IN_MEMORY control what happens. */
#define DEFAULT_PCC_STRUCT_RETURN 0
/* Define which CODE values are valid. */
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.' || (CODE) == '*' || (CODE) == '$')
+ ((CODE) == '.')
/* Print a memory address as an operand to reference that memory location. */