1
0
mirror of https://github.com/BLAKE2/libb2 synced 2024-11-23 00:32:03 +01:00

Fix missing xgetbv on downlevel compilers

This commit is contained in:
Jeffrey Walton 2020-06-30 13:54:56 -04:00
parent 0f7c898301
commit c4283b3469
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

@ -64,11 +64,13 @@ static inline void cpuid( uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t
#endif
}
/* xgetbv insn is GCC 4.5 and above. The byte codes sidestep the limitation */
/* Also see http://www.agner.org/optimize/vectorclass/read.php?i=65 */
static inline uint64_t xgetbv(uint32_t xcr)
{
uint32_t a, d;
__asm__ __volatile__(
"xgetbv"
".byte 0x0f, 0x01, 0xd0"
: "=a"(a),"=d"(d)
: "c"(xcr)
);