public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] Add -foffload-abi support for PPC
@ 2015-10-06 16:38 ` James Norris
  2015-10-07  8:02   ` Thomas Schwinge
  0 siblings, 1 reply; 8+ messages in thread
From: James Norris @ 2015-10-06 16:38 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

Hi,

The attached patch adds the -foffload-abi option support for PPC.
Only support for the 64-bit ABI has been added.

Committed after regtesting with x86_64 and powerpc64le.

Thanks!
Jim



[-- Attachment #2: offload.patch --]
[-- Type: text/x-patch, Size: 3755 bytes --]

diff --git a/gcc/ChangeLog.gomp b/gcc/ChangeLog.gomp
index a65e652..40326cf 100644
--- a/gcc/ChangeLog.gomp
+++ b/gcc/ChangeLog.gomp
@@ -1,3 +1,11 @@
+2015-10-06 James Norris  <jnorris@codesourcery.com>
+
+	* common.opt (OFFLOAD_ABI_PPC64): New enum.
+	* config/nvptx/mkoffload.c (compile_native): Handle new enum.
+	(main): Handle new option.
+	* config/rs6000/rs6000.c (rs6000_offload_options): New hook.
+	* gcc/coretypes.h (OFFLOAD_ABI_PPC64): New enum.
+
 2015-10-05  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* config/nvptx/mkoffload.c (main): Don't explicitly pass "-lgomp"
diff --git a/gcc/common.opt b/gcc/common.opt
index 290b6b3..c366667 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1730,6 +1730,9 @@ Enum(offload_abi) String(ilp32) Value(OFFLOAD_ABI_ILP32)
 EnumValue
 Enum(offload_abi) String(lp64) Value(OFFLOAD_ABI_LP64)
 
+EnumValue
+Enum(offload_abi) String(ppc64) Value(OFFLOAD_ABI_PPC64)
+
 fomit-frame-pointer
 Common Report Var(flag_omit_frame_pointer) Optimization
 When possible do not generate stack frames
diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c
index e398b44..743df4b 100644
--- a/gcc/config/nvptx/mkoffload.c
+++ b/gcc/config/nvptx/mkoffload.c
@@ -367,6 +367,8 @@ compile_native (const char *infile, const char *outfile, const char *compiler)
     case OFFLOAD_ABI_ILP32:
       obstack_ptr_grow (&argv_obstack, "-m32");
       break;
+    case OFFLOAD_ABI_PPC64:
+      break;
     default:
       gcc_unreachable ();
     }
@@ -458,6 +460,8 @@ main (int argc, char **argv)
 	    offload_abi = OFFLOAD_ABI_LP64;
 	  else if (strcmp (argv[i] + strlen (STR), "ilp32") == 0)
 	    offload_abi = OFFLOAD_ABI_ILP32;
+	  else if (strcmp (argv[i] + strlen (STR), "ppc64") == 0)
+	    offload_abi = OFFLOAD_ABI_PPC64;
 	  else
 	    fatal_error (input_location,
 			 "unrecognizable argument of option " STR);
@@ -485,6 +489,8 @@ main (int argc, char **argv)
     case OFFLOAD_ABI_ILP32:
       obstack_ptr_grow (&argv_obstack, "-m32");
       break;
+    case OFFLOAD_ABI_PPC64:
+      break;
     default:
       gcc_unreachable ();
     }
@@ -518,7 +524,8 @@ main (int argc, char **argv)
 
   /* PR libgomp/65099: Currently, we only support offloading in 64-bit
      configurations, and only for OpenACC offloading.  */
