diff --git a/failing-ui-tests.txt b/failing-ui-tests.txt index 8a780e8814780..5b3166113e77f 100644 --- a/failing-ui-tests.txt +++ b/failing-ui-tests.txt @@ -33,7 +33,6 @@ src/test/ui/sepcomp/sepcomp-statics.rs src/test/ui/simd/intrinsic/generic-arithmetic-pass.rs src/test/ui/simd/intrinsic/generic-bitmask-pass.rs src/test/ui/simd/intrinsic/generic-gather-pass.rs -src/test/ui/simd/intrinsic/generic-select-pass.rs src/test/ui/simd/issue-17170.rs src/test/ui/simd/issue-39720.rs src/test/ui/simd/issue-85915-simd-ptrs.rs diff --git a/failing-ui-tests12.txt b/failing-ui-tests12.txt index 00cd42d8e9dc0..32feb2c886b2c 100644 --- a/failing-ui-tests12.txt +++ b/failing-ui-tests12.txt @@ -16,6 +16,7 @@ src/test/ui/simd/intrinsic/generic-cast-pointer-width.rs src/test/ui/simd/intrinsic/generic-comparison-pass.rs src/test/ui/simd/intrinsic/generic-elements-pass.rs src/test/ui/simd/intrinsic/generic-reduction-pass.rs +src/test/ui/simd/intrinsic/generic-select-pass.rs src/test/ui/simd/intrinsic/inlining-issue67557-ice.rs src/test/ui/simd/intrinsic/inlining-issue67557.rs src/test/ui/simd/monomorphize-shuffle-index.rs diff --git a/src/builder.rs b/src/builder.rs index adcd6235b7096..b7342f507168c 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1599,10 +1599,31 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { pub fn vector_select(&mut self, cond: RValue<'gcc>, then_val: RValue<'gcc>, else_val: RValue<'gcc>) -> RValue<'gcc> { // cond is a vector of integers, not of bools. - let cond_type = cond.get_type(); - let vector_type = cond_type.unqualified().dyncast_vector().expect("vector type"); + let vector_type = cond.get_type().unqualified().dyncast_vector().expect("vector type"); let num_units = vector_type.get_num_units(); let element_type = vector_type.get_element_type(); + + #[cfg(feature="master")] + let (cond, element_type) = { + let then_val_vector_type = then_val.get_type().dyncast_vector().expect("vector type"); + let then_val_element_type = then_val_vector_type.get_element_type(); + let then_val_element_size = then_val_element_type.get_size(); + + // NOTE: the mask needs to be of the same size as the other arguments in order for the & + // operation to work. + if then_val_element_size != element_type.get_size() { + let new_element_type = self.type_ix(then_val_element_size as u64 * 8); + let new_vector_type = self.context.new_vector_type(new_element_type, num_units as u64); + let cond = self.context.convert_vector(None, cond, new_vector_type); + (cond, new_element_type) + } + else { + (cond, element_type) + } + }; + + let cond_type = cond.get_type(); + let zeros = vec![self.context.new_rvalue_zero(element_type); num_units]; let zeros = self.context.new_rvalue_from_vector(None, cond_type, &zeros);