Hide Forgot
Description of problem: Compiler options should be separated by spaces. The implied use of -mavx concatenates this option to the previous option on the compiler command line. Version-Release number of selected component (if applicable): gcc44-4.4.4-13.el5 How reproducible: Always Steps to Reproduce: 1. On system with AMD Bulldozer run this: gcc44 -march=native -o main.o main.c Actual results: $ gcc44 -march=native -o main.o main.c cc1: error: unrecognized command line option "-mxop-mavx" Expected results: There should be a space between the -mxop and -mavx options Additional info: $ cat /proc/cpuinfo | grep "model name" model name : AMD FX(tm)-8120 Eight-Core Processor
Created attachment 557276 [details] Fix spacing of concatenated compiler switches Syntax example #1: $ grep -r mxop gcc-4.4.4-20100726/gcc/config/i386/ | grep concat gcc-4.4.4-20100726/gcc/config/i386/driver-i386.c: options = concat (options, " -mxop", NULL); Syntax example #2: $ grep -r mavx gcc-4.4.4-20100726/gcc/config/i386/ | grep concat gcc-4.4.4-20100726/gcc/config/i386/driver-i386.c: options = concat (options, "-mavx ", NULL); Note how in example #1 a space char precedes the switch being appended, while in example #2 a space trails the switch. The result is that gcc44 sends the string "-mxop-mavx " to cc1 for compilation. The fix is all switches must be handled the same. As most of them have trailing spaces I changed the -mfma4 and -mxop from each having a leading space to each having a trailing space.
This bug basically precludes the use of the "-march=native" on CPUs that have the XOP and/or FMA4 features. It sure would be nice (hint, hint) if this made it into a bug-fix release soon, instead of having to wait for RHEL v5.8 -------- $ gcc44 -march=native -o main.o main.c cc1: error: unrecognized command line option "-mxop-mavx" $ gcc44 -march=native -mno-xop -o main.o main.c cc1: error: unrecognized command line option "-mxop-mavx" $ gcc44 -march=native -mno-avx -o main.o main.c cc1: error: unrecognized command line option "-mxop-mavx" $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 21 model : 1 model name : AMD FX(tm)-8120 Eight-Core Processor stepping : 2 cpu MHz : 3121.221 cache size : 2048 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 4 apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc nonstop_tsc pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy altmovcr8 abm sse4a misalignsse 3dnowprefetch osvw ibs bogomips : 6242.44 TLB size : 1536 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm 100mhzsteps hwpstate [8] [9]
FYI, here's an easier way to see the badness: # gcc44 -march=native -E -v - </dev/null 2>&1 | grep cc1 /usr/libexec/gcc/x86_64-redhat-linux6E/4.4.4/cc1 -E -quiet -v - -march=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mfma4 -mxop-mavx --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver1 cc1: error: unrecognized command line option "-mxop-mavx" And again, the evilness of the misplaced space char: # gcc44 -march=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mfma4 -mxop -mavx --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -O2 -o main-bdver main.c as: unrecognized option `-msse2avx'
-msse2avx is a correct assembler option. gcc44 at least in RHEL6.2+ should pick up the alternate binutils package and should handle that option just fine. The other fixes committed to SVN, queued for errata: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183520
FYI, this also occurs on RHEL6 with the current GCC package: $ rpm -q gcc gcc-4.4.6-3.el6.x86_64 $ gcc -m64 -O2 -g -march=native -I. -c -o example.o test/example.c cc1: error: unrecognized command line option "-mxop-msse4.2" $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 21 model : 1 model name : AMD Opteron(TM) Processor 6234 stepping : 2 cpu MHz : 2399.636 cache size : 512 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 8 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb lm rep_good extd_apicid unfair_spinlock pni ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch xop xsaveopt npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bogomips : 4799.27 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management:
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux release for currently deployed products. This request is not yet committed for inclusion in a release.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0030.html