diff mbox

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

Message ID CAMe9rOpQ6pYz0KfL_QxJOPA=kxUODK_MOTTP65FTngUSMA2nxQ@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu July 22, 2011, 5:14 a.m. UTC
On Thu, Jul 21, 2011 at 5:36 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.
>
>

How about this patch?  OK for trunk?

Thanks.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 9e3532e..6e030d9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3133,6 +3133,9 @@  ix86_option_override_internal (bool main_args_p)
   if (!global_options_set.x_ix86_abi)
     ix86_abi = DEFAULT_ABI;

+  if (ix86_abi == MS_ABI && TARGET_X32)
+    error ("MS ABI not supported in x32 mode");
+
   if (global_options_set.x_ix86_cmodel)
     {
       switch (ix86_cmodel)
@@ -25520,7 +25523,7 @@  ix86_init_builtins (void)

   ix86_init_mmx_sse_builtins ();

-  if (TARGET_64BIT)
+  if (TARGET_LP64)
     ix86_init_builtins_va_builtins_abi ();

 #ifdef SUBTARGET_INIT_BUILTINS
@@ -29340,7 +29343,7 @@  ix86_handle_abi_attribute (tree *node, tree name,
       *no_add_attrs = true;
       return NULL_TREE;
     }
-  if (!TARGET_64BIT)
+  if (!TARGET_LP64)
     {
       warning (OPT_Wattributes, "%qE attribute only available for 64-bit",
 	       name);
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp
b/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp
index b0cba17..e76d0c1 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp
+++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp
@@ -20,7 +20,7 @@ 
 load_lib gcc-dg.exp

 if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
-     || [is-effective-target ia32] } then {
+     || [is-effective-target ilp32] } then {
   return
 }