+2018-07-17 Robin Dapp <rdapp@linux.ibm.com>
+
+ * config/s390/s390.c (s390_default_align): Set default function
+ alignment to 16.
+ (s390_override_options_after_change): Call s390_default align.
+ (s390_option_override_internal): Call s390_default_align.
+ (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): Define.
+
2018-07-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/86542
opts->x_s390_cost_pointer = (long)processor_table[opts->x_s390_tune].cost;
}
+static void
+s390_default_align (struct gcc_options *opts)
+{
+ /* Set the default function alignment to 16 in order to get rid of
+ some unwanted performance effects. */
+ if (opts->x_flag_align_functions && !opts->x_str_align_functions
+ && opts->x_s390_tune >= PROCESSOR_2964_Z13)
+ opts->x_str_align_functions = "16";
+}
+
+static void
+s390_override_options_after_change (void)
+{
+ s390_default_align (&global_options);
+}
+
static void
s390_option_override_internal (bool main_args_p,
struct gcc_options *opts,
opts->x_param_values,
opts_set->x_param_values);
+ /* Set the default alignment. */
+ s390_default_align (opts);
+
/* Call target specific restore function to do post-init work. At the moment,
this just sets opts->x_s390_cost_pointer. */
s390_function_specific_restore (opts, NULL);
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE s390_pass_by_reference
+#undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE
+#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE s390_override_options_after_change
+
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL s390_function_ok_for_sibcall
#undef TARGET_FUNCTION_ARG
+2018-07-17 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/function-align1.c: New test.
+ * gcc.target/s390/function-align2.c: New test.
+ * gcc.target/s390/function-align3.c: New test.
+
2018-07-17 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr55.adb: New test.
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -march=z13" } */
+
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__((noinline))
+void foo1 () {}
+
+__attribute__((noinline))
+__attribute__((optimize("align-functions=32")))
+void foo2 () {}
+
+int main ()
+{
+ foo1 ();
+ foo2 ();
+
+ void *f = &foo1;
+ void *g = &foo2;
+
+ assert (((uintptr_t)f % 16) == 0);
+ assert (((uintptr_t)g % 32) == 0);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-Os -march=z13" } */
+
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__((noinline))
+void bar () {}
+
+__attribute__((noinline))
+__attribute__((optimize("O2")))
+void baf () {}
+
+int main ()
+{
+ bar ();
+ baf ();
+
+ void *g = &baf;
+
+ assert ( ((uintptr_t)g % 16) == 0);
+}