https://gcc.gnu.org/g:0b456434fe0f1d64291b7c6b3596c836c9519f85

commit r15-1604-g0b456434fe0f1d64291b7c6b3596c836c9519f85
Author: YunQiang Su <s...@gcc.gnu.org>
Date:   Wed Jun 19 23:48:26 2024 +0800

    MIPS: Output $0 for conditional trap if !ISA_HAS_COND_TRAPI
    
    MIPSr6 removes condition trap instructions with imm, so the instruction
    like `teq $2,imm` will be converted to
      li $at, imm
      teq $2, $at
    
    The current version of Gas cannot detect if imm is zero, and output
      teq $2, $0
    Let's do it in GCC.
    
    gcc
            * config/mips/mips.md(conditional_trap_reg): Output $0 instead
            of 0 if !ISA_HAS_COND_TRAPI.

Diff:
---
 gcc/config/mips/mips.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index f9da06663bb..737d2566ec8 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -1245,7 +1245,7 @@
                                 (match_operand:GPR 2 "reg_or_0_operand" "dJ")])
            (const_int 0))]
   "ISA_HAS_COND_TRAP && !ISA_HAS_COND_TRAPI"
-  "t%C0\t%z1,%2"
+  "t%C0\t%z1,%z2"
   [(set_attr "type" "trap")])
 
 (define_insn "*conditional_trap<mode>"

Reply via email to