Skip to content

Commit 019f347

Browse files
committed
De-duplicate 128 bit float conv intrinsics using cfg_attr.
1 parent 2cd255d commit 019f347

File tree

1 file changed

+12
-48
lines changed

1 file changed

+12
-48
lines changed

src/float/conv.rs

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -239,83 +239,47 @@ intrinsics! {
239239
// use Win64 ABI rather than unadjusted ABI. Pick the correct ABI based on the
240240
// llvm14-builtins-abi target feature.
241241

242-
#[cfg(target_feature = "llvm14-builtins-abi")]
243242
intrinsics! {
243+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
244244
pub extern "C" fn __floattisf(i: i128) -> f32 {
245245
int_to_float(i)
246246
}
247247

248+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
248249
pub extern "C" fn __floattidf(i: i128) -> f64 {
249250
int_to_float(i)
250251
}
251252

253+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
252254
pub extern "C" fn __floatuntisf(i: u128) -> f32 {
253255
int_to_float(i)
254256
}
255257

258+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
256259
pub extern "C" fn __floatuntidf(i: u128) -> f64 {
257260
int_to_float(i)
258261
}
259262

260-
#[win64_128bit_abi_hack]
263+
#[cfg_attr(target_feature = "llvm14-builtins-abi", win64_128bit_abi_hack)]
264+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
261265
pub extern "C" fn __fixsfti(f: f32) -> i128 {
262266
float_to_int(f)
263267
}
264268

265-
#[win64_128bit_abi_hack]
269+
#[cfg_attr(target_feature = "llvm14-builtins-abi", win64_128bit_abi_hack)]
270+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
266271
pub extern "C" fn __fixdfti(f: f64) -> i128 {
267272
float_to_int(f)
268273
}
269274

270-
#[win64_128bit_abi_hack]
275+
#[cfg_attr(target_feature = "llvm14-builtins-abi", win64_128bit_abi_hack)]
276+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
271277
pub extern "C" fn __fixunssfti(f: f32) -> u128 {
272278
float_to_int(f)
273279
}
274280

275-
#[win64_128bit_abi_hack]
276-
pub extern "C" fn __fixunsdfti(f: f64) -> u128 {
277-
float_to_int(f)
278-
}
279-
}
280-
281-
#[cfg(not(target_feature = "llvm14-builtins-abi"))]
282-
intrinsics! {
283-
#[unadjusted_on_win64]
284-
pub extern "C" fn __floattisf(i: i128) -> f32 {
285-
int_to_float(i)
286-
}
287-
288-
#[unadjusted_on_win64]
289-
pub extern "C" fn __floattidf(i: i128) -> f64 {
290-
int_to_float(i)
291-
}
292-
293-
#[unadjusted_on_win64]
294-
pub extern "C" fn __floatuntisf(i: u128) -> f32 {
295-
int_to_float(i)
296-
}
297-
298-
#[unadjusted_on_win64]
299-
pub extern "C" fn __floatuntidf(i: u128) -> f64 {
300-
int_to_float(i)
301-
}
302-
303-
#[unadjusted_on_win64]
304-
pub extern "C" fn __fixsfti(f: f32) -> i128 {
305-
float_to_int(f)
306-
}
307-
308-
#[unadjusted_on_win64]
309-
pub extern "C" fn __fixdfti(f: f64) -> i128 {
310-
float_to_int(f)
311-
}
312-
313-
#[unadjusted_on_win64]
314-
pub extern "C" fn __fixunssfti(f: f32) -> u128 {
315-
float_to_int(f)
316-
}
317-
318-
#[unadjusted_on_win64]
281+
#[cfg_attr(target_feature = "llvm14-builtins-abi", win64_128bit_abi_hack)]
282+
#[cfg_attr(not(target_feature = "llvm14-builtins-abi"), unadjusted_on_win64)]
319283
pub extern "C" fn __fixunsdfti(f: f64) -> u128 {
320284
float_to_int(f)
321285
}

0 commit comments

Comments
 (0)