Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Detecting Advanced Vector Extensions (AVX) support in Visual Studio???

Featured Replies

Posted

Detecting Advanced Vector Extensions (AVX) support in Visual Studio???
https://insufficientlycomplicated.wordpress.com/2011/11/07/detecting-intel-advanced-vector-extensions-avx-in-visual-studio/

The problem is that I have Visual Studio without Service Pack so _xgetbv method can't be used!
Any other ways to detect if a CPU hash AVX?
 

6 hours ago, CodeExplorer said:

Visual Studio without Service Pack

..and any good reason NOT to install the service pack?

  • Author

Thanks Ted for the good direction!
Here is the working code:

int isAvxSupported()
{
int HasAVX = 0;

   __asm
   {
xor eax, eax
  cpuid
  cmp eax, 1           // does CPUID support eax = 1?
  jb not_supported

  mov eax, 1
  cpuid
  and ecx, 402653184  // check 27 bit (OS uses XSAVE/XRSTOR)  018000000h
  cmp ecx, 402653184  // and 28       (AVX supported by CPU)  018000000h
  jne not_supported

  xor ecx, ecx         // XFEATURE_ENABLED_MASK/XCR0 register number = 0
  xgetbv               // XFEATURE_ENABLED_MASK register is in edx:eax
  and eax, 6        // 110b
  cmp eax, 6        // check the AVX registers restore at context switch
  jne not_supported

supported:
  mov HasAVX, 1

not_supported:
  mov HasAVX, 0
   }

return HasAVX;

}

I don't have AVX!
https://stackoverflow.com/questions/44144763/avx-feature-detection-using-sigill-versus-cpu-probing

 

Edited by CodeExplorer

13 hours ago, CodeExplorer said:

I don't have AVX!

What CPU do you have?

Ted.

  • Author
2 hours ago, Teddy Rogers said:

What CPU do you have?

Ted.

AMD Athlon(tm) II X2 245
I know it is an very old CPU; I bought it 7 years ago!
I've thought to buy new motherboard/CPU/RAM.
 

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.