Skip to content

Commit c2aa225

Browse files
lu-zerognzlbg
authored andcommitted
Add Altivec vec_cmpge
1 parent f99fee7 commit c2aa225

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ extern "C" {
219219
fn vcmpequh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_bool_short;
220220
#[link_name = "llvm.ppc.altivec.vcmpequw"]
221221
fn vcmpequw(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_bool_int;
222+
223+
#[link_name = "llvm.ppc.altivec.vcmpgefp"]
224+
fn vcmpgefp(a: vector_float, b: vector_float) -> vector_bool_int;
222225
}
223226

224227
macro_rules! s_t_l {
@@ -375,6 +378,8 @@ mod sealed {
375378
}
376379
}
377380

381+
test_impl! { vec_vcmpgefp(a: vector_float, b: vector_float) -> vector_bool_int [ vcmpgefp, vcmpgefp ] }
382+
378383
test_impl! { vec_vcmpequb(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_bool_char [ vcmpequb, vcmpequb ] }
379384
test_impl! { vec_vcmpequh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_bool_short [ vcmpequh, vcmpequh ] }
380385
test_impl! { vec_vcmpequw(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_bool_int [ vcmpequw, vcmpequw ] }
@@ -1318,6 +1323,13 @@ mod sealed {
13181323
vector_mladd! { vector_signed_short, vector_signed_short, vector_signed_short }
13191324
}
13201325

1326+
/// Vector cmpge.
1327+
#[inline]
1328+
#[target_feature(enable = "altivec")]
1329+
pub unsafe fn vec_cmpge(a: vector_float, b: vector_float) -> vector_bool_int {
1330+
sealed::vec_vcmpgefp(a, b)
1331+
}
1332+
13211333
/// Vector cmpeq.
13221334
#[inline]
13231335
#[target_feature(enable = "altivec")]
@@ -1679,6 +1691,12 @@ mod tests {
16791691
}
16801692
}
16811693

1694+
test_vec_2! { test_vec_cmpge, vec_cmpge, f32x4 -> m32x4,
1695+
[0.1, -0.1, 0.0, 0.99],
1696+
[0.1, 0.0, 0.1, 1.0],
1697+
[true, false, false, false]
1698+
}
1699+
16821700
test_vec_2! { test_vec_cmpeq_i8, vec_cmpeq, i8x16 -> m8x16,
16831701
[1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
16841702
[0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],

0 commit comments

Comments
 (0)