This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Use natural alignment for powerpc64 linux


This patch switches PowerPC64 Linux to use natural alignment of doubles
by default.  The old gcc alignment behaviour is available with
-malign-power.

I've also modified rs6000_parse_alignment_option to be consistent with
the other rs6000_parse_* functions in that when no string is given, the
associated flags are left unchanged.  (I originally intended to init
rs6000_alignment_flags but decided against that, but figure consistency
is worth something.)

Also included in the diff is a previously approved fix for DEFAULT_ABI
when non-biarch, which I'll apply with this one..

OK mainline?

	* config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Choose
	MASK_ALIGN_NATURAL if rs6000_alignment_string not given.  Don't
	assign DEFAULT_ABI.
	(ADJUST_FIELD_ALIGN, ROUND_TYPE_ALIGN): Update comment.
	* config/rs6000/rs6000.c: Formatting.
	(rs6000_parse_alignment_option): Only set rs6000_alignment_flags
	when rs6000_alignment_string given.

Index: gcc/config/rs6000/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/linux64.h,v
retrieving revision 1.50
diff -u -p -r1.50 linux64.h
--- gcc/config/rs6000/linux64.h	5 Oct 2003 13:34:44 -0000	1.50
+++ gcc/config/rs6000/linux64.h	13 Oct 2003 02:23:38 -0000
@@ -65,11 +65,13 @@
 #define	SUBSUBTARGET_OVERRIDE_OPTIONS				\
   do								\
     {								\
+      if (rs6000_alignment_string == 0)				\
+	rs6000_alignment_flags = MASK_ALIGN_NATURAL;		\
       if (TARGET_64BIT)						\
 	{							\
 	  if (DEFAULT_ABI != ABI_AIX)				\
 	    {							\
-	      DEFAULT_ABI = ABI_AIX;				\
+	      rs6000_current_abi = ABI_AIX;			\
 	      error (INVALID_64BIT, "call");			\
 	    }							\
 	  if (TARGET_RELOCATABLE)				\
@@ -202,8 +204,7 @@
 /* We don't need to generate entries in .fixup.  */
 #undef RELOCATABLE_NEEDS_FIXUP
 
-/* This now supports a natural alignment mode. */
-/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints.  */
+/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
 #undef  ADJUST_FIELD_ALIGN
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
   ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)	\
@@ -216,8 +217,8 @@
    ? MIN ((COMPUTED), 32)						\
    : (COMPUTED))
 
-/* AIX increases natural record alignment to doubleword if the first
-   field is an FP double while the FP fields remain word aligned.  */
+/* PowerPC64 Linux increases natural record alignment to doubleword if
+   the first field is an FP double.  */
 #undef  ROUND_TYPE_ALIGN
 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)		\
   ((TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE)	\
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.530
diff -u -p -r1.530 rs6000.c
--- gcc/config/rs6000/rs6000.c	9 Oct 2003 09:08:35 -0000	1.530
+++ gcc/config/rs6000/rs6000.c	12 Oct 2003 23:34:04 -0000
@@ -217,8 +217,8 @@ static void rs6000_emit_stack_tie (void)
 static void rs6000_frame_related (rtx, rtx, HOST_WIDE_INT, rtx, rtx);
 static rtx spe_synthesize_frame_save (rtx);
 static bool spe_func_has_64bit_regs_p (void);
-static void emit_frame_save (rtx, rtx, enum machine_mode,
-				     unsigned int, int, int);
+static void emit_frame_save (rtx, rtx, enum machine_mode, unsigned int,
+			     int, int);
 static rtx gen_frame_mem_offset (enum machine_mode, rtx, int);
 static void rs6000_emit_allocate_stack (HOST_WIDE_INT, int);
 static unsigned rs6000_hash_constant (rtx);
@@ -243,8 +243,8 @@ extern const struct attribute_spec rs600
 static void rs6000_set_default_type_attributes (tree);
 static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT);
 static void rs6000_output_function_epilogue (FILE *, HOST_WIDE_INT);
-static void rs6000_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
-					    HOST_WIDE_INT, tree);
+static void rs6000_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
+				    tree);
 static rtx rs6000_emit_set_long_const (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
 static bool rs6000_return_in_memory (tree, tree);
 static void rs6000_file_start (void);
@@ -255,7 +255,7 @@ static void rs6000_elf_asm_out_destructo
 static void rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
 static void rs6000_elf_unique_section (tree, int);
 static void rs6000_elf_select_rtx_section (enum machine_mode, rtx,
-						   unsigned HOST_WIDE_INT);
+					   unsigned HOST_WIDE_INT);
 static void rs6000_elf_encode_section_info (tree, rtx, int)
      ATTRIBUTE_UNUSED;
 static bool rs6000_elf_in_small_data_p (tree);
@@ -266,7 +266,7 @@ static void rs6000_xcoff_asm_named_secti
 static void rs6000_xcoff_select_section (tree, int, unsigned HOST_WIDE_INT);
 static void rs6000_xcoff_unique_section (tree, int);
 static void rs6000_xcoff_select_rtx_section (enum machine_mode, rtx,
-						     unsigned HOST_WIDE_INT);
+					     unsigned HOST_WIDE_INT);
 static const char * rs6000_xcoff_strip_name_encoding (const char *);
 static unsigned int rs6000_xcoff_section_type_flags (tree, const char *, int);
 static void rs6000_xcoff_file_start (void);
@@ -294,9 +294,9 @@ static void altivec_init_builtins (void)
 static void rs6000_common_init_builtins (void);
 static void rs6000_init_libfuncs (void);
 
-static void enable_mask_for_builtins (struct builtin_description *,
-					      int, enum rs6000_builtins,
-					      enum rs6000_builtins);
+static void enable_mask_for_builtins (struct builtin_description *, int,
+				      enum rs6000_builtins,
+				      enum rs6000_builtins);
 static void spe_init_builtins (void);
 static rtx spe_expand_builtin (tree, rtx, bool *);
 static rtx spe_expand_predicate_builtin (enum insn_code, tree, rtx);
@@ -330,7 +330,7 @@ static inline int rs6000_tls_symbol_ref_
 static const char *rs6000_get_some_local_dynamic_name (void);
 static int rs6000_get_some_local_dynamic_name_1 (rtx *, void *);
 static rtx rs6000_complex_function_value (enum machine_mode);
-static rtx rs6000_spe_function_arg (CUMULATIVE_ARGS *, 
+static rtx rs6000_spe_function_arg (CUMULATIVE_ARGS *,
 				    enum machine_mode, tree);
 static void setup_incoming_varargs (CUMULATIVE_ARGS *,
 				    enum machine_mode, tree,
@@ -975,8 +975,9 @@ rs6000_parse_abi_options (void)
 static void
 rs6000_parse_alignment_option (void)
 {
-  if (rs6000_alignment_string == 0
-      || ! strcmp (rs6000_alignment_string, "power"))
+  if (rs6000_alignment_string == 0)
+    return;
+  else if (! strcmp (rs6000_alignment_string, "power"))
     rs6000_alignment_flags = MASK_ALIGN_POWER;
   else if (! strcmp (rs6000_alignment_string, "natural"))
     rs6000_alignment_flags = MASK_ALIGN_NATURAL;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]