public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Better error messages for power8/9-vector builtins
@ 2021-11-16 17:12 Bill Schmidt
  2021-11-17 16:54 ` Paul A. Clarke
  2021-11-17 20:29 ` Segher Boessenkool
  0 siblings, 2 replies; 8+ messages in thread
From: Bill Schmidt @ 2021-11-16 17:12 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn

Hi!  During a previous patch review, Segher asked that I provide better
messages when builtins are unavailable because they require both a minimum
CPU and the enablement of VSX instructions.  This patch does just that.

Bootstrapped and tested on powerpc64le-linux-gnu with no regressions.
Is this okay for trunk?

Thanks!
Bill


2021-11-11  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_invalid_new_builtin): Change
	error messages for ENB_P8V and ENB_P9V.
---
 gcc/config/rs6000/rs6000-call.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 85fec80c6d7..035266eb001 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -11943,7 +11943,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
       error ("%qs requires the %qs option", name, "-mcpu=power8");
       break;
     case ENB_P8V:
-      error ("%qs requires the %qs option", name, "-mpower8-vector");
+      error ("%qs requires the %qs and %qs options", name, "-mcpu=power8",
+	     "-mvsx");
       break;
     case ENB_P9:
       error ("%qs requires the %qs option", name, "-mcpu=power9");
@@ -11953,7 +11954,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
 	     name, "-mcpu=power9", "-m64", "-mpowerpc64");
       break;
     case ENB_P9V:
-      error ("%qs requires the %qs option", name, "-mpower9-vector");
+      error ("%qs requires the %qs and %qs options", name, "-mcpu=power9",
+	     "-mvsx");
       break;
     case ENB_IEEE128_HW:
       error ("%qs requires ISA 3.0 IEEE 128-bit floating point", name);
-- 
2.27.0



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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-16 17:12 [PATCH] rs6000: Better error messages for power8/9-vector builtins Bill Schmidt
@ 2021-11-17 16:54 ` Paul A. Clarke
  2021-11-17 17:00   ` Bill Schmidt
  2021-11-17 20:29 ` Segher Boessenkool
  1 sibling, 1 reply; 8+ messages in thread
From: Paul A. Clarke @ 2021-11-17 16:54 UTC (permalink / raw)
  To: wschmidt; +Cc: GCC Patches, David Edelsohn, Segher Boessenkool

On Tue, Nov 16, 2021 at 11:12:35AM -0600, Bill Schmidt via Gcc-patches wrote:
> Hi!  During a previous patch review, Segher asked that I provide better
> messages when builtins are unavailable because they require both a minimum
> CPU and the enablement of VSX instructions.  This patch does just that.
...
> gcc/
> 	* config/rs6000/rs6000-call.c (rs6000_invalid_new_builtin): Change
> 	error messages for ENB_P8V and ENB_P9V.
> ---
>  gcc/config/rs6000/rs6000-call.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
> index 85fec80c6d7..035266eb001 100644
> --- a/gcc/config/rs6000/rs6000-call.c
> +++ b/gcc/config/rs6000/rs6000-call.c
> @@ -11943,7 +11943,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
>        error ("%qs requires the %qs option", name, "-mcpu=power8");
>        break;
>      case ENB_P8V:
> -      error ("%qs requires the %qs option", name, "-mpower8-vector");
> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=power8",
> +	     "-mvsx");

"-mcpu=power8" itself enables "-mvsx", doesn't it?

>        break;
>      case ENB_P9:
>        error ("%qs requires the %qs option", name, "-mcpu=power9");
> @@ -11953,7 +11954,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
>  	     name, "-mcpu=power9", "-m64", "-mpowerpc64");
>        break;
>      case ENB_P9V:
> -      error ("%qs requires the %qs option", name, "-mpower9-vector");
> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=power9",
> +	     "-mvsx");

Similarly, "-mcpu=power9" itself enables "-mvsx", doesn't it?

Are you trying to also say "don't use -mno-vsx"?  If so, maybe s/and/with/
would be slightly less confusing? This is going to be awkward unless it can
be more precise, like two messages depending on actual context:
- with "-mcpu=power8 -mno-vsx:  "...requires -mvsx".
- without "-mcpu=power8":  "...requires -mcpu=power8".

PC

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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-17 16:54 ` Paul A. Clarke
@ 2021-11-17 17:00   ` Bill Schmidt
  2021-11-17 17:45     ` Paul A. Clarke
  0 siblings, 1 reply; 8+ messages in thread
