[PATCH] simplify-rtx: Extend (truncate (*extract ...)) fold [PR87763]

Jakub Jelinek jakub@redhat.com
Thu Jan 30 17:33:00 GMT 2020


On Thu, Jan 30, 2020 at 10:23:35AM -0700, Jeff Law wrote:
> diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
> index 8e35357ea23..78c4cbe4753 100644
> --- a/gcc/config/m68k/m68k.md
> +++ b/gcc/config/m68k/m68k.md
> @@ -644,12 +644,12 @@
>    return m68k_output_branch_integer (code);
>  })
>  
> -(define_insn "cbranchsi4_btst_reg_insn_1"
> +(define_insn "cbranch<mode>4_btst_reg_insn_1"
>    [(set (pc)
>  	(if_then_else (match_operator 0 "equality_comparison_operator"
> -		       [(zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do,dQ")
> -					 (const_int 1)
> -					 (match_operand:SI 2 "const_int_operand" "n,n"))
> +		       [(zero_extract:I (match_operand:I 1 "nonimmediate_operand" "do,dQ")
> +					(const_int 1)
> +					(match_operand:I 2 "const_int_operand" "n,n"))
>  			(const_int 0)])
>  		      (label_ref (match_operand 3 ""))
>  		      (pc)))]
> @@ -665,8 +665,9 @@
>      }
>    else
>      {
> -      operands[2] = GEN_INT (31 - INTVAL (operands[2]));
> -      code = m68k_output_btst (operands[2], operands[1], code, 31);
> +      operands[2] = GEN_INT (GET_MODE_BITSIZE (GET_MODE (operands[1]))
> +			     - INTVAL (operands[2]) - 1);
> +      code = m68k_output_btst (operands[2], operands[1], code, GET_MODE_BITSIZE (GET_MODE (operands[1])) - 1);

s/GET_MODE (operands[1])/<MODE>mode/g ?
Also, the last line is too long.

	Jakub



More information about the Gcc-patches mailing list