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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
          Component|target                      |rtl-optimization
     Ever confirmed|1                           |0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Expand does:
;; _1 = *src_5(D);

(insn 7 6 0 (set (reg:SI 134 [ _1 ])
        (zero_extend:SI (mem:QI (reg/v/f:SI 138 [ srcD.2336 ]) [0 MEM[(const
uint8_tD.2311 *)src_5(D) clique 1 base 1]+0 S1 A8]))) "/app/example.cpp":5:21
-1
     (nil))

;; work_6 = ~_1;

(insn 8 7 9 (set (reg:SI 139)
        (not:SI (reg:SI 134 [ _1 ]))) "/app/example.cpp":5:13 -1
     (nil))

(insn 9 8 0 (set (reg/v:SI 136 [ workD.2339 ])
        (zero_extend:SI (subreg:QI (reg:SI 139) 0))) "/app/example.cpp":5:13 -1
     (nil))

The bigger issue we don't take into track of nonzerobits as much as we could.

Though the other issue when combine does the combining here:
Trying 7, 8 -> 9:
    7: r134:SI=zero_extend([r148:SI])
      REG_DEAD r148:SI
    8: r139:SI=~r134:SI
      REG_DEAD r134:SI
    9: r136:SI=zero_extend(r139:SI#0)
      REG_DEAD r139:SI
Failed to match this instruction:
(set (reg/v:SI 136 [ workD.2339 ])
    (zero_extend:SI (subreg:QI (not:SI (subreg:SI (mem:QI (reg:SI 148) [0
MEM[(const uint8_tD.2311 *)src_5(D) clique 1 base 1]+0 S1 A8]) 0)) 0)))



that could be just (xor (zero_extend:SI (mem:QI (reg:SI 148) [0 MEM[(const
uint8_tD.2311 *)src_5(D) clique 1 base 1]+0 S1 A8]) 0))) 255)
But I am not so sure combine knows how to simplify that ...

Reply via email to