Skip to content

Commit 834bacf

Browse files
committed
Remove some unused rust specific intrinsics
I think they were originally introduced when 128bit int support was added to rustc but before LLVM consistently supported 128bit int operations across platforms. Nowadays LLVM and GCC handle 128bit int operations for us rather than manually adding calls to rust specific intrinsics. The only exception is the Cranelift backend which still uses the __rust_u/i128_mulo intrinsics and as such this commit keeps those around.
1 parent ba84ef8 commit 834bacf

File tree

3 files changed

+0
-172
lines changed

3 files changed

+0
-172
lines changed

src/int/addsub.rs

-96
This file was deleted.

src/int/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use core::ops;
22

33
mod specialized_div_rem;
44

5-
pub mod addsub;
65
mod big;
76
pub mod bswap;
87
pub mod leading_zeros;

testcrate/tests/addsub.rs

-75
Original file line numberDiff line numberDiff line change
@@ -3,81 +3,6 @@
33

44
use testcrate::*;
55

6-
mod int_addsub {
7-
use super::*;
8-
9-
macro_rules! sum {
10-
($($i:ty, $fn_add:ident, $fn_sub:ident);*;) => {
11-
$(
12-
#[test]
13-
fn $fn_add() {
14-
use compiler_builtins::int::addsub::{$fn_add, $fn_sub};
15-
16-
fuzz_2(N, |x: $i, y: $i| {
17-
let add0 = x.wrapping_add(y);
18-
let sub0 = x.wrapping_sub(y);
19-
let add1: $i = $fn_add(x, y);
20-
let sub1: $i = $fn_sub(x, y);
21-
if add0 != add1 {
22-
panic!(
23-
"{}({}, {}): std: {}, builtins: {}",
24-
stringify!($fn_add), x, y, add0, add1
25-
);
26-
}
27-
if sub0 != sub1 {
28-
panic!(
29-
"{}({}, {}): std: {}, builtins: {}",
30-
stringify!($fn_sub), x, y, sub0, sub1
31-
);
32-
}
33-
});
34-
}
35-
)*
36-
};
37-
}
38-
39-
macro_rules! overflowing_sum {
40-
($($i:ty, $fn_add:ident, $fn_sub:ident);*;) => {
41-
$(
42-
#[test]
43-
fn $fn_add() {
44-
use compiler_builtins::int::addsub::{$fn_add, $fn_sub};
45-
46-
fuzz_2(N, |x: $i, y: $i| {
47-
let add0 = x.overflowing_add(y);
48-
let sub0 = x.overflowing_sub(y);
49-
let add1: ($i, bool) = $fn_add(x, y);
50-
let sub1: ($i, bool) = $fn_sub(x, y);
51-
if add0.0 != add1.0 || add0.1 != add1.1 {
52-
panic!(
53-
"{}({}, {}): std: {:?}, builtins: {:?}",
54-
stringify!($fn_add), x, y, add0, add1
55-
);
56-
}
57-
if sub0.0 != sub1.0 || sub0.1 != sub1.1 {
58-
panic!(
59-
"{}({}, {}): std: {:?}, builtins: {:?}",
60-
stringify!($fn_sub), x, y, sub0, sub1
61-
);
62-
}
63-
});
64-
}
65-
)*
66-
};
67-
}
68-
69-
// Integer addition and subtraction is very simple, so 100 fuzzing passes should be plenty.
70-
sum! {
71-
u128, __rust_u128_add, __rust_u128_sub;
72-
i128, __rust_i128_add, __rust_i128_sub;
73-
}
74-
75-
overflowing_sum! {
76-
u128, __rust_u128_addo, __rust_u128_subo;
77-
i128, __rust_i128_addo, __rust_i128_subo;
78-
}
79-
}
80-
816
macro_rules! float_sum {
827
($($f:ty, $fn_add:ident, $fn_sub:ident, $apfloat_ty:ident, $sys_available:meta);*;) => {
838
$(

0 commit comments

Comments
 (0)