Re: Builtin for consulting value analysis (better ffs() code gen)

2024-03-14 Thread Andrew Cooper via Gcc
On 14/03/2024 12:03 pm, Andreas Schwab wrote: > On Mär 14 2024, Andrew Cooper via Gcc wrote: > >> so any known-constant value can be folded.  What I'm dealing with is the >> remainder of the cases. > Which cases remain? None, thanks to the answers on this thread. The

Re: Builtin for consulting value analysis (better ffs() code gen)

2024-03-14 Thread Andrew Cooper via Gcc
On 14/03/2024 11:02 am, Florian Weimer wrote: > * Andrew Cooper via Gcc: > >> Anyway - is there a way of doing this that I've managed to overlook? > Use __builtin_ffs? > > I think there's some concern for GCC that some of the alternative x86-64 > implementatio

Re: Builtin for consulting value analysis (better ffs() code gen)

2024-03-14 Thread Andrew Cooper via Gcc
On 14/03/2024 6:04 am, Alexander Monakov wrote: > On Thu, 14 Mar 2024, Andrew Cooper via Gcc wrote: > >> I suppose that what I'm looking for is something a little like >> __builtin_constant_p() which can either be used in a straight if(), or >> in a __builtin_choose_ex

Builtin for consulting value analysis (better ffs() code gen)

2024-03-13 Thread Andrew Cooper via Gcc
Hello, I've come across an issue that I would have thought there would be a builtin for, but perhaps that's just wishful thinking.  I'd like to be able to write something like this:     if (__builtin_expr_is_true(x > 0))         ... // one thing     else         ... // something else This stems

Re: GCC 12 miscompilation of volatile asm (was: Re: [PATCH] arm64/io: Remind compiler that there is a memory side effect)

2022-04-05 Thread Andrew Cooper via Gcc
On 05/04/2022 14:04, Mark Rutland wrote: > On Tue, Apr 05, 2022 at 01:51:30PM +0100, Mark Rutland wrote: > My x86_64 test case is: > > Per compiler explorer (https://godbolt.org/z/cveff9hq5) GCC trunk currently > compiles this as: > > | msr_rmw_set_bits: > | mov rcx, rdi > | rdm

Re: Broken check rejecting -fcf-protection and -mindirect-branch=thunk-extern

2020-04-28 Thread Andrew Cooper via Gcc
On 28/04/2020 16:09, H.J. Lu wrote: > On Tue, Apr 28, 2020 at 8:06 AM Jan Beulich wrote: >> On 28.04.2020 17:00, H.J. Lu wrote: >>> On Tue, Apr 28, 2020 at 6:41 AM Andrew Cooper >>> wrote: On 28/04/2020 14:00, H.J. Lu wrote: > On Tue, Apr 28, 2020 at 5:43 AM Andrew Cooper > wrote:

Re: Broken check rejecting -fcf-protection and -mindirect-branch=thunk-extern

2020-04-28 Thread Andrew Cooper via Gcc
On 28/04/2020 14:00, H.J. Lu wrote: > On Tue, Apr 28, 2020 at 5:43 AM Andrew Cooper > wrote: >> Hello, >> >> I raised https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93654 but it has >> had nothing but tumbleweeds in months, and it is continuing to cause >> problems for Xen. >> >> During the Spectre

Broken check rejecting -fcf-protection and -mindirect-branch=thunk-extern

2020-04-28 Thread Andrew Cooper via Gcc
Hello, I raised https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93654 but it has had nothing but tumbleweeds in months, and it is continuing to cause problems for Xen. During the Spectre embargo period, it was specifically identified that kernels would need to be able to compile one single binary, w