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]

Re: [Bug target/66015] New: align directives not propagated after __attribute__ ((__optimize__ ("O2")))


Hi Jim, Steve, Andreas

Please find here a fix for the issue reported by Andreas
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64835 for ia64.

same than x86 and aarch64.

I don't the environment to run the testsuite for ia64. would you mind
giving it a try and verify that it fixes the issue ?

many thanks

Christian





2015-05-05  Christian Bruel  <christian.bruel@st.com>

	PR target/66015
	* config/ia64/ia64.c (ia64_option_override): Move align_loops,
	and align_functions into ia64_override_options_after_change.

2015-05-05  Christian Bruel  <christian.bruel@st.com>

	PR target/66015
	* gcc.target/ia64/iinline-attr-1.c: New test.

Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	(revision 222803)
+++ gcc/config/ia64/ia64.c	(working copy)
@@ -6051,10 +6051,6 @@
 
   init_machine_status = ia64_init_machine_status;
 
-  if (align_functions <= 0)
-    align_functions = 64;
-  if (align_loops <= 0)
-    align_loops = 32;
   if (TARGET_ABI_OPEN_VMS)
     flag_no_common = 1;
 
@@ -6066,6 +6062,11 @@
 static void
 ia64_override_options_after_change (void)
 {
+  if (align_functions <= 0)
+    align_functions = 64;
+  if (align_loops <= 0)
+    align_loops = 32;
+
   if (optimize >= 3
       && !global_options_set.x_flag_selective_scheduling
       && !global_options_set.x_flag_selective_scheduling2)
Index: gcc/testsuite/gcc.target/ia64/iinline-attr-1.c
===================================================================
--- gcc/testsuite/gcc.target/ia64/iinline-attr-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/ia64/iinline-attr-1.c	(working copy)
@@ -0,0 +1,28 @@
+/* Verify that alignment flags are set when  attribute __optimize is used.  */
+/* { dg-do compile } */
+
+extern void non_existent(int);
+
+__attribute__ ((__optimize__ ("O2")))
+static void hooray ()
+{
+  non_existent (1);
+}
+
+__attribute__ ((__optimize__ ("O2")))
+static void hiphip (void (*f)())
+{
+  non_existent (2);
+  f ();
+}
+
+__attribute__ ((__optimize__ ("O2")))
+int test (void)
+{
+  hiphip (hooray);
+  return 0;
+}
+
+/* { dg-final { scan-assembler ".align 64" } } */
+
+

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