>    The following committed patch solves
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94185
>
>    The patch was successfully bootstrapped and tested on x86-64.

This patch creates unoptimal sequence in reload:

(insn 64 63 248 10 (set (reg:DI 0 ax [161])
        (zero_extend:DI (mem/c:SI (plus:DI (reg/f:DI 6 bp)
                    (const_int -2152 [0xfffffffffffff798])) [7
%sfp+-2104 S4 A64]))) "pr94185.C":25:7 114 {*zero_extendsidi2}
     (nil))
(insn 248 64 65 10 (set (mem/c:DI (plus:DI (reg/f:DI 6 bp)
                (const_int -2152 [0xfffffffffffff798])) [7 %sfp+-2104 S8 A64])
        (reg:DI 0 ax [161])) "pr94185.C":25:7 66 {*movdi_internal}
     (nil))

using a temporary reg, resulting in:

    movl    -2152(%rbp), %eax    # 64    [c=9 l=6]  *zero_extendsidi2/3
    movq    %rax, -2152(%rbp)    # 248    [c=4 l=7]  *movdi_internal/5

Please note that the insn pattern could handle matched offsetable
memory in alternative 4:

(define_insn "*zero_extendsidi2"
  [(set (match_operand:DI 0 "nonimmediate_operand"
        "=r,?r,?o,r   ,o,?*y,?!*y,$r,$v,$x,*x,*v,*r,*k")
    (zero_extend:DI
     (match_operand:SI 1 "x86_64_zext_operand"
            "0 ,rm,r ,rmWz,0,r  ,m   ,v ,r ,m ,*x,*v,*k,*km")))]

memory operand is later split with:

(define_split
  [(set (match_operand:DI 0 "memory_operand")
         (zero_extend:DI (match_operand:SI 1 "memory_operand")))]
  "reload_completed"
  [(set (match_dup 4) (const_int 0))]
  "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")

And would result in a single SImode move of 0 to the high part of the
memory location.

Uros.

Reply via email to