From e2711195d77d9af5755a0fd3e37486f8981171cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Oko=C5=84ski?= Date: Fri, 8 Dec 2023 01:21:12 +0100 Subject: [PATCH] Undo the changes to bitmask validation messages --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 20 ++++++------------- tests/ui/simd/masked-load-store-build-fail.rs | 4 ++-- .../simd/masked-load-store-build-fail.stderr | 4 ++-- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index db356e41b722e..f16014e136159 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1549,17 +1549,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>( } ); - let expected_int_bits = (mask_len.max(8) - 1).next_power_of_two(); - let expected_bytes = mask_len / 8 + ((mask_len % 8 > 0) as u64); - require!( matches!(mask_elem.kind(), ty::Int(_)), - InvalidMonomorphization::InvalidBitmask { + InvalidMonomorphization::ThirdArgElementType { span, name, - mask_ty, - expected_int_bits, - expected_bytes + expected_element: values_elem, + third_arg: mask_ty, } ); @@ -1645,17 +1641,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>( } ); - let expected_int_bits = (mask_len.max(8) - 1).next_power_of_two(); - let expected_bytes = mask_len / 8 + ((mask_len % 8 > 0) as u64); - require!( matches!(mask_elem.kind(), ty::Int(_)), - InvalidMonomorphization::InvalidBitmask { + InvalidMonomorphization::ThirdArgElementType { span, name, - mask_ty, - expected_int_bits, - expected_bytes + expected_element: values_elem, + third_arg: mask_ty, } ); diff --git a/tests/ui/simd/masked-load-store-build-fail.rs b/tests/ui/simd/masked-load-store-build-fail.rs index 3671d2e48975d..9b79b3bd6eaf2 100644 --- a/tests/ui/simd/masked-load-store-build-fail.rs +++ b/tests/ui/simd/masked-load-store-build-fail.rs @@ -41,7 +41,7 @@ fn main() { arr.as_ptr(), default ); - //~^^^^^ ERROR invalid bitmask `Simd`, expected `u8` or `[u8; 1]` + //~^^^^^ ERROR expected element type `u8` of third argument `Simd` to be a signed integer type simd_masked_store( Simd([-1i8; 4]), @@ -69,6 +69,6 @@ fn main() { arr.as_mut_ptr(), Simd([5u8; 4]) ); - //~^^^^^ ERROR invalid bitmask `Simd`, expected `u8` or `[u8; 1] + //~^^^^^ ERROR expected element type `u8` of third argument `Simd` to be a signed integer type } } diff --git a/tests/ui/simd/masked-load-store-build-fail.stderr b/tests/ui/simd/masked-load-store-build-fail.stderr index 5a1c792f9c8de..59af83fe0e893 100644 --- a/tests/ui/simd/masked-load-store-build-fail.stderr +++ b/tests/ui/simd/masked-load-store-build-fail.stderr @@ -28,7 +28,7 @@ LL | | Simd::([9; 4]) LL | | ); | |_________^ -error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: invalid bitmask `Simd`, expected `u8` or `[u8; 1]` +error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of third argument `Simd` to be a signed integer type --> $DIR/masked-load-store-build-fail.rs:39:9 | LL | / simd_masked_load( @@ -68,7 +68,7 @@ LL | | Simd([5u8; 2]) LL | | ); | |_________^ -error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: invalid bitmask `Simd`, expected `u8` or `[u8; 1]` +error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of third argument `Simd` to be a signed integer type --> $DIR/masked-load-store-build-fail.rs:67:9 | LL | / simd_masked_store(