From: Bill Schmidt @ 2021-11-17 17:00 UTC (permalink / raw)
  To: Paul A. Clarke; +Cc: GCC Patches, David Edelsohn, Segher Boessenkool

On 11/17/21 10:54 AM, Paul A. Clarke wrote:
> On Tue, Nov 16, 2021 at 11:12:35AM -0600, Bill Schmidt via Gcc-patches wrote:
>> Hi!  During a previous patch review, Segher asked that I provide better
>> messages when builtins are unavailable because they require both a minimum
>> CPU and the enablement of VSX instructions.  This patch does just that.
> ...
>> gcc/
>> 	* config/rs6000/rs6000-call.c (rs6000_invalid_new_builtin): Change
>> 	error messages for ENB_P8V and ENB_P9V.
>> ---
>>  gcc/config/rs6000/rs6000-call.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
>> index 85fec80c6d7..035266eb001 100644
>> --- a/gcc/config/rs6000/rs6000-call.c
>> +++ b/gcc/config/rs6000/rs6000-call.c
>> @@ -11943,7 +11943,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
>>        error ("%qs requires the %qs option", name, "-mcpu=power8");
>>        break;
>>      case ENB_P8V:
>> -      error ("%qs requires the %qs option", name, "-mpower8-vector");
>> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=power8",
>> +	     "-mvsx");
> "-mcpu=power8" itself enables "-mvsx", doesn't it?

Of course, but it can be disabled with -mno-vsx.  Then you get this error.
You won't get it unless you deliberately did something strange with the
compile options.

>
>>        break;
>>      case ENB_P9:
>>        error ("%qs requires the %qs option", name, "-mcpu=power9");
>> @@ -11953,7 +11954,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
>>  	     name, "-mcpu=power9", "-m64", "-mpowerpc64");
>>        break;
>>      case ENB_P9V:
>> -      error ("%qs requires the %qs option", name, "-mpower9-vector");
>> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=power9",
>> +	     "-mvsx");
> Similarly, "-mcpu=power9" itself enables "-mvsx", doesn't it?
>
> Are you trying to also say "don't use -mno-vsx"?  If so, maybe s/and/with/
> would be slightly less confusing? This is going to be awkward unless it can
> be more precise, like two messages depending on actual context:
> - with "-mcpu=power8 -mno-vsx:  "...requires -mvsx".
> - without "-mcpu=power8":  "...requires -mcpu=power8".

This seems like a YMMV situation...I don't see the confusion myself.

Bill

