[MacPorts] #51642: GCC does not honor -march=native
#51642: GCC does not honor -march=native ------------------------+-------------------------------- Reporter: noloader@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Keywords: | Port: ------------------------+-------------------------------- I'm attempting a compile uder MacPort's GCC compiler: {{{ $ make CXX=/opt/local//bin/x86_64-apple-darwin12-gcc-4.9.3 /opt/local//bin/x86_64-apple-darwin12-gcc-4.9.3 -DNDEBUG -g2 -O2 -fPIC -march=native -pipe -c cryptlib.cpp :1057:no such instruction: `vzeroupper' :1507:no such instruction: `vzeroupper' :1517:no such instruction: `vzeroupper' :1662:no such instruction: `vzeroupper' :1838:no such instruction: `vzeroupper' ... }}} Piping it into `wc` reveals: {{{ $ make CXX=/opt/local//bin/x86_64-apple-darwin12-gcc-4.9.3 2>&1 | wc -l 190 }}} The machine is a 2012 MacBook Pro with a Core i7-2760QM. Broadly speaking, the cpu includes SSE4 and AES-NI, but lacks RDRAND and RDSEED: {{{ $ sysctl -a | grep machdep.cpu.features machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 }}} `vzeroupper` is part of AVX, and AVX is available in the cpu feature set. We have users who use a few MacPorts compilers, so I'm guessing additional testing will reveal the same issue under GCC 5.1 and 5.3. I'm only going to file this one report, however. ----- Here's some additional information that may be useful. {{{ $ port version Version: 2.3.4 }}} And: {{{ $ sysctl -a | grep machdep.cpu machdep.cpu.max_basic: 13 machdep.cpu.max_ext: 2147483656 machdep.cpu.vendor: GenuineIntel machdep.cpu.brand_string: Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz machdep.cpu.family: 6 machdep.cpu.model: 42 machdep.cpu.extmodel: 2 machdep.cpu.extfamily: 0 machdep.cpu.stepping: 7 machdep.cpu.feature_bits: 3219913727 532341759 machdep.cpu.extfeature_bits: 672139520 1 machdep.cpu.signature: 132775 machdep.cpu.brand: 0 machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP TSCI machdep.cpu.logical_per_package: 16 machdep.cpu.cores_per_package: 8 machdep.cpu.microcode_version: 26 machdep.cpu.processor_flag: 4 machdep.cpu.mwait.linesize_min: 64 machdep.cpu.mwait.linesize_max: 64 machdep.cpu.mwait.extensions: 3 machdep.cpu.mwait.sub_Cstates: 135456 machdep.cpu.thermal.sensor: 1 machdep.cpu.thermal.dynamic_acceleration: 1 machdep.cpu.thermal.invariant_APIC_timer: 1 machdep.cpu.thermal.thresholds: 2 machdep.cpu.thermal.ACNT_MCNT: 1 machdep.cpu.thermal.core_power_limits: 1 machdep.cpu.thermal.fine_grain_clock_mod: 1 machdep.cpu.thermal.package_thermal_intr: 1 machdep.cpu.thermal.hardware_feedback: 0 machdep.cpu.thermal.energy_policy: 0 machdep.cpu.xsave.extended_state: 7 832 832 0 machdep.cpu.arch_perf.version: 3 machdep.cpu.arch_perf.number: 4 machdep.cpu.arch_perf.width: 48 machdep.cpu.arch_perf.events_number: 7 machdep.cpu.arch_perf.events: 0 machdep.cpu.arch_perf.fixed_number: 3 machdep.cpu.arch_perf.fixed_width: 48 machdep.cpu.cache.linesize: 64 machdep.cpu.cache.L2_associativity: 8 machdep.cpu.cache.size: 256 machdep.cpu.tlb.inst.small: 64 machdep.cpu.tlb.inst.large: 8 machdep.cpu.tlb.data.small: 64 machdep.cpu.tlb.data.large: 32 machdep.cpu.tlb.shared: 512 machdep.cpu.address_bits.physical: 36 machdep.cpu.address_bits.virtual: 48 machdep.cpu.core_count: 4 machdep.cpu.thread_count: 8 }}} -- Ticket URL: <https://trac.macports.org/ticket/51642> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: GCC does not honor -march=native -------------------------+-------------------------------- Reporter: noloader@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: | -------------------------+-------------------------------- Comment (by noloader@…): I probably should have supplied this with the original report. Sorry about that. {{{ $ /opt/local/bin/x86_64-apple-darwin12-gcc-4.9.3 -march=native -dM -E - < /dev/null | sort #define _LP64 1 #define __AES__ 1 #define __APPLE_CC__ 1 #define __APPLE__ 1 #define __ATOMIC_ACQUIRE 2 #define __ATOMIC_ACQ_REL 4 #define __ATOMIC_CONSUME 1 #define __ATOMIC_HLE_ACQUIRE 65536 #define __ATOMIC_HLE_RELEASE 131072 #define __ATOMIC_RELAXED 0 #define __ATOMIC_RELEASE 3 #define __ATOMIC_SEQ_CST 5 #define __AVX__ 1 #define __BIGGEST_ALIGNMENT__ 32 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __CHAR16_TYPE__ short unsigned int #define __CHAR32_TYPE__ unsigned int #define __CHAR_BIT__ 8 #define __CONSTANT_CFSTRINGS__ 1 #define __DBL_DECIMAL_DIG__ 17 #define __DBL_DENORM_MIN__ ((double)4.94065645841246544177e-324L) #define __DBL_DIG__ 15 #define __DBL_EPSILON__ ((double)2.22044604925031308085e-16L) #define __DBL_HAS_DENORM__ 1 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __DBL_MANT_DIG__ 53 #define __DBL_MAX_10_EXP__ 308 #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX__ ((double)1.79769313486231570815e+308L) #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN__ ((double)2.22507385850720138309e-308L) #define __DEC128_EPSILON__ 1E-33DL #define __DEC128_MANT_DIG__ 34 #define __DEC128_MAX_EXP__ 6145 #define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL #define __DEC128_MIN_EXP__ (-6142) #define __DEC128_MIN__ 1E-6143DL #define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E- 6143DL #define __DEC32_EPSILON__ 1E-6DF #define __DEC32_MANT_DIG__ 7 #define __DEC32_MAX_EXP__ 97 #define __DEC32_MAX__ 9.999999E96DF #define __DEC32_MIN_EXP__ (-94) #define __DEC32_MIN__ 1E-95DF #define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF #define __DEC64_EPSILON__ 1E-15DD #define __DEC64_MANT_DIG__ 16 #define __DEC64_MAX_EXP__ 385 #define __DEC64_MAX__ 9.999999999999999E384DD #define __DEC64_MIN_EXP__ (-382) #define __DEC64_MIN__ 1E-383DD #define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD #define __DECIMAL_DIG__ 21 #define __DEC_EVAL_METHOD__ 2 #define __DYNAMIC__ 1 #define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1086 #define __FINITE_MATH_ONLY__ 0 #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __FLT_DECIMAL_DIG__ 9 #define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F #define __FLT_DIG__ 6 #define __FLT_EPSILON__ 1.19209289550781250000e-7F #define __FLT_EVAL_METHOD__ 0 #define __FLT_HAS_DENORM__ 1 #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MANT_DIG__ 24 #define __FLT_MAX_10_EXP__ 38 #define __FLT_MAX_EXP__ 128 #define __FLT_MAX__ 3.40282346638528859812e+38F #define __FLT_MIN_10_EXP__ ( }}} -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:1> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: GCC does not honor -march=native -------------------------+-------------------------------- Reporter: noloader@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: | -------------------------+-------------------------------- Comment (by ryandesign@…): Setting `CXX=/opt/local//bin/x86_64-apple-darwin12-gcc-4.9.3` is unusual. Usually, you would set `CXX=/opt/local/bin/g++-mp-4.9`. Have you tried that already? Does it change anything? Any particular reason you're using gcc 4.9.3? The latest stable version is 6.1.0, available in the gcc6 port. -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: GCC does not honor -march=native -------------------------+-------------------------------- Reporter: noloader@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: | -------------------------+-------------------------------- Comment (by ryandesign@…): Replying to [comment:2 ryandesign@…]:
Setting `CXX=/opt/local//bin/x86_64-apple-darwin12-gcc-4.9.3` is unusual. Usually, you would set `CXX=/opt/local/bin/g++-mp-4.9`. Have you tried that already? Does it change anything?
I guess they're both hardlinks to the same file so it shouldn't make any difference. Still, /opt/local/bin/g++-mp-4.9 is the recommended form, since it does not vary by processor, OS version, or minor gcc version number. -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:3> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: gcc49 @4.9.3: does not honor -march=native -------------------------+------------------- Reporter: noloader@… | Owner: mww@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: gcc49 | -------------------------+------------------- Changes (by ryandesign@…): * owner: macports-tickets@… => mww@… * port: => gcc49 -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:4> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: gcc49 @4.9.3: does not honor -march=native -------------------------+------------------- Reporter: noloader@… | Owner: mww@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: gcc49 | -------------------------+------------------- Comment (by noloader@…): Replying to [comment:2 ryandesign@…]:
Setting `CXX=/opt/local/bin/x86_64-apple-darwin12-gcc-4.9.3` is unusual. Usually, you would set `CXX=/opt/local/bin/g++-mp-4.9`. Have you tried that already? Does it change anything?
Yeah, Uri Blumenthal told me it was wrong. I couldn't gind a c++ compile, so I installed GCC and hoped it would do the right thing based on file extensions: $ port search 'g++' No match for g++ found $ port search '*g++*' No match for *g++* found $ port search 'g\+\+' No match for g\+\+ found $ port search '*g\+\+*' No match for *g\+\+* found
Any particular reason you're using gcc 4.9.3? The latest stable version is 6.1.0, available in the gcc6 port.
Yes. I am setting up tests for MacPorts GCC compilers using a 4.x, 5.x and 6.x. They will all be tested eventually. -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:5> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: gcc49 @4.9.3: does not honor -march=native -------------------------+------------------- Reporter: noloader@… | Owner: mww@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: gcc49 | -------------------------+------------------- Comment (by noloader@…): This is probably related to `-Wa,-q`. When I originally tried to use it, I used it with a typo: `-Wa,q`. The typo resulted in: {{{ $ /opt/local/bin/g++-mp-4.9 -Wa,q -c test.cxx as:file(q) Can't open source file for input! No such file or directory. }}} At that point, I thought the compiler did not support the option. Now that the typo has been corrected, it appears the option is supported: {{{ $ /opt/local/bin/g++-mp-4.9 -Wa,-q -c test.cxx /opt/local/bin/as: assembler (/opt/local/bin/clang) not installed }}} -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:6> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: gcc49 @4.9.3: does not honor -march=native -------------------------+------------------- Reporter: noloader@… | Owner: mww@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: gcc49 | -------------------------+------------------- Comment (by noloader@…): Its not clear to me if `-Wa-q` is the solution to the problem. We are trying to get our changes for MacPorts GCC tested now: [http://groups.google.com/forum/#!topic/cryptopp-users/9L6JyXpo_mk Need MacPorts testers who use GCC]. I'll report back if we hear something from one of the users. -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:7> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: gcc49 @4.9.3: does not honor -march=native -------------------------+------------------- Reporter: noloader@… | Owner: mww@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: gcc49 | -------------------------+------------------- Comment (by vince@…): I am sorry to butt in, but this sound to me like the old 'as' story. GCC 4 use Apple-supplied /usr/bin/as (or /opt/local/bin/as for that matter): {{{ as -v Apple Inc version cctools-877.8, GNU assembler version 1.38 }}} Which is so ancient it does not know about SSE 4 or AVX. Clang has its own modern assembly, and can (maybe?) be used as a backend for GCC -- Ticket URL: <https://trac.macports.org/ticket/51642#comment:8> MacPorts <https://www.macports.org/> Ports system for OS X
#51642: gcc49 @4.9.3: does not honor -march=native -------------------------+------------------- Reporter: noloader@… | Owner: mww@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: gcc49 | -------------------------+------------------- Comment (by vince@…): Replying to [comment:8 vince@…]:
I am sorry to butt in, but this sounds to me like the old 'as' story. GCC 4 use Apple-supplied /usr/bin/as (or /opt/local/bin/as for that matter):
{{{ as -v Apple Inc version cctools-877.8, GNU assembler version 1.38 }}} Which is so ancient it does not know about SSE 4 or AVX.
Clang has its own modern assembler, and can (maybe?) be used as a backend for GCC
-- Ticket URL: <https://trac.macports.org/ticket/51642#comment:9> MacPorts <https://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts