Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and "+" attributes [Patch (2/3)]

2017-11-17 Thread Kyrill Tkachov


On 15/11/17 15:59, Tamar Christina wrote:



-Original Message-
From: Kyrill Tkachov [mailto:kyrylo.tkac...@foss.arm.com]
Sent: Wednesday, November 15, 2017 10:11
To: Tamar Christina <tamar.christ...@arm.com>; Sandra Loosemore
<san...@codesourcery.com>; gcc-patches@gcc.gnu.org
Cc: nd <n...@arm.com>; Ramana Radhakrishnan
<ramana.radhakrish...@arm.com>; Richard Earnshaw
<richard.earns...@arm.com>; ni...@redhat.com
Subject: Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and
"+" attributes [Patch (2/3)]

Hi Tamar,

On 10/11/17 10:56, Tamar Christina wrote:

Hi Sandra,

I've respun the patch with the docs changes you requested.

Regards,
Tamar


-Original Message-
From: Sandra Loosemore [mailto:san...@codesourcery.com]
Sent: 07 November 2017 03:38
To: Tamar Christina; gcc-patches@gcc.gnu.org
Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com;
Kyrylo Tkachov
Subject: Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and
"+" attributes [Patch (2/3)]

On 11/06/2017 09:50 AM, Tamar Christina wrote:

Hi All,

This patch adds support for the setting the architecture and
extensions using the target GCC pragma.

#pragma GCC target ("arch=armv8-a+crc")

It also supports a short hand where an extension is just added to
the current architecture without changing it

#pragma GCC target ("+crc")

Popping and pushing options also correctly reconfigure the global
state as expected.

Also supported is using the __attribute__((target("...")))
attributes on functions to change the architecture or extension.

Regtested on arm-none-eabi and no regressions.

This will need a bootstrap and test run on arm-none-linux-gnueabihf (like all
arm changes).
Your changelog at
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00387.html mentions some
arm-c.c changes but I don't see any included in this patch?

The other changes look good and in line with what I would expect, but can
you please post the arm-c.c changes if there are any?

Hi Kyrill,

Sorry, I moved this change into another patch that was already committed and 
forgot
to remove it from this changelog.

I've also already bootstrapped this and the 3rd patch when you asked for the 
bootstrap of
First one.  But I didn't update mail the status to the list.

The correct changelog is

gcc/
2017-11-15  Tamar Christina  <tamar.christ...@arm.com>

PR target/82641
* config/arm/arm.c (arm_valid_target_attribute_rec):
Parse "arch=" and "+".
(arm_valid_target_attribute_tree): Re-init global options.
(arm_option_override): Make non-static.
(arm_options_perform_arch_sanity_checks): Make errors fatal.
* config/arm/arm_acle.h (__ARM_FEATURE_CRC32): Replace with pragma.
* doc/extend.texi (ARM Function Attributes): Add pragma and target.

gcc/testsuite/
2017-11-15  Tamar Christina  <tamar.christ...@arm.com>

PR target/82641
* gcc.target/arm/pragma_arch_attribute.c: New.

Ok for trunk?


Thanks Tamar.
This is ok for trunk.
Kyrill


Thanks,
Tamar


Thanks,
Kyrill


Ok for trunk?

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index


8aa443f87fb700f7a723d736bdbd53b6c839656d..18d0ffa6820326ce7badf33001

b1

c6a467c95883 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3858,6 +3858,42 @@ Specifies the fpu for which to tune the

performance of this function.

  The behavior and permissible arguments are the same as for the
@option{-mfpu=}  command-line option.

+@item arch=
+@cindex @code{arch=} function attribute, ARM Specifies the
+architecture version and architectural extensions to use for this
+function.  The behavior and permissible arguments are the same as
+for the @option{-march=} command-line option.
+
+The above target attributes can be specified as follows:
+
+@smallexample
+__attribute__((target("@var{attr-string}")))
+int
+f (int a)
+@{
+  return a + 5;
+@}
+@end smallexample
+
+where @code{@var{attr-string}} is one of the attribute strings.

