Re: [RFC PATCH] fs: micro-optimization remove branches by adjusting flag values

2020-09-14 Thread Al Viro
On Mon, Sep 14, 2020 at 07:06:29PM +0100, Matthew Wilcox wrote: > $ objdump -d test.o > : >0: 89 f8 mov%edi,%eax >2: 83 e0 03and$0x3,%eax >5: c3 retq > > Please stop submitting uglifying patches wi

Re: [RFC PATCH] fs: micro-optimization remove branches by adjusting flag values

2020-09-14 Thread Al Viro
On Mon, Sep 14, 2020 at 07:43:38PM +0200, mateusznos...@gmail.com wrote: > From: Mateusz Nosek > > When flags A and B have equal values than the following code > > if(flags1 & A) > flags2 |= B; > > is equivalent to > > flags2 |= (flags1 & A); > > The latter code should generate less ins

Re: [RFC PATCH] fs: micro-optimization remove branches by adjusting flag values

2020-09-14 Thread Matthew Wilcox
On Mon, Sep 14, 2020 at 07:43:38PM +0200, mateusznos...@gmail.com wrote: > From: Mateusz Nosek > > When flags A and B have equal values than the following code > > if(flags1 & A) > flags2 |= B; > > is equivalent to > > flags2 |= (flags1 & A); > > The latter code should generate less ins

[RFC PATCH] fs: micro-optimization remove branches by adjusting flag values

2020-09-14 Thread mateusznosek0
From: Mateusz Nosek When flags A and B have equal values than the following code if(flags1 & A) flags2 |= B; is equivalent to flags2 |= (flags1 & A); The latter code should generate less instructions and be faster as one branch is omitted in it. Introduced patch changes the value of