public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Do not check index when encoding %esp as %rsp to avoid 0x67 prefix
@ 2017-09-28 18:16 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2017-09-28 18:16 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

As mentioned in the PR, SP_REG can not be encoded as index.

2017-09-28  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.c (ix86_print_operand_address_as): Do not check
    index when encoding %esp as %rsp to avoid 0x67 prefix.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 877 bytes --]

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 253254)
+++ config/i386/i386.c	(working copy)
@@ -19953,12 +19953,11 @@ ix86_print_operand_address_as (FILE *file, rtx add
 	  code = 'k';
 	}
 
-      /* Since the upper 32 bits of RSP are always zero for x32, we can
-	 encode %esp as %rsp to avoid 0x67 prefix if there is no index or
-	 base register.  */
+      /* Since the upper 32 bits of RSP are always zero for x32,
+	 we can encode %esp as %rsp to avoid 0x67 prefix if
+	 there is no index register.  */
       if (TARGET_X32 && Pmode == SImode
-	  && ((!index && base && REG_P (base) && REGNO (base) == SP_REG)
-	      || (!base && index && REGNO (index) == SP_REG)))
+	  && !index && base && REG_P (base) && REGNO (base) == SP_REG)
 	code = 'q';
 
       if (ASSEMBLER_DIALECT == ASM_ATT)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-28 18:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-28 18:16 [PATCH, i386]: Do not check index when encoding %esp as %rsp to avoid 0x67 prefix 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).