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]
Message-ID: <20210409130342.GF26583@gate.crashing.org>
Date:   Fri, 9 Apr 2021 08:03:42 -0500
From:   Segher Boessenkool <segher@...nel.crashing.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-toolchains@...r.kernel.org, linux-kernel@...r.kernel.org,
        jpoimboe@...hat.com, jbaron@...mai.com, rostedt@...dmis.org,
        ardb@...nel.org
Subject: Re: static_branch/jump_label vs branch merging

On Thu, Apr 08, 2021 at 06:52:18PM +0200, Peter Zijlstra wrote:
> Is there *any* way in which we can have the compiler recognise that the
> asm_goto only depends on its arguments and have it merge the branches
> itself?
> 
> I do realize that asm-goto being volatile this is a fairly huge ask, but
> I figured I should at least raise the issue, if only to raise awareness.

"volatile" should not be an impediment to this at all, volatile means
there is an unspecified side effect, nothing more, nothing less.  But
yes this currently does not work with GCC:

void f(int x)
{       if (x)
                asm volatile("ojee %0" :: "r"(x));
        else
                asm volatile("ojee %0" :: "r"(x));
}

or even

static inline void h(int x)
{
        asm volatile("ojee %0" :: "r"(x));
}

void f1(int x)
{       if (x)
                h(x);
        else
                h(x);
}

which both emit silly machine code.


Segher

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