Skip to content

Commit b824fab

Browse files
committed
start using the newly added target features for testing
1 parent b2aac89 commit b824fab

File tree

3 files changed

+43
-24
lines changed

3 files changed

+43
-24
lines changed

ci/run.sh

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ case ${TARGET} in
124124
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa"
125125
cargo_test "${PROFILE}"
126126
;;
127+
s390x*)
128+
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+vector-enhancements-1"
129+
cargo_test "${PROFILE}"
130+
;;
127131
powerpc64*)
128132
# We don't build the ppc 32-bit targets with these - these targets
129133
# are mostly unsupported for now.

crates/core_arch/src/s390x/macros.rs

+16
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ macro_rules! test_impl {
1717
transmute($call ($($v),*))
1818
}
1919
};
20+
($fun:ident +($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $tf:literal $instr:ident]) => {
21+
#[inline]
22+
#[target_feature(enable = "vector")]
23+
#[cfg_attr(all(test, target_feature = $tf), assert_instr($instr))]
24+
pub unsafe fn $fun ($($v : $ty),*) -> $r {
25+
transmute($call ($($v),*))
26+
}
27+
};
28+
($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $tf:literal $instr:ident]) => {
29+
#[inline]
30+
#[target_feature(enable = "vector")]
31+
#[cfg_attr(all(test, target_feature = $tf), assert_instr($instr))]
32+
pub unsafe fn $fun ($($v : $ty),*) -> $r {
33+
$call ($($v),*)
34+
}
35+
};
2036
($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $instr:ident]) => {
2137
#[inline]
2238
#[target_feature(enable = "vector")]

crates/core_arch/src/s390x/vector.rs

+23-24
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ mod sealed {
163163

164164
#[inline]
165165
#[target_feature(enable = "vector")]
166-
// FIXME: "vfasb" is part of vector enhancements 1, add a test for it when possible
167-
// #[cfg_attr(test, assert_instr(vfasb))]
166+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(vfasb))]
168167
pub unsafe fn va_float(a: vector_float, b: vector_float) -> vector_float {
169168
transmute(simd_add(a, b))
170169
}
@@ -247,8 +246,7 @@ mod sealed {
247246

248247
#[inline]
249248
#[target_feature(enable = "vector")]
250-
// FIXME: "vfssb" is part of vector enhancements 1, add a test for it when possible
251-
// #[cfg_attr(test, assert_instr(vfasb))]
249+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(vfssb))]
252250
pub unsafe fn vs_float(a: vector_float, b: vector_float) -> vector_float {
253251
transmute(simd_sub(a, b))
254252
}
@@ -335,9 +333,8 @@ mod sealed {
335333

336334
impl_vec_trait! { [VectorMax vec_max] ~(vmxlb, vmxb, vmxlh, vmxh, vmxlf, vmxf, vmxlg, vmxg) }
337335

338-
// FIXME(vector-enhancements-1) test for the `vfmaxsb` etc. instruction
339-
test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [simd_fmax, _] }
340-
test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [simd_fmax, _] }
336+
test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [simd_fmax, "vector-enhancements-1" vfmaxsb ] }
337+
test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [simd_fmax, "vector-enhancements-1" vfmaxdb] }
341338

342339
impl_vec_trait!([VectorMax vec_max] vec_vfmaxsb (vector_float, vector_float) -> vector_float);
343340
impl_vec_trait!([VectorMax vec_max] vec_vfmaxdb (vector_double, vector_double) -> vector_double);
@@ -360,9 +357,8 @@ mod sealed {
360357

361358
impl_vec_trait! { [VectorMin vec_min] ~(vmxlb, vmxb, vmxlh, vmxh, vmxlf, vmxf, vmxlg, vmxg) }
362359

363-
// FIXME(vector-enhancements-1) test for the `vfminsb` etc. instruction
364-
test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [simd_fmin, _] }
365-
test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [simd_fmin, _] }
360+
test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [simd_fmin, "vector-enhancements-1" vfminsb] }
361+
test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [simd_fmin, "vector-enhancements-1" vfmindb] }
366362

