Using Mustafa's function _may_i_use_cpu_feature() for AVX check

This commit is contained in:
Karthik Gururaj 2014-03-06 08:37:48 -08:00
parent 53895e15cd
commit 37f107cb3a
3 changed files with 10 additions and 8 deletions

View File

@ -33,6 +33,7 @@ using namespace std;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
cout << "AVX supported? " << _may_i_use_cpu_feature(_FEATURE_AVX) << endl ;
#define BATCH_SIZE 10000 #define BATCH_SIZE 10000
if(argc < 2) if(argc < 2)
{ {

View File

@ -46,14 +46,15 @@ float ContextBase<float>::matchToMatchProb[((MAX_QUAL + 1) * (MAX_QUAL + 2)) >>
bool is_avx_supported() bool is_avx_supported()
{ {
int ecx = 0, edx = 0, ebx = 0; return (_may_i_use_cpu_feature(_FEATURE_AVX) > 0);
__asm__("cpuid" //int ecx = 0, edx = 0, ebx = 0;
: "=b" (ebx), //__asm__("cpuid"
"=c" (ecx), //: "=b" (ebx),
"=d" (edx) //"=c" (ecx),
: "a" (1) //"=d" (edx)
); //: "a" (1)
return ((ecx >> 28)&1) == 1; //);
//return ((ecx >> 28)&1) == 1;
} }
bool is_sse41_supported() bool is_sse41_supported()