On Wed, Jul 15, 2020 at 7:38 AM Mark Wielaard <m...@klomp.org> wrote: > > Hi Florian, > > I understand you want to discuss the x86_64 micro-architecture levels > only in this thread, but it would be nice to have a similar discussion > for other architectures. > > One thing that wasn't clear to me from this proposal is how the glibc > dynamic loader checks for the CPU feature flags. This is important for > valgrind since it can communicate those through different means. cpuid > interception, auxv AT_HWCAP/AT_HWCAP2 interception (but not AT_PLATFORM > at the moment) and of course we can generate SIGILL for unsupported > instructions. We currently don't intercept /proc/cpuinfo (but could).
In library, we can use <sys/platform/x86.h>: https://sourceware.org/pipermail/libc-alpha/2020-June/115546.html In GCC, we can use __builtin_cpu_supports. <sys/platform/x86.h> supports all features and __builtin_cpu_supports in GCC 11 supports all features which GCC has codegen for. > I think it is important to be precise here, because in the past this > has sometimes caused confusion. For example for how to check correctly > for avx, lzcnt, or fma[4] support. > > Thanks, > > Mark > > P.S. I don't particular like the numbered names, but well, bike-shed... -- H.J.