[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] bitops/32: Convert variable_ffs() and fls() zero-case handling to C
- To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: "H. Peter Anvin" <hpa@xxxxxxxxx>
- Date: Tue, 29 Apr 2025 14:23:55 -0700
- Cc: Ingo Molnar <mingo@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Alexander Usyskin <alexander.usyskin@xxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Mateusz Jończyk <mat.jonczyk@xxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Ard Biesheuvel <ardb@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 29 Apr 2025 21:24:49 +0000
- Dkim-filter: OpenDKIM Filter v2.11.0 mail.zytor.com 53TLNv1g590765
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On April 29, 2025 1:12:48 PM PDT, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>On Tue, 29 Apr 2025 at 12:13, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
>>
>> That would improve code generation for 32bit, but generally regress 64bit.
>>
>> Preloading the destination register with -1 is better than the CMOV form
>> emitted by the builtin; BSF's habit of conditionally not writing the
>> destination register *is* a CMOV of sorts.
>
>Right you are. So we'd need to do this just for the x86-32 case. Oh
>well. Ugly, but still prettier than what we have now, I guess.
>
> Linus
Could you file a gcc bug? Gcc shouldn't generate worse code than inline asm ...
|