diff --git a/raid/x86.c b/raid/x86.c index 58ee3c1b..8154bac1 100644 --- a/raid/x86.c +++ b/raid/x86.c @@ -15,6 +15,18 @@ #include "internal.h" #include "gf.h" +/** + * Disables in this file any use of SSE2/AVX2 registers by the compiler + * to avoid to messup with the registers use made by these functions. + * + * Note that this is just a precaution as there is no yet a known case + * of conflicting register use, even if formally possible. + */ +#ifdef CONFIG_X86 +#pragma GCC push_options +#pragma GCC target ("no-sse2,no-avx2") +#endif + #ifdef CONFIG_X86 /* * GEN1 (RAID5 with xor) SSE2 implementation @@ -2466,3 +2478,5 @@ void raid_recX_avx2(int nr, int *id, int *ip, int nd, size_t size, void **vv) } #endif +#pragma GCC pop_options + diff --git a/raid/x86z.c b/raid/x86z.c index 7f7d2892..8abc7675 100644 --- a/raid/x86z.c +++ b/raid/x86z.c @@ -14,6 +14,18 @@ #include "internal.h" +/** + * Disables in this file any use of SSE2/AVX2 registers by the compiler + * to avoid to messup with the registers use made by these functions. + * + * Note that this is just a precaution as there is no yet a known case + * of conflicting register use, even if formally possible. + */ +#ifdef CONFIG_X86 +#pragma GCC push_options +#pragma GCC target ("no-sse2,no-avx2") +#endif + #ifdef CONFIG_X86 static const struct gfzconst16 { uint8_t poly[16]; @@ -254,3 +266,5 @@ void raid_genz_avx2ext(int nd, size_t size, void **vv) } #endif +#pragma GCC pop_options +