Re: [PATCH 5/8] middle-end: Add cltz_complement idiom recognition

2022-11-24 Thread Richard Biener via Gcc-patches
On Mon, Nov 21, 2022 at 4:53 PM Andrew Carlotti wrote: > > On Mon, Nov 14, 2022 at 04:10:22PM +0100, Richard Biener wrote: > > On Fri, Nov 11, 2022 at 7:53 PM Andrew Carlotti via Gcc-patches > > wrote: > > > > > > This recognises patterns of the form: > > > while (n) { n >>= 1 } > > > > > > This

Re: [PATCH 5/8] middle-end: Add cltz_complement idiom recognition

2022-11-21 Thread Andrew Carlotti via Gcc-patches
On Mon, Nov 14, 2022 at 04:10:22PM +0100, Richard Biener wrote: > On Fri, Nov 11, 2022 at 7:53 PM Andrew Carlotti via Gcc-patches > wrote: > > > > This recognises patterns of the form: > > while (n) { n >>= 1 } > > > > This patch results in improved (but still suboptimal) codegen: > > > > foo (uns

Re: [PATCH 5/8] middle-end: Add cltz_complement idiom recognition

2022-11-14 Thread Richard Biener via Gcc-patches
On Fri, Nov 11, 2022 at 7:53 PM Andrew Carlotti via Gcc-patches wrote: > > This recognises patterns of the form: > while (n) { n >>= 1 } > > This patch results in improved (but still suboptimal) codegen: > > foo (unsigned int b) { > int c = 0; > > while (b) { > b >>= 1; > c

[PATCH 5/8] middle-end: Add cltz_complement idiom recognition

2022-11-11 Thread Andrew Carlotti via Gcc-patches
This recognises patterns of the form: while (n) { n >>= 1 } This patch results in improved (but still suboptimal) codegen: foo (unsigned int b) { int c = 0; while (b) { b >>= 1; c++; } return c; } foo: .LFB11: .cfi_startproc cbz w0, .L3