* [PATCH] i386: Enable UINTR and HRESET for -march that supports it
@ 2021-03-08 11:51 Martin Liška
2021-03-08 13:15 ` Uros Bizjak
0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2021-03-08 11:51 UTC (permalink / raw)
To: gcc-patches
Hello.
The patch fixes missing features for -march targets that support
PTA_UINTR and PTA_HRESET.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
PR target/99463
* config/i386/i386-options.c (ix86_option_override_internal):
Enable UINTR and HRESET for -march that supports it.
gcc/testsuite/ChangeLog:
PR target/99463
* gcc.target/i386/pr99463-2.c: New test.
* gcc.target/i386/pr99463.c: New test.
---
gcc/config/i386/i386-options.c | 7 +++++++
gcc/testsuite/gcc.target/i386/pr99463-2.c | 5 +++++
gcc/testsuite/gcc.target/i386/pr99463.c | 5 +++++
3 files changed, 17 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/pr99463-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/pr99463.c
diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
index cdeabbfca4b..410fa0cc436 100644
--- a/gcc/config/i386/i386-options.c
+++ b/gcc/config/i386/i386-options.c
@@ -2354,6 +2354,13 @@ ix86_option_override_internal (bool main_args_p,
if (((processor_alias_table[i].flags & PTA_PKU) != 0)
&& !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_PKU))
opts->x_ix86_isa_flags |= OPTION_MASK_ISA_PKU;
+ if (((processor_alias_table[i].flags & PTA_UINTR) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_UINTR))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_UINTR;
+ if (((processor_alias_table[i].flags & PTA_HRESET) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_HRESET))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_HRESET;
+
/* Don't enable x87 instructions if only general registers are
allowed by target("general-regs-only") function attribute or
diff --git a/gcc/testsuite/gcc.target/i386/pr99463-2.c b/gcc/testsuite/gcc.target/i386/pr99463-2.c
new file mode 100644
index 00000000000..017ca959510
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99463-2.c
@@ -0,0 +1,5 @@
+/* PR target/99463 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -march=sapphirerapids" } */
+
+#include "uintr-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr99463.c b/gcc/testsuite/gcc.target/i386/pr99463.c
new file mode 100644
index 00000000000..0b290924118
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr99463.c
@@ -0,0 +1,5 @@
+/* PR target/99463 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=alderlake" } */
+
+#include "hreset-1.c"
--
2.30.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i386: Enable UINTR and HRESET for -march that supports it
2021-03-08 11:51 [PATCH] i386: Enable UINTR and HRESET for -march that supports it Martin Liška
@ 2021-03-08 13:15 ` Uros Bizjak
2021-03-08 13:50 ` Martin Liška
0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2021-03-08 13:15 UTC (permalink / raw)
To: Martin Liška; +Cc: gcc-patches
On Mon, Mar 8, 2021 at 1:45 PM Martin Liška <mliska@suse.cz> wrote:
>
> Hello.
>
> The patch fixes missing features for -march targets that support
> PTA_UINTR and PTA_HRESET.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> PR target/99463
> * config/i386/i386-options.c (ix86_option_override_internal):
> Enable UINTR and HRESET for -march that supports it.
>
> gcc/testsuite/ChangeLog:
>
> PR target/99463
> * gcc.target/i386/pr99463-2.c: New test.
> * gcc.target/i386/pr99463.c: New test.
OK, but looking at i386.h, similar handing for several other PTA_*
flags is missing.
Thanks,
Uros.
> ---
> gcc/config/i386/i386-options.c | 7 +++++++
> gcc/testsuite/gcc.target/i386/pr99463-2.c | 5 +++++
> gcc/testsuite/gcc.target/i386/pr99463.c | 5 +++++
> 3 files changed, 17 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr99463-2.c
> create mode 100644 gcc/testsuite/gcc.target/i386/pr99463.c
>
> diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
> index cdeabbfca4b..410fa0cc436 100644
> --- a/gcc/config/i386/i386-options.c
> +++ b/gcc/config/i386/i386-options.c
> @@ -2354,6 +2354,13 @@ ix86_option_override_internal (bool main_args_p,
> if (((processor_alias_table[i].flags & PTA_PKU) != 0)
> && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_PKU))
> opts->x_ix86_isa_flags |= OPTION_MASK_ISA_PKU;
> + if (((processor_alias_table[i].flags & PTA_UINTR) != 0)
> + && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_UINTR))
> + opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_UINTR;
> + if (((processor_alias_table[i].flags & PTA_HRESET) != 0)
> + && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_HRESET))
> + opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_HRESET;
> +
>
> /* Don't enable x87 instructions if only general registers are
> allowed by target("general-regs-only") function attribute or
> diff --git a/gcc/testsuite/gcc.target/i386/pr99463-2.c b/gcc/testsuite/gcc.target/i386/pr99463-2.c
> new file mode 100644
> index 00000000000..017ca959510
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr99463-2.c
> @@ -0,0 +1,5 @@
> +/* PR target/99463 */
> +/* { dg-do compile { target { ! ia32 } } } */
> +/* { dg-options "-O2 -march=sapphirerapids" } */
> +
> +#include "uintr-1.c"
> diff --git a/gcc/testsuite/gcc.target/i386/pr99463.c b/gcc/testsuite/gcc.target/i386/pr99463.c
> new file mode 100644
> index 00000000000..0b290924118
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr99463.c
> @@ -0,0 +1,5 @@
> +/* PR target/99463 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -march=alderlake" } */
> +
> +#include "hreset-1.c"
> --
> 2.30.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i386: Enable UINTR and HRESET for -march that supports it
2021-03-08 13:15 ` Uros Bizjak
@ 2021-03-08 13:50 ` Martin Liška
0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2021-03-08 13:50 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches
On 3/8/21 2:15 PM, Uros Bizjak wrote:
> OK, but looking at i386.h, similar handing for several other PTA_*
> flags is missing.
Thanks.
Well, I think all other should be covered. I wrote a comparison script and
difference is following after my patch:
{'PTA_PREFETCH_SSE', 'PTA_64BIT', 'PTA_NO_80387', 'PTA_NO_TUNE'}
Which should be fine.
Martin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-08 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 11:51 [PATCH] i386: Enable UINTR and HRESET for -march that supports it Martin Liška
2021-03-08 13:15 ` Uros Bizjak
2021-03-08 13:50 ` Martin Liška
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).