Re: [PATCH] x86/build/64: Prevent native builds from generating APX instructions

David Laight <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-kernel
Message-ID <20260802100808.754400af@pumpkin>
On Sat, 1 Aug 2026 17:00:36 -0700
"Chang S. Bae" <[email protected]> wrote:

> On 8/1/2026 4:44 AM, David Laight wrote:
> > 
> > Much like when AVX support was added, -march-native needs to check that the
> > operating system is saving the registers not that the cpu supports them.  
> 
> This GCC bug looks relevant:
> 
>    "__builtin_cpu_supports avx does not verify OS supports it"
>    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85100

Yes, except I thought it was much older...

> The resulting commit 059cc8aca774 ("i386: Enable AVX/AVX512 features 
> only if supported by OSXSAVE") switched the compiler to read XCR0 before 
> set_feature().
> 
> Similarly, the APX enablement commit e686416b6217 ("[APX_EGPR] Initial 
> support for APX_F") extends the XCR0 check to determine whether APX is 
> usable. So, the compiler seemingly won't emit APX instructions without 
> OS setting XCR0.APX.

Does that mean that this patch is completely unnecessary?

	David

> 
> Thanks,
> Chang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.