@@ -19,9 +19,6 @@ pub(crate) fn maybe_codegen<'tcx>(
19
19
return None ;
20
20
}
21
21
22
- let lhs_val = lhs. load_scalar ( fx) ;
23
- let rhs_val = rhs. load_scalar ( fx) ;
24
-
25
22
let is_signed = type_sign ( lhs. layout ( ) . ty ) ;
26
23
27
24
match bin_op {
@@ -128,40 +125,6 @@ pub(crate) fn maybe_codegen<'tcx>(
128
125
assert ! ( !checked) ;
129
126
None
130
127
}
131
- BinOp :: Shl | BinOp :: Shr => {
132
- let is_overflow = if checked {
133
- // rhs >= 128
134
-
135
- // FIXME support non 128bit rhs
136
- /*let (rhs_lsb, rhs_msb) = fx.bcx.ins().isplit(rhs_val);
137
- let rhs_msb_gt_0 = fx.bcx.ins().icmp_imm(IntCC::NotEqual, rhs_msb, 0);
138
- let rhs_lsb_ge_128 = fx.bcx.ins().icmp_imm(IntCC::SignedGreaterThan, rhs_lsb, 127);
139
- let is_overflow = fx.bcx.ins().bor(rhs_msb_gt_0, rhs_lsb_ge_128);*/
140
- let is_overflow = fx. bcx . ins ( ) . bconst ( types:: B1 , false ) ;
141
-
142
- Some ( fx. bcx . ins ( ) . bint ( types:: I8 , is_overflow) )
143
- } else {
144
- None
145
- } ;
146
-
147
- let truncated_rhs = clif_intcast ( fx, rhs_val, types:: I32 , false ) ;
148
- let val = match bin_op {
149
- BinOp :: Shl => fx. bcx . ins ( ) . ishl ( lhs_val, truncated_rhs) ,
150
- BinOp :: Shr => {
151
- if is_signed {
152
- fx. bcx . ins ( ) . sshr ( lhs_val, truncated_rhs)
153
- } else {
154
- fx. bcx . ins ( ) . ushr ( lhs_val, truncated_rhs)
155
- }
156
- }
157
- _ => unreachable ! ( ) ,
158
- } ;
159
- if let Some ( is_overflow) = is_overflow {
160
- let out_ty = fx. tcx . mk_tup ( [ lhs. layout ( ) . ty , fx. tcx . types . bool ] . iter ( ) ) ;
161
- Some ( CValue :: by_val_pair ( val, is_overflow, fx. layout_of ( out_ty) ) )
162
- } else {
163
- Some ( CValue :: by_val ( val, lhs. layout ( ) ) )
164
- }
165
- }
128
+ BinOp :: Shl | BinOp :: Shr => None ,
166
129
}
167
130
}
0 commit comments