This example doesn't illustrate anything useful, and in fact just

confuses

things by introducing @var{attr-string}.  Please use an actual valid

attribute

here, something like "arch=armv8-a" or whatever.

Also, either kill the sentence fragment after the example, or be

careful to

add @noindent before it to indicate it's a continuation of the
previous paragraph.


+
+Additionally, the architectural extension string may be specified
+on its own.  This can be used to turn on and off particular
+architectural extensions without having to specify a particular

architecture

version or core.  Example:

+
+@smallexample
+__attribute__((target("+crc+nocrypto")))
+int
+foo (int a)
+@{
+  return a + 5;
+@}
+@end smallexample
+
+In this example @code{target("+crc+nocrypto")} enables the
+@code{crc} extension and disables the @code{crypto} extension for
+the function @code{foo} without modifying an existing
+@option{-march=} or

@option{-mcpu} option.

+
  @end table

  @end table

-Sandra




RE: [PATCH][GCC][ARM] Implement "arch" GCC pragma and "+" attributes [Patch (2/3)]

2017-11-15 Thread Tamar Christina


> -Original Message-
> From: Kyrill Tkachov [mailto:kyrylo.tkac...@foss.arm.com]
> Sent: Wednesday, November 15, 2017 10:11
> To: Tamar Christina <tamar.christ...@arm.com>; Sandra Loosemore
> <san...@codesourcery.com>; gcc-patches@gcc.gnu.org
> Cc: nd <n...@arm.com>; Ramana Radhakrishnan
> <ramana.radhakrish...@arm.com>; Richard Earnshaw
> <richard.earns...@arm.com>; ni...@redhat.com
> Subject: Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and
> "+" attributes [Patch (2/3)]
> 
> Hi Tamar,
> 
> On 10/11/17 10:56, Tamar Christina wrote:
> > Hi Sandra,
> >
> > I've respun the patch with the docs changes you requested.
> >
> > Regards,
> > Tamar
> >
> > > -Original Message-
> > > From: Sandra Loosemore [mailto:san...@codesourcery.com]
> > > Sent: 07 November 2017 03:38
> > > To: Tamar Christina; gcc-patches@gcc.gnu.org
> > > Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com;
> > > Kyrylo Tkachov
> > > Subject: Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and
> > > "+" attributes [Patch (2/3)]
> > >
> > > On 11/06/2017 09:50 AM, Tamar Christina wrote:
> > > > Hi All,
> > > >
> > > > This patch adds support for the setting the architecture and
> > > > extensions using the target GCC pragma.
> > > >
> > > > #pragma GCC target ("arch=armv8-a+crc")
> > > >
> > > > It also supports a short hand where an extension is just added to
> > > > the current architecture without changing it
> > > >
> > > > #pragma GCC target ("+crc")
> > > >
> > > > Popping and pushing options also correctly reconfigure the global
> > > > state as expected.
> > > >
> > > > Also supported is using the __attribute__((target("...")))
> > > > attributes on functions to change the architecture or extension.
> > > >
> > > > Regtested on arm-none-eabi and no regressions.
> 
> This will need a bootstrap and test run on arm-none-linux-gnueabihf (like all
> arm changes).
> Your changelog at
> https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00387.html mentions some
> arm-c.c changes but I don't see any included in this patch?
> 
> The other changes look good and in line with what I would expect, but can
> you please post the arm-c.c changes if there are any?

Hi Kyrill,

Sorry, I moved this change into another patch that was already committed and 
forgot
to remove it from this changelog.

I've also already bootstrapped this and the 3rd patch when you asked for the 
bootstrap of
First one.  But I didn't update mail the status to the list.

The correct changelog is 

gcc/
2017-11-15  Tamar Christina  <tamar.christ...@arm.com>

