Skip to content

Commit 2b6a371

Browse files
committed
Make use of new f16 and f128 config options
Change from `not(feature = "no-f16-f128")` to `f16_enabled` or `f128_disabled`, as applicable.
1 parent 309c50b commit 2b6a371

File tree

9 files changed

+26
-16
lines changed

9 files changed

+26
-16
lines changed

src/float/add.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ intrinsics! {
204204
}
205205

206206
#[ppc_alias = __addkf3]
207-
#[cfg(not(feature = "no-f16-f128"))]
207+
#[cfg(f128_enabled)]
208208
pub extern "C" fn __addtf3(a: f128, b: f128) -> f128 {
209209
add(a, b)
210210
}

src/float/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ intrinsics! {
172172
}
173173
}
174174

175-
#[cfg(not(feature = "no-f16-f128",))]
175+
#[cfg(f128_enabled)]
176176
intrinsics! {
177177
#[avr_skip]
178178
#[ppc_alias = __lekf2]

src/float/conv.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,19 @@ intrinsics! {
263263
}
264264

265265
#[ppc_alias = __fixunskfsi]
266-
#[cfg(not(feature = "no-f16-f128"))]
266+
#[cfg(f128_enabled)]
267267
pub extern "C" fn __fixunstfsi(f: f128) -> u32 {
268268
float_to_unsigned_int(f)
269269
}
270270

271271
#[ppc_alias = __fixunskfdi]
272-
#[cfg(not(feature = "no-f16-f128"))]
272+
#[cfg(f128_enabled)]
273273
pub extern "C" fn __fixunstfdi(f: f128) -> u64 {
274274
float_to_unsigned_int(f)
275275
}
276276

277277
#[ppc_alias = __fixunskfti]
278-
#[cfg(not(feature = "no-f16-f128"))]
278+
#[cfg(f128_enabled)]
279279
pub extern "C" fn __fixunstfti(f: f128) -> u128 {
280280
float_to_unsigned_int(f)
281281
}
@@ -314,19 +314,19 @@ intrinsics! {
314314
}
315315

316316
#[ppc_alias = __fixkfsi]
317-
#[cfg(not(feature = "no-f16-f128"))]
317+
#[cfg(f128_enabled)]
318318
pub extern "C" fn __fixtfsi(f: f128) -> i32 {
319319
float_to_signed_int(f)
320320
}
321321

322322
#[ppc_alias = __fixkfdi]
323-
#[cfg(not(feature = "no-f16-f128"))]
323+
#[cfg(f128_enabled)]
324324
pub extern "C" fn __fixtfdi(f: f128) -> i64 {
325325
float_to_signed_int(f)
326326
}
327327

328328
#[ppc_alias = __fixkfti]
329-
#[cfg(not(feature = "no-f16-f128"))]
329+
#[cfg(f128_enabled)]
330330
pub extern "C" fn __fixtfti(f: f128) -> i128 {
331331
float_to_signed_int(f)
332332
}

src/float/extend.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -83,35 +83,39 @@ intrinsics! {
8383
}
8484
}
8585

86-
#[cfg(not(feature = "no-f16-f128"))]
8786
intrinsics! {
87+
#[cfg(f16_enabled)]
8888
#[avr_skip]
8989
#[aapcs_on_arm]
9090
#[arm_aeabi_alias = __aeabi_h2f]
9191
pub extern "C" fn __extendhfsf2(a: f16) -> f32 {
9292
extend(a)
9393
}
9494

95+
#[cfg(f16_enabled)]
9596
#[avr_skip]
9697
#[aapcs_on_arm]
9798
pub extern "C" fn __gnu_h2f_ieee(a: f16) -> f32 {
9899
extend(a)
99100
}
100101

102+
#[cfg(all(f16_enabled, f128_enabled))]
101103
#[avr_skip]
102104
#[aapcs_on_arm]
103105
#[ppc_alias = __extendhfkf2]
104106
pub extern "C" fn __extendhftf2(a: f16) -> f128 {
105107
extend(a)
106108
}
107109

110+
#[cfg(f128_enabled)]
108111
#[avr_skip]
109112
#[aapcs_on_arm]
110113
#[ppc_alias = __extendsfkf2]
111114
pub extern "C" fn __extendsftf2(a: f32) -> f128 {
112115
extend(a)
113116
}
114117

118+
#[cfg(f128_enabled)]
115119
#[avr_skip]
116120
#[aapcs_on_arm]
117121
#[ppc_alias = __extenddfkf2]

src/float/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ macro_rules! float_impl {
188188
};
189189
}
190190

191-
#[cfg(not(feature = "no-f16-f128"))]
191+
#[cfg(f16_enabled)]
192192
float_impl!(f16, u16, i16, i8, 16, 10);
193193
float_impl!(f32, u32, i32, i16, 32, 23);
194194
float_impl!(f64, u64, i64, i16, 64, 52);
195-
#[cfg(not(feature = "no-f16-f128"))]
195+
#[cfg(f128_enabled)]
196196
float_impl!(f128, u128, i128, i16, 128, 112);

src/float/mul.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ intrinsics! {
195195
}
196196

197197
#[ppc_alias = __mulkf3]
198-
#[cfg(not(feature = "no-f16-f128"))]
198+
#[cfg(f128_enabled)]
199199
pub extern "C" fn __multf3(a: f128, b: f128) -> f128 {
200200
mul(a, b)
201201
}

src/float/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ intrinsics! {
1414
}
1515

1616
#[ppc_alias = __subkf3]
17-
#[cfg(not(feature = "no-f16-f128"))]
17+
#[cfg(f128_enabled)]
1818
pub extern "C" fn __subtf3(a: f128, b: f128) -> f128 {
1919
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
2020
use crate::float::add::__addkf3 as __addtf3;

src/float/trunc.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ intrinsics! {
131131
}
132132
}
133133

134-
#[cfg(not(feature = "no-f16-f128"))]
134+
#[cfg(f16_enabled)]
135135
intrinsics! {
136136
#[avr_skip]
137137
#[aapcs_on_arm]
@@ -152,14 +152,20 @@ intrinsics! {
152152
pub extern "C" fn __truncdfhf2(a: f64) -> f16 {
153153
trunc(a)
154154
}
155+
}
155156

157+
#[cfg(all(f16_enabled, f128_enabled))]
158+
intrinsics! {
156159
#[avr_skip]
157160
#[aapcs_on_arm]
158161
#[ppc_alias = __trunckfhf2]
159162
pub extern "C" fn __trunctfhf2(a: f128) -> f16 {
160163
trunc(a)
161164
}
165+
}
162166

167+
#[cfg(f128_enabled)]
168+
intrinsics! {
163169
#[avr_skip]
164170
#[aapcs_on_arm]
165171
#[ppc_alias = __trunckfsf2]

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#![feature(naked_functions)]
1414
#![feature(repr_simd)]
1515
#![feature(c_unwind)]
16-
#![cfg_attr(not(feature = "no-f16-f128"), feature(f16))]
17-
#![cfg_attr(not(feature = "no-f16-f128"), feature(f128))]
16+
#![cfg_attr(f16_enabled, feature(f16))]
17+
#![cfg_attr(f128_enabled, feature(f128))]
1818
#![no_builtins]
1919
#![no_std]
2020
#![allow(unused_features)]

0 commit comments

Comments
 (0)