diff --git a/library/stdarch/crates/core_arch/src/powerpc/altivec.rs b/library/stdarch/crates/core_arch/src/powerpc/altivec.rs index c5f08b519405..85255904383d 100644 --- a/library/stdarch/crates/core_arch/src/powerpc/altivec.rs +++ b/library/stdarch/crates/core_arch/src/powerpc/altivec.rs @@ -239,6 +239,9 @@ extern "C" { #[link_name = "llvm.ppc.altivec.vexptefp"] fn vexptefp(a: vector_float) -> vector_float; + + #[link_name = "llvm.floor.v4f32"] + fn vfloor(a: vector_float) -> vector_float; } macro_rules! s_t_l { @@ -409,6 +412,8 @@ mod sealed { } } + test_impl! { vec_floor(a: vector_float) -> vector_float [ vfloor, vrfim / xvrspim ] } + test_impl! { vec_vexptefp(a: vector_float) -> vector_float [ vexptefp, vexptefp ] } test_impl! { vec_vcmpgtub(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_bool_char [ vcmpgtub, vcmpgtub ] } @@ -1371,6 +1376,13 @@ mod sealed { vector_mladd! { vector_signed_short, vector_signed_short, vector_signed_short } } +/// Vector floor. +#[inline] +#[target_feature(enable = "altivec")] +pub unsafe fn vec_floor(a: vector_float) -> vector_float { + sealed::vec_floor(a) +} + /// Vector expte. #[inline] #[target_feature(enable = "altivec")] @@ -1800,6 +1812,11 @@ mod tests { } } + test_vec_1! { test_vec_floor, vec_floor, f32x4, + [1.1, 1.9, -0.5, -0.9], + [1.0, 1.0, -1.0, -1.0] + } + test_vec_1! { test_vec_expte, vec_expte, f32x4, [0.0, 2.0, 2.0, -1.0], ~[1.0, 4.0, 4.0, 0.5]