public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] translation: reuse string and use switch for codes
@ 2022-03-07 10:09 Martin Liška
  2022-03-07 10:12 ` Jakub Jelinek
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Martin Liška @ 2022-03-07 10:09 UTC (permalink / raw)
  To: gcc-patches

Hi.

The patch simplifies translation strings.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

	* config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
	message.
---
  gcc/config/arm/arm-builtins.cc | 127 ++++++++++++++++++++-------------
  1 file changed, 79 insertions(+), 48 deletions(-)

diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
index a7acc1d71e7..bdccba2bc88 100644
--- a/gcc/config/arm/arm-builtins.cc
+++ b/gcc/config/arm/arm-builtins.cc
@@ -3926,61 +3926,92 @@ arm_expand_builtin (tree exp,
  	       || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
  	      && (imm < 0 || imm > 32))
  	    {
-	      if (fcode == ARM_BUILTIN_WRORHI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORWI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORH)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi16%> in code");
-	      else
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi32%> in code");
+	      const char *builtin;
+	      switch (fcode)
+		{
+		case ARM_BUILTIN_WRORHI:
+		  builtin = "_mm_rori_pi16";
+		  break;
+		case ARM_BUILTIN_WRORWI:
+		  builtin = "_mm_rori_pi32";
+		  break;
+		case ARM_BUILTIN_WRORH:
+		  builtin = "_mm_ror_pi16";
+		  break;
+		default:
+		  builtin = "_mm_ror_pi32";
+		  break;
+		}
+	      error ("the range of count should be in 0 to 32; please check the intrinsic %qs in code", builtin);
  	    }
  	  else if ((fcode == ARM_BUILTIN_WRORDI || fcode == ARM_BUILTIN_WRORD)
  		   && (imm < 0 || imm > 64))
  	    {
-	      if (fcode == ARM_BUILTIN_WRORDI)
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_rori_si64%> in code");
-	      else
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_ror_si64%> in code");
+	      const char *builtin = fcode == ARM_BUILTIN_WRORDI ? "_mm_rori_si64" : "_mm_ror_si64";
+	      error ("the range of count should be in 0 to 64; please check the intrinsic %qs in code", builtin);
  	    }
  	  else if (imm < 0)
  	    {
-	      if (fcode == ARM_BUILTIN_WSRLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRADI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi32%> in code");
-	      else
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_si64%> in code");
+	      const char *builtin;
+	      switch (fcode)
+		{
+		  case ARM_BUILTIN_WSRLHI:
+		    builtin = "_mm_srli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLWI:
+		    builtin = "_mm_srli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLDI:
+		    builtin = "_mm_srli_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLHI:
+		    builtin = "_mm_slli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLWI:
+		    builtin = "_mm_slli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLDI:
+		    builtin = "_mm_slli_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAHI:
+		    builtin = "_mm_srai_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAWI:
+		    builtin = "_mm_srai_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRADI:
+		    builtin = "_mm_srai_si64";
+		    break;
+		  case ARM_BUILTIN_WSRLH:
+		    builtin = "_mm_srl_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLW:
+		    builtin = "_mm_srl_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLD:
+		    builtin = "_mm_srl_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLH:
+		    builtin = "_mm_sll_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLW:
+		    builtin = "_mm_sll_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLD:
+		    builtin = "_mm_sll_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAH:
+		    builtin = "_mm_sra_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAW:
+		    builtin = "_mm_sra_si64";
+		    break;
+		  default:
+		    builtin = "_mm_sra_si64";
+		    break;
+		}
+	      error ("the count should be no less than 0; please check the intrinsic %qs in code",
+		     builtin);
  	    }
  	}
        return arm_expand_binop_builtin (icode, exp, target);
-- 
2.35.1


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

* Re: [PATCH][ARM] translation: reuse string and use switch for codes
  2022-03-07 10:09 [PATCH][ARM] translation: reuse string and use switch for codes Martin Liška
@ 2022-03-07 10:12 ` Jakub Jelinek
  2022-03-07 10:18   ` Martin Liška
  2022-03-07 10:16 ` Martin Liška
  2022-03-07 10:18 ` Christophe Lyon
  2 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2022-03-07 10:12 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Mon, Mar 07, 2022 at 11:09:26AM +0100, Martin Liška wrote:
> gcc/ChangeLog:
> 
> 	* config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
> 	message.

Will defer review to ARM maintainers, just wanted to mention some of the
lines are way too long (before or after).

> --- a/gcc/config/arm/arm-builtins.cc
> +++ b/gcc/config/arm/arm-builtins.cc
> @@ -3926,61 +3926,92 @@ arm_expand_builtin (tree exp,
>  	       || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
>  	      && (imm < 0 || imm > 32))
>  	    {
> -	      if (fcode == ARM_BUILTIN_WRORHI)
> -		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WRORWI)
> -		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi32%> in code");
> -	      else if (fcode == ARM_BUILTIN_WRORH)
> -		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi16%> in code");
> -	      else
> -		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi32%> in code");
> +	      const char *builtin;
> +	      switch (fcode)
> +		{
> +		case ARM_BUILTIN_WRORHI:
> +		  builtin = "_mm_rori_pi16";
> +		  break;
> +		case ARM_BUILTIN_WRORWI:
> +		  builtin = "_mm_rori_pi32";
> +		  break;
> +		case ARM_BUILTIN_WRORH:
> +		  builtin = "_mm_ror_pi16";
> +		  break;
> +		default:
> +		  builtin = "_mm_ror_pi32";
> +		  break;
> +		}
> +	      error ("the range of count should be in 0 to 32; please check the intrinsic %qs in code", builtin);
>  	    }
>  	  else if ((fcode == ARM_BUILTIN_WRORDI || fcode == ARM_BUILTIN_WRORD)
>  		   && (imm < 0 || imm > 64))
>  	    {
> -	      if (fcode == ARM_BUILTIN_WRORDI)
> -		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_rori_si64%> in code");
> -	      else
> -		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_ror_si64%> in code");
> +	      const char *builtin = fcode == ARM_BUILTIN_WRORDI ? "_mm_rori_si64" : "_mm_ror_si64";
> +	      error ("the range of count should be in 0 to 64; please check the intrinsic %qs in code", builtin);
>  	    }
>  	  else if (imm < 0)
>  	    {
> -	      if (fcode == ARM_BUILTIN_WSRLHI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRLWI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi32%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRLDI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_si64%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSLLHI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSLLWI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi32%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSLLDI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_si64%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRAHI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRAWI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi32%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRADI)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_si64%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRLH)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRLW)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi32%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRLD)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_si64%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSLLH)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSLLW)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi32%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSLLD)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_si64%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRAH)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi16%> in code");
> -	      else if (fcode == ARM_BUILTIN_WSRAW)
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi32%> in code");
> -	      else
> -		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_si64%> in code");
> +	      const char *builtin;
> +	      switch (fcode)
> +		{
> +		  case ARM_BUILTIN_WSRLHI:
> +		    builtin = "_mm_srli_pi16";
> +		    break;
> +		  case ARM_BUILTIN_WSRLWI:
> +		    builtin = "_mm_srli_pi32";
> +		    break;
> +		  case ARM_BUILTIN_WSRLDI:
> +		    builtin = "_mm_srli_si64";
> +		    break;
> +		  case ARM_BUILTIN_WSLLHI:
> +		    builtin = "_mm_slli_pi16";
> +		    break;
> +		  case ARM_BUILTIN_WSLLWI:
> +		    builtin = "_mm_slli_pi32";
> +		    break;
> +		  case ARM_BUILTIN_WSLLDI:
> +		    builtin = "_mm_slli_si64";
> +		    break;
> +		  case ARM_BUILTIN_WSRAHI:
> +		    builtin = "_mm_srai_pi16";
> +		    break;
> +		  case ARM_BUILTIN_WSRAWI:
> +		    builtin = "_mm_srai_pi32";
> +		    break;
> +		  case ARM_BUILTIN_WSRADI:
> +		    builtin = "_mm_srai_si64";
> +		    break;
> +		  case ARM_BUILTIN_WSRLH:
> +		    builtin = "_mm_srl_pi16";
> +		    break;
> +		  case ARM_BUILTIN_WSRLW:
> +		    builtin = "_mm_srl_pi32";
> +		    break;
> +		  case ARM_BUILTIN_WSRLD:
> +		    builtin = "_mm_srl_si64";
> +		    break;
> +		  case ARM_BUILTIN_WSLLH:
> +		    builtin = "_mm_sll_pi16";
> +		    break;
> +		  case ARM_BUILTIN_WSLLW:
> +		    builtin = "_mm_sll_pi32";
> +		    break;
> +		  case ARM_BUILTIN_WSLLD:
> +		    builtin = "_mm_sll_si64";
> +		    break;
> +		  case ARM_BUILTIN_WSRAH:
> +		    builtin = "_mm_sra_pi16";
> +		    break;
> +		  case ARM_BUILTIN_WSRAW:
> +		    builtin = "_mm_sra_si64";
> +		    break;
> +		  default:
> +		    builtin = "_mm_sra_si64";
> +		    break;
> +		}
> +	      error ("the count should be no less than 0; please check the intrinsic %qs in code",
> +		     builtin);
>  	    }
>  	}
>        return arm_expand_binop_builtin (icode, exp, target);
> -- 
> 2.35.1

	Jakub


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

* Re: [PATCH][ARM] translation: reuse string and use switch for codes
  2022-03-07 10:09 [PATCH][ARM] translation: reuse string and use switch for codes Martin Liška
  2022-03-07 10:12 ` Jakub Jelinek
