Re: [PATCH] x86: Fold arch_names_table into processor_alias_table

2020-06-24 Thread H.J. Lu via Gcc-patches
On Wed, Jun 24, 2020 at 12:31 AM Uros Bizjak  wrote:
>
> [CC list removed, it is not shown in archives]
>
> > In i386-builtins.c, arch_names_table is used to to map architecture name
> > string to internal model.  A switch statement is used to map internal
> > processor name to architecture name string and internal priority.
> >
> > model and priority are added to processor_alias_table so that a single
> > entry contains architecture name string, internal processor name,
> > internal model and internal priority.  6 entries are appended for
> > i386-builtins.c, which have special architecture name strings: amd,
> > amdfam10h, amdfam15h, amdfam17h, shanghai and istanbul, and pta_size is
> > adjusted to exclude them.  Entries which are not used by i386-builtins.c
>
> We already have an "amdfam10" entry, so I think these should later be
> extended by AMD folks to include correct processor_type, schedule
> model and flags. Having to manually exclude generic entries feels a
> bit hackish, though, but the patch is certainly an improvement.
>
> > have internal model 0.  P_PROC_DYNAMIC is added to internal priority to
> > make entries with dynamic architecture name string or priority.
>
> BTW: Can you please change P_ZERO to P_NONE?

Fixed.
> > PR target/95842
> > * common/config/i386/i386-common.c (processor_alias_table): Add
> > processor model and priority to each entry.
> > (pta_size): Updated with -6.
> > (num_arch_names): New.
> > * common/config/i386/i386-cpuinfo.h: New file.
> > * config/i386/i386-builtins.c (feature_priority): Removed.
> > (processor_model): Likewise.
> > (_arch_names_table): Likewise.
> > (arch_names_table): Likewise.
> > (get_builtin_code_for_version): Use processor_alias_table.
> > (fold_builtin_cpu): Replace arch_names_table with
> > processor_alias_table.
> > * config/i386/i386.h: Include "common/config/i386/i386-cpuinfo.h".
> > (pta): Add model and priority.
> > (num_arch_names): New.
>
> LGTM.
>
> Thanks,
> Uros.

This is the patch I am checking in.

Thanks.

-- 
H.J.
From e4d03220e495f8b316d088b49a9143a13b8180d4 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" 
Date: Tue, 23 Jun 2020 12:49:32 -0700
Subject: [PATCH] x86: Fold arch_names_table into processor_alias_table

In i386-builtins.c, arch_names_table is used to to map architecture name
string to internal model.  A switch statement is used to map internal
processor name to architecture name string and internal priority.

model and priority are added to processor_alias_table so that a single
entry contains architecture name string, internal processor name,
internal model and internal priority.  6 entries are appended for
i386-builtins.c, which have special architecture name strings: amd,
amdfam10h, amdfam15h, amdfam17h, shanghai and istanbul, and pta_size is
adjusted to exclude them.  Entries which are not used by i386-builtins.c
have internal model 0.  P_PROC_DYNAMIC is added to internal priority to
make entries with dynamic architecture name string or priority.

	PR target/95842
	* common/config/i386/i386-common.c (processor_alias_table): Add
	processor model and priority to each entry.
	(pta_size): Updated with -6.
	(num_arch_names): New.
	* common/config/i386/i386-cpuinfo.h: New file.
	* config/i386/i386-builtins.c (feature_priority): Removed.
	(processor_model): Likewise.
	(_arch_names_table): Likewise.
	(arch_names_table): Likewise.
	(_isa_names_table): Replace P_ZERO with P_NONE.
	(get_builtin_code_for_version): Replace P_ZERO with P_NONE.  Use
	processor_alias_table.
	(fold_builtin_cpu): Replace arch_names_table with
	processor_alias_table.
	* config/i386/i386.h: Include "common/config/i386/i386-cpuinfo.h".
	(pta): Add model and priority.
	(num_arch_names): New.
---
 gcc/common/config/i386/i386-common.c  | 239 ++---
 gcc/common/config/i386/i386-cpuinfo.h | 134 ++
 gcc/config/i386/i386-builtins.c   | 371 ++
 gcc/config/i386/i386.h|   5 +
 4 files changed, 366 insertions(+), 383 deletions(-)
 create mode 100644 gcc/common/config/i386/i386-cpuinfo.h

diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c
index 42d14c29f16..654df68d688 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -1619,164 +1619,202 @@ STATIC_ASSERT (ARRAY_SIZE (processor_names) == PROCESSOR_max);
 
 const pta processor_alias_table[] =
 {
-  {"i386", PROCESSOR_I386, CPU_NONE, 0},
-  {"i486", PROCESSOR_I486, CPU_NONE, 0},
-  {"i586", PROCESSOR_PENTIUM, CPU_PENTIUM, 0},
-  {"pentium", PROCESSOR_PENTIUM, CPU_PENTIUM, 0},
-  {"lakemont", PROCESSOR_LAKEMONT, CPU_PENTIUM, PTA_NO_80387},
-  {"pentium-mmx", PROCESSO

Re: [PATCH] x86: Fold arch_names_table into processor_alias_table

2020-06-24 Thread Uros Bizjak via Gcc-patches
[CC list removed, it is not shown in archives]

> In i386-builtins.c, arch_names_table is used to to map architecture name
> string to internal model.  A switch statement is used to map internal
> processor name to architecture name string and internal priority.
>
> model and priority are added to processor_alias_table so that a single
> entry contains architecture name string, internal processor name,
> internal model and internal priority.  6 entries are appended for
> i386-builtins.c, which have special architecture name strings: amd,
> amdfam10h, amdfam15h, amdfam17h, shanghai and istanbul, and pta_size is
> adjusted to exclude them.  Entries which are not used by i386-builtins.c

We already have an "amdfam10" entry, so I think these should later be
extended by AMD folks to include correct processor_type, schedule
model and flags. Having to manually exclude generic entries feels a
bit hackish, though, but the patch is certainly an improvement.

> have internal model 0.  P_PROC_DYNAMIC is added to internal priority to
> make entries with dynamic architecture name string or priority.

BTW: Can you please change P_ZERO to P_NONE?

> PR target/95842
> * common/config/i386/i386-common.c (processor_alias_table): Add
> processor model and priority to each entry.
> (pta_size): Updated with -6.
> (num_arch_names): New.
> * common/config/i386/i386-cpuinfo.h: New file.
> * config/i386/i386-builtins.c (feature_priority): Removed.
> (processor_model): Likewise.
> (_arch_names_table): Likewise.
> (arch_names_table): Likewise.
> (get_builtin_code_for_version): Use processor_alias_table.
> (fold_builtin_cpu): Replace arch_names_table with
> processor_alias_table.
> * config/i386/i386.h: Include "common/config/i386/i386-cpuinfo.h".
> (pta): Add model and priority.
> (num_arch_names): New.

LGTM.

Thanks,
Uros.


[PATCH] x86: Fold arch_names_table into processor_alias_table

2020-06-23 Thread H.J. Lu via Gcc-patches
In i386-builtins.c, arch_names_table is used to to map architecture name
string to internal model.  A switch statement is used to map internal
processor name to architecture name string and internal priority.

model and priority are added to processor_alias_table so that a single
entry contains architecture name string, internal processor name,
internal model and internal priority.  6 entries are appended for
i386-builtins.c, which have special architecture name strings: amd,
amdfam10h, amdfam15h, amdfam17h, shanghai and istanbul, and pta_size is
adjusted to exclude them.  Entries which are not used by i386-builtins.c
have internal model 0.  P_PROC_DYNAMIC is added to internal priority to
make entries with dynamic architecture name string or priority.

PR target/95842
* common/config/i386/i386-common.c (processor_alias_table): Add
processor model and priority to each entry.
(pta_size): Updated with -6.
(num_arch_names): New.
* common/config/i386/i386-cpuinfo.h: New file.
* config/i386/i386-builtins.c (feature_priority): Removed.
(processor_model): Likewise.
(_arch_names_table): Likewise.
(arch_names_table): Likewise.
(get_builtin_code_for_version): Use processor_alias_table.
(fold_builtin_cpu): Replace arch_names_table with
processor_alias_table.
* config/i386/i386.h: Include "common/config/i386/i386-cpuinfo.h".
(pta): Add model and priority.
(num_arch_names): New.
---
 gcc/common/config/i386/i386-common.c  | 239 ---
 gcc/common/config/i386/i386-cpuinfo.h | 134 +++
 gcc/config/i386/i386-builtins.c   | 329 +-
 gcc/config/i386/i386.h|   5 +
 4 files changed, 345 insertions(+), 362 deletions(-)
 create mode 100644 gcc/common/config/i386/i386-cpuinfo.h

diff --git a/gcc/common/config/i386/i386-common.c 
b/gcc/common/config/i386/i386-common.c
index 42d14c29f16..d3c9a3bff9a 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -1619,164 +1619,202 @@ STATIC_ASSERT (ARRAY_SIZE (processor_names) == 
PROCESSOR_max);
 
 const pta processor_alias_table[] =
 {
-  {"i386", PROCESSOR_I386, CPU_NONE, 0},
-  {"i486", PROCESSOR_I486, CPU_NONE, 0},
-  {"i586", PROCESSOR_PENTIUM, CPU_PENTIUM, 0},
-  {"pentium", PROCESSOR_PENTIUM, CPU_PENTIUM, 0},
-  {"lakemont", PROCESSOR_LAKEMONT, CPU_PENTIUM, PTA_NO_80387},
-  {"pentium-mmx", PROCESSOR_PENTIUM, CPU_PENTIUM, PTA_MMX},
-  {"winchip-c6", PROCESSOR_I486, CPU_NONE, PTA_MMX},
-  {"winchip2", PROCESSOR_I486, CPU_NONE, PTA_MMX | PTA_3DNOW},
-  {"c3", PROCESSOR_I486, CPU_NONE, PTA_MMX | PTA_3DNOW},
-  {"samuel-2", PROCESSOR_I486, CPU_NONE, PTA_MMX | PTA_3DNOW},
+  {"i386", PROCESSOR_I386, CPU_NONE, 0, 0, P_ZERO},
+  {"i486", PROCESSOR_I486, CPU_NONE, 0, 0, P_ZERO},
+  {"i586", PROCESSOR_PENTIUM, CPU_PENTIUM, 0, 0, P_ZERO},
+  {"pentium", PROCESSOR_PENTIUM, CPU_PENTIUM, 0, 0, P_ZERO},
+  {"lakemont", PROCESSOR_LAKEMONT, CPU_PENTIUM, PTA_NO_80387,
+0, P_ZERO},
+  {"pentium-mmx", PROCESSOR_PENTIUM, CPU_PENTIUM, PTA_MMX, 0, P_ZERO},
+  {"winchip-c6", PROCESSOR_I486, CPU_NONE, PTA_MMX, 0, P_ZERO},
+  {"winchip2", PROCESSOR_I486, CPU_NONE, PTA_MMX | PTA_3DNOW,
+0, P_ZERO},
+  {"c3", PROCESSOR_I486, CPU_NONE, PTA_MMX | PTA_3DNOW, 0, P_ZERO},
+  {"samuel-2", PROCESSOR_I486, CPU_NONE, PTA_MMX | PTA_3DNOW,
+0, P_ZERO},
   {"c3-2", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_FXSR, 0, P_ZERO},
   {"nehemiah", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_FXSR, 0, P_ZERO},
   {"c7", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR, 0, P_ZERO},
   {"esther", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR},
-  {"i686", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO, 0},
-  {"pentiumpro", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO, 0},
-  {"pentium2", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO, PTA_MMX | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR, 0, P_ZERO},
+  {"i686", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO, 0, 0, P_ZERO},
+  {"pentiumpro", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO, 0, 0, P_ZERO},
+  {"pentium2", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO, PTA_MMX | PTA_FXSR,
+0, P_ZERO},
   {"pentium3", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_FXSR, 0, P_ZERO},
   {"pentium3m", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_FXSR, 0, P_ZERO},
   {"pentium-m", PROCESSOR_PENTIUMPRO, CPU_PENTIUMPRO,
-PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_FXSR},
+PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_FXSR, 0, P_ZERO},
   {"pentium4", PROCESSOR_PENTIUM4, CPU_NONE,
-PTA_MMX | PTA_SSE | PTA_SSE2 |