>
> PC

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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-17 17:00   ` Bill Schmidt
@ 2021-11-17 17:45     ` Paul A. Clarke
  2021-11-17 20:00       ` Segher Boessenkool
  0 siblings, 1 reply; 8+ messages in thread
From: Paul A. Clarke @ 2021-11-17 17:45 UTC (permalink / raw)
  To: wschmidt; +Cc: GCC Patches, Segher Boessenkool, David Edelsohn

On Wed, Nov 17, 2021 at 11:00:07AM -0600, Bill Schmidt via Gcc-patches wrote:
> On 11/17/21 10:54 AM, Paul A. Clarke wrote:
> > On Tue, Nov 16, 2021 at 11:12:35AM -0600, Bill Schmidt via Gcc-patches wrote:
> >> Hi!  During a previous patch review, Segher asked that I provide better
> >> messages when builtins are unavailable because they require both a minimum
> >> CPU and the enablement of VSX instructions.  This patch does just that.
> > ...
> >> gcc/
> >> 	* config/rs6000/rs6000-call.c (rs6000_invalid_new_builtin): Change
> >> 	error messages for ENB_P8V and ENB_P9V.
> >> ---
> >>  gcc/config/rs6000/rs6000-call.c | 6 ++++--
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
> >> index 85fec80c6d7..035266eb001 100644
> >> --- a/gcc/config/rs6000/rs6000-call.c
> >> +++ b/gcc/config/rs6000/rs6000-call.c
> >> @@ -11943,7 +11943,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
> >>        error ("%qs requires the %qs option", name, "-mcpu=power8");
> >>        break;
> >>      case ENB_P8V:
> >> -      error ("%qs requires the %qs option", name, "-mpower8-vector");
> >> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=power8",
> >> +	     "-mvsx");
> > "-mcpu=power8" itself enables "-mvsx", doesn't it?
> 
> Of course, but it can be disabled with -mno-vsx.  Then you get this error.
> You won't get it unless you deliberately did something strange with the
> compile options.
> 
> >
> >>        break;
> >>      case ENB_P9:
> >>        error ("%qs requires the %qs option", name, "-mcpu=power9");
> >> @@ -11953,7 +11954,8 @@ rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
> >>  	     name, "-mcpu=power9", "-m64", "-mpowerpc64");
> >>        break;
> >>      case ENB_P9V:
> >> -      error ("%qs requires the %qs option", name, "-mpower9-vector");
> >> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=power9",
> >> +	     "-mvsx");
> > Similarly, "-mcpu=power9" itself enables "-mvsx", doesn't it?
> >
> > Are you trying to also say "don't use -mno-vsx"?  If so, maybe s/and/with/
> > would be slightly less confusing? This is going to be awkward unless it can
> > be more precise, like two messages depending on actual context:
> > - with "-mcpu=power8 -mno-vsx:  "...requires -mvsx".
> > - without "-mcpu=power8":  "...requires -mcpu=power8".
> 
> This seems like a YMMV situation...I don't see the confusion myself.

I guess I'm being pedantic.  "requires -mcpu=power8 and -mvsx" is not
accurate from a user's point a view, as "-mcpu=power8" is sufficient,
since "-mvsx" is enabled when "-mcpu=power8" is specified.

The real "requires" is "-mcpu=power8" and no "-mno-vsx".

(I'm just picturing myself fumbling around in a Makefile written by
somebody else. ;-)

It's not a strong objection, since specifying "-mno-vsx" should be
uncommon.  (Right?)  And, specifying "-mcpu=power8 -mvsx" is harmless.

PC

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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-17 17:45     ` Paul A. Clarke
@ 2021-11-17 20:00       ` Segher Boessenkool
  2021-11-17 20:04         ` David Edelsohn
  2021-11-17 20:25         ` Paul A. Clarke
  0 siblings, 2 replies; 8+ messages in thread
From: Segher Boessenkool @ 2021-11-17 20:00 UTC (permalink / raw)
  To: Paul A. Clarke; +Cc: wschmidt, GCC Patches, David Edelsohn

On Wed, Nov 17, 2021 at 11:45:02AM -0600, Paul A. Clarke wrote:
> I guess I'm being pedantic.  "requires -mcpu=power8 and -mvsx" is not
> accurate from a user's point a view, as "-mcpu=power8" is sufficient,
> since "-mvsx" is enabled when "-mcpu=power8" is specified.

To be really pedantic, -mcpu=power8 isn't required either: anythng that
enable the subset of ISA 2.07 that is needed is enough already.  But we
don't want to encourage users to use those interfaces.

> The real "requires" is "-mcpu=power8" and no "-mno-vsx".

And no -mno-altivec.  And and and.  There is a huge web.

> It's not a strong objection, since specifying "-mno-vsx" should be
> uncommon.  (Right?)  And, specifying "-mcpu=power8 -mvsx" is harmless.

Maybe the warning could say "requires -mcpu=power8 (and -mvsx)"?  Is
that clearer, to your eye?


Segher

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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-17 20:00       ` Segher Boessenkool
@ 2021-11-17 20:04         ` David Edelsohn
  2021-11-17 20:25         ` Paul A. Clarke
  1 sibling, 0 replies; 8+ messages in thread