@ 2022-03-07 10:16 ` Martin Liška
  2022-03-07 10:18 ` Christophe Lyon
  2 siblings, 0 replies; 7+ messages in thread
From: Martin Liška @ 2022-03-07 10:16 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

Hello.

There's V2 where I fixed fact that:

ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORH can have valid range on [1, 16].

Ready to be installed?
Thanks,
Martin

[-- Attachment #2: 0001-translation-reuse-string-and-use-switch-for-codes.patch --]
[-- Type: text/x-patch, Size: 7015 bytes --]

From 879262c3a7aefd3ab9552cec881248b240f53818 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 7 Mar 2022 10:56:43 +0100
Subject: [PATCH] translation: reuse string and use switch for codes

gcc/ChangeLog:

	* config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
	message.
---
 gcc/config/arm/arm-builtins.cc | 125 ++++++++++++++++++++-------------
 1 file changed, 75 insertions(+), 50 deletions(-)

diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
index a7acc1d71e7..77d47d1d059 100644
--- a/gcc/config/arm/arm-builtins.cc
+++ b/gcc/config/arm/arm-builtins.cc
@@ -3922,65 +3922,90 @@ arm_expand_builtin (tree exp,
       if (GET_MODE (op1) == VOIDmode)
 	{
 	  imm = INTVAL (op1);
-	  if ((fcode == ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORWI
-	       || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
+	  if ((fcode == ARM_BUILTIN_WRORWI || fcode == ARM_BUILTIN_WRORW)
 	      && (imm < 0 || imm > 32))
 	    {
-	      if (fcode == ARM_BUILTIN_WRORHI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORWI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORH)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi16%> in code");
-	      else
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi32%> in code");
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORWI
+				     ? "_mm_rori_pi32" : "_mm_ror_pi32");
+	      error ("the range of count should be in 0 to 32; please check the intrinsic %qs in code",
+		     builtin);
+	    }
+	  else if ((fcode == ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORH)
+		   && (imm < 0 || imm > 16))
+	    {
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORHI
+				     ? "_mm_rori_pi16" : "_mm_ror_pi16");
+	      error ("the range of count should be in 0 to 16; please check the intrinsic %qs in code",
+		     builtin);
 	    }
 	  else if ((fcode == ARM_BUILTIN_WRORDI || fcode == ARM_BUILTIN_WRORD)
 		   && (imm < 0 || imm > 64))
 	    {
-	      if (fcode == ARM_BUILTIN_WRORDI)
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_rori_si64%> in code");
-	      else
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_ror_si64%> in code");
+	      const char *builtin = fcode == ARM_BUILTIN_WRORDI ? "_mm_rori_si64" : "_mm_ror_si64";
+	      error ("the range of count should be in 0 to 64; please check the intrinsic %qs in code", builtin);
 	    }
 	  else if (imm < 0)
 	    {
-	      if (fcode == ARM_BUILTIN_WSRLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRADI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi32%> in code");
-	      else
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_si64%> in code");
+	      const char *builtin;
+	      switch (fcode)
+		{
+		  case ARM_BUILTIN_WSRLHI:
+		    builtin = "_mm_srli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLWI:
+		    builtin = "_mm_srli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLDI:
+		    builtin = "_mm_srli_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLHI:
+		    builtin = "_mm_slli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLWI:
+		    builtin = "_mm_slli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLDI:
+		    builtin = "_mm_slli_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAHI:
+		    builtin = "_mm_srai_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAWI:
+		    builtin = "_mm_srai_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRADI:
+		    builtin = "_mm_srai_si64";
+		    break;
+		  case ARM_BUILTIN_WSRLH:
+		    builtin = "_mm_srl_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLW:
+		    builtin = "_mm_srl_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLD:
+		    builtin = "_mm_srl_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLH:
+		    builtin = "_mm_sll_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLW:
+		    builtin = "_mm_sll_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLD:
+		    builtin = "_mm_sll_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAH:
+		    builtin = "_mm_sra_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAW:
+		    builtin = "_mm_sra_si64";
+		    break;
+		  default:
+		    builtin = "_mm_sra_si64";
+		    break;
+		}
+	      error ("the count should be no less than 0; please check the intrinsic %qs in code",
+		     builtin);
 	    }
 	}
       return arm_expand_binop_builtin (icode, exp, target);
-- 
2.35.1


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

* Re: [PATCH][ARM] translation: reuse string and use switch for codes
  2022-03-07 10:12 ` Jakub Jelinek
@ 2022-03-07 10:18   ` Martin Liška
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Liška @ 2022-03-07 10:18 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

On 3/7/22 11:12, Jakub Jelinek wrote:
> Will defer review to ARM maintainers, just wanted to mention some of the
> lines are way too long (before or after).

Sure, fixed in V3.

Martin

[-- Attachment #2: 0001-translation-reuse-string-and-use-switch-for-codes.patch --]
[-- Type: text/x-patch, Size: 7047 bytes --]

From 34a195d905bb1719e13c2021ee475a0581b62a5b Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 7 Mar 2022 10:56:43 +0100
Subject: [PATCH] translation: reuse string and use switch for codes

gcc/ChangeLog:

	* config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
	message.
---
 gcc/config/arm/arm-builtins.cc | 127 ++++++++++++++++++++-------------
 1 file changed, 77 insertions(+), 50 deletions(-)

diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
index a7acc1d71e7..6c0b1bda66a 100644
--- a/gcc/config/arm/arm-builtins.cc
+++ b/gcc/config/arm/arm-builtins.cc
@@ -3922,65 +3922,92 @@ arm_expand_builtin (tree exp,
       if (GET_MODE (op1) == VOIDmode)
 	{
 	  imm = INTVAL (op1);
-	  if ((fcode == ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORWI
-	       || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
+	  if ((fcode == ARM_BUILTIN_WRORWI || fcode == ARM_BUILTIN_WRORW)
 	      && (imm < 0 || imm > 32))
 	    {
-	      if (fcode == ARM_BUILTIN_WRORHI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORWI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORH)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi16%> in code");
-	      else
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi32%> in code");
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORWI
+				     ? "_mm_rori_pi32" : "_mm_ror_pi32");
+	      error ("the range of count should be in 0 to 32; "
+		     "please check the intrinsic %qs in code", builtin);
+	    }
+	  else if ((fcode == ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORH)
+		   && (imm < 0 || imm > 16))
+	    {
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORHI
+				     ? "_mm_rori_pi16" : "_mm_ror_pi16");
+	      error ("the range of count should be in 0 to 16; "
+		     "please check the intrinsic %qs in code", builtin);
 	    }
 	  else if ((fcode == ARM_BUILTIN_WRORDI || fcode == ARM_BUILTIN_WRORD)
 		   && (imm < 0 || imm > 64))
 	    {
-	      if (fcode == ARM_BUILTIN_WRORDI)
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_rori_si64%> in code");
-	      else
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_ror_si64%> in code");
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORDI
+				     ? "_mm_rori_si64" : "_mm_ror_si64");
+	      error ("the range of count should be in 0 to 64; "
+		     "please check the intrinsic %qs in code", builtin);
 	    }
 	  else if (imm < 0)
 	    {
-	      if (fcode == ARM_BUILTIN_WSRLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRADI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi32%> in code");
-	      else
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_si64%> in code");
+	      const char *builtin;
+	      switch (fcode)
+		{
+		  case ARM_BUILTIN_WSRLHI:
+		    builtin = "_mm_srli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLWI:
+		    builtin = "_mm_srli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLDI:
+		    builtin = "_mm_srli_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLHI:
+		    builtin = "_mm_slli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLWI:
+		    builtin = "_mm_slli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLDI:
+		    builtin = "_mm_slli_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAHI:
+		    builtin = "_mm_srai_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAWI:
+		    builtin = "_mm_srai_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRADI:
+		    builtin = "_mm_srai_si64";
+		    break;
+		  case ARM_BUILTIN_WSRLH:
+		    builtin = "_mm_srl_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLW:
+		    builtin = "_mm_srl_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLD:
+		    builtin = "_mm_srl_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLH:
+		    builtin = "_mm_sll_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLW:
+		    builtin = "_mm_sll_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLD:
+		    builtin = "_mm_sll_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAH:
+		    builtin = "_mm_sra_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAW:
+		    builtin = "_mm_sra_si64";
+		    break;
+		  default:
+		    builtin = "_mm_sra_si64";
+		    break;
+		}
+	      error ("the count should be no less than 0; "
+		     "please check the intrinsic %qs in code", builtin);
 	    }
 	}
       return arm_expand_binop_builtin (icode, exp, target);
-- 
2.35.1


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

* Re: [PATCH][ARM] translation: reuse string and use switch for codes
  2022-03-07 10:09 [PATCH][ARM] translation: reuse string and use switch for codes Martin Liška
  2022-03-07 10:12 ` Jakub Jelinek
  2022-03-07 10:16 ` Martin Liška
@ 2022-03-07 10:18 ` Christophe Lyon
  2022-03-07 10:22   ` Martin Liška
  2 siblings, 1 reply; 7+ messages in thread
From: Christophe Lyon @ 2022-03-07 10:18 UTC (permalink / raw)
  To: gcc-patches

Hi!

On 3/7/22 11:09, Martin Liška wrote:
> Hi.
> 
> The patch simplifies translation strings.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
This is an arm-only patch, it's not clear if you built a cross-compiler 
for arm, and that these regression tests passed?

> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
>      * config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
>      message.

I think this is about PR target/104794, so this should be mentioned?

Thanks,

Christophe


> ---
>   gcc/config/arm/arm-builtins.cc | 127 ++++++++++++++++++++-------------
>   1 file changed, 79 insertions(+), 48 deletions(-)
> 
> diff --git a/gcc/config/arm/arm-builtins.cc 
> b/gcc/config/arm/arm-builtins.cc
> index a7acc1d71e7..bdccba2bc88 100644
> --- a/gcc/config/arm/arm-builtins.cc
> +++ b/gcc/config/arm/arm-builtins.cc
> @@ -3926,61 +3926,92 @@ arm_expand_builtin (tree exp,
>              || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
>             && (imm < 0 || imm > 32))
>           {
> -          if (fcode == ARM_BUILTIN_WRORHI)
> -        error ("the range of count should be in 0 to 32; please check 
> the intrinsic %<_mm_rori_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WRORWI)
> -        error ("the range of count should be in 0 to 32; please check 
> the intrinsic %<_mm_rori_pi32%> in code");
> -          else if (fcode == ARM_BUILTIN_WRORH)
> -        error ("the range of count should be in 0 to 32; please check 
> the intrinsic %<_mm_ror_pi16%> in code");
> -          else
> -        error ("the range of count should be in 0 to 32; please check 
> the intrinsic %<_mm_ror_pi32%> in code");
> +          const char *builtin;
> +          switch (fcode)
> +        {
> +        case ARM_BUILTIN_WRORHI:
> +          builtin = "_mm_rori_pi16";
> +          break;
> +        case ARM_BUILTIN_WRORWI:
> +          builtin = "_mm_rori_pi32";
> +          break;
> +        case ARM_BUILTIN_WRORH:
> +          builtin = "_mm_ror_pi16";
> +          break;
> +        default:
> +          builtin = "_mm_ror_pi32";
> +          break;
> +        }
> +          error ("the range of count should be in 0 to 32; please check 
> the intrinsic %qs in code", builtin);
>           }
>         else if ((fcode == ARM_BUILTIN_WRORDI || fcode == 
> ARM_BUILTIN_WRORD)
>              && (imm < 0 || imm > 64))
>           {
> -          if (fcode == ARM_BUILTIN_WRORDI)
> -        error ("the range of count should be in 0 to 64; please check 
> the intrinsic %<_mm_rori_si64%> in code");
> -          else
> -        error ("the range of count should be in 0 to 64; please check 
> the intrinsic %<_mm_ror_si64%> in code");
> +          const char *builtin = fcode == ARM_BUILTIN_WRORDI ? 
> "_mm_rori_si64" : "_mm_ror_si64";
> +          error ("the range of count should be in 0 to 64; please check 
> the intrinsic %qs in code", builtin);
>           }
>         else if (imm < 0)
>           {
> -          if (fcode == ARM_BUILTIN_WSRLHI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srli_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRLWI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srli_pi32%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRLDI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srli_si64%> in code");
> -          else if (fcode == ARM_BUILTIN_WSLLHI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_slli_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WSLLWI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_slli_pi32%> in code");
> -          else if (fcode == ARM_BUILTIN_WSLLDI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_slli_si64%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRAHI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srai_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRAWI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srai_pi32%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRADI)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srai_si64%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRLH)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srl_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRLW)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srl_pi32%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRLD)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_srl_si64%> in code");
> -          else if (fcode == ARM_BUILTIN_WSLLH)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_sll_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WSLLW)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_sll_pi32%> in code");
> -          else if (fcode == ARM_BUILTIN_WSLLD)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_sll_si64%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRAH)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_sra_pi16%> in code");
> -          else if (fcode == ARM_BUILTIN_WSRAW)
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_sra_pi32%> in code");
> -          else
> -        error ("the count should be no less than 0; please check the 
> intrinsic %<_mm_sra_si64%> in code");
> +          const char *builtin;
> +          switch (fcode)
> +        {
> +          case ARM_BUILTIN_WSRLHI:
> +            builtin = "_mm_srli_pi16";
> +            break;
> +          case ARM_BUILTIN_WSRLWI:
> +            builtin = "_mm_srli_pi32";
> +            break;
> +          case ARM_BUILTIN_WSRLDI:
> +            builtin = "_mm_srli_si64";
> +            break;
> +          case ARM_BUILTIN_WSLLHI:
> +            builtin = "_mm_slli_pi16";
> +            break;
> +          case ARM_BUILTIN_WSLLWI:
> +            builtin = "_mm_slli_pi32";
> +            break;
> +          case ARM_BUILTIN_WSLLDI:
> +            builtin = "_mm_slli_si64";
> +            break;
> +          case ARM_BUILTIN_WSRAHI:
> +            builtin = "_mm_srai_pi16";
> +            break;
> +          case ARM_BUILTIN_WSRAWI:
> +            builtin = "_mm_srai_pi32";
> +            break;
> +          case ARM_BUILTIN_WSRADI:
> +            builtin = "_mm_srai_si64";
> +            break;
> +          case ARM_BUILTIN_WSRLH:
> +            builtin = "_mm_srl_pi16";
> +            break;
> +          case ARM_BUILTIN_WSRLW:
> +            builtin = "_mm_srl_pi32";
> +            break;
> +          case ARM_BUILTIN_WSRLD:
> +            builtin = "_mm_srl_si64";
> +            break;
> +          case ARM_BUILTIN_WSLLH:
> +            builtin = "_mm_sll_pi16";
> +            break;
> +          case ARM_BUILTIN_WSLLW:
> +            builtin = "_mm_sll_pi32";
> +            break;
> +          case ARM_BUILTIN_WSLLD:
> +            builtin = "_mm_sll_si64";
> +            break;
> +          case ARM_BUILTIN_WSRAH:
> +            builtin = "_mm_sra_pi16";
> +            break;
> +          case ARM_BUILTIN_WSRAW:
> +            builtin = "_mm_sra_si64";
> +            break;
> +          default:
> +            builtin = "_mm_sra_si64";
> +            break;
> +        }
> +          error ("the count should be no less than 0; please check the 
> intrinsic %qs in code",
> +             builtin);
>           }
>       }
>         return arm_expand_binop_builtin (icode, exp, target);

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

* Re: [PATCH][ARM] translation: reuse string and use switch for codes
  2022-03-07 10:18 ` Christophe Lyon
@ 2022-03-07 10:22   ` Martin Liška
  2022-03-07 10:37     ` Kyrylo Tkachov
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Liška @ 2022-03-07 10:22 UTC (permalink / raw)
  To: Christophe Lyon, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 9631 bytes --]

On 3/7/22 11:18, Christophe Lyon via Gcc-patches wrote:
> Hi!
> 
> On 3/7/22 11:09, Martin Liška wrote:
>> Hi.
>>
>> The patch simplifies translation strings.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> This is an arm-only patch, it's not clear if you built a cross-compiler for arm, and that these regression tests passed?

Sorry, I meant I can built the cross compiler. If I see correctly there are no tests that
would check the error messages.

> 
>>
>> Ready to be installed?
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>>      * config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
>>      message.
> 
> I think this is about PR target/104794, so this should be mentioned?

Yep.

There's V4.

Is it ready for master?

Martin

> 
> Thanks,
> 
> Christophe
> 
> 
>> ---
>>   gcc/config/arm/arm-builtins.cc | 127 ++++++++++++++++++++-------------
>>   1 file changed, 79 insertions(+), 48 deletions(-)
>>
>> diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
>> index a7acc1d71e7..bdccba2bc88 100644
>> --- a/gcc/config/arm/arm-builtins.cc
>> +++ b/gcc/config/arm/arm-builtins.cc
>> @@ -3926,61 +3926,92 @@ arm_expand_builtin (tree exp,
>>              || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
>>             && (imm < 0 || imm > 32))
>>           {
>> -          if (fcode == ARM_BUILTIN_WRORHI)
>> -        error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WRORWI)
>> -        error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi32%> in code");
>> -          else if (fcode == ARM_BUILTIN_WRORH)
>> -        error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi16%> in code");
>> -          else
>> -        error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi32%> in code");
>> +          const char *builtin;
>> +          switch (fcode)
>> +        {
>> +        case ARM_BUILTIN_WRORHI:
>> +          builtin = "_mm_rori_pi16";
>> +          break;
>> +        case ARM_BUILTIN_WRORWI:
>> +          builtin = "_mm_rori_pi32";
>> +          break;
>> +        case ARM_BUILTIN_WRORH:
>> +          builtin = "_mm_ror_pi16";
>> +          break;
>> +        default:
>> +          builtin = "_mm_ror_pi32";
>> +          break;
>> +        }
>> +          error ("the range of count should be in 0 to 32; please check the intrinsic %qs in code", builtin);
>>           }
>>         else if ((fcode == ARM_BUILTIN_WRORDI || fcode == ARM_BUILTIN_WRORD)
>>              && (imm < 0 || imm > 64))
>>           {
>> -          if (fcode == ARM_BUILTIN_WRORDI)
>> -        error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_rori_si64%> in code");
>> -          else
>> -        error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_ror_si64%> in code");
>> +          const char *builtin = fcode == ARM_BUILTIN_WRORDI ? "_mm_rori_si64" : "_mm_ror_si64";
>> +          error ("the range of count should be in 0 to 64; please check the intrinsic %qs in code", builtin);
>>           }
>>         else if (imm < 0)
>>           {
>> -          if (fcode == ARM_BUILTIN_WSRLHI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRLWI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi32%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRLDI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_si64%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSLLHI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSLLWI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi32%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSLLDI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_si64%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRAHI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRAWI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi32%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRADI)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_si64%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRLH)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRLW)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi32%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRLD)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_si64%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSLLH)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSLLW)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi32%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSLLD)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_si64%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRAH)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi16%> in code");
>> -          else if (fcode == ARM_BUILTIN_WSRAW)
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi32%> in code");
>> -          else
>> -        error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_si64%> in code");
>> +          const char *builtin;
>> +          switch (fcode)
>> +        {
>> +          case ARM_BUILTIN_WSRLHI:
>> +            builtin = "_mm_srli_pi16";
>> +            break;
>> +          case ARM_BUILTIN_WSRLWI:
>> +            builtin = "_mm_srli_pi32";
>> +            break;
>> +          case ARM_BUILTIN_WSRLDI:
>> +            builtin = "_mm_srli_si64";
>> +            break;
>> +          case ARM_BUILTIN_WSLLHI:
>> +            builtin = "_mm_slli_pi16";
>> +            break;
>> +          case ARM_BUILTIN_WSLLWI:
>> +            builtin = "_mm_slli_pi32";
>> +            break;
>> +          case ARM_BUILTIN_WSLLDI:
>> +            builtin = "_mm_slli_si64";
>> +            break;
>> +          case ARM_BUILTIN_WSRAHI:
>> +            builtin = "_mm_srai_pi16";
>> +            break;
>> +          case ARM_BUILTIN_WSRAWI:
>> +            builtin = "_mm_srai_pi32";
>> +            break;
>> +          case ARM_BUILTIN_WSRADI:
>> +            builtin = "_mm_srai_si64";
>> +            break;
>> +          case ARM_BUILTIN_WSRLH:
>> +            builtin = "_mm_srl_pi16";
>> +            break;
>> +          case ARM_BUILTIN_WSRLW:
>> +            builtin = "_mm_srl_pi32";
>> +            break;
>> +          case ARM_BUILTIN_WSRLD:
>> +            builtin = "_mm_srl_si64";
>> +            break;
>> +          case ARM_BUILTIN_WSLLH:
>> +            builtin = "_mm_sll_pi16";
>> +            break;
>> +          case ARM_BUILTIN_WSLLW:
>> +            builtin = "_mm_sll_pi32";
>> +            break;
>> +          case ARM_BUILTIN_WSLLD:
>> +            builtin = "_mm_sll_si64";
>> +            break;
>> +          case ARM_BUILTIN_WSRAH:
>> +            builtin = "_mm_sra_pi16";
>> +            break;
>> +          case ARM_BUILTIN_WSRAW:
>> +            builtin = "_mm_sra_si64";
>> +            break;
>> +          default:
>> +            builtin = "_mm_sra_si64";
>> +            break;
>> +        }
>> +          error ("the count should be no less than 0; please check the intrinsic %qs in code",
>> +             builtin);
>>           }
>>       }
>>         return arm_expand_binop_builtin (icode, exp, target);

[-- Attachment #2: 0001-translation-reuse-string-and-use-switch-for-codes.patch --]
[-- Type: text/x-patch, Size: 7146 bytes --]

From 3cd2de6b978c52ba1d509eef1f86626c42906fba Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 7 Mar 2022 10:56:43 +0100
Subject: [PATCH] translation: reuse string and use switch for codes

	PR target/104794

gcc/ChangeLog:

	* config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
	message.  Fix ARM_BUILTIN_WRORHI and ARM_BUILTIN_WRORH that can
	have only range [0,32].
---
 gcc/config/arm/arm-builtins.cc | 127 ++++++++++++++++++++-------------
 1 file changed, 77 insertions(+), 50 deletions(-)

diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
index a7acc1d71e7..6c0b1bda66a 100644
--- a/gcc/config/arm/arm-builtins.cc
+++ b/gcc/config/arm/arm-builtins.cc
@@ -3922,65 +3922,92 @@ arm_expand_builtin (tree exp,
       if (GET_MODE (op1) == VOIDmode)
 	{
 	  imm = INTVAL (op1);
-	  if ((fcode == ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORWI
-	       || fcode == ARM_BUILTIN_WRORH || fcode == ARM_BUILTIN_WRORW)
+	  if ((fcode == ARM_BUILTIN_WRORWI || fcode == ARM_BUILTIN_WRORW)
 	      && (imm < 0 || imm > 32))
 	    {
-	      if (fcode == ARM_BUILTIN_WRORHI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORWI)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_rori_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WRORH)
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi16%> in code");
-	      else
-		error ("the range of count should be in 0 to 32; please check the intrinsic %<_mm_ror_pi32%> in code");
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORWI
+				     ? "_mm_rori_pi32" : "_mm_ror_pi32");
+	      error ("the range of count should be in 0 to 32; "
+		     "please check the intrinsic %qs in code", builtin);
+	    }
+	  else if ((fcode == ARM_BUILTIN_WRORHI || fcode == ARM_BUILTIN_WRORH)
+		   && (imm < 0 || imm > 16))
+	    {
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORHI
+				     ? "_mm_rori_pi16" : "_mm_ror_pi16");
+	      error ("the range of count should be in 0 to 16; "
+		     "please check the intrinsic %qs in code", builtin);
 	    }
 	  else if ((fcode == ARM_BUILTIN_WRORDI || fcode == ARM_BUILTIN_WRORD)
 		   && (imm < 0 || imm > 64))
 	    {
-	      if (fcode == ARM_BUILTIN_WRORDI)
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_rori_si64%> in code");
-	      else
-		error ("the range of count should be in 0 to 64; please check the intrinsic %<_mm_ror_si64%> in code");
+	      const char *builtin = (fcode == ARM_BUILTIN_WRORDI
+				     ? "_mm_rori_si64" : "_mm_ror_si64");
+	      error ("the range of count should be in 0 to 64; "
+		     "please check the intrinsic %qs in code", builtin);
 	    }
 	  else if (imm < 0)
 	    {
-	      if (fcode == ARM_BUILTIN_WSRLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLDI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_slli_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAHI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAWI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRADI)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srai_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_srl_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_pi32%> in code");
-	      else if (fcode == ARM_BUILTIN_WSLLD)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sll_si64%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAH)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi16%> in code");
-	      else if (fcode == ARM_BUILTIN_WSRAW)
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_pi32%> in code");
-	      else
-		error ("the count should be no less than 0; please check the intrinsic %<_mm_sra_si64%> in code");
+	      const char *builtin;
+	      switch (fcode)
+		{
+		  case ARM_BUILTIN_WSRLHI:
+		    builtin = "_mm_srli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLWI:
+		    builtin = "_mm_srli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLDI:
+		    builtin = "_mm_srli_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLHI:
+		    builtin = "_mm_slli_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLWI:
+		    builtin = "_mm_slli_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLDI:
+		    builtin = "_mm_slli_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAHI:
+		    builtin = "_mm_srai_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAWI:
+		    builtin = "_mm_srai_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRADI:
+		    builtin = "_mm_srai_si64";
+		    break;
+		  case ARM_BUILTIN_WSRLH:
+		    builtin = "_mm_srl_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRLW:
+		    builtin = "_mm_srl_pi32";
+		    break;
+		  case ARM_BUILTIN_WSRLD:
+		    builtin = "_mm_srl_si64";
+		    break;
+		  case ARM_BUILTIN_WSLLH:
+		    builtin = "_mm_sll_pi16";
+		    break;
+		  case ARM_BUILTIN_WSLLW:
+		    builtin = "_mm_sll_pi32";
+		    break;
+		  case ARM_BUILTIN_WSLLD:
+		    builtin = "_mm_sll_si64";
+		    break;
+		  case ARM_BUILTIN_WSRAH:
+		    builtin = "_mm_sra_pi16";
+		    break;
+		  case ARM_BUILTIN_WSRAW:
+		    builtin = "_mm_sra_si64";
+		    break;
+		  default:
+		    builtin = "_mm_sra_si64";
+		    break;
+		}
+	      error ("the count should be no less than 0; "
+		     "please check the intrinsic %qs in code", builtin);
 	    }
 	}
       return arm_expand_binop_builtin (icode, exp, target);
-- 
2.35.1


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

* RE: [PATCH][ARM] translation: reuse string and use switch for codes
  2022-03-07 10:22   ` Martin Liška
@ 2022-03-07 10:37     ` Kyrylo Tkachov
  0 siblings, 0 replies; 7+ messages in thread
From: Kyrylo Tkachov @ 2022-03-07 10:37 UTC (permalink / raw)
  To: Martin Liška, Christophe Lyon, gcc-patches



> -----Original Message-----
> From: Gcc-patches <gcc-patches-
> bounces+kyrylo.tkachov=arm.com@gcc.gnu.org> On Behalf Of Martin Liška
> Sent: Monday, March 7, 2022 10:22 AM
> To: Christophe Lyon <Christophe.Lyon@arm.com>; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH][ARM] translation: reuse string and use switch for codes
> 
> On 3/7/22 11:18, Christophe Lyon via Gcc-patches wrote:
> > Hi!
> >
> > On 3/7/22 11:09, Martin Liška wrote:
> >> Hi.
> >>
> >> The patch simplifies translation strings.
> >>
> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> > This is an arm-only patch, it's not clear if you built a cross-compiler for arm,
> and that these regression tests passed?
> 
> Sorry, I meant I can built the cross compiler. If I see correctly there are no
> tests that
> would check the error messages.
> 
> >
> >>
> >> Ready to be installed?
> >> Thanks,
> >> Martin
> >>
> >> gcc/ChangeLog:
> >>
> >>      * config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
> >>      message.
> >
> > I think this is about PR target/104794, so this should be mentioned?
> 
> Yep.
> 
> There's V4.
> 
> Is it ready for master?

Ok.
Thanks,
Kyrill

> 
> Martin
> 
> >
> > Thanks,
> >
> > Christophe
> >
> >
> >> ---
> >>   gcc/config/arm/arm-builtins.cc | 127 ++++++++++++++++++++-------------
> >>   1 file changed, 79 insertions(+), 48 deletions(-)
> >>
> >> diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-
> builtins.cc
> >> index a7acc1d71e7..bdccba2bc88 100644
> >> --- a/gcc/config/arm/arm-builtins.cc
> >> +++ b/gcc/config/arm/arm-builtins.cc
> >> @@ -3926,61 +3926,92 @@ arm_expand_builtin (tree exp,
> >>              || fcode == ARM_BUILTIN_WRORH || fcode ==
> ARM_BUILTIN_WRORW)
> >>             && (imm < 0 || imm > 32))
> >>           {
> >> -          if (fcode == ARM_BUILTIN_WRORHI)
> >> -        error ("the range of count should be in 0 to 32; please check the
> intrinsic %<_mm_rori_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WRORWI)
> >> -        error ("the range of count should be in 0 to 32; please check the
> intrinsic %<_mm_rori_pi32%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WRORH)
> >> -        error ("the range of count should be in 0 to 32; please check the
> intrinsic %<_mm_ror_pi16%> in code");
> >> -          else
> >> -        error ("the range of count should be in 0 to 32; please check the
> intrinsic %<_mm_ror_pi32%> in code");
> >> +          const char *builtin;
> >> +          switch (fcode)
> >> +        {
> >> +        case ARM_BUILTIN_WRORHI:
> >> +          builtin = "_mm_rori_pi16";
> >> +          break;
> >> +        case ARM_BUILTIN_WRORWI:
> >> +          builtin = "_mm_rori_pi32";
> >> +          break;
> >> +        case ARM_BUILTIN_WRORH:
> >> +          builtin = "_mm_ror_pi16";
> >> +          break;
> >> +        default:
> >> +          builtin = "_mm_ror_pi32";
> >> +          break;
> >> +        }
> >> +          error ("the range of count should be in 0 to 32; please check the
> intrinsic %qs in code", builtin);
> >>           }
> >>         else if ((fcode == ARM_BUILTIN_WRORDI || fcode ==
> ARM_BUILTIN_WRORD)
> >>              && (imm < 0 || imm > 64))
> >>           {
> >> -          if (fcode == ARM_BUILTIN_WRORDI)
> >> -        error ("the range of count should be in 0 to 64; please check the
> intrinsic %<_mm_rori_si64%> in code");
> >> -          else
> >> -        error ("the range of count should be in 0 to 64; please check the
> intrinsic %<_mm_ror_si64%> in code");
> >> +          const char *builtin = fcode == ARM_BUILTIN_WRORDI ?
> "_mm_rori_si64" : "_mm_ror_si64";
> >> +          error ("the range of count should be in 0 to 64; please check the
> intrinsic %qs in code", builtin);
> >>           }
> >>         else if (imm < 0)
> >>           {
> >> -          if (fcode == ARM_BUILTIN_WSRLHI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srli_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRLWI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srli_pi32%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRLDI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srli_si64%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSLLHI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_slli_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSLLWI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_slli_pi32%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSLLDI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_slli_si64%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRAHI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srai_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRAWI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srai_pi32%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRADI)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srai_si64%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRLH)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srl_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRLW)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srl_pi32%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRLD)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_srl_si64%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSLLH)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_sll_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSLLW)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_sll_pi32%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSLLD)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_sll_si64%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRAH)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_sra_pi16%> in code");
> >> -          else if (fcode == ARM_BUILTIN_WSRAW)
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_sra_pi32%> in code");
> >> -          else
> >> -        error ("the count should be no less than 0; please check the intrinsic
> %<_mm_sra_si64%> in code");
> >> +          const char *builtin;
> >> +          switch (fcode)
> >> +        {
> >> +          case ARM_BUILTIN_WSRLHI:
> >> +            builtin = "_mm_srli_pi16";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRLWI:
> >> +            builtin = "_mm_srli_pi32";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRLDI:
> >> +            builtin = "_mm_srli_si64";
> >> +            break;
> >> +          case ARM_BUILTIN_WSLLHI:
> >> +            builtin = "_mm_slli_pi16";
> >> +            break;
> >> +          case ARM_BUILTIN_WSLLWI:
> >> +            builtin = "_mm_slli_pi32";
> >> +            break;
> >> +          case ARM_BUILTIN_WSLLDI:
> >> +            builtin = "_mm_slli_si64";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRAHI:
> >> +            builtin = "_mm_srai_pi16";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRAWI:
> >> +            builtin = "_mm_srai_pi32";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRADI:
> >> +            builtin = "_mm_srai_si64";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRLH:
> >> +            builtin = "_mm_srl_pi16";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRLW:
> >> +            builtin = "_mm_srl_pi32";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRLD:
> >> +            builtin = "_mm_srl_si64";
> >> +            break;
> >> +          case ARM_BUILTIN_WSLLH:
> >> +            builtin = "_mm_sll_pi16";
> >> +            break;
> >> +          case ARM_BUILTIN_WSLLW:
> >> +            builtin = "_mm_sll_pi32";
> >> +            break;
> >> +          case ARM_BUILTIN_WSLLD:
> >> +            builtin = "_mm_sll_si64";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRAH:
> >> +            builtin = "_mm_sra_pi16";
> >> +            break;
> >> +          case ARM_BUILTIN_WSRAW:
> >> +            builtin = "_mm_sra_si64";
> >> +            break;
> >> +          default:
> >> +            builtin = "_mm_sra_si64";
> >> +            break;
> >> +        }
> >> +          error ("the count should be no less than 0; please check the
> intrinsic %qs in code",
> >> +             builtin);
> >>           }
> >>       }
> >>         return arm_expand_binop_builtin (icode, exp, target);

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

end of thread, other threads:[~2022-03-07 10:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 10:09 [PATCH][ARM] translation: reuse string and use switch for codes Martin Liška
2022-03-07 10:12 ` Jakub Jelinek
2022-03-07 10:18   ` Martin Liška
2022-03-07 10:16 ` Martin Liška
2022-03-07 10:18 ` Christophe Lyon
2022-03-07 10:22   ` Martin Liška
2022-03-07 10:37     ` Kyrylo Tkachov

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