Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-25 Thread Uros Bizjak via Gcc-patches
On Tue, Aug 24, 2021 at 5:22 PM Hongyu Wang wrote: > > Hi Uros, > > Sorry for the late update. I have tried adjusting the combine pass but > found it is not easy to modify shift const, so I came up with an > alternative solution with your patch. It matches the non-canonical > zero-extend in

Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-24 Thread Hongyu Wang via Gcc-patches
Hi Uros, Sorry for the late update. I have tried adjusting the combine pass but found it is not easy to modify shift const, so I came up with an alternative solution with your patch. It matches the non-canonical zero-extend in ix86_decompose_address and adjust ix86_rtx_cost to combine below

Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-16 Thread Uros Bizjak via Gcc-patches
On Mon, Aug 16, 2021 at 11:18 AM Hongyu Wang wrote: > > > So, the question is if the combine pass really needs to zero-extend > > with 0xfffe, the left shift << 1 guarantees zero in the LSB, so > > 0x should be better and in line with canonical zero-extension > > RTX. > > The shift

Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-16 Thread Hongyu Wang via Gcc-patches
> So, the question is if the combine pass really needs to zero-extend > with 0xfffe, the left shift << 1 guarantees zero in the LSB, so > 0x should be better and in line with canonical zero-extension > RTX. The shift mask is generated in simplify_shift_const_1: mask_rtx =

Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-16 Thread Uros Bizjak via Gcc-patches
On Fri, Aug 13, 2021 at 9:21 AM Uros Bizjak wrote: > > On Fri, Aug 13, 2021 at 2:48 AM Hongyu Wang wrote: > > > > Hi, > > > > For lea + zero_extendsidi insns, if dest of lea and src of zext are the > > same, combine them with single leal under 64bit target since 32bit > > register will be

Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-13 Thread Uros Bizjak via Gcc-patches
On Fri, Aug 13, 2021 at 2:48 AM Hongyu Wang wrote: > > Hi, > > For lea + zero_extendsidi insns, if dest of lea and src of zext are the > same, combine them with single leal under 64bit target since 32bit > register will be automatically zero-extended. > > Bootstrapped and regtested on

Re: [PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-12 Thread Hongyu Wang via Gcc-patches
Sorry for the typo, scan-assembler should be +/* { dg-final { scan-assembler "leal\[\\t \]\[^\\n\]*eax" } } */ +/* { dg-final { scan-assembler-not "movl\[\\t \]\[^\\n\]*eax" } } */ Hongyu Wang via Gcc-patches 于2021年8月13日周五 上午8:49写道: > > Hi, > > For lea + zero_extendsidi insns, if dest of lea

[PATCH] i386: Add peephole for lea and zero extend [PR 101716]

2021-08-12 Thread Hongyu Wang via Gcc-patches
Hi, For lea + zero_extendsidi insns, if dest of lea and src of zext are the same, combine them with single leal under 64bit target since 32bit register will be automatically zero-extended. Bootstrapped and regtested on x86_64-linux-gnu{-m32,}. Ok for master? gcc/ChangeLog: PR