367363
impl_vec_trait!([VectorMin vec_min] vec_vfminsb (vector_float, vector_float) -> vector_float);
368364
impl_vec_trait!([VectorMin vec_min] vec_vfmindb (vector_double, vector_double) -> vector_double);
@@ -389,8 +385,7 @@ mod sealed {
389385
impl_abs! { vec_abs_i32, i32x4 }
390386
impl_abs! { vec_abs_i64, i64x2 }
391387

392-
// FIXME(vector-enhancements-1)
393-
test_impl! { vec_abs_f32 (v: vector_float) -> vector_float [ simd_fabs, _ ] }
388+
test_impl! { vec_abs_f32 (v: vector_float) -> vector_float [ simd_fabs, "vector-enhancements-1" vflpsb ] }
394389
test_impl! { vec_abs_f64 (v: vector_double) -> vector_double [ simd_fabs, vflpdb ] }
395390

396391
impl_vec_trait! { [VectorAbs vec_abs] vec_abs_f32 (vector_float) }
@@ -527,10 +522,15 @@ mod sealed {
527522
test_impl! { vec_ctzf_unsigned +(a: vector_unsigned_int) -> vector_unsigned_int [simd_cttz, vctzf] }
528523
test_impl! { vec_ctzg_unsigned +(a: vector_unsigned_long_long) -> vector_unsigned_long_long [simd_cttz, vctzg] }
529524

530-
// FIXME(vector-enhancements-1) other integer types are emulated, but get their own
531-
// instructions in later facilities. Add tests when possible.
532-
test_impl! { vec_popcnt_signed +(a: vector_signed_char) -> vector_signed_char [simd_ctpop, vpopctb] }
533-
test_impl! { vec_popcnt_unsigned +(a: vector_unsigned_char) -> vector_unsigned_char [simd_ctpop, vpopctb] }
525+
test_impl! { vec_vpopctb_signed +(a: vector_signed_char) -> vector_signed_char [simd_ctpop, vpopctb] }
526+
test_impl! { vec_vpopcth_signed +(a: vector_signed_short) -> vector_signed_short [simd_ctpop, "vector-enhancements-1" vpopcth] }
527+
test_impl! { vec_vpopctf_signed +(a: vector_signed_int) -> vector_signed_int [simd_ctpop, "vector-enhancements-1" vpopctf] }
528+
test_impl! { vec_vpopctg_signed +(a: vector_signed_long_long) -> vector_signed_long_long [simd_ctpop, "vector-enhancements-1" vpopctg] }
529+
530+
test_impl! { vec_vpopctb_unsigned +(a: vector_unsigned_char) -> vector_unsigned_char [simd_ctpop, vpopctb] }
531+
test_impl! { vec_vpopcth_unsigned +(a: vector_unsigned_short) -> vector_unsigned_short [simd_ctpop, "vector-enhancements-1" vpopcth] }
532+
test_impl! { vec_vpopctf_unsigned +(a: vector_unsigned_int) -> vector_unsigned_int [simd_ctpop, "vector-enhancements-1" vpopctf] }
533+
test_impl! { vec_vpopctg_unsigned +(a: vector_unsigned_long_long) -> vector_unsigned_long_long [simd_ctpop, "vector-enhancements-1" vpopctg] }
534534

535535
#[unstable(feature = "stdarch_s390x", issue = "135681")]
536536
pub trait VectorAnd<Other> {
@@ -558,7 +558,7 @@ mod sealed {
558558

559559
#[inline]
560560
#[target_feature(enable = "vector")]
561-
// FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vno))]
561+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(vno))]
562562
unsafe fn nor(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
563563
let a: u8x16 = transmute(a);
564564
let b: u8x16 = transmute(b);
@@ -575,7 +575,7 @@ mod sealed {
575575

576576
#[inline]
577577
#[target_feature(enable = "vector")]
578-
// FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vnn))]
578+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(vnn))]
579579
unsafe fn nand(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
580580
let a: u8x16 = transmute(a);
581581
let b: u8x16 = transmute(b);
@@ -592,7 +592,7 @@ mod sealed {
592592

593593
#[inline]
594594
#[target_feature(enable = "vector")]
595-
// FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vnx))]
595+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(vnx))]
596596
unsafe fn eqv(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
597597
let a: u8x16 = transmute(a);
598598
let b: u8x16 = transmute(b);
@@ -609,7 +609,7 @@ mod sealed {
609609

610610
#[inline]
611611
#[target_feature(enable = "vector")]
612-
// FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vnc))]
612+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(vnc))]
613613
unsafe fn andc(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
614614
let a = transmute(a);
615615
let b = transmute(b);
@@ -626,7 +626,7 @@ mod sealed {
626626

627627
#[inline]
628628
#[target_feature(enable = "vector")]
629-
// FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(voc))]
629+
#[cfg_attr(all(test, target_feature = "vector-enhancements-1"), assert_instr(voc))]
630630
unsafe fn orc(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
631631
let a = transmute(a);
632632
let b = transmute(b);
@@ -641,15 +641,14 @@ mod sealed {
641641

642642
impl_vec_trait! { [VectorOrc vec_orc]+ 2c (orc) }
643643

644-
// FIXME(vector-enhancements-1) add instr tests for f32
645-
test_impl! { vec_roundc_f32 (a: vector_float) -> vector_float [nearbyint_v4f32, _] }
644+
test_impl! { vec_roundc_f32 (a: vector_float) -> vector_float [nearbyint_v4f32, "vector-enhancements-1" vfisb] }
646645
test_impl! { vec_roundc_f64 (a: vector_double) -> vector_double [nearbyint_v2f64, vfidb] }
647646

648647
// FIXME(llvm) roundeven does not yet lower to vfidb (but should in the future)
649648
test_impl! { vec_round_f32 (a: vector_float) -> vector_float [roundeven_v4f32, _] }
650649
test_impl! { vec_round_f64 (a: vector_double) -> vector_double [roundeven_v2f64, _] }
651650

652-
test_impl! { vec_rint_f32 (a: vector_float) -> vector_float [rint_v4f32, _] }
651+
test_impl! { vec_rint_f32 (a: vector_float) -> vector_float [rint_v4f32, "vector-enhancements-1" vfisb] }
653652
test_impl! { vec_rint_f64 (a: vector_double) -> vector_double [rint_v2f64, vfidb] }
654653

655654
#[unstable(feature = "stdarch_s390x", issue = "135681")]

0 commit comments

Comments
 (0)