PR target/82641
* config/arm/arm.c (arm_valid_target_attribute_rec):
Parse "arch=" and "+".
(arm_valid_target_attribute_tree): Re-init global options.
(arm_option_override): Make non-static.
(arm_options_perform_arch_sanity_checks): Make errors fatal.
* config/arm/arm_acle.h (__ARM_FEATURE_CRC32): Replace with pragma.
* doc/extend.texi (ARM Function Attributes): Add pragma and target.

gcc/testsuite/
2017-11-15  Tamar Christina  <tamar.christ...@arm.com>

PR target/82641
* gcc.target/arm/pragma_arch_attribute.c: New.

Ok for trunk?

Thanks,
Tamar

> 
> Thanks,
> Kyrill
> 
> > > >
> > > > Ok for trunk?
> > > >
> > > > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index
> > > >
> > >
> 8aa443f87fb700f7a723d736bdbd53b6c839656d..18d0ffa6820326ce7badf33001
> > > b1
> > > > c6a467c95883 100644
> > > > --- a/gcc/doc/extend.texi
> > > > +++ b/gcc/doc/extend.texi
> > > > @@ -3858,6 +3858,42 @@ Specifies the fpu for which to tune the
> > > performance of this function.
> > > >  The behavior and permissible arguments are the same as for the
> > > > @option{-mfpu=}  command-line option.
> > > >
> > > > +@item arch=
> > > > +@cindex @code{arch=} function attribute, ARM Specifies the
> > > > +architecture version and architectural extensions to use for this
> > > > +function.  The behavior and permissible arguments are the same as
> > > > +for the @option{-march=} command-line option.
> > > > +
> > > > +The above target attributes can be specified as follows:
> > > > +
> &

Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and "+" attributes [Patch (2/3)]

2017-11-15 Thread Kyrill Tkachov

Hi Tamar,

On 10/11/17 10:56, Tamar Christina wrote:

Hi Sandra,

I've respun the patch with the docs changes you requested.

Regards,
Tamar

> -Original Message-
> From: Sandra Loosemore [mailto:san...@codesourcery.com]
> Sent: 07 November 2017 03:38
> To: Tamar Christina; gcc-patches@gcc.gnu.org
> Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com; Kyrylo
> Tkachov
> Subject: Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and
> "+" attributes [Patch (2/3)]
>
> On 11/06/2017 09:50 AM, Tamar Christina wrote:
> > Hi All,
> >
> > This patch adds support for the setting the architecture and
> > extensions using the target GCC pragma.
> >
> > #pragma GCC target ("arch=armv8-a+crc")
> >
> > It also supports a short hand where an extension is just added to the
> > current architecture without changing it
> >
> > #pragma GCC target ("+crc")
> >
> > Popping and pushing options also correctly reconfigure the global
> > state as expected.
> >
> > Also supported is using the __attribute__((target("..."))) attributes
> > on functions to change the architecture or extension.
> >
> > Regtested on arm-none-eabi and no regressions.


This will need a bootstrap and test run on arm-none-linux-gnueabihf 
(like all arm changes).
Your changelog at 
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00387.html mentions

some arm-c.c changes but I don't see any included in this patch?

The other changes look good and in line with what I would expect, but 
can you please

post the arm-c.c changes if there are any?

Thanks,
Kyrill


