public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/55307] New: libgcc's __cpu_indicator_init does not check for avx correctly
@ 2012-11-13  5:21 luto at mit dot edu
  2012-11-13 14:55 ` [Bug target/55307] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: luto at mit dot edu @ 2012-11-13  5:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55307

             Bug #: 55307
           Summary: libgcc's __cpu_indicator_init does not check for avx
                    correctly
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: luto@mit.edu


[this is a libgcc bug, and I haven't tested it -- the test is a PITA.]

One might expect that __builtin_cpu_supports("avx") would only return true if
avx is usable.  Unfortunately, it returns true iff avx is implemented by the
cpu, regardless of whether it should be expected to work.  The code should
check for osxsave and then use xgetbv to see if ymm state is available.

This is more or less the same bug as glibc bug 13007 [1].  There's an intel
blog post on the subject at [2].  It's likely to result in crashes if old
kernels are run on new hardware.

Curiously, the code in gcc/testsuite/gcc.target/i386/avx-check.h appears
correct.  I suspect it's never been run with ymm state disabled.

[1] http://sourceware.org/bugzilla/show_bug.cgi?id=13007
[2] http://software.intel.com/en-us/blogs/2011/04/14/is-avx-enabled/


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-08-19 17:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13  5:21 [Bug other/55307] New: libgcc's __cpu_indicator_init does not check for avx correctly luto at mit dot edu
2012-11-13 14:55 ` [Bug target/55307] " hjl.tools at gmail dot com
2013-03-22 14:48 ` jakub at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2015-06-22 14:25 ` rguenth at gcc dot gnu.org
2015-08-19 17:04 ` noloader at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).