-  if (offload_abi == OFFLOAD_ABI_LP64 && fopenacc)
+  if ((offload_abi == OFFLOAD_ABI_LP64
+      || (offload_abi == OFFLOAD_ABI_PPC64)) && fopenacc)
     {
       ptx_name = make_temp_file (".mkoffload");
       obstack_ptr_grow (&argv_obstack, "-o");
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 023f622..146b45b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1688,6 +1688,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode
 #undef TARGET_UNWIND_WORD_MODE
 #define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode
+
+#undef TARGET_OFFLOAD_OPTIONS
+#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options
 \f
 
 /* Processor table.  */
@@ -9532,6 +9535,13 @@ rs6000_abi_word_mode (void)
   return TARGET_32BIT ? SImode : DImode;
 }
 
+/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
+static char *
+rs6000_offload_options (void)
+{
+  return xstrdup ("-foffload-abi=ppc64");
+}
+
 /* On rs6000, function arguments are promoted, as are function return
    values.  */
 
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 7b3df54..3bb0528 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -170,7 +170,8 @@ enum tls_model {
 enum offload_abi {
   OFFLOAD_ABI_UNSET,
   OFFLOAD_ABI_LP64,
-  OFFLOAD_ABI_ILP32
+  OFFLOAD_ABI_ILP32,
+  OFFLOAD_ABI_PPC64
 };
 
 /* Types of unwind/exception handling info that can be generated.  */

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gomp4] Add -foffload-abi support for PPC
  2015-10-06 16:38 ` [gomp4] Add -foffload-abi support for PPC James Norris
@ 2015-10-07  8:02   ` Thomas Schwinge
  2015-10-07 13:51     ` David Edelsohn
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Schwinge @ 2015-10-07  8:02 UTC (permalink / raw)
  To: James Norris, David Edelsohn; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 6274 bytes --]

Hi!

rs6000/powerpc port maintainer copied.

On Tue, 6 Oct 2015 11:38:04 -0500, James Norris <jnorris@codesourcery.com> wrote:
> The attached patch adds the -foffload-abi option support for PPC.
> Only support for the 64-bit ABI has been added.

(Yes, only powerpc64le-linux-gnu configurations can be supported.)

> Committed after regtesting with x86_64 and powerpc64le.

Such a patch needs to go into trunk.  (It's of course OK to test-drive it
on gomp-4_0-branch first.)

However:

> +	* common.opt (OFFLOAD_ABI_PPC64): New enum.
> +	* config/nvptx/mkoffload.c (compile_native): Handle new enum.
> +	(main): Handle new option.
> +	* config/rs6000/rs6000.c (rs6000_offload_options): New hook.
> +	* gcc/coretypes.h (OFFLOAD_ABI_PPC64): New enum.

> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -1730,6 +1730,9 @@ Enum(offload_abi) String(ilp32) Value(OFFLOAD_ABI_ILP32)
>  EnumValue
>  Enum(offload_abi) String(lp64) Value(OFFLOAD_ABI_LP64)
>  
> +EnumValue
> +Enum(offload_abi) String(ppc64) Value(OFFLOAD_ABI_PPC64)

> --- a/gcc/config/nvptx/mkoffload.c
> +++ b/gcc/config/nvptx/mkoffload.c
> @@ -367,6 +367,8 @@ compile_native (const char *infile, const char *outfile, const char *compiler)
>      case OFFLOAD_ABI_ILP32:
>        obstack_ptr_grow (&argv_obstack, "-m32");
>        break;
> +    case OFFLOAD_ABI_PPC64:
> +      break;
>      default:
>        gcc_unreachable ();
>      }
> @@ -458,6 +460,8 @@ main (int argc, char **argv)
>  	    offload_abi = OFFLOAD_ABI_LP64;
>  	  else if (strcmp (argv[i] + strlen (STR), "ilp32") == 0)
>  	    offload_abi = OFFLOAD_ABI_ILP32;
> +	  else if (strcmp (argv[i] + strlen (STR), "ppc64") == 0)
> +	    offload_abi = OFFLOAD_ABI_PPC64;
>  	  else
>  	    fatal_error (input_location,
>  			 "unrecognizable argument of option " STR);
> @@ -485,6 +489,8 @@ main (int argc, char **argv)
>      case OFFLOAD_ABI_ILP32:
>        obstack_ptr_grow (&argv_obstack, "-m32");
>        break;
> +    case OFFLOAD_ABI_PPC64:
> +      break;
>      default:
>        gcc_unreachable ();
>      }
> @@ -518,7 +524,8 @@ main (int argc, char **argv)
>  
>    /* PR libgomp/65099: Currently, we only support offloading in 64-bit
>       configurations, and only for OpenACC offloading.  */
> -  if (offload_abi == OFFLOAD_ABI_LP64 && fopenacc)
> +  if ((offload_abi == OFFLOAD_ABI_LP64
> +      || (offload_abi == OFFLOAD_ABI_PPC64)) && fopenacc)
>      {
>        ptx_name = make_temp_file (".mkoffload");
>        obstack_ptr_grow (&argv_obstack, "-o");

> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c

> +#undef TARGET_OFFLOAD_OPTIONS
> +#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options

> +/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
> +static char *
> +rs6000_offload_options (void)
> +{
> +  return xstrdup ("-foffload-abi=ppc64");
> +}

> --- a/gcc/coretypes.h
> +++ b/gcc/coretypes.h
> @@ -170,7 +170,8 @@ enum tls_model {
>  enum offload_abi {
>    OFFLOAD_ABI_UNSET,
>    OFFLOAD_ABI_LP64,
> -  OFFLOAD_ABI_ILP32
> +  OFFLOAD_ABI_ILP32,
> +  OFFLOAD_ABI_PPC64
>  };

No, that's not how I meant it to be done; I wrote:

| On Mon, 5 Oct 2015 07:06:55 -0500, James Norris <James_Norris@mentor.com> wrote:
| > [The -foffload-abi parameter] is not passed [to mkoffload] when using the
| > ppc compiler, and as a result the 'unreachable' assertion [in mkoffload]
| > went off.
| 
| That's the bug: you need to pass this parameter: the target (a.k.a. host)
| and offload target (a.k.a. device) compilers need to agree on the ABI to
| use.  This should be straightforward to do; see here:
| 
|     $ git grep -i offload.options -- gcc/config/i386/
|     gcc/config/i386/i386.c:/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
|     gcc/config/i386/i386.c:ix86_offload_options (void)
|     gcc/config/i386/i386.c:#undef TARGET_OFFLOAD_OPTIONS
|     gcc/config/i386/i386.c:#define TARGET_OFFLOAD_OPTIONS \
|     gcc/config/i386/i386.c:  ix86_offload_options
| 
| gcc/config/i386/i386.c:ix86_offload_options:
| 
|     /* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
|     static char *
|     ix86_offload_options (void)
|     {
|       if (TARGET_LP64)
|         return xstrdup ("-foffload-abi=lp64");
|       return xstrdup ("-foffload-abi=ilp32");
|     }
| 
| In case that PowerPC supports additional ABIs, you need to add these to
| gcc/coretypes.h:enum offload_abi, and adjust the parsing in the
| mkoffloads (I can easily test the IntelMIC mkoffload patch for you); of
| course we don't need to support anything but the 64-bit ABI (that you're
| currently already using, I suppose).

From a quick look at the *_TYPE_SIZE definitions in
gcc/config/rs6000/rs6000.h as well as
<http://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf>, "3-1
Fundamental Types", and
<http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUND-TYPE>,
I gather we're dealing with regular ilp32/lp64 here.  Then, I assume the
right thing is to use the 64BIT flag from gcc/config/rs6000/sysv4.opt
(which, per gcc/config.gcc I suppose is used for the relevant
powerpc64le-linux-gnu configuration).  (David?)

I'm not sure where to place the TARGET_OFFLOAD_OPTIONS #define and the
function definition in rs6000.c.  (David?)

So, please revert your patch and instead try the following.

--- gcc/config/rs6000/rs6000.c
+++ gcc/config/rs6000/rs6000.c
@@ -1688,6 +1688,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode
 #undef TARGET_UNWIND_WORD_MODE
 #define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode
+
+#undef TARGET_OFFLOAD_OPTIONS
+#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options
 \f
 
 /* Processor table.  */
@@ -9532,6 +9535,16 @@ rs6000_abi_word_mode (void)
   return TARGET_32BIT ? SImode : DImode;
 }
 
+/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
+static char *
+rs6000_offload_options (void)
+{
+  if (TARGET_64BIT)
+    return xstrdup ("-foffload-abi=lp64");
+  else
+    return xstrdup ("-foffload-abi=ilp32");
+}
+
 /* On rs6000, function arguments are promoted, as are function return
    values.  */
 


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gomp4] Add -foffload-abi support for PPC
  2015-10-07  8:02   ` Thomas Schwinge
