LoongArch: Fix inconsistent description in *sge<u>_<X:mode><GPR:mode>

Message ID 20240304030307.12335-1-guojie@loongson.cn
State Accepted
Headers
Series LoongArch: Fix inconsistent description in *sge<u>_<X:mode><GPR:mode> |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Guo Jie March 4, 2024, 3:03 a.m. UTC
  The constraint of op[1] is inconsistent with the output template.

gcc/ChangeLog:

	* config/loongarch/loongarch.md
	(define_insn "*sge<u>_<X:mode><GPR:mode>"): Fix inconsistency
	error.

---
 gcc/config/loongarch/loongarch.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Xi Ruoyao March 4, 2024, 9:18 a.m. UTC | #1
On Mon, 2024-03-04 at 11:03 +0800, Guo Jie wrote:
> The constraint of op[1] is inconsistent with the output template.
> 
> gcc/ChangeLog:
> 
> 	* config/loongarch/loongarch.md
> 	(define_insn "*sge<u>_<X:mode><GPR:mode>"): Fix inconsistency
> 	error.
>
> ---
>  gcc/config/loongarch/loongarch.md | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/loongarch/loongarch.md
> b/gcc/config/loongarch/loongarch.md
> index f3b5c641fce..2d25374bdc9 100644
> --- a/gcc/config/loongarch/loongarch.md
> +++ b/gcc/config/loongarch/loongarch.md
> @@ -3357,10 +3357,10 @@ (define_insn "*sgt<u>_<X:mode><GPR:mode>"
>  
>  (define_insn "*sge<u>_<X:mode><GPR:mode>"
>    [(set (match_operand:GPR 0 "register_operand" "=r")
> -	(any_ge:GPR (match_operand:X 1 "register_operand" "r")
> +	(any_ge:GPR (match_operand:X 1 "arith_operand" "rI")
>  		     (const_int 1)))]

No, arith_operand is just register_operand or const_imm12_operand, but
comparing a const_imm12_operand with (const_int 1) should be folded into
a constant (even at -O0, AFAIK).  So allowing const_imm12_operand here
makes no benefit.

>    ""
> -  "slt<u>i\t%0,%.,%1"
> +  "slt<u>%i1\t%0,%.,%1"
>    [(set_attr "type" "slt")
>     (set_attr "mode" "<X:MODE>")])
>
  

Patch

diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
index f3b5c641fce..2d25374bdc9 100644
--- a/gcc/config/loongarch/loongarch.md
+++ b/gcc/config/loongarch/loongarch.md
@@ -3357,10 +3357,10 @@  (define_insn "*sgt<u>_<X:mode><GPR:mode>"
 
 (define_insn "*sge<u>_<X:mode><GPR:mode>"
   [(set (match_operand:GPR 0 "register_operand" "=r")
-	(any_ge:GPR (match_operand:X 1 "register_operand" "r")
+	(any_ge:GPR (match_operand:X 1 "arith_operand" "rI")
 		     (const_int 1)))]
   ""
-  "slt<u>i\t%0,%.,%1"
+  "slt<u>%i1\t%0,%.,%1"
   [(set_attr "type" "slt")
    (set_attr "mode" "<X:MODE>")])