[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 Jakub Jelinek changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #20 from Jakub Jelinek 2012-10-03 18:48:30 UTC --- Seems H.J. has committed this already: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192044 http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192045 http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192046
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 Jakub Jelinek changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #19 from Jakub Jelinek 2012-10-03 18:06:29 UTC --- The patch looks good to me, but patches should be posted to gcc-patches at gcc.gnu.org mailing list instead.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #18 from Andrew W. Nosenko 2012-10-03 17:36:28 UTC --- Created attachment 28342 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28342 Followup patch for config/i386/driver-i386.c
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 Andrew W. Nosenko changed: What|Removed |Added CC||andrew.w.nosenko at gmail ||dot com --- Comment #17 from Andrew W. Nosenko 2012-10-03 17:32:51 UTC --- Sorry, but commited patch does NOT fixes the problem. It does just reverse -- disables AVX & Co on systems the has OSXSAVE, XSTATE_SSE and XSTATE_YMM bits set, while the intention was to disable if any of these bits are not set. Proposed followup patch is attached.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 H.J. Lu changed: What|Removed |Added Status|WAITING |RESOLVED Resolution||FIXED Target Milestone|--- |4.6.4 --- Comment #16 from H.J. Lu 2012-10-02 20:32:39 UTC --- Fixed.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #15 from hjl at gcc dot gnu.org 2012-10-02 20:31:43 UTC --- Author: hjl Date: Tue Oct 2 20:31:40 2012 New Revision: 192004 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192004 Log: Check SSE and YMM state support for -march=native Backported from mainline PR target/54741 * config/i386/driver-i386.c (XCR_XFEATURE_ENABLED_MASK): New. (XSTATE_FP): Likewise. (XSTATE_SSE): Likewise. (XSTATE_YMM): Likewise. (host_detect_local_cpu): Disable AVX, FMA, FMA4 and XOP if SSE and YMM states aren't supported. Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/i386/driver-i386.c
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #14 from hjl at gcc dot gnu.org 2012-10-02 20:25:13 UTC --- Author: hjl Date: Tue Oct 2 20:25:04 2012 New Revision: 192003 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192003 Log: Check SSE and YMM state support for -march=native Backported from mainline PR target/54741 * config/i386/driver-i386.c (XCR_XFEATURE_ENABLED_MASK): New. (XSTATE_FP): Likewise. (XSTATE_SSE): Likewise. (XSTATE_YMM): Likewise. (host_detect_local_cpu): Disable AVX, AVX2, FMA, FMA4 and XOP if SSE and YMM states aren't supported. Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/i386/driver-i386.c
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #13 from hjl at gcc dot gnu.org 2012-10-02 19:49:05 UTC --- Author: hjl Date: Tue Oct 2 19:49:01 2012 New Revision: 191998 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191998 Log: Check SSE and YMM state support for -march=native 2012-10-02 H.J. Lu PR target/54741 * config/i386/driver-i386.c (XCR_XFEATURE_ENABLED_MASK): New. (XSTATE_FP): Likewise. (XSTATE_SSE): Likewise. (XSTATE_YMM): Likewise. (host_detect_local_cpu): Disable AVX, AVX2, FMA, FMA4 and XOP if SSE and YMM states aren't supported. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/driver-i386.c
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #12 from M.S. Babaei 2012-10-02 17:00:28 UTC --- Created attachment 28327 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28327 After applying patch - gcc4.7
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #11 from M.S. Babaei 2012-10-02 16:58:57 UTC --- Well well, something happened here!! This bug does not affect me anymore; Now with or without your patch the above example code works just fine! I even tried crypto++ which I had problem with in the past but it works fine too. # uname -a FreeBSD 13x17.localhost 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Sat Sep 29 20:53:22 IRST 2012 babaei@13x17.localhost:/usr/obj/usr/src/sys/GENERIC amd64 Two days ago I upgraded my system to 9-STABLE branch (a development branch), looks like the FreeBSD folks implemented AVX support into thier kernel. Hopefully I kept the old kernel. I rebuilt GCC 4.7 with your patch (GCC 4.6.4 is my system wide GCC and I'll won't mess with that one). Then I booted to the old kernel and rebuilt the above example code and, hell yeah!! Your patch does the job, the program finished normally with 'Hello, World!' printed out on screen (Note: with old kernel without your patch, it still get killed by SIGILL). Since this is a development branch and is not out yet I believe your patch is still relevant. Because out there 9.0, 8.3 and 7.4 is being used by people. And one more thing. Your patch is little different from my 'driver-i386.c' file (gcc-4.7-20120929) and my patch command failed to merge it. I merged your patch manually which is attached.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #10 from Uros Bizjak 2012-10-02 09:59:39 UTC --- (In reply to comment #7) > Created attachment 28312 [details] > A patch with fixed ChangeLog The patch looks OK, but please introduce some #defines: #define XCR_XFEATURE_ENABLED_MASK 0x0 #define XSTATE_FP 0x1 #define XSTATE_SSE 0x2 #define XSTATE_YMM 0x4 (Please see testsuite/gcc.target/i386/avx-os-support.h)
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #9 from M.S. Babaei 2012-10-02 07:18:23 UTC --- (In reply to comment #7) > Created attachment 28312 [details] > A patch with fixed ChangeLog Now I'm at work. I'll try your patch to build GCC and post later.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #8 from M.S. Babaei 2012-10-02 07:14:32 UTC --- (In reply to comment #3) > use disassemble from inside gdb and look for the faulting instruction. Sorry I'm not very familiar with GDB, but I assume you need this: (gdb) disassemble main Dump of assembler code for function main: 0x00400bc4 :push %rbp 0x00400bc5 :mov%rsp,%rbp 0x00400bc8 :push %rbx 0x00400bc9 :sub$0x48,%rsp 0x00400bcd :lea-0x13(%rbp),%rax 0x00400bd1 :mov%rax,%rdi 0x00400bd4 :callq 0x400e7c <_ZNSaISt4pairIKSsSsEEC2Ev> 0x00400bd9 :lea-0x13(%rbp),%rsi 0x00400bdd :lea-0x12(%rbp),%rcx 0x00400be1 :lea-0x11(%rbp),%rdx 0x00400be5 :lea-0x50(%rbp),%rax 0x00400be9 :mov%rsi,%r8 0x00400bec :mov$0xa,%esi 0x00400bf1 :mov%rax,%rdi 0x00400bf4 :callq 0x400eb0 <_ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEEC2EmRKS1_RKS3_RKS7_> 0x00400bf9 :lea-0x13(%rbp),%rax 0x00400bfd :mov%rax,%rdi 0x00400c00 :callq 0x400e96 <_ZNSaISt4pairIKSsSsEED2Ev> 0x00400c05 :mov$0x4016b2,%esi 0x00400c0a :mov$0x602c40,%edi 0x00400c0f :callq 0x4009f0 basic_ostreamIcT_ES5_PKc@plt> 0x00400c14 :mov$0x400a40,%esi 0x00400c19 :mov%rax,%rdi 0x00400c1c :callq 0x400a20 <_ZNSolsEPFRSoS_E@plt> 0x00400c21 :mov$0x0,%ebx 0x00400c26 :lea-0x50(%rbp),%rax 0x00400c2a :mov%rax,%rdi 0x00400c2d :callq 0x400dba <_ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEED2Ev> 0x00400c32 :mov%ebx,%eax 0x00400c34 :add$0x48,%rsp 0x00400c38 :pop%rbx 0x00400c39 :pop%rbp 0x00400c3a :retq 0x00400c3b :mov%rax,%rbx 0x00400c3e :lea-0x13(%rbp),%rax 0x00400c42 :mov%rax,%rdi 0x00400c45 :callq 0x400e96 <_ZNSaISt4pairIKSsSsEED2Ev> 0x00400c4a :mov%rbx,%rax 0x00400c4d :mov%rax,%rdi 0x00400c50 :callq 0x400a80 <_Unwind_Resume@plt> 0x00400c55 :mov%rax,%rbx 0x00400c58 :lea-0x50(%rbp),%rax 0x00400c5c :mov%rax,%rdi 0x00400c5f :callq 0x400dba <_ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEED2Ev> 0x00400c64 :mov%rbx,%rax 0x00400c67 :mov%rax,%rdi 0x00400c6a :callq 0x400a80 <_Unwind_Resume@plt> End of assembler dump. If not then tell me the steps and I'll post what you need.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 H.J. Lu changed: What|Removed |Added Attachment #28311|0 |1 is obsolete|| --- Comment #7 from H.J. Lu 2012-10-01 13:32:51 UTC --- Created attachment 28312 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28312 A patch with fixed ChangeLog
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek 2012-10-01 13:26:54 UTC --- s/FAM/FMA/ in the ChangeLog entry.
[Bug target/54741] GCC 4.4, 4.5, 4.6 4.7 (probably 4.8) Generates un-usable code on AVX supported CPUs (FreeBSD)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54741 --- Comment #5 from H.J. Lu 2012-10-01 12:55:07 UTC --- Created attachment 28311 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28311 A patch Please try this.