On Mon, 23 Sep 2024, Bradley Lucier via Gcc-help wrote: > So the use seems to be guarded by > > __has_builtin(__builtin_ia32_rdtscp) > > I compiled the code on the same machine that it failed on. So it thinks it > has the builtin and then it doesn't, right? This is a misunderstanding: __has_builtin checks if the compiler recognizes the builtin's name. Its main intended use is checking that the compiler is not too old for the builtin you're trying to use. And if the code used __builtin_ia32_rdtscp() the compiler would emit the rdtscp instruction. The builtin doesn't disappear depending on -march. > OK, so that gave me "x86-64". Does that mean that code generated by gcc-12 > will run on any processor on this page: > > https://gcc.gnu.org/onlinedocs/gcc-12.4.0/gcc/x86-Options.html > > from "nocona" on? The compiler doesn't check what's in your inline asm. If your inline asm has rdtscp, the binary will have rdtscp, and won't run on old CPUs. Alexander