@@ -32,21 +32,14 @@ pub(crate) fn maybe_codegen<'tcx>(
32
32
let val_ty = if is_signed { fx. tcx . types . i128 } else { fx. tcx . types . u128 } ;
33
33
if fx. tcx . sess . target . is_like_windows {
34
34
let ret_place = CPlace :: new_stack_slot ( fx, lhs. layout ( ) ) ;
35
- let ( lhs_ptr, lhs_extra) = lhs. force_stack ( fx) ;
36
- let ( rhs_ptr, rhs_extra) = rhs. force_stack ( fx) ;
37
- assert ! ( lhs_extra. is_none( ) ) ;
38
- assert ! ( rhs_extra. is_none( ) ) ;
39
- let args = [
40
- ret_place. to_ptr ( ) . get_addr ( fx) ,
41
- lhs_ptr. get_addr ( fx) ,
42
- rhs_ptr. get_addr ( fx) ,
43
- ] ;
35
+ let args =
36
+ [ ret_place. to_ptr ( ) . get_addr ( fx) , lhs. load_scalar ( fx) , rhs. load_scalar ( fx) ] ;
44
37
fx. lib_call (
45
38
"__multi3" ,
46
39
vec ! [
47
40
AbiParam :: special( fx. pointer_type, ArgumentPurpose :: StructReturn ) ,
48
- AbiParam :: new( fx . pointer_type ) ,
49
- AbiParam :: new( fx . pointer_type ) ,
41
+ AbiParam :: new( types :: I128 ) ,
42
+ AbiParam :: new( types :: I128 ) ,
50
43
] ,
51
44
vec ! [ ] ,
52
45
& args,
@@ -87,29 +80,12 @@ pub(crate) fn maybe_codegen<'tcx>(
87
80
assert ! ( checked) ;
88
81
let out_ty = fx. tcx . mk_tup ( [ lhs. layout ( ) . ty , fx. tcx . types . bool ] . iter ( ) ) ;
89
82
let out_place = CPlace :: new_stack_slot ( fx, fx. layout_of ( out_ty) ) ;
90
- let ( param_types, args) = if fx. tcx . sess . target . is_like_windows {
91
- let ( lhs_ptr, lhs_extra) = lhs. force_stack ( fx) ;
92
- let ( rhs_ptr, rhs_extra) = rhs. force_stack ( fx) ;
93
- assert ! ( lhs_extra. is_none( ) ) ;
94
- assert ! ( rhs_extra. is_none( ) ) ;
95
- (
96
- vec ! [
97
- AbiParam :: special( fx. pointer_type, ArgumentPurpose :: StructReturn ) ,
98
- AbiParam :: new( fx. pointer_type) ,
99
- AbiParam :: new( fx. pointer_type) ,
100
- ] ,
101
- [ out_place. to_ptr ( ) . get_addr ( fx) , lhs_ptr. get_addr ( fx) , rhs_ptr. get_addr ( fx) ] ,
102
- )
103
- } else {
104
- (
105
- vec ! [
106
- AbiParam :: special( fx. pointer_type, ArgumentPurpose :: StructReturn ) ,
107
- AbiParam :: new( types:: I128 ) ,
108
- AbiParam :: new( types:: I128 ) ,
109
- ] ,
110
- [ out_place. to_ptr ( ) . get_addr ( fx) , lhs. load_scalar ( fx) , rhs. load_scalar ( fx) ] ,
111
- )
112
- } ;
83
+ let param_types = vec ! [
84
+ AbiParam :: special( fx. pointer_type, ArgumentPurpose :: StructReturn ) ,
85
+ AbiParam :: new( types:: I128 ) ,
86
+ AbiParam :: new( types:: I128 ) ,
87
+ ] ;
88
+ let args = [ out_place. to_ptr ( ) . get_addr ( fx) , lhs. load_scalar ( fx) , rhs. load_scalar ( fx) ] ;
113
89
let name = match ( bin_op, is_signed) {
114
90
( BinOp :: Add , false ) => "__rust_u128_addo" ,
115
91
( BinOp :: Add , true ) => "__rust_i128_addo" ,
@@ -132,14 +108,10 @@ pub(crate) fn maybe_codegen<'tcx>(
132
108
_ => unreachable ! ( ) ,
133
109
} ;
134
110
if fx. tcx . sess . target . is_like_windows {
135
- let ( lhs_ptr, lhs_extra) = lhs. force_stack ( fx) ;
136
- let ( rhs_ptr, rhs_extra) = rhs. force_stack ( fx) ;
137
- assert ! ( lhs_extra. is_none( ) ) ;
138
- assert ! ( rhs_extra. is_none( ) ) ;
139
- let args = [ lhs_ptr. get_addr ( fx) , rhs_ptr. get_addr ( fx) ] ;
111
+ let args = [ lhs. load_scalar ( fx) , rhs. load_scalar ( fx) ] ;
140
112
let ret = fx. lib_call (
141
113
name,
142
- vec ! [ AbiParam :: new( fx . pointer_type ) , AbiParam :: new( fx . pointer_type ) ] ,
114
+ vec ! [ AbiParam :: new( types :: I128 ) , AbiParam :: new( types :: I128 ) ] ,
143
115
vec ! [ AbiParam :: new( types:: I64X2 ) ] ,
144
116
& args,
145
117
) [ 0 ] ;
0 commit comments