This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Simplification of combine patterns with subreg and zero_extract


Combine is trying to find this instruction (when compiling _popcountsi2 from
libgcc2.c for my i8086 experiment):

(set (subreg:QI (reg:HI 30) 0)
    (mem/s/u:QI (plus:HI (subreg:HI (zero_extract:SI (subreg:HI (reg/v:SI 22 [ x ]) 0)
                    (const_int 8 [0x8])
                    (const_int 8 [0x8])) 0)
            (reg/f:HI 25)) [0 __popcount_tab S1 A8]))

The part

(subreg:HI (zero_extract:SI (subreg:HI (reg/v:SI 22 [ x ]) 0)
                    (const_int 8 [0x8])
                    (const_int 8 [0x8])) 0)

should, IMHO, be simplified to

(zero_extract:HI (subreg:HI (reg/v:SI 22 [ x ]) 0)
                    (const_int 8 [0x8])
                    (const_int 8 [0x8]))

or perhaps

(subreg:HI (zero_extract:SI (reg/v:SI 22 [ x ])
                    (const_int 8 [0x8])
                    (const_int 8 [0x8])) 0)

or maybe even

(zero_extract:HI (reg/v:SI 22 [ x ])
                    (const_int 8 [0x8])
                    (const_int 8 [0x8]))

which seems to be the simplest way of saying "zero extend byte 1 of
register 22 to 16 bits".

Also, is there a function for simplifying a zero_extract?

-- 
Rask Ingemann Lambertsen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]