Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31237

avx-os-support runtime-detection-fail

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.1.1
    • 5.0.2, 5.1.0 Beta 1
    • Core: Other
    • None
    • x86_64-w64-mingw32 gcc 4.8.0
      Win7SP1x64@AMD FX-8350
    • 76d75fd7df66c2687cf78945ccead03c5500f531

    Description

      Affects the function »static void xgetbv(uint, uint, uint)« in file »corelib/tools/qsimd.cpp«.

      The GCC and Windows compilation branches in this function are in the wrong order.

      When using gcc on windows, the gcc inline asm should be used,
      but instead the fallback function is used which causes Qt to think that the OS doesn't back up the ymm registers.

      That causes a windows-gcc-compiled Qt with enabled avx to crash on an avx-capable-platform.

      _proposed fix_: (the gcc and windows branches are switched, as in the other functions)

      #ifdef Q_OS_WIN
      // fallback overload in case this intrinsic does not exist: unsigned __int64 _xgetbv(unsigned int);
      inline quint64 xgetbv(_int64)

      { return 0; }

      #endif
      static void xgetbv(uint in, uint &eax, uint &edx)
      {
      #if defined(Q_CC_GNU)
      asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction
      : "=a" (eax), "=d" (edx)
      : "c" (in));
      #elif defined(Q_OS_WIN)
      quint64 result = _xgetbv(in);
      eax = result;
      edx = result >> 32;
      #endif
      }

      the function is the same in 5.0.2 and 5.1.0Beta1, so this applies to both

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            darklighter Norbert Pfeiler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes