Skip to content

Commit 998a0ac

Browse files
folkertdevAmanieu
authored andcommitted
use the right load instruction
1 parent ffef966 commit 998a0ac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ mod sealed {
547547
#[target_feature(enable = "altivec")]
548548
#[cfg_attr(test, assert_instr($instr))]
549549
pub unsafe fn $fun(a: isize, b: *const $ty) -> t_t_l!($ty) {
550-
let addr = (b as *const i8).offset(a);
550+
let addr = b.byte_offset(a).cast::<i8>();
551551
transmute($instr(addr))
552552
}
553553

@@ -4785,7 +4785,7 @@ mod tests {
47854785
unsafe fn test_vec_lde_u16() {
47864786
let pat = [u16x8::new(0, 1, 2, 3, 4, 5, 6, 7)];
47874787
for off in 0..8 {
4788-
let v: u16x8 = transmute(vec_lde(off * 2, pat.as_ptr() as *const u8));
4788+
let v: u16x8 = transmute(vec_lde(off * 2, pat.as_ptr() as *const u16));
47894789
assert_eq!(off as u16, v.extract(off as _));
47904790
}
47914791
}
@@ -4794,7 +4794,7 @@ mod tests {
47944794
unsafe fn test_vec_lde_u32() {
47954795
let pat = [u32x4::new(0, 1, 2, 3)];
47964796
for off in 0..4 {
4797-
let v: u32x4 = transmute(vec_lde(off * 4, pat.as_ptr() as *const u8));
4797+
let v: u32x4 = transmute(vec_lde(off * 4, pat.as_ptr() as *const u32));
47984798
assert_eq!(off as u32, v.extract(off as _));
47994799
}
48004800
}

0 commit comments

Comments
 (0)