lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 14 Sep 2020 19:06:29 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     mateusznosek0@...il.com
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        viro@...iv.linux.org.uk
Subject: Re: [RFC PATCH] fs: micro-optimization remove branches by adjusting
 flag values

On Mon, Sep 14, 2020 at 07:43:38PM +0200, mateusznosek0@...il.com wrote:
> From: Mateusz Nosek <mateusznosek0@...il.com>
> 
> 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.

[citation needed]

$ cat test.c 
int a(int x)
{
	int y = 0;

	if (x & 1)
		y |= 1;
	if (x & 2)
		y |= 2;

	return y;
}

$ objdump -d test.o
0000000000000000 <a>:
   0:   89 f8                   mov    %edi,%eax
   2:   83 e0 03                and    $0x3,%eax
   5:   c3                      retq   

Please stop submitting uglifying patches without checking they actually
improve anything.  GCC is smarter than you think it is.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