11//! Private implementation details of public gather/scatter APIs.
2+ #[ cfg( not( bootstrap) ) ]
3+ use crate :: simd:: intrinsics;
24use crate :: simd:: { LaneCount , Simd , SupportedLaneCount } ;
5+ #[ cfg( bootstrap) ]
36use core:: mem;
47
58/// A vector of *const T.
@@ -21,12 +24,16 @@ where
2124 #[ inline]
2225 #[ must_use]
2326 pub fn wrapping_add ( self , addend : Simd < usize , LANES > ) -> Self {
27+ #[ cfg( bootstrap) ]
2428 // Safety: converting pointers to usize and vice-versa is safe
2529 // (even if using that pointer is not)
2630 unsafe {
2731 let x: Simd < usize , LANES > = mem:: transmute_copy ( & self ) ;
2832 mem:: transmute_copy ( & { x + ( addend * Simd :: splat ( mem:: size_of :: < T > ( ) ) ) } )
2933 }
34+ #[ cfg( not( bootstrap) ) ]
35+ // Safety: this intrinsic doesn't have a precondition
36+ unsafe { intrinsics:: simd_arith_offset ( self , addend) }
3037 }
3138}
3239
@@ -49,11 +56,15 @@ where
4956 #[ inline]
5057 #[ must_use]
5158 pub fn wrapping_add ( self , addend : Simd < usize , LANES > ) -> Self {
59+ #[ cfg( bootstrap) ]
5260 // Safety: converting pointers to usize and vice-versa is safe
5361 // (even if using that pointer is not)
5462 unsafe {
5563 let x: Simd < usize , LANES > = mem:: transmute_copy ( & self ) ;
5664 mem:: transmute_copy ( & { x + ( addend * Simd :: splat ( mem:: size_of :: < T > ( ) ) ) } )
5765 }
66+ #[ cfg( not( bootstrap) ) ]
67+ // Safety: this intrinsic doesn't have a precondition
68+ unsafe { intrinsics:: simd_arith_offset ( self , addend) }
5869 }
5970}
0 commit comments