@ 2015-10-07 13:51     ` David Edelsohn
  2015-10-08 16:19       ` James Norris
  0 siblings, 1 reply; 8+ messages in thread
From: David Edelsohn @ 2015-10-07 13:51 UTC (permalink / raw)
  To: Thomas Schwinge, James Norris; +Cc: GCC Patches

On Wed, Oct 7, 2015 at 4:02 AM, Thomas Schwinge <thomas@codesourcery.com> wrote:

> From a quick look at the *_TYPE_SIZE definitions in
> gcc/config/rs6000/rs6000.h as well as
> <http://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf>, "3-1
> Fundamental Types", and
> <http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUND-TYPE>,
> I gather we're dealing with regular ilp32/lp64 here.  Then, I assume the
> right thing is to use the 64BIT flag from gcc/config/rs6000/sysv4.opt
> (which, per gcc/config.gcc I suppose is used for the relevant
> powerpc64le-linux-gnu configuration).  (David?)

TARGET_64BIT is the appropriate macro to test.

>
> I'm not sure where to place the TARGET_OFFLOAD_OPTIONS #define and the
> function definition in rs6000.c.  (David?)

As mentioned earlier, only PPC64LE is supported.

I'm not sure if it really matters if this is defined in ELF-specific
portion of the file or a general place, although it never will be
called by other configurations.

