diff options
| author | Ralf Jung <post@ralfj.de> | 2025-03-03 18:18:33 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-04-20 12:25:27 +0200 |
| commit | fc4afeafc1c7631b98e41cc1585e9e21ac754dac (patch) | |
| tree | ddd2dfe6620cbe78576047cdbc2545b9c53d8eab | |
| parent | b25a593b40e88019a5c76198f5c69e2fcced368d (diff) | |
| download | rust-fc4afeafc1c7631b98e41cc1585e9e21ac754dac.tar.gz rust-fc4afeafc1c7631b98e41cc1585e9e21ac754dac.zip | |
simd intrinsics with mask: accept unsigned integer masks
| -rw-r--r-- | src/intrinsic/simd.rs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/intrinsic/simd.rs b/src/intrinsic/simd.rs index 8b454ab2a42..787f4cd7d41 100644 --- a/src/intrinsic/simd.rs +++ b/src/intrinsic/simd.rs @@ -443,9 +443,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>( m_len == v_len, InvalidMonomorphization::MismatchedLengths { span, name, m_len, v_len } ); + // TODO: also support unsigned integers. match *m_elem_ty.kind() { ty::Int(_) => {} - _ => return_error!(InvalidMonomorphization::MaskType { span, name, ty: m_elem_ty }), + _ => return_error!(InvalidMonomorphization::MaskWrongElementType { + span, + name, + ty: m_elem_ty + }), } return Ok(bx.vector_select(args[0].immediate(), args[1].immediate(), args[2].immediate())); } @@ -987,19 +992,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>( assert_eq!(pointer_count - 1, ptr_count(element_ty0)); assert_eq!(underlying_ty, non_ptr(element_ty0)); - // The element type of the third argument must be a signed integer type of any width: + // The element type of the third argument must be an integer type of any width: + // TODO: also support unsigned integers. let (_, element_ty2) = arg_tys[2].simd_size_and_type(bx.tcx()); match *element_ty2.kind() { ty::Int(_) => (), _ => { require!( false, - InvalidMonomorphization::ThirdArgElementType { - span, - name, - expected_element: element_ty2, - third_arg: arg_tys[2] - } + InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 } ); } } @@ -1105,17 +1106,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>( assert_eq!(underlying_ty, non_ptr(element_ty0)); // The element type of the third argument must be a signed integer type of any width: + // TODO: also support unsigned integers. match *element_ty2.kind() { ty::Int(_) => (), _ => { require!( false, - InvalidMonomorphization::ThirdArgElementType { - span, - name, - expected_element: element_ty2, - third_arg: arg_tys[2] - } + InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 } ); } } |
