Why does combine turn zero_extract into lshiftrf?
Jeff Law
law@redhat.com
Thu Jun 24 18:12:00 GMT 2010
On 06/23/10 16:44, H.J. Lu wrote:
> On Tue, Jun 22, 2010 at 11:05 AM, Uros Bizjak<ubizjak@gmail.com> wrote:
>
>> On Mon, 2010-06-21 at 12:33 -0700, H.J. Lu wrote:
>>
>>> Hi,
>>>
>>> This patch adds 8bit divmov pattern for x86. X86 8bit divide
>>> instructions return result in AX with
>>>
>>> AL<- Quotient
>>> AH<- Remainder
>>>
>>> This patch models it and properly extends quotient. Tested
>>> on Intel64 with -m64 and -m32. There are no regressions.
>>> OK for trunk?
>>>
>>> BTW, there is only one divb used in subreg_get_info in
>>> gcc compilers. The old code is
>>>
>>> movzbl mode_size(%r13), %edi
>>> movzbl mode_size(%r14), %esi
>>> xorl %edx, %edx
>>> movl %edi, %eax
>>> divw %si
>>> testw %dx, %dx
>>> jne .L1194
>>>
>>> The new one is
>>>
>>> movzbl mode_size(%r13), %edi
>>> movl %edi, %eax
>>> divb mode_size(%r14)
>>> movzbl %ah, %eax
>>> testb %al, %al
>>> jne .L1194
>>>
>>>
>> Hm, something is not combined correctly, I'd say "testb %ah, %ah" is
>> optimal in the second case.
>>
>> Uros.
>>
>>
>>
> For some reason, combine tries to turn
>
> (insn 11 10 13 2 umod-6.c:4 (set (reg:QI 67)
> (subreg:QI (zero_extract:SI (reg:HI 69)
> (const_int 8 [0x8])
> (const_int 8 [0x8])) 0)) 91 {*movqi_extzv_2_rex64}
> (expr_list:REG_DEAD (reg:HI 69)
> (nil)))
>
> (insn 13 11 14 2 umod-6.c:4 (set (reg:CCZ 17 flags)
> (compare:CCZ (reg:QI 67)
> (const_int 0 [0]))) 0 {*cmpqi_ccno_1} (expr_list:REG_DEAD
> (reg:QI 67)
> (nil)))
>
> into
>
> (set (reg:CCZ 17 flags)
> (compare:CCZ (subreg:QI (lshiftrt:SI (subreg:SI (reg:HI 69) 0)
> (const_int 8 [0x8])) 0)
> (const_int 0 [0])))
>
I believe that's standard form within combine.c
jeff
More information about the Gcc-patches
mailing list