PATCH: PR target/50603: [x32] Unnecessary lea

H.J. Lu hongjiu.lu@intel.com
Mon Oct 3 23:01:00 GMT 2011


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.  */



More information about the Gcc-patches mailing list