diff mbox

[PATCH/AARCH64] v2 Add aligning of functions/loops/jumps

Message ID CA+=Sn1m-+L3D=9RqNYj3YR0rBST4czr9cAOUqH2e8QvO5xeSbA@mail.gmail.com
State New
Headers show

Commit Message

Andrew Pinski Nov. 23, 2014, 12:09 a.m. UTC
Hi,
  This is just a rebase of
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01615.html as requested
by https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01736.html.  Nothing
has changed in it.

OK?  Built and tested on aarch64-elf with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

* config/aarch64/aarch64-protos.h (tune_params): Add align field.
* config/aarch64/aarch64.c (generic_tunings): Specify align.
(cortexa53_tunings): Likewise.
(cortexa57_tunings): Likewise.
(thunderx_tunings): Likewise.
(aarch64_override_options): Set align_loops, align_jumps,
align_functions based on what the tuning struct.

Comments

James Greenhalgh Dec. 5, 2014, 1:53 p.m. UTC | #1
On Sun, Nov 23, 2014 at 12:09:16AM +0000, Andrew Pinski wrote:
> Hi,
>   This is just a rebase of
> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01615.html as requested
> by https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01736.html.  Nothing
> has changed in it.

*ping* I'd like to see this patch revived, rebased and committed.

Thanks,
James

> 
> OK?  Built and tested on aarch64-elf with no regressions.
> 
> Thanks,
> Andrew Pinski
> 
> ChangeLog:
> 
> * config/aarch64/aarch64-protos.h (tune_params): Add align field.
> * config/aarch64/aarch64.c (generic_tunings): Specify align.
> (cortexa53_tunings): Likewise.
> (cortexa57_tunings): Likewise.
> (thunderx_tunings): Likewise.
> (aarch64_override_options): Set align_loops, align_jumps,
> align_functions based on what the tuning struct.

> Index: config/aarch64/aarch64-protos.h
> ===================================================================
> --- config/aarch64/aarch64-protos.h	(revision 217974)
> +++ config/aarch64/aarch64-protos.h	(working copy)
> @@ -170,6 +170,7 @@ struct tune_params
>    const struct cpu_vector_cost *const vec_costs;
>    const int memmov_cost;
>    const int issue_rate;
> +  const int align;
>  };
>  
>  HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
> Index: config/aarch64/aarch64.c
> ===================================================================
> --- config/aarch64/aarch64.c	(revision 217974)
> +++ config/aarch64/aarch64.c	(working copy)
> @@ -314,7 +314,8 @@ static const struct tune_params generic_
>    &generic_regmove_cost,
>    &generic_vector_cost,
>    NAMED_PARAM (memmov_cost, 4),
> -  NAMED_PARAM (issue_rate, 2)
> +  NAMED_PARAM (issue_rate, 2),
> +  NAMED_PARAM (align, 2),
>  };
>  
>  static const struct tune_params cortexa53_tunings =
> @@ -324,7 +325,8 @@ static const struct tune_params cortexa5
>    &cortexa53_regmove_cost,
>    &generic_vector_cost,
>    NAMED_PARAM (memmov_cost, 4),
> -  NAMED_PARAM (issue_rate, 2)
> +  NAMED_PARAM (issue_rate, 2),
> +  NAMED_PARAM (align, 8),
>  };
>  
>  static const struct tune_params cortexa57_tunings =
> @@ -334,7 +336,8 @@ static const struct tune_params cortexa5
>    &cortexa57_regmove_cost,
>    &cortexa57_vector_cost,
>    NAMED_PARAM (memmov_cost, 4),
> -  NAMED_PARAM (issue_rate, 3)
> +  NAMED_PARAM (issue_rate, 3),
> +  NAMED_PARAM (align, 8),
>  };
>  
>  static const struct tune_params thunderx_tunings =
> @@ -344,7 +347,8 @@ static const struct tune_params thunderx
>    &thunderx_regmove_cost,
>    &generic_vector_cost,
>    NAMED_PARAM (memmov_cost, 6),
> -  NAMED_PARAM (issue_rate, 2)
> +  NAMED_PARAM (issue_rate, 2),
> +  NAMED_PARAM (align, 8),
>  };
>  
>  /* A processor implementing AArch64.  */
> @@ -6727,6 +6731,18 @@ aarch64_override_options (void)
>  #endif
>      }
>  
> +  /* If not opzimizing for size, set the default
> +     alignment to what the target wants */
> +  if (!optimize_size)
> +    {
> +      if (align_loops <= 0)
> +	align_loops = aarch64_tune_params->align;
> +      if (align_jumps <= 0)
> +	align_jumps = aarch64_tune_params->align;
> +      if (align_functions <= 0)
> +	align_functions = aarch64_tune_params->align;
> +    }
> +
>    aarch64_override_options_after_change ();
>  }
>
Marcus Shawcroft Dec. 11, 2014, 3:03 p.m. UTC | #2
On 23 November 2014 at 00:09, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>   This is just a rebase of
> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01615.html as requested
> by https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01736.html.  Nothing
> has changed in it.
>
> OK?  Built and tested on aarch64-elf with no regressions.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> * config/aarch64/aarch64-protos.h (tune_params): Add align field.
> * config/aarch64/aarch64.c (generic_tunings): Specify align.
> (cortexa53_tunings): Likewise.
> (cortexa57_tunings): Likewise.
> (thunderx_tunings): Likewise.
> (aarch64_override_options): Set align_loops, align_jumps,
> align_functions based on what the tuning struct.

OK /Marcus
diff mbox

Patch

Index: config/aarch64/aarch64-protos.h
===================================================================
--- config/aarch64/aarch64-protos.h	(revision 217974)
+++ config/aarch64/aarch64-protos.h	(working copy)
@@ -170,6 +170,7 @@  struct tune_params
   const struct cpu_vector_cost *const vec_costs;
   const int memmov_cost;
   const int issue_rate;
+  const int align;
 };
 
 HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
Index: config/aarch64/aarch64.c
===================================================================
--- config/aarch64/aarch64.c	(revision 217974)
+++ config/aarch64/aarch64.c	(working copy)
@@ -314,7 +314,8 @@  static const struct tune_params generic_
   &generic_regmove_cost,
   &generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (align, 2),
 };
 
 static const struct tune_params cortexa53_tunings =
@@ -324,7 +325,8 @@  static const struct tune_params cortexa5
   &cortexa53_regmove_cost,
   &generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (align, 8),
 };
 
 static const struct tune_params cortexa57_tunings =
@@ -334,7 +336,8 @@  static const struct tune_params cortexa5
   &cortexa57_regmove_cost,
   &cortexa57_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 3)
+  NAMED_PARAM (issue_rate, 3),
+  NAMED_PARAM (align, 8),
 };
 
 static const struct tune_params thunderx_tunings =
@@ -344,7 +347,8 @@  static const struct tune_params thunderx
   &thunderx_regmove_cost,
   &generic_vector_cost,
   NAMED_PARAM (memmov_cost, 6),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (align, 8),
 };
 
 /* A processor implementing AArch64.  */
@@ -6727,6 +6731,18 @@  aarch64_override_options (void)
 #endif
     }
 
+  /* If not opzimizing for size, set the default
+     alignment to what the target wants */
+  if (!optimize_size)
+    {
+      if (align_loops <= 0)
+	align_loops = aarch64_tune_params->align;
+      if (align_jumps <= 0)
+	align_jumps = aarch64_tune_params->align;
+      if (align_functions <= 0)
+	align_functions = aarch64_tune_params->align;
+    }
+
   aarch64_override_options_after_change ();
 }