Thanks, David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Add -foffload-abi support for PPC
  2015-10-07 13:51     ` David Edelsohn
@ 2015-10-08 16:19       ` James Norris
  2015-10-08 16:53         ` David Edelsohn
  2015-10-08 16:55         ` Thomas Schwinge
  0 siblings, 2 replies; 8+ messages in thread
From: James Norris @ 2015-10-08 16:19 UTC (permalink / raw)
  To: David Edelsohn, Thomas Schwinge; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

Hi!

On 10/07/2015 08:51 AM, David Edelsohn wrote:
> On Wed, Oct 7, 2015 at 4:02 AM, Thomas Schwinge <thomas@codesourcery.com> wrote:
>
>>  From a quick look at the *_TYPE_SIZE definitions in
>> gcc/config/rs6000/rs6000.h as well as
>> <http://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf>, "3-1
>> Fundamental Types", and
>> <http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUND-TYPE>,
>> I gather we're dealing with regular ilp32/lp64 here.  Then, I assume the
>> right thing is to use the 64BIT flag from gcc/config/rs6000/sysv4.opt
>> (which, per gcc/config.gcc I suppose is used for the relevant
>> powerpc64le-linux-gnu configuration).  (David?)
>
> TARGET_64BIT is the appropriate macro to test.
>
>>
>> I'm not sure where to place the TARGET_OFFLOAD_OPTIONS #define and the
>> function definition in rs6000.c.  (David?)
>
> As mentioned earlier, only PPC64LE is supported.
>
> I'm not sure if it really matters if this is defined in ELF-specific
> portion of the file or a general place, although it never will be
> called by other configurations.
>
> Thanks, David
>

I've revised the patch from the review comments (thank you) and
is attached.

