[Bug rtl-optimization/82356] auto-vectorizing pack of 16->8 has a redundant AND after a shift

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 25 03:21:33 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2021-08-14 00:00:00         |2021-8-24

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With -O3 -fno-move-loop-invariants  -fno-gcse 
We get
Trying 38, 34 -> 39:
   38: r160:V8HI=[`*.LC0']
      REG_EQUAL const_vector
   34: r154:V8HI=r153:V8HI 0>>0x8
      REG_DEAD r153:V8HI
   39: r158:V8HI=r160:V8HI&r154:V8HI
      REG_DEAD r154:V8HI
Failed to match this instruction:
(parallel [
        (set (reg:V8HI 158)
            (and:V8HI (lshiftrt:V8HI (reg:V8HI 153 [ vect__1.12 ])
                    (const_int 8 [0x8]))
                (const_vector:V8HI [
                        (const_int 255 [0xff]) repeated x8
                    ])))
        (set (reg:V8HI 160)
            (mem/u/c:V8HI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [0  S16
A128]))
    ])
Failed to match this instruction:
(parallel [
        (set (reg:V8HI 158)
            (and:V8HI (lshiftrt:V8HI (reg:V8HI 153 [ vect__1.12 ])
                    (const_int 8 [0x8]))
                (const_vector:V8HI [
                        (const_int 255 [0xff]) repeated x8
                    ])))
        (set (reg:V8HI 160)
            (mem/u/c:V8HI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [0  S16
A128]))
    ])
Successfully matched this instruction:
(set (reg:V8HI 160)
    (mem/u/c:V8HI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [0  S16 A128]))
Failed to match this instruction:
(set (reg:V8HI 158)
    (and:V8HI (lshiftrt:V8HI (reg:V8HI 153 [ vect__1.12 ])
            (const_int 8 [0x8]))
        (const_vector:V8HI [
                (const_int 255 [0xff]) repeated x8
            ])))

Which we don't recongize the and part is not needed.

Also since we don't emit REG_EQUAL when using vector_csts, we needed to use
"-fno-move-loop-invariants  -fno-gcse ".


More information about the Gcc-bugs mailing list