public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Jan Hubicka <hubicka@ucw.cz>, Uros Bizjak <ubizjak@gmail.com>
Subject: add ASM_OUTPUT_MAX_SKIP_ALIGN to i386.h
Date: Tue, 27 Apr 2021 12:34:06 -0300	[thread overview]
Message-ID: <oro8dzvj0x.fsf@lxoliva.fsfla.org> (raw)


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

             reply	other threads:[~2021-04-27 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 15:34 Alexandre Oliva [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=oro8dzvj0x.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).