You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=2273542#c14 the SIMDUTF_CAN_ALWAYS_RUN_{HASWELL,ICELAKE,WESTMERE} macros are broken at least for GCC.
This is because GCC (since ~4.7 when not using -save-temps, since 14 when preprocessing separately from compilation) on #pragma GCC target ISA changes undefines/defines the predefined preprocessor macros like __AVX2__, so that they reflect the current set of the enabled/disabled ISAs in the region.
When you
and compile this with -mno-avx2, the first SIMDUTF_CAN_ALWAYS_RUN_AVX2 use will evaluate to 0 because __AVX2__ is not defined, but then #pragma GCC target ("avx2") defines it, on the second use it will evaluate to 1 because __AVX2__ is defined to 1 there and finally #pragma GCC pop_options will undefine it again.
The code clearly expects it to evaluate the same in both cases, otherwise there is a misbalance, which in the rhbz case causes unsupported_implementation to be compiled with avx2,bmi,lzcnt,popcnt isas.
As mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=2273542#c14 the SIMDUTF_CAN_ALWAYS_RUN_{HASWELL,ICELAKE,WESTMERE} macros are broken at least for GCC.
This is because GCC (since ~4.7 when not using -save-temps, since 14 when preprocessing separately from compilation) on #pragma GCC target ISA changes undefines/defines the predefined preprocessor macros like
__AVX2__
, so that they reflect the current set of the enabled/disabled ISAs in the region.When you
and compile this with -mno-avx2, the first
SIMDUTF_CAN_ALWAYS_RUN_AVX2
use will evaluate to 0 because__AVX2__
is not defined, but then#pragma GCC target ("avx2")
defines it, on the second use it will evaluate to 1 because__AVX2__
is defined to 1 there and finally#pragma GCC pop_options
will undefine it again.The code clearly expects it to evaluate the same in both cases, otherwise there is a misbalance, which in the rhbz case causes unsupported_implementation to be compiled with avx2,bmi,lzcnt,popcnt isas.
I'd suggest either change macros like:
to
Then it will have a constant value through the whole compilation unit.
The text was updated successfully, but these errors were encountered: