[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a05422be-8043-409e-817d-3dec9571dd15@zytor.com>
Date: Tue, 18 Mar 2025 12:08:56 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: mingo@...nel.org, linux-kernel@...r.kernel.org
Cc: Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
"Ahmed S . Darwish" <darwi@...utronix.de>,
Andrew Cooper <andrew.cooper3@...rix.com>,
John Ogness <john.ogness@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 4/5] x86/cpuid: Standardize on u32 in <asm/cpuid/api.h>
On 3/18/25 11:48, H. Peter Anvin wrote:
>
> One more thing is that we ought to be able to make cpuid a const
> function, allowing the compiler to elide multiple calls. (Slight warning
> for feature-enabling MSRs changing CPUID), but that would require
> changing the API to returning a structure, since a pure or const
> structure can't return values by reference.
>
So I experimented (test included) and found that gcc 14.2 does not seem
to merge the cpuid calls in this code, whereas clang 19.1 does.
-hpa
View attachment "cpuid.c" of type "text/x-csrc" (1262 bytes)
Powered by blists - more mailing lists