[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 Richard Guenther changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||FIXED Target Milestone|--- |4.5.4 --- Comment #10 from Richard Guenther 2012-02-08 10:45:35 UTC --- Fixed for 4.5.4.
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #9 from Quentin Neill 2012-02-07 16:17:35 UTC --- Author: qneill Date: Tue Feb 7 16:17:26 2012 New Revision: 183973 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183973 Log: 2012-02-07 Quentin Neill Backport from mainline: 2012-01-19 Quentin Neill PR target/48743 * config/i386/driver-i386.c (host_detect_local_cpu): Also check family to distinguish PROCESSOR_ATHLON. Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/config/i386/driver-i386.c
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #8 from Quentin Neill 2012-01-19 20:15:38 UTC --- Author: qneill Date: Thu Jan 19 20:15:29 2012 New Revision: 183309 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183309 Log: 2012-01-19 Quentin Neill PR target/48743 * config/i386/driver-i386.c (host_detect_local_cpu): Also check family to distinguish PROCESSOR_ATHLON. Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/i386/driver-i386.c
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 Quentin Neill changed: What|Removed |Added CC||qneill at gcc dot gnu.org --- Comment #7 from Quentin Neill 2011-12-19 18:55:49 UTC --- Waiting to fix in 4.5 and 4.6 per Uros: http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00938.html Meanwhile, fixed in trunk (4.7) after testing on amdfam10 and bdver1: Author: qneill Date: Mon Dec 19 17:57:32 2011 New Revision: 182489 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182489 Log: 2011-12-19 Quentin Neill 2011-12-19 Quentin Neill PR target/48743 * config/i386/driver-i386.c (host_detect_local_cpu): Also check family to distinguish PROCESSOR_ATHLON. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/driver-i386.c
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #6 from Quentin Neill 2011-12-19 17:57:42 UTC --- Author: qneill Date: Mon Dec 19 17:57:32 2011 New Revision: 182489 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182489 Log: 2011-12-19 Quentin Neill 2011-12-19 Quentin Neill PR target/48743 * config/i386/driver-i386.c (host_detect_local_cpu): Also check family to distinguish PROCESSOR_ATHLON. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/driver-i386.c
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #5 from Joe Stroller 2011-06-16 15:10:30 UTC --- (In reply to comment #4) > Does this solve your problem? Yes! Thank you, Mikael, and apologies for not testing sooner. The fix in attachment 24326 works perfectly. I tested it on gcc 4.5.2, and the "if" that is changed is at line 509 on that version, but the structure is exactly the same. Now: # echo | gcc -dM -E - -march=native gcc -v -Q --help=target -march=native 2>&1 | grep march /usr/libexec/gcc/i586-pc-linux-gnu/4.5.2/cc1 -E -v help-dummy -D_FORTIFY_SOURCE=2 -march=k6-3 --param l1-cache-size=32 --param l1-cache-line-size=32 --param l2-cache-size=128 -mtune=k6 -fhelp=target -dM -march= k6-3 # cc -march=native -E -v - &1 | grep cc1 /usr/libexec/gcc/i586-pc-linux-gnu/4.5.2/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=k6-3 --param l1-cache-size=32 --param l1-cache-line-size=32 --param l2-cache-size=128 -mtune=k6 # Additionally I have recompiled my whole system with -march=native, and it is working perfectly. I would be very grateful if this were able to be incorporated into gcc.
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #4 from Mikael Pettersson 2011-05-22 14:23:21 UTC --- Created attachment 24326 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24326 untested fix The previous patch doesn't look quite right to me. The fundamental problem IMO is that the AMD CPU type detection only looks at feature flags without considering the CPUID family value. This (untested) patch qualifies the ambiguous feature test with a family test before assuming CPU == Athlon. Does this solve your problem?
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #3 from Zuxy 2011-05-12 08:27:56 UTC --- Created attachment 24233 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24233 Proposed patch For a brief time AMD produced K6-2+ and K6-3+ processors, targeting mobile market. These processors support Extended 3DNow! but not CMOV or Extended MMX (a subset of SSE) and are detected as Athlon by GCC so GCC will generate CMOV for them, leading to #UD. The patch solves the problem by differentiating K6 and Athlon by Extended MMX rather than Extended 3DNow!.
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #2 from Joe Stroller 2011-04-23 21:14:26 UTC --- Created attachment 24086 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24086 Raw output from Todd Allen's cpuid utility Raw output also attached. I think the AMD document "AMD Processor Recognition Application Note" may also be relevant: http://support.amd.com/us/Processor_TechDocs/20734.pdf
[Bug target/48743] -march=native mis-detects AMD K6-2+ / K6-3 as Athlon - compiled C fails with "illegal instruction"
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48743 --- Comment #1 from Joe Stroller 2011-04-23 21:12:35 UTC --- Created attachment 24085 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24085 Output from Todd Allen's cpuid utility Todd Allen's cpuid utility detects this CPU correctly. http://www.etallen.com/cpuid.html Output attached.