https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66593
Bug ID: 66593 Summary: driver-i386.c: -mtune=native unavailable with non-bootstrapped build of libgccjit with gcc < 5 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org CC: uros at gcc dot gnu.org Target Milestone: --- Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu Build: x86_64-unknown-linux-gnu Currently libgccjit uses -mtune=generic; I'm working on enabling -mtune=native for libgccjit. However, on i386/x86_64 with a non-bootstrap build using gcc < 5, host_detect_local_cpu does nothing. This is due to: commit b587c12551143c14f023860a1dbdf7316ae71f27 Author: uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Oct 17 06:00:58 2014 +0000 * config/i386/cpuid.h (__cpuid): Remove definitions that handle %ebx register in a special way. (__cpuid_count): Ditto. * config/i386/driver-i386.h: Protect with "#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__))". (host_detect_local_cpu): Mention that GCC with non-fixed %ebx is required to compile the function. Uros said (in https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01516.html): > The only drawback would be that non-bootstrapped build with gcc < 5.0 > will ignore -march=native, but I think this should be acceptable." Jakub said (in https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01520.html): > At least on Linux, driver-i386.c should not be built with PIC normally, > so at least changing > #if __GNUC__ >= 5 > to > #if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__)) > would limit the -march=native change for non-bootstrapped compilers to > Darwin only (or what other targets use PIC by default?). The jit builds with PIC, and -mtune=native would be highly appropriate for jitted-code; so this is a somewhat bigger deal. Currently the instructions for building libgccjit recommend --disable-bootstrap, so everyone following those on i386/x86_64 with gcc < 5 as the system compiler is going to get a hobbled -mtune=native. That said, the above code runs inside the driver, and libgccjit doesn't yet run that part of the driver, so some extra work will be needed by me on top of this before we can get it to do better than -mtune=generic.