* [PATCH] LoongArch: Remove unused and incorrect "sge<u>_<X:mode><GPR:mode>" define_insn
@ 2024-03-13 13:03 Xi Ruoyao
2024-03-14 7:58 ` chenglulu
0 siblings, 1 reply; 2+ messages in thread
From: Xi Ruoyao @ 2024-03-13 13:03 UTC (permalink / raw)
To: gcc-patches; +Cc: chenglulu, i, xuchenghua, Xi Ruoyao
If this insn is really used, we'll have something like
slti $r4,$r0,$r5
in the code. The assembler will reject it because slti wants 2
register operands and 1 immediate operand. But we've not got any bug
report for this, indicating this define_insn is unused at all.
Note that do_store_flag (in expr.cc) is already converting x >= 1 to
x > 0 unconditionally, so this define_insn is indeed unused and we can
just remove it.
gcc/ChangeLog:
* config/loongarch/loongarch.md (any_ge): Remove.
(sge<u>_<X:mode><GPR:mode>): Remove.
---
Not fully tested but should be obvious. Ok for trunk?
gcc/config/loongarch/loongarch.md | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
index 525e1e82183..18fd9c1e7d5 100644
--- a/gcc/config/loongarch/loongarch.md
+++ b/gcc/config/loongarch/loongarch.md
@@ -517,7 +517,6 @@ (define_code_iterator equality_op [eq ne])
;; These code iterators allow the signed and unsigned scc operations to use
;; the same template.
(define_code_iterator any_gt [gt gtu])
-(define_code_iterator any_ge [ge geu])
(define_code_iterator any_lt [lt ltu])
(define_code_iterator any_le [le leu])
@@ -3355,15 +3354,6 @@ (define_insn "*sgt<u>_<X:mode><GPR:mode>"
[(set_attr "type" "slt")
(set_attr "mode" "<X: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")
- (const_int 1)))]
- ""
- "slt<u>i\t%0,%.,%1"
- [(set_attr "type" "slt")
- (set_attr "mode" "<X:MODE>")])
-
(define_insn "*slt<u>_<X:mode><GPR:mode>"
[(set (match_operand:GPR 0 "register_operand" "=r")
(any_lt:GPR (match_operand:X 1 "register_operand" "r")
--
2.44.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] LoongArch: Remove unused and incorrect "sge<u>_<X:mode><GPR:mode>" define_insn
2024-03-13 13:03 [PATCH] LoongArch: Remove unused and incorrect "sge<u>_<X:mode><GPR:mode>" define_insn Xi Ruoyao
@ 2024-03-14 7:58 ` chenglulu
0 siblings, 0 replies; 2+ messages in thread
From: chenglulu @ 2024-03-14 7:58 UTC (permalink / raw)
To: Xi Ruoyao, gcc-patches; +Cc: i, xuchenghua
在 2024/3/13 下午9:03, Xi Ruoyao 写道:
> If this insn is really used, we'll have something like
>
> slti $r4,$r0,$r5
>
> in the code. The assembler will reject it because slti wants 2
> register operands and 1 immediate operand. But we've not got any bug
> report for this, indicating this define_insn is unused at all.
>
> Note that do_store_flag (in expr.cc) is already converting x >= 1 to
> x > 0 unconditionally, so this define_insn is indeed unused and we can
> just remove it.
>
> gcc/ChangeLog:
>
> * config/loongarch/loongarch.md (any_ge): Remove.
> (sge<u>_<X:mode><GPR:mode>): Remove.
> ---
>
> Not fully tested but should be obvious. Ok for trunk?
LGTM!
Thanks!
>
> gcc/config/loongarch/loongarch.md | 10 ----------
> 1 file changed, 10 deletions(-)
>
> diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
> index 525e1e82183..18fd9c1e7d5 100644
> --- a/gcc/config/loongarch/loongarch.md
> +++ b/gcc/config/loongarch/loongarch.md
> @@ -517,7 +517,6 @@ (define_code_iterator equality_op [eq ne])
> ;; These code iterators allow the signed and unsigned scc operations to use
> ;; the same template.
> (define_code_iterator any_gt [gt gtu])
> -(define_code_iterator any_ge [ge geu])
> (define_code_iterator any_lt [lt ltu])
> (define_code_iterator any_le [le leu])
>
> @@ -3355,15 +3354,6 @@ (define_insn "*sgt<u>_<X:mode><GPR:mode>"
> [(set_attr "type" "slt")
> (set_attr "mode" "<X: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")
> - (const_int 1)))]
> - ""
> - "slt<u>i\t%0,%.,%1"
> - [(set_attr "type" "slt")
> - (set_attr "mode" "<X:MODE>")])
> -
> (define_insn "*slt<u>_<X:mode><GPR:mode>"
> [(set (match_operand:GPR 0 "register_operand" "=r")
> (any_lt:GPR (match_operand:X 1 "register_operand" "r")
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-14 7:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 13:03 [PATCH] LoongArch: Remove unused and incorrect "sge<u>_<X:mode><GPR:mode>" define_insn Xi Ruoyao
2024-03-14 7:58 ` chenglulu
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).