> >
> > Ok for trunk?
> >
> > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index
> >
> 8aa443f87fb700f7a723d736bdbd53b6c839656d..18d0ffa6820326ce7badf33001
> b1
> > c6a467c95883 100644
> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -3858,6 +3858,42 @@ Specifies the fpu for which to tune the
> performance of this function.
> >  The behavior and permissible arguments are the same as for the
> > @option{-mfpu=}  command-line option.
> >
> > +@item arch=
> > +@cindex @code{arch=} function attribute, ARM Specifies the
> > +architecture version and architectural extensions to use for this
> > +function.  The behavior and permissible arguments are the same as for
> > +the @option{-march=} command-line option.
> > +
> > +The above target attributes can be specified as follows:
> > +
> > +@smallexample
> > +__attribute__((target("@var{attr-string}")))
> > +int
> > +f (int a)
> > +@{
> > +  return a + 5;
> > +@}
> > +@end smallexample
> > +
> > +where @code{@var{attr-string}} is one of the attribute strings.
>
> This example doesn't illustrate anything useful, and in fact just 
confuses
> things by introducing @var{attr-string}.  Please use an actual valid 
attribute

> here, something like "arch=armv8-a" or whatever.
>
> Also, either kill the sentence fragment after the example, or be 
careful to

> add @noindent before it to indicate it's a continuation of the previous
> paragraph.
>
> > +
> > +Additionally, the architectural extension string may be specified on
> > +its own.  This can be used to turn on and off particular
> > +architectural extensions without having to specify a particular 
architecture

> version or core.  Example:
> > +
> > +@smallexample
> > +__attribute__((target("+crc+nocrypto")))
> > +int
> > +foo (int a)
> > +@{
> > +  return a + 5;
> > +@}
> > +@end smallexample
> > +
> > +In this example @code{target("+crc+nocrypto")} enables the @code{crc}
> > +extension and disables the @code{crypto} extension for the function
> > +@code{foo} without modifying an existing @option{-march=} or
> @option{-mcpu} option.
> > +
> >  @end table
> >
> >  @end table
>
> -Sandra




Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and "+" attributes [Patch (2/3)]

2017-11-11 Thread Sandra Loosemore

On 11/10/2017 03:56 AM, Tamar Christina wrote:

Hi Sandra,

I've respun the patch with the docs changes you requested.

Regards,
Tamar


Thanks!  The doc part is OK now.

-Sandra


RE: [PATCH][GCC][ARM] Implement "arch" GCC pragma and "+" attributes [Patch (2/3)]

2017-11-10 Thread Tamar Christina
Hi Sandra,

I've respun the patch with the docs changes you requested.

Regards,
Tamar

> -Original Message-
> From: Sandra Loosemore [mailto:san...@codesourcery.com]
> Sent: 07 November 2017 03:38
> To: Tamar Christina; gcc-patches@gcc.gnu.org
> Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com; Kyrylo
> Tkachov
> Subject: Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and
> "+" attributes [Patch (2/3)]
> 
> On 11/06/2017 09:50 AM, Tamar Christina wrote:
> > Hi All,
> >
> > This patch adds support for the setting the architecture and
> > extensions using the target GCC pragma.
> >
> > #pragma GCC target ("arch=armv8-a+crc")
> >
> > It also supports a short hand where an extension is just added to the
> > current architecture without changing it
> >
> > #pragma GCC target ("+crc")
> >
> > Popping and pushing options also correctly reconfigure the global
> > state as expected.
> >
> > Also supported is using the __attribute__((target("..."))) attributes
> > on functions to change the architecture or extension.
> >
> > Regtested on arm-none-eabi and no regressions.
> >
> > Ok for trunk?
> >
> > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index
> >
> 8aa443f87fb700f7a723d736bdbd53b6c839656d..18d0ffa6820326ce7badf33001
> b1
> > c6a467c95883 100644
> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -3858,6 +3858,42 @@ Specifies the fpu for which to tune the
> performance of this function.
> >  The behavior and permissible arguments are the same as for the
> > @option{-mfpu=}  command-line option.
> >
> > +@item arch=
> > +@cindex @code{arch=} function attribute, ARM Specifies the
> > +architecture version and architectural extensions to use for this
> > +function.  The behavior and permissible arguments are the same as for
> > +the @option{-march=} command-line option.
> > +
> > +The above target attributes can be specified as follows:
> > +
> > +@smallexample
> > +__attribute__((target("@var{attr-string}")))
> > +int
> > +f (int a)
> > +@{
> > +  return a + 5;
> > +@}
> > +@end smallexample
> > +
> > +where @code{@var{attr-string}} is one of the attribute strings.
> 
> This example doesn't illustrate anything useful, and in fact just confuses
> things by introducing @var{attr-string}.  Please use an actual valid attribute
> here, something like "arch=armv8-a" or whatever.
> 
> Also, either kill the sentence fragment after the example, or be careful to
> add @noindent before it to indicate it's a continuation of the previous
> paragraph.
> 
> > +
> > +Additionally, the architectural extension string may be specified on
> > +its own.  This can be used to turn on and off particular
> > +architectural extensions without having to specify a particular 
> > architecture
> version or core.  Example:
> > +
> > +@smallexample
> > +__attribute__((target("+crc+nocrypto")))
> > +int
> > +foo (int a)
> > +@{
> > +  return a + 5;
> > +@}
> > +@end smallexample
> > +
> > +In this example @code{target("+crc+nocrypto")} enables the @code{crc}
> > +extension and disables the @code{crypto} extension for the function
> > +@code{foo} without modifying an existing @option{-march=} or
> @option{-mcpu} option.
> > +
> >  @end table
> >
> >  @end table
> 
> -Sandra


