https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Hongtao.liu from comment #2)
> I'm testing
> 
> 1 file changed, 3 insertions(+), 3 deletions(-)
> gcc/config/i386/i386.md | 6 +++---
> 
> modified   gcc/config/i386/i386.md
> @@ -10455,7 +10455,7 @@ (define_insn_and_split "*xordi_1_btc"
>  
>  ;; PR target/94790: Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b &
> mask)

Please remove the reference to the PR.

>  (define_insn_and_split "*xor2andn"
> -  [(set (match_operand:SWI248 0 "nonimmediate_operand")
> +  [(set (match_operand:SWI248 0 "register_operand")
>       (xor:SWI248
>         (and:SWI248
>           (xor:SWI248
> @@ -10464,8 +10464,7 @@ (define_insn_and_split "*xor2andn"
>           (match_operand:SWI248 3 "nonimmediate_operand"))
>         (match_dup 1)))
>      (clobber (reg:CC FLAGS_REG))]
> -  "(TARGET_BMI || TARGET_AVX512BW)
> -   && ix86_pre_reload_split ()"
> +  "TARGET_BMI && ix86_pre_reload_split ()"
>    "#"
>    "&& 1"
>    [(parallel [(set (match_dup 4)
> @@ -10486,6 +10485,7 @@ (define_insn_and_split "*xor2andn"
>             (clobber (reg:CC FLAGS_REG))])]
>  {
>    operands[1] = force_reg (<MODE>mode, operands[1]);
> +  operands[2] = force_reg (<MODE>mode, operands[2]);

You don't need to force this operand to reg, "and" will accept memory operand.
But please swap (match_dup 2) and (match_dup 3) here:

+   (parallel [(set (match_dup 5)
+               (and:SWI248
+                 (match_dup 2)
+                 (match_dup 3)))
+             (clobber (reg:CC FLAGS_REG))])

This will ease RA job a bit.

The patch is pre-approved with the above changes.

>    operands[3] = force_reg (<MODE>mode, operands[3]);
>    operands[4] = gen_reg_rtx (<MODE>mode);
>    operands[5] = gen_reg_rtx (<MODE>mode);
> 
> [back]

Reply via email to