This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR target/50603: [x32] Unnecessary lea
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ubizjak at gmail dot com
- Date: Mon, 3 Oct 2011 16:00:55 -0700
- Subject: PATCH: PR target/50603: [x32] Unnecessary lea
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
This patch improves address combine for x32 by forcing the memory memory
operand of PLUS operation into register. Tested on Linux/x86-64 with
-mx32. OK for trunk?
Thanks.
H.J.
---
2011-10-03 H.J. Lu <hongjiu.lu@intel.com>
PR target/50603
* config/i386/i386.c (ix86_fixup_binary_operands): Force the
memory operand of PLUS operation into register for x32.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 9b079af..922f691 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -15713,6 +15713,16 @@ ix86_fixup_binary_operands (enum rtx_code code, enum machine_mode mode,
else
src2 = force_reg (mode, src2);
}
+ else
+ {
+ /* Improve address combine in x32 mode. */
+ if (TARGET_X32
+ && code == PLUS
+ && !MEM_P (dst)
+ && !MEM_P (src1)
+ && MEM_P (src2) )
+ src2 = force_reg (mode, src2);
+ }
/* If the destination is memory, and we do not have matching source
operands, do things in registers. */