On 9/23/24 15:14, Jonathan Wakely wrote:
On Mon, 23 Sept 2024 at 19:21, Bradley Lucier via Gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
On 9/23/24 13:51, Alexander Monakov wrote:
On Mon, 23 Sep 2024, Bradley Lucier via Gcc-help wrote:
#ifdef ___CPU_x86
#if __has_builtin(__builtin_ia32_rdtscp)
This will always be true on x86_64, even for an -march that doesn't
support the instruction. What __has_builtin tells you is that GCC
knows that built-in function, not that the instruction is available in
the current instruction set selected by -march.
Thank you for that explanation (and the ones below).
Is there a way to test in the C source whether the architecture you're
compiling for has a specific instruction?
#undef ___USE___builtin_ia32_rdtscp
#define ___USE___builtin_ia32_rdtscp
This is a reserved name, unless your library is part of the kernel or
the C library or the C compiler, you should not be defining names
starting with double underscores.
These names start with three underscores. I suppose that means they
also start with two underscores, but otherwise I don't know what
difference that makes. This part is not my code.
Brad