Thanks for the feedback.

The comparison between a const_imm12_operand and (const_int 1) does indeed

perform a universal process of constant folding before any tree based optimization.

I will fix it in patch v2.


在 2024/3/4 下午5:18, Xi Ruoyao 写道:
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>")])

Reply via email to