On Wed, 19 Jun 2024, YunQiang Su wrote:

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

 It seems like an output pattern issue with `*conditional_trap_reg<mode>' 
insn to me.

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

 IOW this just papers over the actual issue.

 FWIW,

  Maciej

Reply via email to