MinGW+Eclipse下C/C++使用SSE4指令集

直接在程序中加入以下代码:

#pragma GCC target("sse4.2")

头文件include示例:

#ifndef _IMMINTRIN_H_INCLUDED
#define _IMMINTRIN_H_INCLUDED
#ifdef __MMX__
#include 
    printf("__MMX__  is defined\n");
#endif
#ifdef __SSE__
#include 
    printf("__SSE__  is defined\n");
#endif
#ifdef __SSE2__
#include 
    printf("__SSE2__  is defined\n");
#endif
#ifdef __SSE3__
#include 
    printf("__SSE3__  is defined\n");
#endif
#ifdef __SSSE3__
#include 
    printf("__SSSE3__  is defined\n");
#endif
#if defined (__SSE4_2__) || defined (__SSE4_1__)
#include 
    printf("__SSE4_2__  is defined\n");
#endif
#if defined (__AES__) || defined (__PCLMUL__)
#include 
    printf("__AES__  is defined\n");
#endif
#ifdef __AVX__
#include 
    printf("__AVX__  is defined\n");
#endif
#endif /* _IMMINTRIN_H_INCLUDED */


你可能感兴趣的:(MinGW+Eclipse下C/C++使用SSE4指令集)