Don't use xgetbv instruction when NO_AVX=1

This commit is contained in:
Zhang Xianyi 2012-10-09 14:52:35 +08:00
parent 0b719945c5
commit 6c5899dff5
3 changed files with 15 additions and 1 deletions

View File

@ -79,7 +79,7 @@ If you compile this lib with USE_OPENMP=1, you should set OMP_NUM_THREADS enviro
### Set the number of threads on runtime.
We provided the below functions to controll the number of threads on runtime. So far, we didn't support changing the number of threads on Windows. On Windows, these functions are dummy.
We provided the below functions to controll the number of threads on runtime.
void goto_set_num_threads(int num_threads);
@ -97,6 +97,7 @@ OpenBLAS users mailing list: http://list.rdcps.ac.cn/mailman/listinfo/openblas
Please see Changelog.txt to obtain the differences between GotoBLAS2 1.13 BSD version.
## Troubleshooting
* Please read [Faq](https://github.com/xianyi/OpenBLAS/wiki/Faq) at first.
* Please use gcc version 4.6 and above to compile Sandy Bridge AVX kernels on Linux/MingW/BSD.
* Please use Clang version 3.1 and above to compile the library on Sandy Bridge microarchitecture. The Clang 3.0 will generate the wrong AVX binary code.
* The number of CPUs/Cores should less than or equal to 256.

View File

@ -114,12 +114,15 @@ static inline int have_excpuid(void){
return eax & 0xffff;
}
#ifndef NO_AVX
static inline void xgetbv(int op, int * eax, int * edx){
__asm__ __volatile__
("xgetbv": "=a" (*eax), "=d" (*edx) : "c" (op) : "cc");
}
#endif
int support_avx(){
#ifndef NO_AVX
int eax, ebx, ecx, edx;
int ret=0;
@ -131,8 +134,12 @@ int support_avx(){
}
}
return ret;
#else
return 0;
#endif
}
int get_vendor(void){
int eax, ebx, ecx, edx;
char vendor[13];

View File

@ -76,12 +76,15 @@ extern gotoblas_t gotoblas_SANDYBRIDGE;
#define BITMASK(a, b, c) ((((a) >> (b)) & (c)))
#ifndef NO_AVX
static inline void xgetbv(int op, int * eax, int * edx){
__asm__ __volatile__
("xgetbv": "=a" (*eax), "=d" (*edx) : "c" (op) : "cc");
}
#endif
int support_avx(){
#ifndef NO_AVX
int eax, ebx, ecx, edx;
int ret=0;
@ -93,6 +96,9 @@ int support_avx(){
}
}
return ret;
#else
return 0;
#endif
}
static int get_vendor(void){