From: David Edelsohn @ 2021-11-17 20:04 UTC (permalink / raw)
  To: Segher Boessenkool, Paul A. Clarke, Bill Schmidt; +Cc: GCC Patches

On Wed, Nov 17, 2021 at 3:02 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> > It's not a strong objection, since specifying "-mno-vsx" should be
> > uncommon.  (Right?)  And, specifying "-mcpu=power8 -mvsx" is harmless.
>
> Maybe the warning could say "requires -mcpu=power8 (and -mvsx)"?  Is
> that clearer, to your eye?

Maybe "requires -mcpu=power8 with VSX" or "requires -mcpu=power8 with
VSX enabled"?

Thanks, David

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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-17 20:00       ` Segher Boessenkool
  2021-11-17 20:04         ` David Edelsohn
@ 2021-11-17 20:25         ` Paul A. Clarke
  1 sibling, 0 replies; 8+ messages in thread
From: Paul A. Clarke @ 2021-11-17 20:25 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches, wschmidt, David Edelsohn

On Wed, Nov 17, 2021 at 02:00:02PM -0600, Segher Boessenkool wrote:
> On Wed, Nov 17, 2021 at 11:45:02AM -0600, Paul A. Clarke wrote:
> > I guess I'm being pedantic.  "requires -mcpu=power8 and -mvsx" is not
> > accurate from a user's point a view, as "-mcpu=power8" is sufficient,
> > since "-mvsx" is enabled when "-mcpu=power8" is specified.
> 
> To be really pedantic, -mcpu=power8 isn't required either: anythng that
> enable the subset of ISA 2.07 that is needed is enough already.  But we
> don't want to encourage users to use those interfaces.
> 
> > The real "requires" is "-mcpu=power8" and no "-mno-vsx".
> 
> And no -mno-altivec.  And and and.  There is a huge web.
> 
> > It's not a strong objection, since specifying "-mno-vsx" should be
> > uncommon.  (Right?)  And, specifying "-mcpu=power8 -mvsx" is harmless.
> 
> Maybe the warning could say "requires -mcpu=power8 (and -mvsx)"?  Is
> that clearer, to your eye?

Hrm. No, but let me withdraw my expression of concern. Both "power8" and
"vsx" are required, and those two options get that explicitly.
That "-mcpu=power8" also pulls in "-mvsx" is a subtlety that is
perhaps not terribly relevant.

Thanks for entertaining my concern, but we've spent too much time on it
already.  :-)

PC

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

* Re: [PATCH] rs6000: Better error messages for power8/9-vector builtins
  2021-11-16 17:12 [PATCH] rs6000: Better error messages for power8/9-vector builtins Bill Schmidt
  2021-11-17 16:54 ` Paul A. Clarke
@ 2021-11-17 20:29 ` Segher Boessenkool
  1 sibling, 0 replies; 8+ messages in thread
From: Segher Boessenkool @ 2021-11-17 20:29 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: GCC Patches, David Edelsohn

On Tue, Nov 16, 2021 at 11:12:35AM -0600, Bill Schmidt wrote:
> Hi!  During a previous patch review, Segher asked that I provide better
> messages when builtins are unavailable because they require both a minimum
> CPU and the enablement of VSX instructions.  This patch does just that.
> 
> Bootstrapped and tested on powerpc64le-linux-gnu with no regressions.
> Is this okay for trunk?

It is.  Thank you!


Segher

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

end of thread, other threads:[~2021-11-17 20:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 17:12 [PATCH] rs6000: Better error messages for power8/9-vector builtins Bill Schmidt
2021-11-17 16:54 ` Paul A. Clarke
2021-11-17 17:00   ` Bill Schmidt
2021-11-17 17:45     ` Paul A. Clarke
2021-11-17 20:00       ` Segher Boessenkool
2021-11-17 20:04         ` David Edelsohn
2021-11-17 20:25         ` Paul A. Clarke
2021-11-17 20:29 ` Segher Boessenkool

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).