mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
also rename the SIMD intrinsic
This commit is contained in:
parent
038e7c6c38
commit
f2cff5ebb9
@ -965,7 +965,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
});
|
||||
}
|
||||
|
||||
sym::simd_expose_addr | sym::simd_from_exposed_addr | sym::simd_cast_ptr => {
|
||||
sym::simd_expose_addr | sym::simd_with_exposed_provenance | sym::simd_cast_ptr => {
|
||||
intrinsic_args!(fx, args => (arg); intrinsic);
|
||||
ret.write_cvalue_transmute(fx, arg);
|
||||
}
|
||||
|
@ -2133,7 +2133,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
|
||||
return Ok(bx.ptrtoint(args[0].immediate(), llret_ty));
|
||||
}
|
||||
|
||||
if name == sym::simd_from_exposed_addr {
|
||||
if name == sym::simd_with_exposed_provenance {
|
||||
let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
|
||||
require!(
|
||||
in_len == out_len,
|
||||
|
@ -42,7 +42,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
|
||||
CastKind::PointerWithExposedProvenance => {
|
||||
let src = self.read_immediate(src)?;
|
||||
let res = self.pointer_from_exposed_address_cast(&src, cast_layout)?;
|
||||
let res = self.pointer_with_exposed_provenance_cast(&src, cast_layout)?;
|
||||
self.write_immediate(*res, dest)?;
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
Ok(ImmTy::from_scalar(self.cast_from_int_like(scalar, src.layout, cast_to.ty)?, cast_to))
|
||||
}
|
||||
|
||||
pub fn pointer_from_exposed_address_cast(
|
||||
pub fn pointer_with_exposed_provenance_cast(
|
||||
&self,
|
||||
src: &ImmTy<'tcx, M::Provenance>,
|
||||
cast_to: TyAndLayout<'tcx>,
|
||||
|
@ -623,7 +623,7 @@ pub fn check_intrinsic_type(
|
||||
| sym::simd_as
|
||||
| sym::simd_cast_ptr
|
||||
| sym::simd_expose_addr
|
||||
| sym::simd_from_exposed_addr => (2, 0, vec![param(0)], param(1)),
|
||||
| sym::simd_with_exposed_provenance => (2, 0, vec![param(0)], param(1)),
|
||||
sym::simd_bitmask => (2, 0, vec![param(0)], param(1)),
|
||||
sym::simd_select | sym::simd_select_bitmask => {
|
||||
(2, 0, vec![param(0), param(1), param(1)], param(1))
|
||||
|
@ -1649,7 +1649,6 @@ symbols! {
|
||||
simd_fmin,
|
||||
simd_fpow,
|
||||
simd_fpowi,
|
||||
simd_from_exposed_addr,
|
||||
simd_fsin,
|
||||
simd_fsqrt,
|
||||
simd_gather,
|
||||
@ -1688,6 +1687,7 @@ symbols! {
|
||||
simd_shuffle_generic,
|
||||
simd_sub,
|
||||
simd_trunc,
|
||||
simd_with_exposed_provenance,
|
||||
simd_xor,
|
||||
since,
|
||||
sinf128,
|
||||
|
@ -549,6 +549,10 @@ extern "rust-intrinsic" {
|
||||
///
|
||||
/// `U` must be a vector of pointers, with the same length as `T`.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn simd_with_exposed_provenance<T, U>(addr: T) -> U;
|
||||
#[rustc_nounwind]
|
||||
#[cfg(bootstrap)]
|
||||
pub fn simd_from_exposed_addr<T, U>(addr: T) -> U;
|
||||
|
||||
/// Swap bytes of each element.
|
||||
@ -655,3 +659,6 @@ extern "rust-intrinsic" {
|
||||
#[rustc_nounwind]
|
||||
pub fn simd_flog<T>(a: T) -> T;
|
||||
}
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
pub use simd_from_exposed_addr as simd_with_exposed_provenance;
|
||||
|
@ -139,7 +139,7 @@ where
|
||||
#[inline]
|
||||
fn with_exposed_provenance(addr: Self::Usize) -> Self {
|
||||
// Safety: `self` is a pointer vector
|
||||
unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
|
||||
unsafe { core::intrinsics::simd::simd_with_exposed_provenance(addr) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -136,7 +136,7 @@ where
|
||||
#[inline]
|
||||
fn with_exposed_provenance(addr: Self::Usize) -> Self {
|
||||
// Safety: `self` is a pointer vector
|
||||
unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
|
||||
unsafe { core::intrinsics::simd::simd_with_exposed_provenance(addr) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -484,7 +484,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
dest.transmute(this.machine.layouts.uint(dest.layout.size).unwrap(), this)?;
|
||||
this.write_int(res, &dest)?;
|
||||
}
|
||||
"cast" | "as" | "cast_ptr" | "expose_addr" | "from_exposed_addr" => {
|
||||
"cast" | "as" | "cast_ptr" | "expose_addr" | "with_exposed_provenance" => {
|
||||
let [op] = check_arg_count(args)?;
|
||||
let (op, op_len) = this.operand_to_simd(op)?;
|
||||
let (dest, dest_len) = this.mplace_to_simd(dest)?;
|
||||
@ -495,7 +495,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
let safe_cast = intrinsic_name == "as";
|
||||
let ptr_cast = intrinsic_name == "cast_ptr";
|
||||
let expose_cast = intrinsic_name == "expose_addr";
|
||||
let from_exposed_cast = intrinsic_name == "from_exposed_addr";
|
||||
let from_exposed_cast = intrinsic_name == "with_exposed_provenance";
|
||||
|
||||
for i in 0..dest_len {
|
||||
let op = this.read_immediate(&this.project_index(&op, i)?)?;
|
||||
@ -529,7 +529,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
(ty::RawPtr(..), ty::Int(_) | ty::Uint(_)) if expose_cast =>
|
||||
this.pointer_expose_address_cast(&op, dest.layout)?,
|
||||
(ty::Int(_) | ty::Uint(_), ty::RawPtr(..)) if from_exposed_cast =>
|
||||
this.pointer_from_exposed_address_cast(&op, dest.layout)?,
|
||||
this.pointer_with_exposed_provenance_cast(&op, dest.layout)?,
|
||||
// Error otherwise
|
||||
_ =>
|
||||
throw_unsup_format!(
|
||||
|
@ -5,7 +5,7 @@
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_cast_ptr<T, U>(x: T) -> U;
|
||||
fn simd_expose_addr<T, U>(x: T) -> U;
|
||||
fn simd_from_exposed_addr<T, U>(x: T) -> U;
|
||||
fn simd_with_exposed_provenance<T, U>(x: T) -> U;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@ -24,7 +24,7 @@ fn main() {
|
||||
|
||||
let exposed_addr: V<usize> = simd_expose_addr(const_ptrs);
|
||||
|
||||
let with_exposed_provenance: V<*mut i8> = simd_from_exposed_addr(exposed_addr);
|
||||
let with_exposed_provenance: V<*mut i8> = simd_with_exposed_provenance(exposed_addr);
|
||||
|
||||
assert!(const_ptrs.0 == [ptr as *const u8, core::ptr::null()]);
|
||||
assert!(exposed_addr.0 == [ptr as usize, 0]);
|
||||
|
Loading…
Reference in New Issue
Block a user