@@ -82,18 +82,6 @@ pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
82
82
check_expr ( fcx, lhs_expr) ;
83
83
let lhs_ty = fcx. resolve_type_vars_if_possible ( fcx. expr_ty ( lhs_expr) ) ;
84
84
85
- // Annoyingly, SIMD ops don't fit into the PartialEq/PartialOrd
86
- // traits, because their return type is not bool. Perhaps this
87
- // should change, but for now if LHS is SIMD we go down a
88
- // different path that bypassess all traits.
89
- if lhs_ty. is_simd ( ) {
90
- check_expr_coercable_to_type ( fcx, rhs_expr, lhs_ty) ;
91
- let rhs_ty = fcx. resolve_type_vars_if_possible ( fcx. expr_ty ( lhs_expr) ) ;
92
- let return_ty = enforce_builtin_binop_types ( fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op) ;
93
- fcx. write_ty ( expr. id , return_ty) ;
94
- return ;
95
- }
96
-
97
85
match BinOpCategory :: from ( op) {
98
86
BinOpCategory :: Shortcircuit => {
99
87
// && and || are a simple case.
@@ -154,12 +142,6 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
154
142
}
155
143
156
144
BinOpCategory :: Shift => {
157
- // For integers, the shift amount can be of any integral
158
- // type. For simd, the type must match exactly.
159
- if lhs_ty. is_simd ( ) {
160
- demand:: suptype ( fcx, rhs_expr. span , lhs_ty, rhs_ty) ;
161
- }
162
-
163
145
// result type is same as LHS always
164
146
lhs_ty
165
147
}
@@ -174,27 +156,7 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
174
156
BinOpCategory :: Comparison => {
175
157
// both LHS and RHS and result will have the same type
176
158
demand:: suptype ( fcx, rhs_expr. span , lhs_ty, rhs_ty) ;
177
-
178
- // if this is simd, result is same as lhs, else bool
179
- if lhs_ty. is_simd ( ) {
180
- let unit_ty = lhs_ty. simd_type ( tcx) ;
181
- debug ! ( "enforce_builtin_binop_types: lhs_ty={:?} unit_ty={:?}" ,
182
- lhs_ty,
183
- unit_ty) ;
184
- if !unit_ty. is_integral ( ) {
185
- tcx. sess . span_err (
186
- lhs_expr. span ,
187
- & format ! ( "binary comparison operation `{}` not supported \
188
- for floating point SIMD vector `{}`",
189
- ast_util:: binop_to_string( op. node) ,
190
- lhs_ty) ) ;
191
- tcx. types . err
192
- } else {
193
- lhs_ty
194
- }
195
- } else {
196
- tcx. mk_bool ( )
197
- }
159
+ tcx. mk_bool ( )
198
160
}
199
161
}
200
162
}
@@ -427,29 +389,25 @@ fn is_builtin_binop<'tcx>(lhs: Ty<'tcx>,
427
389
428
390
BinOpCategory :: Shift => {
429
391
lhs. references_error ( ) || rhs. references_error ( ) ||
430
- lhs. is_integral ( ) && rhs. is_integral ( ) ||
431
- lhs. is_simd ( ) && rhs. is_simd ( )
392
+ lhs. is_integral ( ) && rhs. is_integral ( )
432
393
}
433
394
434
395
BinOpCategory :: Math => {
435
396
lhs. references_error ( ) || rhs. references_error ( ) ||
436
397
lhs. is_integral ( ) && rhs. is_integral ( ) ||
437
- lhs. is_floating_point ( ) && rhs. is_floating_point ( ) ||
438
- lhs. is_simd ( ) && rhs. is_simd ( )
398
+ lhs. is_floating_point ( ) && rhs. is_floating_point ( )
439
399
}
440
400
441
401
BinOpCategory :: Bitwise => {
442
402
lhs. references_error ( ) || rhs. references_error ( ) ||
443
403
lhs. is_integral ( ) && rhs. is_integral ( ) ||
444
404
lhs. is_floating_point ( ) && rhs. is_floating_point ( ) ||
445
- lhs. is_simd ( ) && rhs. is_simd ( ) ||
446
405
lhs. is_bool ( ) && rhs. is_bool ( )
447
406
}
448
407
449
408
BinOpCategory :: Comparison => {
450
409
lhs. references_error ( ) || rhs. references_error ( ) ||
451
- lhs. is_scalar ( ) && rhs. is_scalar ( ) ||
452
- lhs. is_simd ( ) && rhs. is_simd ( )
410
+ lhs. is_scalar ( ) && rhs. is_scalar ( )
453
411
}
454
412
}
455
413
}
0 commit comments