Skip to content

Commit a76e41f

Browse files
committed
use simd_ge instead
1 parent 1b392f9 commit a76e41f

2 files changed

Lines changed: 51 additions & 12 deletions

File tree

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,21 +842,21 @@ pub(crate) mod sealed {
842842
unsafe fn vec_cmpge(self, b: Other) -> Self::Result;
843843
}
844844

845-
test_impl! { vec_vcmpgefp(a: vector_float, b: vector_float) -> vector_bool_int [ vcmpgefp, vcmpgefp ] }
846-
847-
// Implement VectorCmpGe trait for vector_float using vcmpgefp (AltiVec)
848-
// This is overridden by vsx.rs when VSX is available
849-
#[cfg(not(target_feature = "vsx"))]
845+
// Implement VectorCmpGe trait for vector_float using simd_ge
850846
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
851847
impl VectorCmpGe<vector_float> for vector_float {
852848
type Result = vector_bool_int;
853849
#[inline]
854850
#[target_feature(enable = "altivec")]
851+
#[cfg_attr(all(test, not(target_feature = "vsx")), assert_instr(vcmpgefp))]
852+
#[cfg_attr(all(test, target_feature = "vsx"), assert_instr(xvcmpgesp))]
855853
unsafe fn vec_cmpge(self, b: vector_float) -> Self::Result {
856-
vec_vcmpgefp(self, b)
854+
let result: m32x4 = simd_ge(self, b);
855+
transmute(result)
857856
}
858857
}
859858

859+
test_impl! { vec_vcmpgefp(a: vector_float, b: vector_float) -> vector_bool_int [ vcmpgefp, vcmpgefp ] }
860860
test_impl! { vec_vcmpequb(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_bool_char [ vcmpequb, vcmpequb ] }
861861
test_impl! { vec_vcmpequh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_bool_short [ vcmpequh, vcmpequh ] }
862862
test_impl! { vec_vcmpequw(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_bool_int [ vcmpequw, vcmpequw ] }

crates/core_arch/src/powerpc/vsx.rs

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,51 @@ macro_rules! impl_vsx_cmp {
192192
};
193193
}
194194

195-
impl_vsx_cmp!(VectorCmpEq, vec_cmpeq, simd_eq, vector_float, vector_bool_int, m32x4, xvcmpeqsp);
196-
impl_vsx_cmp!(VectorCmpEq, vec_cmpeq, simd_eq, vector_double, vector_bool_long, m64x2, xvcmpeqdp);
197-
impl_vsx_cmp!(VectorCmpGt, vec_cmpgt, simd_gt, vector_float, vector_bool_int, m32x4, xvcmpgtsp);
198-
impl_vsx_cmp!(VectorCmpGt, vec_cmpgt, simd_gt, vector_double, vector_bool_long, m64x2, xvcmpgtdp);
199-
impl_vsx_cmp!(VectorCmpGe, vec_cmpge, simd_ge, vector_float, vector_bool_int, m32x4, xvcmpgesp);
200-
impl_vsx_cmp!(VectorCmpGe, vec_cmpge, simd_ge, vector_double, vector_bool_long, m64x2, xvcmpgedp);
195+
impl_vsx_cmp!(
196+
VectorCmpEq,
197+
vec_cmpeq,
198+
simd_eq,
199+
vector_float,
200+
vector_bool_int,
201+
m32x4,
202+
xvcmpeqsp
203+
);
204+
impl_vsx_cmp!(
205+
VectorCmpEq,
206+
vec_cmpeq,
207+
simd_eq,
208+
vector_double,
209+
vector_bool_long,
210+
m64x2,
211+
xvcmpeqdp
212+
);
213+
impl_vsx_cmp!(
214+
VectorCmpGt,
215+
vec_cmpgt,
216+
simd_gt,
217+
vector_float,
218+
vector_bool_int,
219+
m32x4,
220+
xvcmpgtsp
221+
);
222+
impl_vsx_cmp!(
223+
VectorCmpGt,
224+
vec_cmpgt,
225+
simd_gt,
226+
vector_double,
227+
vector_bool_long,
228+
m64x2,
229+
xvcmpgtdp
230+
);
231+
impl_vsx_cmp!(
232+
VectorCmpGe,
233+
vec_cmpge,
234+
simd_ge,
235+
vector_double,
236+
vector_bool_long,
237+
m64x2,
238+
xvcmpgedp
239+
);
201240

202241
/// Vector permute.
203242
#[inline]

0 commit comments

Comments
 (0)