public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Use Reg0 instead of const0_rtx for TRAP
@ 2024-06-19 15:53 YunQiang Su
  2024-06-19 17:23 ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: YunQiang Su @ 2024-06-19 15:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: YunQiang Su

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.cc(mips_expand_conditional_trap): Use Reg0
	instead of const0_rtx.
---
 gcc/config/mips/mips.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 48924116937..ba1e6214656 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -6026,7 +6026,7 @@ mips_expand_conditional_trap (rtx comparison)
 
   emit_insn (gen_rtx_TRAP_IF (VOIDmode,
 			      gen_rtx_fmt_ee (code, mode, op0, op1),
-			      const0_rtx));
+			      gen_rtx_REG (mode, GP_REG_FIRST)));
 }
 \f
 /* Initialize *CUM for a call to a function of type FNTYPE.  */
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-20  5:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-19 15:53 [PATCH] MIPS: Use Reg0 instead of const0_rtx for TRAP YunQiang Su
2024-06-19 17:23 ` Maciej W. Rozycki
2024-06-20  3:20   ` YunQiang Su
2024-06-20  5:11     ` YunQiang Su

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).