@@ -405,27 +405,27 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
405
405
} ;
406
406
407
407
simd_reduce_min, ( c v) {
408
- // FIXME support floats
409
408
validate_simd_type!( fx, intrinsic, span, v. layout( ) . ty) ;
410
409
simd_reduce( fx, v, None , ret, |fx, layout, a, b| {
411
- let lt = fx. bcx. ins( ) . icmp( if layout. ty. is_signed( ) {
412
- IntCC :: SignedLessThan
413
- } else {
414
- IntCC :: UnsignedLessThan
415
- } , a, b) ;
410
+ let lt = match layout. ty. kind( ) {
411
+ ty:: Int ( _) => fx. bcx. ins( ) . icmp( IntCC :: SignedLessThan , a, b) ,
412
+ ty:: Uint ( _) => fx. bcx. ins( ) . icmp( IntCC :: UnsignedLessThan , a, b) ,
413
+ ty:: Float ( _) => fx. bcx. ins( ) . fcmp( FloatCC :: LessThan , a, b) ,
414
+ _ => unreachable!( ) ,
415
+ } ;
416
416
fx. bcx. ins( ) . select( lt, a, b)
417
417
} ) ;
418
418
} ;
419
419
420
420
simd_reduce_max, ( c v) {
421
- // FIXME support floats
422
421
validate_simd_type!( fx, intrinsic, span, v. layout( ) . ty) ;
423
422
simd_reduce( fx, v, None , ret, |fx, layout, a, b| {
424
- let gt = fx. bcx. ins( ) . icmp( if layout. ty. is_signed( ) {
425
- IntCC :: SignedGreaterThan
426
- } else {
427
- IntCC :: UnsignedGreaterThan
428
- } , a, b) ;
423
+ let gt = match layout. ty. kind( ) {
424
+ ty:: Int ( _) => fx. bcx. ins( ) . icmp( IntCC :: SignedGreaterThan , a, b) ,
425
+ ty:: Uint ( _) => fx. bcx. ins( ) . icmp( IntCC :: UnsignedGreaterThan , a, b) ,
426
+ ty:: Float ( _) => fx. bcx. ins( ) . fcmp( FloatCC :: GreaterThan , a, b) ,
427
+ _ => unreachable!( ) ,
428
+ } ;
429
429
fx. bcx. ins( ) . select( gt, a, b)
430
430
} ) ;
431
431
} ;
0 commit comments