@@ -2278,6 +2278,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
22782278 } )
22792279 }
22802280
2281+ /// Emits a SIMD min/max operation for floats. The semantics for each lane are: if one
2282+ /// side is NaN (QNaN or SNaN), the other side is returned.
22812283 fn vector_extremum (
22822284 & mut self ,
22832285 a : RValue < ' gcc > ,
@@ -2286,8 +2288,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
22862288 ) -> RValue < ' gcc > {
22872289 let vector_type = a. get_type ( ) ;
22882290
2289- // mask out the NaNs in b and replace them with the corresponding lane in a, so when a and
2290- // b get compared & spliced together, we get the numeric values instead of NaNs.
2291+ // Mask out the NaNs (both QNaN and SNaN) in b and replace them with the corresponding lane
2292+ // in a, so when a and b get compared & spliced together, we get the numeric values instead
2293+ // of NaNs.
22912294 let b_nan_mask = self . context . new_comparison ( self . location , ComparisonOp :: NotEquals , b, b) ;
22922295 let mask_type = b_nan_mask. get_type ( ) ;
22932296 let b_nan_mask_inverted =
@@ -2309,7 +2312,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
23092312 self . context . new_bitcast ( self . location , res, vector_type)
23102313 }
23112314
2312- pub fn vector_fmin ( & mut self , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
2315+ pub fn vector_minimum_number_nsz ( & mut self , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
23132316 self . vector_extremum ( a, b, ExtremumOperation :: Min )
23142317 }
23152318
@@ -2341,7 +2344,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
23412344 unimplemented ! ( ) ;
23422345 }
23432346
2344- pub fn vector_fmax ( & mut self , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
2347+ pub fn vector_maximum_number_nsz ( & mut self , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
23452348 self . vector_extremum ( a, b, ExtremumOperation :: Max )
23462349 }
23472350
0 commit comments