esp-rs / rust

Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266
https://www.rust-lang.org
Other
743 stars 39 forks source link

Add XTENSA_ALLOWED_FEATURES to supported_target_features #240

Closed taiki-e closed 1 month ago

taiki-e commented 1 month ago

This fixes an issue that target_feature is not handled correctly.

Currently, cfg(target_feature) does not work, and inline assembly incorrectly rejects registers that depend on a particular target_feature.

e.g., freg, scompare1, etc. are rejected even on esp32.

error: register class `freg` requires at least one of the following target features: dfpaccel, fp
  --> /Users/taiki/projects/forks/rust-lang/rust/tests/assembly/asm/xtensa-types.rs:62:44
   |
62 |             asm!(concat!($mov, " {}, {}"), out($class) y, in($class) x);
   |                                            ^^^^^^^^^^^^^
...
96 | check_general_reg!(freg_f32 f32 freg "mov.s");
   | --------------------------------------------- in this macro invocation
   |
   = note: this error originates in the macro `check_general_reg` (in Nightly builds, run with -Z macro-backtrace for more info)
MabezDev commented 1 month ago

Thanks! I've also opened https://github.com/rust-lang/rust/pull/132265 so we fix this at source. I plan on fixing a few things and then cutting 1.82.0.2 shortly.