]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
MIPS: Output $0 for conditional trap if !ISA_HAS_COND_TRAPI
authorYunQiang Su <syq@gcc.gnu.org>
Wed, 19 Jun 2024 15:48:26 +0000 (23:48 +0800)
committerYunQiang Su <syq@gcc.gnu.org>
Tue, 25 Jun 2024 08:29:09 +0000 (16:29 +0800)
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.

gcc/config/mips/mips.md

index f9da06663bb582b0c86c3aeddadcc28643c77039..737d2566ec809320377699e0c81d27c652abf1f2 100644 (file)
                                 (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>"