respin-arm-2.patch
Description: respin-arm-2.patch


Re: [PATCH][GCC][ARM] Implement "arch" GCC pragma and "+" attributes [Patch (2/3)]

2017-11-06 Thread Sandra Loosemore

On 11/06/2017 09:50 AM, Tamar Christina wrote:

Hi All,

This patch adds support for the setting the architecture and extensions
using the target GCC pragma.

#pragma GCC target ("arch=armv8-a+crc")

It also supports a short hand where an extension is just added to the
current architecture without changing it

#pragma GCC target ("+crc")

Popping and pushing options also correctly reconfigure the global state
as expected.

Also supported is using the __attribute__((target("..."))) attributes
on functions to change the architecture or extension.

Regtested on arm-none-eabi and no regressions.

Ok for trunk?

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 
8aa443f87fb700f7a723d736bdbd53b6c839656d..18d0ffa6820326ce7badf33001b1c6a467c95883
 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3858,6 +3858,42 @@ Specifies the fpu for which to tune the performance of 
this function.
 The behavior and permissible arguments are the same as for the @option{-mfpu=}
 command-line option.
 
+@item arch=

+@cindex @code{arch=} function attribute, ARM
+Specifies the architecture version and architectural extensions to use
+for this function.  The behavior and permissible arguments are the same as
+for the @option{-march=} command-line option.
+
+The above target attributes can be specified as follows:
+
+@smallexample
+__attribute__((target("@var{attr-string}")))
+int
+f (int a)
+@{
+  return a + 5;
+@}
+@end smallexample
+
+where @code{@var{attr-string}} is one of the attribute strings.


This example doesn't illustrate anything useful, and in fact just 
confuses things by introducing @var{attr-string}.  Please use an actual 
valid attribute here, something like "arch=armv8-a" or whatever.


Also, either kill the sentence fragment after the example, or be careful 
to add @noindent before it to indicate it's a continuation of the 
previous paragraph.



+
+Additionally, the architectural extension string may be specified on its
+own.  This can be used to turn on and off particular architectural extensions
+without having to specify a particular architecture version or core.  Example:
+
+@smallexample
+__attribute__((target("+crc+nocrypto")))
+int
+foo (int a)
+@{
+  return a + 5;
+@}
+@end smallexample
+
+In this example @code{target("+crc+nocrypto")} enables the @code{crc}
+extension and disables the @code{crypto} extension for the function @code{foo}
+without modifying an existing @option{-march=} or @option{-mcpu} option.
+
 @end table
 
 @end table


-Sandra