-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[zigcc] -mavx2
without -mpopcnt
fails if using popcnt
#17572
Comments
-mavx2
without -mpopcnt
fails if using popcnt-mavx2
without -mpopcnt
fails if using popcnt
See #12227 |
A related issue indeed, but not quite the same. Here we don't have conflicting features, just inconsistent behaviour. It's illogical that popcnt is considered to be a feature that is enabled by default unless AVX2/AVX512 is enabled, at which point it disables it. Consistency is what I'd like, as it makes autoconf feature detection challenging and I don't want to have to test all combinations. |
It doesn't seem to be mentioned in the issue but I think it should also include features depending on other features. |
I understand more a bit of the problem here. I have code using AVX2 intrinsics and also a couple POPCNTs. My Makefile was If I change that to It turns out it's because zig is targetting the CPU options native to the host I'm building on. THat host has popcnt, but not avx2. So If zig cc is going to be doing native CPU options by default, then it probably ought to retain those auto-detected features when adding more with |
Zig Version
0.10.0-dev.3523+4d7f5a191
Steps to Reproduce and Observed Behavior
Create a file using
_mm_popcnt_u32
and build with-mavx2
or-mavx512f
.Example:
Expected Behavior
I have a Makefile test for whether or not
-mpopcnt
is required, but this claims it is not as in the absence of any other command line option it's automatically enabled. Unfortunately as soon as I then do-mavx2
it disables popcnt support, which feels a bit weird because it's almost certainly there once we get to avx2. (Technically it may not be, but I'm not aware of a single chip that omits popcnt while adding AVX.)If we want to be explicit and require
-mpopcnt
when doing-mavx2
, then it shouldn't accept popcnt without other options either.The text was updated successfully, but these errors were encountered: