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

"Chang S. Bae" <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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

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.

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.