Remove the need for #[cfg] in #[use_c_shim_if]
This commit tweaks the implementation of the synthetic `#[use_c_shim_if]` attribute, renaming it to `#[maybe_use_optimized_c_shim]` in the process. This no longer requires specifying a `#[cfg]` clause indicating when the optimized intrinsic should be used, but rather this is inferred and printed from the build script. The build script will now print out appropriate `#[cfg]` directives for rustc to indicate what intrinsics it's compiling. This should remove the need for us to keep the build script and the source in sync, but rather the build script can simply take care of everything.
This commit is contained in:
@@ -87,11 +87,7 @@ intrinsics! {
|
||||
int_to_float!(i, i32, f64)
|
||||
}
|
||||
|
||||
#[use_c_shim_if(any(
|
||||
all(target_arch = "x86", not(target_env = "msvc")),
|
||||
all(target_arch = "x86_64", not(windows)),
|
||||
all(target_arch = "x86_64", target_env = "msvc"),
|
||||
))]
|
||||
#[maybe_use_optimized_c_shim]
|
||||
#[arm_aeabi_alias = __aeabi_l2f]
|
||||
pub extern "C" fn __floatdisf(i: i64) -> f32 {
|
||||
// On x86_64 LLVM will use native instructions for this conversion, we
|
||||
@@ -103,7 +99,7 @@ intrinsics! {
|
||||
}
|
||||
}
|
||||
|
||||
#[use_c_shim_if(all(target_arch = "x86", not(target_env = "msvc")))]
|
||||
#[maybe_use_optimized_c_shim]
|
||||
#[arm_aeabi_alias = __aeabi_l2d]
|
||||
pub extern "C" fn __floatdidf(i: i64) -> f64 {
|
||||
// On x86_64 LLVM will use native instructions for this conversion, we
|
||||
@@ -135,19 +131,13 @@ intrinsics! {
|
||||
int_to_float!(i, u32, f64)
|
||||
}
|
||||
|
||||
#[use_c_shim_if(any(
|
||||
all(target_arch = "x86", not(target_env = "msvc")),
|
||||
all(target_arch = "x86_64", not(windows)),
|
||||
))]
|
||||
#[maybe_use_optimized_c_shim]
|
||||
#[arm_aeabi_alias = __aeabi_ul2f]
|
||||
pub extern "C" fn __floatundisf(i: u64) -> f32 {
|
||||
int_to_float!(i, u64, f32)
|
||||
}
|
||||
|
||||
#[use_c_shim_if(any(
|
||||
all(target_arch = "x86", not(target_env = "msvc")),
|
||||
all(target_arch = "x86_64", not(windows)),
|
||||
))]
|
||||
#[maybe_use_optimized_c_shim]
|
||||
#[arm_aeabi_alias = __aeabi_ul2d]
|
||||
pub extern "C" fn __floatundidf(i: u64) -> f64 {
|
||||
int_to_float!(i, u64, f64)
|
||||
|
||||
Reference in New Issue
Block a user