diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2020-10-03 16:13:06 +0100 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2020-10-03 20:35:59 +0100 |
| commit | e41a14412e207aac5f7d686d395bc6a23f643dc9 (patch) | |
| tree | e9387b3eaabb9516d8cc676a286a2d2d63bd950d /compiler/rustc_codegen_llvm/src | |
| parent | 6f56fbdc1c58992a9db630f5cd2ba9882d32e84b (diff) | |
| download | rust-e41a14412e207aac5f7d686d395bc6a23f643dc9.tar.gz rust-e41a14412e207aac5f7d686d395bc6a23f643dc9.zip | |
Support vectors with fewer than 8 elements for simd_select_bitmask
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 7f5b09eac4f..e76e86f5651 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -793,14 +793,18 @@ fn generic_simd_intrinsic( require_simd!(arg_tys[1], "argument"); let v_len = arg_tys[1].simd_size(tcx); require!( - m_len == v_len, + // Allow masks for vectors with fewer than 8 elements to be + // represented with a u8 or i8. + m_len == v_len || (m_len == 8 && v_len < 8), "mismatched lengths: mask length `{}` != other vector length `{}`", m_len, v_len ); let i1 = bx.type_i1(); - let i1xn = bx.type_vector(i1, m_len); - let m_i1s = bx.bitcast(args[0].immediate(), i1xn); + let im = bx.type_ix(v_len); + let i1xn = bx.type_vector(i1, v_len); + let m_im = bx.trunc(args[0].immediate(), im); + let m_i1s = bx.bitcast(m_im, i1xn); return Ok(bx.select(m_i1s, args[1].immediate(), args[2].immediate())); } |
