Re: [PATCH] i386: Improve extensions of __builtin_clz and constant - __builtin_clz for -mno-lzcnt [PR78103]

2021-07-31 Thread H.J. Lu via Gcc-patches
On Fri, Jul 30, 2021 at 6:27 AM Jakub Jelinek via Gcc-patches wrote: > > On Fri, Jul 30, 2021 at 12:27:39PM +0200, Uros Bizjak wrote: > > Please put some space here, e.g.: > ... > > Can you just name the relevant insn pattern and use > > > > emit_insn (gen_bsr_1)? > > Here is the updated patch.

Re: [PATCH] i386: Improve extensions of __builtin_clz and constant - __builtin_clz for -mno-lzcnt [PR78103]

2021-07-31 Thread H.J. Lu via Gcc-patches
On Sat, Jul 31, 2021 at 12:38 PM H.J. Lu wrote: > > On Fri, Jul 30, 2021 at 6:27 AM Jakub Jelinek via Gcc-patches > wrote: > > > > On Fri, Jul 30, 2021 at 12:27:39PM +0200, Uros Bizjak wrote: > > > Please put some space here, e.g.: > > ... > > > Can you just name the relevant insn pattern and

Re: [PATCH] i386: Improve extensions of __builtin_clz and constant - __builtin_clz for -mno-lzcnt [PR78103]

2021-07-31 Thread H.J. Lu via Gcc-patches
On Fri, Jul 30, 2021 at 6:27 AM Jakub Jelinek via Gcc-patches wrote: > > On Fri, Jul 30, 2021 at 12:27:39PM +0200, Uros Bizjak wrote: > > Please put some space here, e.g.: > ... > > Can you just name the relevant insn pattern and use > > > > emit_insn (gen_bsr_1)? > > Here is the updated patch.

Re: [PATCH] i386: Improve extensions of __builtin_clz and constant - __builtin_clz for -mno-lzcnt [PR78103]

2021-07-30 Thread Jakub Jelinek via Gcc-patches
On Fri, Jul 30, 2021 at 12:27:39PM +0200, Uros Bizjak wrote: > Please put some space here, e.g.: ... > Can you just name the relevant insn pattern and use > > emit_insn (gen_bsr_1)? Here is the updated patch. I'll bootstrap/regtest it tonight. 2021-07-30 Jakub Jelinek PR

Re: [PATCH] i386: Improve extensions of __builtin_clz and constant - __builtin_clz for -mno-lzcnt [PR78103]

2021-07-30 Thread Uros Bizjak via Gcc-patches
On Wed, Jul 28, 2021 at 10:36 AM Jakub Jelinek wrote: > > Hi! > > This patch improves emitted code for the non-TARGET_LZCNT case. > As __builtin_clz* is UB on 0 argument and for !TARGET_LZCNT > CLZ_VALUE_DEFINED_AT_ZERO is 0, it is UB even at RTL time and so we > can take advantage of that and

[PATCH] i386: Improve extensions of __builtin_clz and constant - __builtin_clz for -mno-lzcnt [PR78103]

2021-07-28 Thread Jakub Jelinek via Gcc-patches
Hi! This patch improves emitted code for the non-TARGET_LZCNT case. As __builtin_clz* is UB on 0 argument and for !TARGET_LZCNT CLZ_VALUE_DEFINED_AT_ZERO is 0, it is UB even at RTL time and so we can take advantage of that and assume the result will be 0 to 31 or 0 to 63. Given that, sign or zero