diff mbox

[x32] PATCH: Convert function address to Pmode if needed

Message ID 20110306185557.GA19947@intel.com
State New
Headers show

Commit Message

H.J. Lu March 6, 2011, 6:55 p.m. UTC
Hi,

I checked in this patch to convert function address to Pmode if needed.

H.J.
---
commit b2f3e23711761c7ae4c8378ba63525dfd4030a7a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Mar 6 10:52:38 2011 -0800

    Convert function address to Pmode if needed.
diff mbox

Patch

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 022767b..0fae773 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,5 +1,10 @@ 
 2011-03-06  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* config/i386/i386.c (ix86_expand_call): Convert function address
+	to Pmode if needed.
+
+2011-03-06  H.J. Lu  <hongjiu.lu@intel.com>
+
 	PR other/48007
 	* unwind-dw2.c (_Unwind_Context): Save call frame hard registers
 	as _Unwind_Word.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b2eae67..c034257 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -22041,7 +22041,10 @@  ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
 	   ? !sibcall_insn_operand (XEXP (fnaddr, 0), Pmode)
 	   : !call_insn_operand (XEXP (fnaddr, 0), Pmode))
     {
-      fnaddr = copy_to_mode_reg (Pmode, XEXP (fnaddr, 0));
+      fnaddr = XEXP (fnaddr, 0);
+      if (GET_MODE (fnaddr) != Pmode)
+	fnaddr = convert_to_mode (Pmode, fnaddr, 1);
+      fnaddr = copy_to_mode_reg (Pmode, fnaddr);
       fnaddr = gen_rtx_MEM (QImode, fnaddr);
     }