Skip to content

Commit f85ee20

Browse files
committed
Use llvm.ppc.altivec.lvx intrinsic for vec_ld
The `vec_ld` intrinsic is expected to automatically round the given address down to a 16-byte boundary.
1 parent b668972 commit f85ee20

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/core_arch/src/powerpc/altivec.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ types! {
5151

5252
#[allow(improper_ctypes)]
5353
extern "C" {
54+
#[link_name = "llvm.ppc.altivec.lvx"]
55+
fn lvx(
56+
p: *const i8,
57+
) -> vector_unsigned_int;
5458
#[link_name = "llvm.ppc.altivec.vperm"]
5559
fn vperm(
5660
a: vector_signed_int,
@@ -442,8 +446,7 @@ mod sealed {
442446
#[inline(always)]
443447
unsafe fn load(off: i32, p: *const i8) -> u32x4 {
444448
let addr = p.offset(off as isize);
445-
446-
*(addr as *const u32x4)
449+
transmute(lvx(addr))
447450
}
448451

449452
pub trait VectorLd {

0 commit comments

Comments
 (0)