Regtested on x86_64 and powerpcle64.

OK for trunk?

Thanks!
Jim


[-- Attachment #2: ppc.patch --]
[-- Type: text/x-patch, Size: 848 bytes --]

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index e095f03..e775e9a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1690,6 +1690,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode
 #undef TARGET_UNWIND_WORD_MODE
 #define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode
+
+#undef TARGET_OFFLOAD_OPTIONS
+#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options
 \f
 
 /* Processor table.  */
@@ -9530,6 +9533,13 @@ rs6000_abi_word_mode (void)
   return TARGET_32BIT ? SImode : DImode;
 }
 
+/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
+static char *
+rs6000_offload_options (void)
+{
+  return xstrdup ("-foffload-abi=lp64");
+}
+
 /* On rs6000, function arguments are promoted, as are function return
    values.  */
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Add -foffload-abi support for PPC
  2015-10-08 16:19       ` James Norris
@ 2015-10-08 16:53         ` David Edelsohn
  2015-10-09 12:20           ` James Norris
  2015-10-08 16:55         ` Thomas Schwinge
  1 sibling, 1 reply; 8+ messages in thread
From: David Edelsohn @ 2015-10-08 16:53 UTC (permalink / raw)
  To: James Norris; +Cc: Thomas Schwinge, GCC Patches

On Thu, Oct 8, 2015 at 12:19 PM, James Norris <jnorris@codesourcery.com> wrote:

> I've revised the patch from the review comments (thank you) and
> is attached.
>
> Regtested on x86_64 and powerpcle64.
>
> OK for trunk?

What is the goal? Do you want this to return the correct value or only
the value for the supported 64 bit PPC64LE system?

Thanks, David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Add -foffload-abi support for PPC
  2015-10-08 16:19       ` James Norris
  2015-10-08 16:53         ` David Edelsohn
@ 2015-10-08 16:55         ` Thomas Schwinge
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Schwinge @ 2015-10-08 16:55 UTC (permalink / raw)
  To: James Norris, David Edelsohn; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]

Hi!

On Thu, 8 Oct 2015 11:19:05 -0500, James Norris <jnorris@codesourcery.com> wrote:
> On 10/07/2015 08:51 AM, David Edelsohn wrote:
> > On Wed, Oct 7, 2015 at 4:02 AM, Thomas Schwinge <thomas@codesourcery.com> wrote:
> >
> >>  From a quick look at the *_TYPE_SIZE definitions in
> >> gcc/config/rs6000/rs6000.h as well as
> >> <http://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf>, "3-1
> >> Fundamental Types", and
> >> <http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUND-TYPE>,
> >> I gather we're dealing with regular ilp32/lp64 here.  Then, I assume the
> >> right thing is to use the 64BIT flag from gcc/config/rs6000/sysv4.opt
> >> (which, per gcc/config.gcc I suppose is used for the relevant
> >> powerpc64le-linux-gnu configuration).  (David?)
> >
> > TARGET_64BIT is the appropriate macro to test.
> >
> >>
> >> I'm not sure where to place the TARGET_OFFLOAD_OPTIONS #define and the
> >> function definition in rs6000.c.  (David?)
> >
> > As mentioned earlier, only PPC64LE is supported.
> >
> > I'm not sure if it really matters if this is defined in ELF-specific
> > portion of the file or a general place, although it never will be
> > called by other configurations.
> >
> > Thanks, David
> >
> 
> I've revised the patch from the review comments (thank you) and
> is attached.
> 
> Regtested on x86_64 and powerpcle64.
> 
> OK for trunk?

> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c

> +/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
> +static char *
> +rs6000_offload_options (void)
> +{
> +  return xstrdup ("-foffload-abi=lp64");
> +}

Well, that's a stripped-down variant of what I had suggested:

    static char *
    rs6000_offload_options (void)
    {
      if (TARGET_64BIT)
        return xstrdup ("-foffload-abi=lp64");
      else
        return xstrdup ("-foffload-abi=ilp32");
    }

If you return -foffload-abi=lp64 unconditionally, strange things will
happen for -m32 compilation (ABI mismatch).


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Add -foffload-abi support for PPC
  2015-10-08 16:53         ` David Edelsohn
