[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250513200619.GJ2023217@ZenIV>
Date: Tue, 13 May 2025 21:06:19 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>, dan.j.williams@...el.com,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
David Lechner <dlechner@...libre.com>,
Ingo Molnar <mingo@...nel.org>,
"Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>,
Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>
Subject: Re: [PATCH 1/7] cleanup: Introduce DEFINE_ACQUIRE() a CLASS() for
conditional locking
On Tue, May 13, 2025 at 12:46:29PM -0700, Linus Torvalds wrote:
> Right now IS_ERR_OR_NULL() generates pretty disgusting code, with
> clang doing things like this:
>
> testq %rdi, %rdi
> sete %al
> cmpq $-4095, %rdi # imm = 0xF001
> setae %cl
> orb %al, %cl
> je .LBB3_1
>
> in order to avoid two jumps, while gcc generates that
>
> testq %rdi, %rdi
> je .L189
> cmpq $-4096, %rdi
> ja .L189
>
> pattern.
FWIW (unsigned long)v - 1 >= (unsigned long)(-MAX_ERRNO-1) yields
leaq -1(%rdi), %rax
cmpq $-4097, %rax
ja .L4
from gcc and
leaq 4095(%rdi), %rax
cmpq $4095, %rax # imm = 0xFFF
ja .LBB0_1
from clang...
Powered by blists - more mailing lists