public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] arm: Fix parsecpu.awk for aliases [PR113030]
@ 2024-01-21  7:29 Andrew Pinski
  2024-01-22 15:48 ` Richard Earnshaw (lists)
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2024-01-21  7:29 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

So the problem here is the 2 functions check_cpu and check_arch use
the wrong variable to check if an alias is valid for that cpu/arch.
check_cpu uses cpu_optaliases instead of cpu_opt_alias. cpu_optaliases
is an array of index'ed by the cpuname that contains all of the valid aliases
for that cpu but cpu_opt_alias is an double index array which is index'ed
by cpuname and the alias which provides what is the alias for that option.
Similar thing happens for check_arch and arch_optaliases vs arch_optaliases.

Tested by running:
```
awk -f config/arm/parsecpu.awk -v cmd="chkarch armv7-a+simd" config/arm/arm-cpus.in
awk -f config/arm/parsecpu.awk -v cmd="chkarch armv7-a+neon" config/arm/arm-cpus.in
awk -f config/arm/parsecpu.awk -v cmd="chkarch armv7-a+neon-vfpv3" config/arm/arm-cpus.in
```
And they don't return error back.

gcc/ChangeLog:

	PR target/113030
	* config/arm/parsecpu.awk (check_cpu): Use cpu_opt_alias
	instead of cpu_optaliases.
	(check_arch): Use arch_opt_alias instead of arch_optaliases.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/config/arm/parsecpu.awk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/arm/parsecpu.awk b/gcc/config/arm/parsecpu.awk
index ddd4f3b440a..384462bdb5b 100644
--- a/gcc/config/arm/parsecpu.awk
+++ b/gcc/config/arm/parsecpu.awk
@@ -529,7 +529,7 @@ function check_cpu (name) {
 
     for (n = 2; n <= exts; n++) {
 	if (!((cpu_name, extensions[n]) in cpu_opt_remove)	\
-	    && !((cpu_name, extensions[n]) in cpu_optaliases)) {
+	    && !((cpu_name, extensions[n]) in cpu_opt_alias)) {
 	    return "error"
 	}
     }
@@ -552,7 +552,7 @@ function check_arch (name) {
 
     for (n = 2; n <= exts; n++) {
 	if (!((extensions[1], extensions[n]) in arch_opt_remove)	\
-	    && !((extensions[1], extensions[n]) in arch_optaliases)) {
+	    && !((extensions[1], extensions[n]) in arch_opt_alias)) {
 	    return "error"
 	}
     }
-- 
2.39.3


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

* Re: [PATCH] arm: Fix parsecpu.awk for aliases [PR113030]
  2024-01-21  7:29 [PATCH] arm: Fix parsecpu.awk for aliases [PR113030] Andrew Pinski
@ 2024-01-22 15:48 ` Richard Earnshaw (lists)
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw (lists) @ 2024-01-22 15:48 UTC (permalink / raw)
  To: Andrew Pinski, gcc-patches

On 21/01/2024 07:29, Andrew Pinski wrote:
> So the problem here is the 2 functions check_cpu and check_arch use
> the wrong variable to check if an alias is valid for that cpu/arch.
> check_cpu uses cpu_optaliases instead of cpu_opt_alias. cpu_optaliases
> is an array of index'ed by the cpuname that contains all of the valid aliases
> for that cpu but cpu_opt_alias is an double index array which is index'ed
> by cpuname and the alias which provides what is the alias for that option.
> Similar thing happens for check_arch and arch_optaliases vs arch_optaliases.
> 
> Tested by running:
> ```
> awk -f config/arm/parsecpu.awk -v cmd="chkarch armv7-a+simd" config/arm/arm-cpus.in
> awk -f config/arm/parsecpu.awk -v cmd="chkarch armv7-a+neon" config/arm/arm-cpus.in
> awk -f config/arm/parsecpu.awk -v cmd="chkarch armv7-a+neon-vfpv3" config/arm/arm-cpus.in
> ```
> And they don't return error back.
> 
> gcc/ChangeLog:
> 
> 	PR target/113030
> 	* config/arm/parsecpu.awk (check_cpu): Use cpu_opt_alias
> 	instead of cpu_optaliases.
> 	(check_arch): Use arch_opt_alias instead of arch_optaliases.

OK

Thanks,

R.

> 
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/config/arm/parsecpu.awk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/arm/parsecpu.awk b/gcc/config/arm/parsecpu.awk
> index ddd4f3b440a..384462bdb5b 100644
> --- a/gcc/config/arm/parsecpu.awk
> +++ b/gcc/config/arm/parsecpu.awk
> @@ -529,7 +529,7 @@ function check_cpu (name) {
>  
>      for (n = 2; n <= exts; n++) {
>  	if (!((cpu_name, extensions[n]) in cpu_opt_remove)	\
> -	    && !((cpu_name, extensions[n]) in cpu_optaliases)) {
> +	    && !((cpu_name, extensions[n]) in cpu_opt_alias)) {
>  	    return "error"
>  	}
>      }
> @@ -552,7 +552,7 @@ function check_arch (name) {
>  
>      for (n = 2; n <= exts; n++) {
>  	if (!((extensions[1], extensions[n]) in arch_opt_remove)	\
> -	    && !((extensions[1], extensions[n]) in arch_optaliases)) {
> +	    && !((extensions[1], extensions[n]) in arch_opt_alias)) {
>  	    return "error"
>  	}
>      }


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

end of thread, other threads:[~2024-01-22 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-21  7:29 [PATCH] arm: Fix parsecpu.awk for aliases [PR113030] Andrew Pinski
2024-01-22 15:48 ` Richard Earnshaw (lists)

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