Change:
I tried this code: I expected to see this happen: I thought this would compile and do as it says since, states that accepts vector types., like f64x8 and i64x8. Instead, this happened: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: No backtrace applicable.
This is partly a diagnostics issue. The type you refer to in is more abstract, in that we permit it to be compiled in a way that does not actually use an AVX512 register. The type that the documentation is trying to refer to is... very not. Thus it needs a conversion step to/from the "definitely a hardware register" type. The implementation that we should be recommending is: Obviously that's a fair few steps to get from here to there and we can also consider ways to smooth this path further.
It turns out this was actually more possible than I expected by simply changing how inline accepts arguments, and validating that still has an equivalence to a register, so this code now passes:

Discussion:
ty::Adt(adt, substs) if adt.repr().simd() => { let fields = &adt.non_enum_variant().fields; let elem_ty = fields[FieldIdx::from_u32(0)].ty(self.tcx, substs); <del> match elem_ty.kind() { ty::Never | ty::Error(_) => return None, ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => { Some(InlineAsmType::VecI8(fields.len() as u64)) </del> <ins> let (size, ty) = match elem_ty.kind() { ty::Array(ty, len) => { if let Some(len) = len.try_eval_target_usize(self.tcx, self.tcx.param_env(adt.did())) { (len, *ty) } else { return None; } </ins> } <ins> _ => (fields.len() as u64, elem_ty), }; match ty.kind() { ty::Never | ty::Error(_) => return None, ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::VecI8(size)), </ins> ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => { <del> Some(InlineAsmType::VecI16(fields.len() as u64)) </del> <ins> Some(InlineAsmType::VecI16(size)) </ins> } ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => { <del> Some(InlineAsmType::VecI32(fields.len() as u64)) </del> <ins> Some(InlineAsmType::VecI32(size)) </ins> } ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => { <del> Some(InlineAsmType::VecI64(fields.len() as u64)) </del> <ins> Some(InlineAsmType::VecI64(size)) </ins> } ty::Int(IntTy::I128) | ty::Uint(UintTy::U128) => { <del> Some(InlineAsmType::VecI128(fields.len() as u64)) </del> <ins> Some(InlineAsmType::VecI128(size)) </ins> } ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => { Some(match self.tcx.sess.target.pointer_width { <del> 16 => InlineAsmType::VecI16(fields.len() as u64), 32 => InlineAsmType::VecI32(fields.len() as u64), 64 => InlineAsmType::VecI64(fields.len() as u64), </del> <ins> 16 => InlineAsmType::VecI16(size), 32 => InlineAsmType::VecI32(size), 64 => InlineAsmType::VecI64(size), </ins> _ => unreachable!(), }) } <del> ty::Float(FloatTy::F32) => Some(InlineAsmType::VecF32(fields.len() as u64)), ty::Float(FloatTy::F64) => Some(InlineAsmType::VecF64(fields.len() as u64)), </del> <ins> ty::Float(FloatTy::F32) => Some(InlineAsmType::VecF32(size)), ty::Float(FloatTy::F64) => Some(InlineAsmType::VecF64(size)), </ins> _ => None, } }

<ins> // assembly-output: emit-asm // compile-flags: --crate-type=lib // only-x86_64 // ignore-sgx #![feature(portable_simd)] use std::simd::Simd; use std::arch::asm; #[target_feature(enable = "avx")] #[no_mangle] // CHECK-LABEL: convert: pub unsafe fn convert(a: *const f32) -> Simd<f32, 8> { // CHECK: vbroadcastss (%{{[er][a-ds0-9][xpi0-9]?}}), {{%ymm[0-7]}} let b: Simd<f32, 8>; unsafe { asm!( "vbroadcastss {b}, [{a}]", a = in(reg) a, b = out(ymm_reg) b, ); } b } </ins>