diff options
| author | bors <bors@rust-lang.org> | 2023-12-11 08:07:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-11 08:07:20 +0000 |
| commit | 8b1ba11cb1176cd7b8a0f4b55d1c97ee9fd3662d (patch) | |
| tree | bcf864ae9145c72eaed1c0f3f62cd79b3219a584 /compiler/rustc_codegen_llvm/src | |
| parent | c13187c9983a58f689531002e696ec206450b338 (diff) | |
| parent | aa00baeba410141d579d1cd32a8f4afa45bd28e9 (diff) | |
| download | rust-8b1ba11cb1176cd7b8a0f4b55d1c97ee9fd3662d.tar.gz rust-8b1ba11cb1176cd7b8a0f4b55d1c97ee9fd3662d.zip | |
Auto merge of #117116 - calebzulawski:repr-simd-packed, r=workingjubilee
Implement repr(packed) for repr(simd) This allows creating vectors with non-power-of-2 lengths that do not have padding. See rust-lang/portable-simd#319
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index f16014e1361..23b424f25ba 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -10,7 +10,7 @@ use crate::value::Value; use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc_codegen_ssa::errors::{ExpectedPointerMutability, InvalidMonomorphization}; -use rustc_codegen_ssa::mir::operand::OperandRef; +use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::*; use rustc_hir as hir; @@ -946,6 +946,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>( tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), callee_ty.fn_sig(tcx)); let arg_tys = sig.inputs(); + // Vectors must be immediates (non-power-of-2 #[repr(packed)] are not) + for (ty, arg) in arg_tys.iter().zip(args) { + if ty.is_simd() && !matches!(arg.val, OperandValue::Immediate(_)) { + return_error!(InvalidMonomorphization::SimdArgument { span, name, ty: *ty }); + } + } + if name == sym::simd_select_bitmask { let (len, _) = require_simd!(arg_tys[1], SimdArgument); |
