Skip to content

Commit 9e31b97

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 0cfc3be commit 9e31b97

File tree

9 files changed

+25
-16
lines changed

9 files changed

+25
-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,38 +83,42 @@ intrinsics! {
8383
}
8484
}
8585

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

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

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

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

115118
#[avr_skip]
116119
#[aapcs_on_arm]
117120
#[ppc_alias = __extenddfkf2]
121+
#[cfg(f128_enabled)]
118122
pub extern "C" fn __extenddftf2(a: f64) -> f128 {
119123
extend(a)
120124
}

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

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

134-
#[cfg(not(feature = "no-f16-f128"))]
135134
intrinsics! {
136135
#[avr_skip]
137136
#[aapcs_on_arm]
138137
#[arm_aeabi_alias = __aeabi_f2h]
138+
#[cfg(f16_enabled)]
139139
pub extern "C" fn __truncsfhf2(a: f32) -> f16 {
140140
trunc(a)
141141
}
142142

143143
#[avr_skip]
144144
#[aapcs_on_arm]
145+
#[cfg(f16_enabled)]
145146
pub extern "C" fn __gnu_f2h_ieee(a: f32) -> f16 {
146147
trunc(a)
147148
}
148149

149150
#[avr_skip]
150151
#[aapcs_on_arm]
151152
#[arm_aeabi_alias = __aeabi_d2h]
153+
#[cfg(f16_enabled)]
152154
pub extern "C" fn __truncdfhf2(a: f64) -> f16 {
153155
trunc(a)
154156
}
155157

156158
#[avr_skip]
157159
#[aapcs_on_arm]
158160
#[ppc_alias = __trunckfhf2]
161+
#[cfg(all(f16_enabled, f128_enabled))]
159162
pub extern "C" fn __trunctfhf2(a: f128) -> f16 {
160163
trunc(a)
161164
}
162165

163166
#[avr_skip]
164167
#[aapcs_on_arm]
165168
#[ppc_alias = __trunckfsf2]
169+
#[cfg(f128_enabled)]
166170
pub extern "C" fn __trunctfsf2(a: f128) -> f32 {
167171
trunc(a)
168172
}
169173

170174
#[avr_skip]
171175
#[aapcs_on_arm]
172176
#[ppc_alias = __trunckfdf2]
177+
#[cfg(f128_enabled)]
173178
pub extern "C" fn __trunctfdf2(a: f128) -> f64 {
174179
trunc(a)
175180
}

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)