diff mbox

PATCH [3/n] X32: Promote pointers to Pmode

Message ID CAMe9rOodOZk8i39C+QuTGywq6KirST-Q-SVQjSzip50=97wC1w@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu July 21, 2011, 11:28 p.m. UTC
On Thu, Jul 21, 2011 at 3:05 PM, Richard Henderson <rth@redhat.com> wrote:
> On 07/21/2011 03:02 PM, H.J. Lu wrote:
>>       * config/i386/i386.c (function_value_64): Always return pointers
>>       in Pmode.
>>       (ix86_promote_function_mode): New.
>>       (TARGET_PROMOTE_FUNCTION_MODE): Likewise.
>
> Much better, thanks.
>
>
> r~
>

Also need this patch.  Otherwise, I got

FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (internal compiler error)
FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (test for excess errors)
FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (internal compiler error)
FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (test for excess errors)

OK for trunk?

Thanks.

Comments

Richard Henderson July 21, 2011, 11:51 p.m. UTC | #1
On 07/21/2011 04:28 PM, H.J. Lu wrote:
> On Thu, Jul 21, 2011 at 3:05 PM, Richard Henderson <rth@redhat.com> wrote:
>> On 07/21/2011 03:02 PM, H.J. Lu wrote:
>>>       * config/i386/i386.c (function_value_64): Always return pointers
>>>       in Pmode.
>>>       (ix86_promote_function_mode): New.
>>>       (TARGET_PROMOTE_FUNCTION_MODE): Likewise.
>>
>> Much better, thanks.
>>
>>
>> r~
>>
> 
> Also need this patch.  Otherwise, I got
> 
> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (internal compiler error)
> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (test for excess errors)
> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (internal compiler error)
> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (test for excess errors)
> 
> OK for trunk?

Hmm.  Should we even be running ms_64 callabi tests across pointer sizes though?


r~
H.J. Lu July 22, 2011, 12:36 a.m. UTC | #2
On Thu, Jul 21, 2011 at 4:51 PM, Richard Henderson <rth@redhat.com> wrote:
> On 07/21/2011 04:28 PM, H.J. Lu wrote:
>> On Thu, Jul 21, 2011 at 3:05 PM, Richard Henderson <rth@redhat.com> wrote:
>>> On 07/21/2011 03:02 PM, H.J. Lu wrote:
>>>>       * config/i386/i386.c (function_value_64): Always return pointers
>>>>       in Pmode.
>>>>       (ix86_promote_function_mode): New.
>>>>       (TARGET_PROMOTE_FUNCTION_MODE): Likewise.
>>>
>>> Much better, thanks.
>>>
>>>
>>> r~
>>>
>>
>> Also need this patch.  Otherwise, I got
>>
>> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (internal compiler error)
>> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (test for excess errors)
>> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (internal compiler error)
>> FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (test for excess errors)
>>
>> OK for trunk?
>
> Hmm.  Should we even be running ms_64 callabi tests across pointer sizes though?
>

Good question.  I can disable the test.  But compiler will still ICE on this
input.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b603f4e..9bc2eef 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7097,11 +7097,17 @@  function_value_64 (enum machine_mode
orig_mode, enum machine_mode mode,
 }

 static rtx
-function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode)
+function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode,
+		      const_tree valtype)
 {
   unsigned int regno = AX_REG;

-  if (TARGET_SSE)
+  if (valtype && POINTER_TYPE_P (valtype))
+    {
+      /* Pointers are always returned in Pmode. */
+      orig_mode = Pmode;
+    }
+  else if (TARGET_SSE)
     {
       switch (GET_MODE_SIZE (mode))