it shouldn't also be used for if cfg!(target_feature = "adx") { but it looks like it tries to use it. Why? I get:
error[E0425]: cannot find function `carry_add_adx` in this scope
--> src/lib.rs:18:9
|
18 | carry_add_adx(a, b, c)
| ^^^^^^^^^^^^^ not found in this scope
Here's the documentation for static vs. dynamic feature detection:
The default x86_64 target does not have "adx" enabled. You can enable that with -Ctarget-feature or a newer -Ctarget-cpu, which will satisfy the static detection above, or you can use dynamic detection to detect features in the running cpu.
You get this error because #[cfg(false)] makes the following item disappear from your code if the condition is not met, but things inside cfg!(false) don't, so the function still has to exist.
The cfg!() macro just evaluates to a boolean, so anything hidden behind a cfg!(...) still needs to be valid code. It just won't be executed at runtime and in release mode the unused code will be compiled out.