diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-09-13 00:45:18 +0000 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-11-06 02:12:14 +0000 |
| commit | 569c51d30d0437ea03c62cd75aa1fa5bee1eaab0 (patch) | |
| tree | 8c2e2086b56abae9015c2c9d6d06ed322fe33eeb /compiler/rustc_codegen_llvm | |
| parent | 3981ca076c2a843d1cdc230691a0772eab76426e (diff) | |
| download | rust-569c51d30d0437ea03c62cd75aa1fa5bee1eaab0.tar.gz rust-569c51d30d0437ea03c62cd75aa1fa5bee1eaab0.zip | |
Fix off-by-one error uncovered by std::simd tests
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 2aafac7a6dc..99de11bc2c4 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -861,7 +861,7 @@ fn generic_simd_intrinsic( let (len, _) = arg_tys[1].simd_size_and_type(bx.tcx()); let expected_int_bits = (len.max(8) - 1).next_power_of_two(); - let expected_bytes = len / 8 + ((len % 8 > 1) as u64); + let expected_bytes = len / 8 + ((len % 8 > 0) as u64); let mask_ty = arg_tys[0]; let mask = match mask_ty.kind() { @@ -1073,7 +1073,7 @@ fn generic_simd_intrinsic( // * an array of `u8` // If the vector has less than 8 lanes, a u8 is returned with zeroed trailing bits. let expected_int_bits = in_len.max(8); - let expected_bytes = expected_int_bits / 8 + ((expected_int_bits % 8 > 1) as u64); + let expected_bytes = expected_int_bits / 8 + ((expected_int_bits % 8 > 0) as u64); // Integer vector <i{in_bitwidth} x in_len>: let (i_xn, in_elem_bitwidth) = match in_elem.kind() { |