@ 2015-10-09 12:20           ` James Norris
  2015-10-09 12:22             ` David Edelsohn
  0 siblings, 1 reply; 8+ messages in thread
From: James Norris @ 2015-10-09 12:20 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Thomas Schwinge, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

David,

On 10/08/2015 11:53 AM, David Edelsohn wrote:
> On Thu, Oct 8, 2015 at 12:19 PM, James Norris <jnorris@codesourcery.com> wrote:
>
>> I've revised the patch from the review comments (thank you) and
>> is attached.
>>
>> Regtested on x86_64 and powerpcle64.
>>
>> OK for trunk?
>
> What is the goal? Do you want this to return the correct value or only
> the value for the supported 64 bit PPC64LE system?
>
> Thanks, David
>
>

The goal is to support both 32-bit and 64-bit. There was some
confusion on my part, my apologies.

Attached is the corrected patch.

Thanks!
Jim

[-- Attachment #2: ppc.patch --]
[-- Type: text/x-patch, Size: 924 bytes --]

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index e095f03..8aac4f7 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1690,6 +1690,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode
 #undef TARGET_UNWIND_WORD_MODE
 #define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode
+
+#undef TARGET_OFFLOAD_OPTIONS
+#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options
 \f
 
 /* Processor table.  */
@@ -9530,6 +9533,16 @@ rs6000_abi_word_mode (void)
   return TARGET_32BIT ? SImode : DImode;
 }
 
+/* Implement the TARGET_OFFLOAD_OPTIONS hook.  */
+static char *
+rs6000_offload_options (void)
+{
+  if (TARGET_64BIT)
+    return xstrdup ("-foffload-abi=lp64");
+  else
+    return xstrdup ("-foffload-abi=ilp32");
+}
+
 /* On rs6000, function arguments are promoted, as are function return
    values.  */
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Add -foffload-abi support for PPC
  2015-10-09 12:20           ` James Norris
@ 2015-10-09 12:22             ` David Edelsohn
  0 siblings, 0 replies; 8+ messages in thread
From: David Edelsohn @ 2015-10-09 12:22 UTC (permalink / raw)
  To: James Norris; +Cc: Thomas Schwinge, GCC Patches

On Fri, Oct 9, 2015 at 8:20 AM, James Norris <jnorris@codesourcery.com> wrote:
> David,
>
>
> On 10/08/2015 11:53 AM, David Edelsohn wrote:
>>
>> On Thu, Oct 8, 2015 at 12:19 PM, James Norris <jnorris@codesourcery.com>
>> wrote:
>>
>>> I've revised the patch from the review comments (thank you) and
>>> is attached.
>>>
>>> Regtested on x86_64 and powerpcle64.
>>>
>>> OK for trunk?
>>
>>
>> What is the goal? Do you want this to return the correct value or only
>> the value for the supported 64 bit PPC64LE system?
>>
>> Thanks, David
>>
>>
>
> The goal is to support both 32-bit and 64-bit. There was some
> confusion on my part, my apologies.
>
> Attached is the corrected patch.

This version seems reasonable to me.

Thanks, David

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-09 12:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87zizxcxnm.fsf@schwinge.name>
2015-10-06 16:38 ` [gomp4] Add -foffload-abi support for PPC James Norris
2015-10-07  8:02   ` Thomas Schwinge
2015-10-07 13:51     ` David Edelsohn
2015-10-08 16:19       ` James Norris
2015-10-08 16:53         ` David Edelsohn
2015-10-09 12:20           ` James Norris
2015-10-09 12:22             ` David Edelsohn
2015-10-08 16:55         ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).