11
11
// compile-flags: -Z lower_128bit_ops -C debug_assertions=yes
12
12
13
13
#![ feature( i128_type) ]
14
- #![ feature( lang_items) ]
15
-
16
- #[ lang="i128_div" ]
17
- fn i128_div ( _x : i128 , _y : i128 ) -> i128 { 3 }
18
- #[ lang="u128_div" ]
19
- fn u128_div ( _x : u128 , _y : u128 ) -> u128 { 4 }
20
- #[ lang="i128_rem" ]
21
- fn i128_rem ( _x : i128 , _y : i128 ) -> i128 { 5 }
22
- #[ lang="u128_rem" ]
23
- fn u128_rem ( _x : u128 , _y : u128 ) -> u128 { 6 }
24
-
25
- #[ lang="i128_addo" ]
26
- fn i128_addo ( _x : i128 , _y : i128 ) -> ( i128 , bool ) { ( 0 , false ) }
27
- #[ lang="u128_addo" ]
28
- fn u128_addo ( _x : u128 , _y : u128 ) -> ( u128 , bool ) { ( 1 , false ) }
29
- #[ lang="i128_subo" ]
30
- fn i128_subo ( _x : i128 , _y : i128 ) -> ( i128 , bool ) { ( 2 , false ) }
31
- #[ lang="u128_subo" ]
32
- fn u128_subo ( _x : u128 , _y : u128 ) -> ( u128 , bool ) { ( 3 , false ) }
33
- #[ lang="i128_mulo" ]
34
- fn i128_mulo ( _x : i128 , _y : i128 ) -> ( i128 , bool ) { ( 4 , false ) }
35
- #[ lang="u128_mulo" ]
36
- fn u128_mulo ( _x : u128 , _y : u128 ) -> ( u128 , bool ) { ( 5 , false ) }
37
- #[ lang="i128_shlo" ]
38
- fn i128_shlo ( _x : i128 , _y : u128 ) -> ( i128 , bool ) { ( 6 , false ) }
39
- #[ lang="u128_shlo" ]
40
- fn u128_shlo ( _x : u128 , _y : u128 ) -> ( u128 , bool ) { ( 6 , false ) }
41
- #[ lang="i128_shro" ]
42
- fn i128_shro ( _x : i128 , _y : u128 ) -> ( i128 , bool ) { ( 7 , false ) }
43
- #[ lang="u128_shro" ]
44
- fn u128_shro ( _x : u128 , _y : u128 ) -> ( u128 , bool ) { ( 8 , false ) }
45
14
46
15
fn test_signed ( mut x : i128 ) -> i128 {
47
16
x += 1 ;
@@ -66,31 +35,31 @@ fn test_unsigned(mut x: u128) -> u128 {
66
35
}
67
36
68
37
fn main ( ) {
69
- test_signed ( -200 ) ;
70
- test_unsigned ( 200 ) ;
38
+ assert_eq ! ( test_signed( -222 ) , - 1 ) ;
39
+ assert_eq ! ( test_unsigned( 200 ) , 2 ) ;
71
40
}
72
41
73
42
// END RUST SOURCE
74
43
75
44
// START rustc.test_signed.Lower128Bit.after.mir
76
- // _2 = const i128_addo (_1, const 1i128) -> bb10;
45
+ // _2 = const compiler_builtins::int::addsub::rust_i128_addo (_1, const 1i128) -> bb10;
77
46
// ...
78
47
// _1 = move (_2.0: i128);
79
- // _3 = const i128_subo (_1, const 2i128) -> bb11;
48
+ // _3 = const compiler_builtins::int::addsub::rust_i128_subo (_1, const 2i128) -> bb11;
80
49
// ...
81
50
// _1 = move (_3.0: i128);
82
- // _4 = const i128_mulo (_1, const 3i128) -> bb12;
51
+ // _4 = const compiler_builtins::int::mul::rust_i128_mulo (_1, const 3i128) -> bb12;
83
52
// ...
84
53
// _1 = move (_4.0: i128);
85
54
// ...
86
- // _1 = const i128_div (_1, const 4i128) -> bb13;
55
+ // _1 = const compiler_builtins::int::sdiv::rust_i128_div (_1, const 4i128) -> bb13;
87
56
// ...
88
- // _1 = const i128_rem (_1, const 5i128) -> bb15;
57
+ // _1 = const compiler_builtins::int::sdiv::rust_i128_rem (_1, const 5i128) -> bb15;
89
58
// ...
90
59
// _1 = move (_13.0: i128);
91
60
// ...
92
61
// _17 = const 7i32 as u128 (Misc);
93
- // _14 = const i128_shro (_1, move _17) -> bb16;
62
+ // _14 = const compiler_builtins::int::shift::rust_i128_shro (_1, move _17) -> bb16;
94
63
// ...
95
64
// _1 = move (_14.0: i128);
96
65
// ...
@@ -103,30 +72,30 @@ fn main() {
103
72
// assert(!move (_13.1: bool), "attempt to shift left with overflow") -> bb8;
104
73
// ...
105
74
// _16 = const 6i32 as u128 (Misc);
106
- // _13 = const i128_shlo (_1, move _16) -> bb14;
75
+ // _13 = const compiler_builtins::int::shift::rust_i128_shlo (_1, move _16) -> bb14;
107
76
// ...
108
77
// assert(!move (_14.1: bool), "attempt to shift right with overflow") -> bb9;
109
78
// END rustc.test_signed.Lower128Bit.after.mir
110
79
111
80
// START rustc.test_unsigned.Lower128Bit.after.mir
112
- // _2 = const u128_addo (_1, const 1u128) -> bb8;
81
+ // _2 = const compiler_builtins::int::addsub::rust_u128_addo (_1, const 1u128) -> bb8;
113
82
// ...
114
83
// _1 = move (_2.0: u128);
115
- // _3 = const u128_subo (_1, const 2u128) -> bb9;
84
+ // _3 = const compiler_builtins::int::addsub::rust_u128_subo (_1, const 2u128) -> bb9;
116
85
// ...
117
86
// _1 = move (_3.0: u128);
118
- // _4 = const u128_mulo (_1, const 3u128) -> bb10;
87
+ // _4 = const compiler_builtins::int::mul::rust_u128_mulo (_1, const 3u128) -> bb10;
119
88
// ...
120
89
// _1 = move (_4.0: u128);
121
90
// ...
122
- // _1 = const u128_div (_1, const 4u128) -> bb11;
91
+ // _1 = const compiler_builtins::int::udiv::rust_u128_div (_1, const 4u128) -> bb11;
123
92
// ...
124
- // _1 = const u128_rem (_1, const 5u128) -> bb13;
93
+ // _1 = const compiler_builtins::int::udiv::rust_u128_rem (_1, const 5u128) -> bb13;
125
94
// ...
126
95
// _1 = move (_7.0: u128);
127
96
// ...
128
97
// _11 = const 7i32 as u128 (Misc);
129
- // _8 = const u128_shro (_1, move _11) -> bb14;
98
+ // _8 = const compiler_builtins::int::shift::rust_u128_shro (_1, move _11) -> bb14;
130
99
// ...
131
100
// _1 = move (_8.0: u128);
132
101
// ...
@@ -139,7 +108,7 @@ fn main() {
139
108
// assert(!move (_7.1: bool), "attempt to shift left with overflow") -> bb6;
140
109
// ...
141
110
// _10 = const 6i32 as u128 (Misc);
142
- // _7 = const u128_shlo (_1, move _10) -> bb12;
111
+ // _7 = const compiler_builtins::int::shift::rust_u128_shlo (_1, move _10) -> bb12;
143
112
// ...
144
113
// assert(!move (_8.1: bool), "attempt to shift right with overflow") -> bb7;
145
114
// END rustc.test_unsigned.Lower128Bit.after.mir
0 commit comments