5,699,997 members and growing! (14,356 online)
Email Password   helpLost your password?
Languages » C / C++ Language » General     Beginner License: The Code Project Open License (CPOL)

Identify the Types of SIMD Instructions

By Wong Shao Voon

Identify the types of SIMD instructions which the Processor has
C++, Windows, Dev

Posted: 29 Aug 2008
Updated: 3 Sep 2008
Views: 3,340
Bookmarked: 9 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
11 votes for this Article.
Popularity: 2.08 Rating: 2.00 out of 5
8 votes, 72.7%
1
0 votes, 0.0%
2
1 vote, 9.1%
3
1 vote, 9.1%
4
1 vote, 9.1%
5
Demo

Introduction

I have been learning and writing SSE2 intrinsic instructions but I did not find an article on CodeProject that has sample code for me to identify the presence of SIMD instructions on processor, hence I wrote a simple class to do it. I hope that people who need this information can save some time using this class, without having to roll out their own class.

The HasSIMD Class

Here is the class declaration. I guess there is no need for sample code. It is simple to use.

class HasSIMD
{
public:
// Intel SIMD
    bool HasMMX()
    bool HasSSE()
    bool HasSSE2()
    bool HasSSE3()
    bool HasSSSE3()
    bool HasSSE41()
    bool HasSSE42()
// AMD SIMD
    bool HasMMXplus()
    bool Has3Dnow()
    bool Has3DnowExt()
};

Important Notes on Symmetric Multiprocessor(SMP) System

Beware of SMP systems, the processors used should be identical, hence the word, "symmetric". Or else, the class may detect that one of the processors supports this SIMD. When it runs this SIMD instruction on another non-identical processor which doesn't supports this SIMD, your program may crash.

References

History

  • 01/09/2008: Version 1.1.0 includes bug fix for 3DNow, 3DNow+ and MMX+ detection by Leonardo Tazzini
  • 27/08/2008: First release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Wong Shao Voon


I am currently working as a software developer in a company specialized in 3D modelling software. My wish is to write a article on GUI since I am specialized in GUI.

Like many Singaporeans, my hobbies include reading, karaoke, watching movies and anime, play games and jogging.

I wish I have more time to write articles for CodeProject since I have a few ideas(long overdue) to write about. And I always explain the working behind the code in my articles. I hope you like my articles on CodeProject!
Occupation: Software Developer
Location: Singapore Singapore

Other popular C / C++ Language articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 2 of 2 (Total in Forum: 2) (Refresh)FirstPrevNext
General3DNow, 3DNow+ and MMX+ detection bugmemberLeonardo Tazzini14:13 29 Aug '08  
GeneralRe: 3DNow, 3DNow+ and MMX+ detection bugmemberCBasicNet16:47 29 Aug '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 3 Sep 2008
Editor: Sean Ewington
Copyright 2008 by Wong Shao Voon
Everything else Copyright © CodeProject, 1999-2008
Web15 | Advertise on the Code Project