Skip to content

Commit 63f91a0

Browse files
author
Jorge Aparicio
committed
Revert "i128 test: transmute intrinsic output before comparing"
This reverts commit 46085a2.
1 parent 30b8b43 commit 63f91a0

File tree

1 file changed

+15
-71
lines changed

1 file changed

+15
-71
lines changed

build.rs

+15-71
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ use core::mem;
189189
target_os = "linux",
190190
test)))]
191191
use std::mem;
192-
193192
use compiler_builtins::float::add::__adddf3;
194193
195194
fn mk_f64(x: u64) -> f64 {
@@ -829,22 +828,11 @@ fn divsi3() {
829828
}
830829

831830
fn prologue() -> &'static str {
832-
r#"
833-
#[cfg(all(target_arch = "arm",
834-
not(any(target_env = "gnu", target_env = "musl")),
835-
target_os = "linux",
836-
test))]
837-
use core::mem;
838-
#[cfg(not(all(target_arch = "arm",
839-
not(any(target_env = "gnu", target_env = "musl")),
840-
target_os = "linux",
841-
test)))]
842-
use std::mem;
843-
831+
"
844832
use compiler_builtins::int::sdiv::__divti3;
845833
846834
static TEST_CASES: &[((i128, i128), i128)] = &[
847-
"#
835+
"
848836
}
849837

850838
fn epilogue() -> &'static str {
@@ -854,7 +842,7 @@ static TEST_CASES: &[((i128, i128), i128)] = &[
854842
#[test]
855843
fn divti3() {
856844
for &((a, b), c) in TEST_CASES {
857-
let c_: i128 = unsafe { mem::transmute(__divti3(a, b)) };
845+
let c_ = __divti3(a, b);
858846
assert_eq!(((a, b), c), ((a, b), c_));
859847
}
860848
}
@@ -1907,22 +1895,11 @@ fn modsi3() {
19071895
}
19081896

19091897
fn prologue() -> &'static str {
1910-
r#"
1911-
#[cfg(all(target_arch = "arm",
1912-
not(any(target_env = "gnu", target_env = "musl")),
1913-
target_os = "linux",
1914-
test))]
1915-
use core::mem;
1916-
#[cfg(not(all(target_arch = "arm",
1917-
not(any(target_env = "gnu", target_env = "musl")),
1918-
target_os = "linux",
1919-
test)))]
1920-
use std::mem;
1921-
1898+
"
19221899
use compiler_builtins::int::sdiv::__modti3;
19231900
19241901
static TEST_CASES: &[((i128, i128), i128)] = &[
1925-
"#
1902+
"
19261903
}
19271904

19281905
fn epilogue() -> &'static str {
@@ -1932,7 +1909,7 @@ static TEST_CASES: &[((i128, i128), i128)] = &[
19321909
#[test]
19331910
fn modti3() {
19341911
for &((a, b), c) in TEST_CASES {
1935-
let c_: i128 = unsafe { mem::transmute(__modti3(a, b)) };
1912+
let c_ = __modti3(a, b);
19361913
assert_eq!(((a, b), c), ((a, b), c_));
19371914
}
19381915
}
@@ -2936,22 +2913,11 @@ fn udivmodsi4() {
29362913
}
29372914

29382915
fn prologue() -> &'static str {
2939-
r#"
2940-
#[cfg(all(target_arch = "arm",
2941-
not(any(target_env = "gnu", target_env = "musl")),
2942-
target_os = "linux",
2943-
test))]
2944-
use core::mem;
2945-
#[cfg(not(all(target_arch = "arm",
2946-
not(any(target_env = "gnu", target_env = "musl")),
2947-
target_os = "linux",
2948-
test)))]
2949-
use std::mem;
2950-
2916+
"
29512917
use compiler_builtins::int::udiv::__udivmodti4;
29522918
29532919
static TEST_CASES: &[((u128, u128), (u128, u128))] = &[
2954-
"#
2920+
"
29552921
}
29562922

29572923
fn epilogue() -> &'static str {
@@ -2962,7 +2928,7 @@ static TEST_CASES: &[((u128, u128), (u128, u128))] = &[
29622928
fn udivmodti4() {
29632929
for &((a, b), (c, rem)) in TEST_CASES {
29642930
let mut rem_ = 0;
2965-
let c_: u128 = unsafe { mem::transmute(__udivmodti4(a, b, Some(&mut rem_))) };
2931+
let c_ = __udivmodti4(a, b, Some(&mut rem_));
29662932
assert_eq!(((a, b), (c, rem)), ((a, b), (c_, rem_)));
29672933
}
29682934
}
@@ -3070,22 +3036,11 @@ fn udivsi3() {
30703036
}
30713037

30723038
fn prologue() -> &'static str {
3073-
r#"
3074-
#[cfg(all(target_arch = "arm",
3075-
not(any(target_env = "gnu", target_env = "musl")),
3076-
target_os = "linux",
3077-
test))]
3078-
use core::mem;
3079-
#[cfg(not(all(target_arch = "arm",
3080-
not(any(target_env = "gnu", target_env = "musl")),
3081-
target_os = "linux",
3082-
test)))]
3083-
use std::mem;
3084-
3039+
"
30853040
use compiler_builtins::int::udiv::__udivti3;
30863041
30873042
static TEST_CASES: &[((u128, u128), u128)] = &[
3088-
"#
3043+
"
30893044
}
30903045

30913046
fn epilogue() -> &'static str {
@@ -3095,7 +3050,7 @@ static TEST_CASES: &[((u128, u128), u128)] = &[
30953050
#[test]
30963051
fn udivti3() {
30973052
for &((a, b), c) in TEST_CASES {
3098-
let c_: u128 = unsafe { mem::transmute(__udivti3(a, b)) };
3053+
let c_ = __udivti3(a, b);
30993054
assert_eq!(((a, b), c), ((a, b), c_));
31003055
}
31013056
}
@@ -3264,22 +3219,11 @@ fn umodsi3() {
32643219
}
32653220

32663221
fn prologue() -> &'static str {
3267-
r#"
3268-
#[cfg(all(target_arch = "arm",
3269-
not(any(target_env = "gnu", target_env = "musl")),
3270-
target_os = "linux",
3271-
test))]
3272-
use core::mem;
3273-
#[cfg(not(all(target_arch = "arm",
3274-
not(any(target_env = "gnu", target_env = "musl")),
3275-
target_os = "linux",
3276-
test)))]
3277-
use std::mem;
3278-
3222+
"
32793223
use compiler_builtins::int::udiv::__umodti3;
32803224
32813225
static TEST_CASES: &[((u128, u128), u128)] = &[
3282-
"#
3226+
"
32833227
}
32843228

32853229
fn epilogue() -> &'static str {
@@ -3289,7 +3233,7 @@ static TEST_CASES: &[((u128, u128), u128)] = &[
32893233
#[test]
32903234
fn umodti3() {
32913235
for &((a, b), c) in TEST_CASES {
3292-
let c_: u128 = unsafe { mem::transmute(__umodti3(a, b)) };
3236+
let c_ = __umodti3(a, b);
32933237
assert_eq!(((a, b), c), ((a, b), c_));
32943238
}
32953239
}

0 commit comments

Comments
 (0)