Add Altivec vec_floor

This commit is contained in:
Luca Barbato 2019-05-28 09:28:22 +00:00 committed by Luca Barbato
parent 1f96c3192e
commit 6f9061f78b

View file

@ -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]