Skip to content

Commit f2cff5e

Browse files
committed
also rename the SIMD intrinsic
1 parent 038e7c6 commit f2cff5e

File tree

10 files changed

+20
-13
lines changed

10 files changed

+20
-13
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
965965
});
966966
}
967967

968-
sym::simd_expose_addr | sym::simd_from_exposed_addr | sym::simd_cast_ptr => {
968+
sym::simd_expose_addr | sym::simd_with_exposed_provenance | sym::simd_cast_ptr => {
969969
intrinsic_args!(fx, args => (arg); intrinsic);
970970
ret.write_cvalue_transmute(fx, arg);
971971
}

compiler/rustc_codegen_llvm/src/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
21332133
return Ok(bx.ptrtoint(args[0].immediate(), llret_ty));
21342134
}
21352135

2136-
if name == sym::simd_from_exposed_addr {
2136+
if name == sym::simd_with_exposed_provenance {
21372137
let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
21382138
require!(
21392139
in_len == out_len,

compiler/rustc_const_eval/src/interpret/cast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
4242

4343
CastKind::PointerWithExposedProvenance => {
4444
let src = self.read_immediate(src)?;
45-
let res = self.pointer_from_exposed_address_cast(&src, cast_layout)?;
45+
let res = self.pointer_with_exposed_provenance_cast(&src, cast_layout)?;
4646
self.write_immediate(*res, dest)?;
4747
}
4848

@@ -242,7 +242,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
242242
Ok(ImmTy::from_scalar(self.cast_from_int_like(scalar, src.layout, cast_to.ty)?, cast_to))
243243
}
244244

245-
pub fn pointer_from_exposed_address_cast(
245+
pub fn pointer_with_exposed_provenance_cast(
246246
&self,
247247
src: &ImmTy<'tcx, M::Provenance>,
248248
cast_to: TyAndLayout<'tcx>,

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ pub fn check_intrinsic_type(
623623
| sym::simd_as
624624
| sym::simd_cast_ptr
625625
| sym::simd_expose_addr
626-
| sym::simd_from_exposed_addr => (2, 0, vec![param(0)], param(1)),
626+
| sym::simd_with_exposed_provenance => (2, 0, vec![param(0)], param(1)),
627627
sym::simd_bitmask => (2, 0, vec![param(0)], param(1)),
628628
sym::simd_select | sym::simd_select_bitmask => {
629629
(2, 0, vec![param(0), param(1), param(1)], param(1))

compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,6 @@ symbols! {
16491649
simd_fmin,
16501650
simd_fpow,
16511651
simd_fpowi,
1652-
simd_from_exposed_addr,
16531652
simd_fsin,
16541653
simd_fsqrt,
16551654
simd_gather,
@@ -1688,6 +1687,7 @@ symbols! {
16881687
simd_shuffle_generic,
16891688
simd_sub,
16901689
simd_trunc,
1690+
simd_with_exposed_provenance,
16911691
simd_xor,
16921692
since,
16931693
sinf128,

library/core/src/intrinsics/simd.rs

+7
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ extern "rust-intrinsic" {
549549
///
550550
/// `U` must be a vector of pointers, with the same length as `T`.
551551
#[rustc_nounwind]
552+
#[cfg(not(bootstrap))]
553+
pub fn simd_with_exposed_provenance<T, U>(addr: T) -> U;
554+
#[rustc_nounwind]
555+
#[cfg(bootstrap)]
552556
pub fn simd_from_exposed_addr<T, U>(addr: T) -> U;
553557

554558
/// Swap bytes of each element.
@@ -655,3 +659,6 @@ extern "rust-intrinsic" {
655659
#[rustc_nounwind]
656660
pub fn simd_flog<T>(a: T) -> T;
657661
}
662+
663+
#[cfg(bootstrap)]
664+
pub use simd_from_exposed_addr as simd_with_exposed_provenance;

library/portable-simd/crates/core_simd/src/simd/ptr/const_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ where
139139
#[inline]
140140
fn with_exposed_provenance(addr: Self::Usize) -> Self {
141141
// Safety: `self` is a pointer vector
142-
unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
142+
unsafe { core::intrinsics::simd::simd_with_exposed_provenance(addr) }
143143
}
144144

145145
#[inline]

library/portable-simd/crates/core_simd/src/simd/ptr/mut_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ where
136136
#[inline]
137137
fn with_exposed_provenance(addr: Self::Usize) -> Self {
138138
// Safety: `self` is a pointer vector
139-
unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
139+
unsafe { core::intrinsics::simd::simd_with_exposed_provenance(addr) }
140140
}
141141

142142
#[inline]

src/tools/miri/src/shims/intrinsics/simd.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
484484
dest.transmute(this.machine.layouts.uint(dest.layout.size).unwrap(), this)?;
485485
this.write_int(res, &dest)?;
486486
}
487-
"cast" | "as" | "cast_ptr" | "expose_addr" | "from_exposed_addr" => {
487+
"cast" | "as" | "cast_ptr" | "expose_addr" | "with_exposed_provenance" => {
488488
let [op] = check_arg_count(args)?;
489489
let (op, op_len) = this.operand_to_simd(op)?;
490490
let (dest, dest_len) = this.mplace_to_simd(dest)?;
@@ -495,7 +495,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
495495
let safe_cast = intrinsic_name == "as";
496496
let ptr_cast = intrinsic_name == "cast_ptr";
497497
let expose_cast = intrinsic_name == "expose_addr";
498-
let from_exposed_cast = intrinsic_name == "from_exposed_addr";
498+
let from_exposed_cast = intrinsic_name == "with_exposed_provenance";
499499

500500
for i in 0..dest_len {
501501
let op = this.read_immediate(&this.project_index(&op, i)?)?;
@@ -529,7 +529,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
529529
(ty::RawPtr(..), ty::Int(_) | ty::Uint(_)) if expose_cast =>
530530
this.pointer_expose_address_cast(&op, dest.layout)?,
531531
(ty::Int(_) | ty::Uint(_), ty::RawPtr(..)) if from_exposed_cast =>
532-
this.pointer_from_exposed_address_cast(&op, dest.layout)?,
532+
this.pointer_with_exposed_provenance_cast(&op, dest.layout)?,
533533
// Error otherwise
534534
_ =>
535535
throw_unsup_format!(

tests/ui/simd/intrinsic/ptr-cast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern "rust-intrinsic" {
66
fn simd_cast_ptr<T, U>(x: T) -> U;
77
fn simd_expose_addr<T, U>(x: T) -> U;
8-
fn simd_from_exposed_addr<T, U>(x: T) -> U;
8+
fn simd_with_exposed_provenance<T, U>(x: T) -> U;
99
}
1010

1111
#[derive(Copy, Clone)]
@@ -24,7 +24,7 @@ fn main() {
2424

2525
let exposed_addr: V<usize> = simd_expose_addr(const_ptrs);
2626

27-
let with_exposed_provenance: V<*mut i8> = simd_from_exposed_addr(exposed_addr);
27+
let with_exposed_provenance: V<*mut i8> = simd_with_exposed_provenance(exposed_addr);
2828

2929
assert!(const_ptrs.0 == [ptr as *const u8, core::ptr::null()]);
3030
assert!(exposed_addr.0 == [ptr as usize, 0]);

0 commit comments

Comments
 (0)