public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* add ASM_OUTPUT_MAX_SKIP_ALIGN to i386.h
@ 2021-04-27 15:34 Alexandre Oliva
  2021-04-28  8:24 ` Uros Bizjak
  2021-04-28  8:46 ` Uros Bizjak
  0 siblings, 2 replies; 7+ messages in thread
From: Alexandre Oliva @ 2021-04-27 15:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka, Uros Bizjak


Several i386 align tests expect p2align to be used, but not all
configurations define ASM_OUTPUT_MAX_SKIP_ALIGN, even when
HAVE_GAS_MAX_SKIP_P2ALIGN.

i386.h has an equivalent ASM_OUTPUT_MAX_SKIP_PAD that is used in
i386.c, so I'm adding an _ALIGN variant, as in x86-64.h, and an #undef
to x86-64.h to avoid warnings over the duplicate def; perhaps I should
remove them entirely?  Should we even keep the x86-specific _PAD?

Regstrapped on x86_64-linux-gnu, also tested with a cross to x86-vx7r2.
Ok to install?


for  gcc/ChangeLog

	* config/i386/i386.h [HAVE_GAS_MAX_SKIP_P2ALIGN]
	(ASM_OUTPUT_MAX_SKIP_ALIGN): New, copied from...
	* config/i386/x86-64.h: ... here.  Add undef before define.
---
 gcc/config/i386/i386.h   |   10 ++++++++++
 gcc/config/i386/x86-64.h |    1 +
 2 files changed, 11 insertions(+)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 96b46bac23858..26b1fda433ea7 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2068,6 +2068,16 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
    bytes if it is within MAX_SKIP bytes.  */
 
 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
+  do {									\
+    if ((LOG) != 0) {							\
+      if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1)		\
+	fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
+      else								\
+	fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
+    }									\
+  } while (0)
 #undef  ASM_OUTPUT_MAX_SKIP_PAD
 #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP)			\
   if ((LOG) != 0)							\
diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
index 0cdd980f48105..354bd60005dd1 100644
--- a/gcc/config/i386/x86-64.h
+++ b/gcc/config/i386/x86-64.h
@@ -75,6 +75,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define SUBALIGN_LOG 3
 
 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
   do {									\
     if ((LOG) != 0) {							\

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-29  6:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 15:34 add ASM_OUTPUT_MAX_SKIP_ALIGN to i386.h Alexandre Oliva
2021-04-28  8:24 ` Uros Bizjak
2021-04-29  4:04   ` Alexandre Oliva
2021-04-29  6:38     ` Uros Bizjak
2021-04-29  4:10   ` Alexandre Oliva
2021-04-29  6:40     ` Uros Bizjak
2021-04-28  8:46 ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).