Skip to content

Commit de68f27

Browse files
authored
Rollup merge of #152174 - folkertdev:stdarch-sync-2026-02-05, r=folkertdev
stdarch subtree update Subtree update of `stdarch` to rust-lang/stdarch@1a7cc47. Created using https://github.com/rust-lang/josh-sync. r? @ghost
2 parents f889772 + 3cf999f commit de68f27

File tree

16 files changed

+975
-1757
lines changed

16 files changed

+975
-1757
lines changed

library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs

Lines changed: 39 additions & 39 deletions
Large diffs are not rendered by default.

library/stdarch/crates/core_arch/src/aarch64/neon/mod.rs

Lines changed: 291 additions & 129 deletions
Large diffs are not rendered by default.

library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs

Lines changed: 100 additions & 1252 deletions
Large diffs are not rendered by default.

library/stdarch/crates/core_arch/src/powerpc/altivec.rs

Lines changed: 300 additions & 240 deletions
Large diffs are not rendered by default.

library/stdarch/crates/core_arch/src/powerpc/vsx.rs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#![allow(non_camel_case_types)]
1010

1111
use crate::core_arch::powerpc::*;
12+
use crate::core_arch::simd::*;
1213

1314
#[cfg(test)]
1415
use stdarch_test::assert_instr;
@@ -34,6 +35,22 @@ types! {
3435
// pub struct vector_unsigned___int128 = i128x1;
3536
}
3637

38+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
39+
impl From<m64x2> for vector_bool_long {
40+
#[inline]
41+
fn from(value: m64x2) -> Self {
42+
unsafe { transmute(value) }
43+
}
44+
}
45+
46+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
47+
impl From<vector_bool_long> for m64x2 {
48+
#[inline]
49+
fn from(value: vector_bool_long) -> Self {
50+
unsafe { transmute(value) }
51+
}
52+
}
53+
3754
#[allow(improper_ctypes)]
3855
unsafe extern "C" {
3956
#[link_name = "llvm.ppc.altivec.vperm"]
@@ -46,7 +63,6 @@ unsafe extern "C" {
4663

4764
mod sealed {
4865
use super::*;
49-
use crate::core_arch::simd::*;
5066

5167
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
5268
pub trait VectorPermDI {
@@ -221,14 +237,16 @@ mod tests {
221237
macro_rules! test_vec_xxpermdi {
222238
{$name:ident, $shorttype:ident, $longtype:ident, [$($a:expr),+], [$($b:expr),+], [$($c:expr),+], [$($d:expr),+]} => {
223239
#[simd_test(enable = "vsx")]
224-
unsafe fn $name() {
225-
let a: $longtype = transmute($shorttype::new($($a),+, $($b),+));
226-
let b = transmute($shorttype::new($($c),+, $($d),+));
227-
228-
assert_eq!($shorttype::new($($a),+, $($c),+), transmute(vec_xxpermdi::<_, 0>(a, b)));
229-
assert_eq!($shorttype::new($($b),+, $($c),+), transmute(vec_xxpermdi::<_, 1>(a, b)));
230-
assert_eq!($shorttype::new($($a),+, $($d),+), transmute(vec_xxpermdi::<_, 2>(a, b)));
231-
assert_eq!($shorttype::new($($b),+, $($d),+), transmute(vec_xxpermdi::<_, 3>(a, b)));
240+
fn $name() {
241+
let a = $longtype::from($shorttype::new($($a),+, $($b),+));
242+
let b = $longtype::from($shorttype::new($($c),+, $($d),+));
243+
244+
unsafe {
245+
assert_eq!($shorttype::new($($a),+, $($c),+), $shorttype::from(vec_xxpermdi::<_, 0>(a, b)));
246+
assert_eq!($shorttype::new($($b),+, $($c),+), $shorttype::from(vec_xxpermdi::<_, 1>(a, b)));
247+
assert_eq!($shorttype::new($($a),+, $($d),+), $shorttype::from(vec_xxpermdi::<_, 2>(a, b)));
248+
assert_eq!($shorttype::new($($b),+, $($d),+), $shorttype::from(vec_xxpermdi::<_, 3>(a, b)));
249+
}
232250
}
233251
}
234252
}

library/stdarch/crates/core_arch/src/s390x/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
33
pub(crate) mod macros;
44

5+
/// the float and vector registers overlap therefore we cannot use any vector
6+
/// extensions if softfloat is enabled.
7+
8+
#[cfg(not(target_abi = "softfloat"))]
59
mod vector;
10+
#[cfg(not(target_abi = "softfloat"))]
611
#[unstable(feature = "stdarch_s390x", issue = "130869")]
712
pub use self::vector::*;

library/stdarch/crates/core_arch/src/s390x/vector.rs

Lines changed: 80 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,54 @@ types! {
5151
pub struct vector_double(2 x f64);
5252
}
5353

54+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
55+
impl From<m8x16> for vector_bool_char {
56+
#[inline]
57+
fn from(value: m8x16) -> Self {
58+
unsafe { transmute(value) }
59+
}
60+
}
61+
62+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
63+
impl From<vector_bool_char> for m8x16 {
64+
#[inline]
65+
fn from(value: vector_bool_char) -> Self {
66+
unsafe { transmute(value) }
67+
}
68+
}
69+
70+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
71+
impl From<m16x8> for vector_bool_short {
72+
#[inline]
73+
fn from(value: m16x8) -> Self {
74+
unsafe { transmute(value) }
75+
}
76+
}
77+
78+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
79+
impl From<vector_bool_short> for m16x8 {
80+
#[inline]
81+
fn from(value: vector_bool_short) -> Self {
82+
unsafe { transmute(value) }
83+
}
84+
}
85+
86+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
87+
impl From<m32x4> for vector_bool_int {
88+
#[inline]
89+
fn from(value: m32x4) -> Self {
90+
unsafe { transmute(value) }
91+
}
92+
}
93+
94+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
95+
impl From<vector_bool_int> for m32x4 {
96+
#[inline]
97+
fn from(value: vector_bool_int) -> Self {
98+
unsafe { transmute(value) }
99+
}
100+
}
101+
54102
#[repr(C, packed)]
55103
struct PackedTuple<T, U> {
56104
x: T,
@@ -6051,27 +6099,16 @@ mod tests {
60516099
}
60526100

60536101
macro_rules! test_vec_1 {
6054-
{ $name: ident, $fn:ident, f32x4, [$($a:expr),+], ~[$($d:expr),+] } => {
6055-
#[simd_test(enable = "vector")]
6056-
unsafe fn $name() {
6057-
let a: vector_float = transmute(f32x4::new($($a),+));
6058-
6059-
let d: vector_float = transmute(f32x4::new($($d),+));
6060-
let r = transmute(vec_cmple(vec_abs(vec_sub($fn(a), d)), vec_splats(f32::EPSILON)));
6061-
let e = m32x4::new(true, true, true, true);
6062-
assert_eq!(e, r);
6063-
}
6064-
};
60656102
{ $name: ident, $fn:ident, $ty: ident, [$($a:expr),+], [$($d:expr),+] } => {
60666103
test_vec_1! { $name, $fn, $ty -> $ty, [$($a),+], [$($d),+] }
60676104
};
60686105
{ $name: ident, $fn:ident, $ty: ident -> $ty_out: ident, [$($a:expr),+], [$($d:expr),+] } => {
60696106
#[simd_test(enable = "vector")]
6070-
unsafe fn $name() {
6071-
let a: s_t_l!($ty) = transmute($ty::new($($a),+));
6107+
fn $name() {
6108+
let a: s_t_l!($ty) = $ty::new($($a),+).into();
60726109

60736110
let d = $ty_out::new($($d),+);
6074-
let r : $ty_out = transmute($fn(a));
6111+
let r = $ty_out::from(unsafe { $fn(a) });
60756112
assert_eq!(d, r);
60766113
}
60776114
}
@@ -6086,35 +6123,23 @@ mod tests {
60866123
};
60876124
{ $name: ident, $fn:ident, $ty1: ident, $ty2: ident -> $ty_out: ident, [$($a:expr),+], [$($b:expr),+], [$($d:expr),+] } => {
60886125
#[simd_test(enable = "vector")]
6089-
unsafe fn $name() {
6090-
let a: s_t_l!($ty1) = transmute($ty1::new($($a),+));
6091-
let b: s_t_l!($ty2) = transmute($ty2::new($($b),+));
6126+
fn $name() {
6127+
let a: s_t_l!($ty1) = $ty1::new($($a),+).into();
6128+
let b: s_t_l!($ty2) = $ty2::new($($b),+).into();
60926129

60936130
let d = $ty_out::new($($d),+);
6094-
let r : $ty_out = transmute($fn(a, b));
6131+
let r = $ty_out::from(unsafe { $fn(a, b) });
60956132
assert_eq!(d, r);
60966133
}
60976134
};
6098-
{ $name: ident, $fn:ident, $ty: ident -> $ty_out: ident, [$($a:expr),+], [$($b:expr),+], $d:expr } => {
6099-
#[simd_test(enable = "vector")]
6100-
unsafe fn $name() {
6101-
let a: s_t_l!($ty) = transmute($ty::new($($a),+));
6102-
let b: s_t_l!($ty) = transmute($ty::new($($b),+));
6103-
6104-
let r : $ty_out = transmute($fn(a, b));
6105-
assert_eq!($d, r);
6106-
}
6107-
}
61086135
}
61096136

61106137
#[simd_test(enable = "vector")]
6111-
unsafe fn vec_add_i32x4_i32x4() {
6112-
let x = i32x4::new(1, 2, 3, 4);
6113-
let y = i32x4::new(4, 3, 2, 1);
6114-
let x: vector_signed_int = transmute(x);
6115-
let y: vector_signed_int = transmute(y);
6116-
let z = vec_add(x, y);
6117-
assert_eq!(i32x4::splat(5), transmute(z));
6138+
fn vec_add_i32x4_i32x4() {
6139+
let x = vector_signed_int::from(i32x4::new(1, 2, 3, 4));
6140+
let y = vector_signed_int::from(i32x4::new(4, 3, 2, 1));
6141+
let z = unsafe { vec_add(x, y) };
6142+
assert_eq!(i32x4::splat(5), i32x4::from(z));
61186143
}
61196144

61206145
macro_rules! test_vec_sub {
@@ -6232,11 +6257,11 @@ mod tests {
62326257
macro_rules! test_vec_abs {
62336258
{ $name: ident, $ty: ident, $a: expr, $d: expr } => {
62346259
#[simd_test(enable = "vector")]
6235-
unsafe fn $name() {
6236-
let a: s_t_l!($ty) = vec_splats($a);
6237-
let a: s_t_l!($ty) = vec_abs(a);
6260+
fn $name() {
6261+
let a: s_t_l!($ty) = unsafe { vec_splats($a) };
6262+
let a: s_t_l!($ty) = unsafe { vec_abs(a) };
62386263
let d = $ty::splat($d);
6239-
assert_eq!(d, transmute(a));
6264+
assert_eq!(d, $ty::from(a));
62406265
}
62416266
}
62426267
}
@@ -6386,7 +6411,7 @@ mod tests {
63866411
[0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 16],
63876412
[4, 2, 1, 8] }
63886413

6389-
test_vec_2! { test_vec_sral_pos, vec_sral, u32x4, u8x16 -> i32x4,
6414+
test_vec_2! { test_vec_sral_pos, vec_sral, u32x4, u8x16 -> u32x4,
63906415
[0b1000, 0b1000, 0b1000, 0b1000],
63916416
[0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 16],
63926417
[4, 2, 1, 8] }
@@ -6423,13 +6448,13 @@ mod tests {
64236448
$shorttype:ident, $longtype:ident,
64246449
[$($a:expr),+], [$($b:expr),+], [$($c:expr),+], [$($d:expr),+]} => {
64256450
#[simd_test(enable = "vector")]
6426-
unsafe fn $name() {
6427-
let a: $longtype = transmute($shorttype::new($($a),+));
6428-
let b: $longtype = transmute($shorttype::new($($b),+));
6429-
let c: vector_unsigned_char = transmute(u8x16::new($($c),+));
6451+
fn $name() {
6452+
let a = $longtype::from($shorttype::new($($a),+));
6453+
let b = $longtype::from($shorttype::new($($b),+));
6454+
let c = vector_unsigned_char::from(u8x16::new($($c),+));
64306455
let d = $shorttype::new($($d),+);
64316456

6432-
let r: $shorttype = transmute(vec_perm(a, b, c));
6457+
let r = $shorttype::from(unsafe { vec_perm(a, b, c) });
64336458
assert_eq!(d, r);
64346459
}
64356460
}
@@ -6512,46 +6537,46 @@ mod tests {
65126537
[core::f32::consts::PI, 1.0, 25.0, 2.0],
65136538
[core::f32::consts::PI.sqrt(), 1.0, 5.0, core::f32::consts::SQRT_2] }
65146539

6515-
test_vec_2! { test_vec_find_any_eq, vec_find_any_eq, i32x4, i32x4 -> u32x4,
6540+
test_vec_2! { test_vec_find_any_eq, vec_find_any_eq, i32x4, i32x4 -> i32x4,
65166541
[1, -2, 3, -4],
65176542
[-5, 3, -7, 8],
6518-
[0, 0, 0xFFFFFFFF, 0]
6543+
[0, 0, !0, 0]
65196544
}
65206545

6521-
test_vec_2! { test_vec_find_any_ne, vec_find_any_ne, i32x4, i32x4 -> u32x4,
6546+
test_vec_2! { test_vec_find_any_ne, vec_find_any_ne, i32x4, i32x4 -> i32x4,
65226547
[1, -2, 3, -4],
65236548
[-5, 3, -7, 8],
6524-
[0xFFFFFFFF, 0xFFFFFFFF, 0, 0xFFFFFFFF]
6549+
[!0, !0, 0, !0]
65256550
}
65266551

6527-
test_vec_2! { test_vec_find_any_eq_idx_1, vec_find_any_eq_idx, i32x4, i32x4 -> u32x4,
6552+
test_vec_2! { test_vec_find_any_eq_idx_1, vec_find_any_eq_idx, i32x4, i32x4 -> i32x4,
65286553
[1, 2, 3, 4],
65296554
[5, 3, 7, 8],
65306555
[0, 8, 0, 0]
65316556
}
6532-
test_vec_2! { test_vec_find_any_eq_idx_2, vec_find_any_eq_idx, i32x4, i32x4 -> u32x4,
6557+
test_vec_2! { test_vec_find_any_eq_idx_2, vec_find_any_eq_idx, i32x4, i32x4 -> i32x4,
65336558
[1, 2, 3, 4],
65346559
[5, 6, 7, 8],
65356560
[0, 16, 0, 0]
65366561
}
65376562

6538-
test_vec_2! { test_vec_find_any_ne_idx_1, vec_find_any_ne_idx, i32x4, i32x4 -> u32x4,
6563+
test_vec_2! { test_vec_find_any_ne_idx_1, vec_find_any_ne_idx, i32x4, i32x4 -> i32x4,
65396564
[1, 2, 3, 4],
65406565
[1, 5, 3, 4],
65416566
[0, 4, 0, 0]
65426567
}
6543-
test_vec_2! { test_vec_find_any_ne_idx_2, vec_find_any_ne_idx, i32x4, i32x4 -> u32x4,
6568+
test_vec_2! { test_vec_find_any_ne_idx_2, vec_find_any_ne_idx, i32x4, i32x4 -> i32x4,
65446569
[1, 2, 3, 4],
65456570
[1, 2, 3, 4],
65466571
[0, 16, 0, 0]
65476572
}
65486573

6549-
test_vec_2! { test_vec_find_any_eq_or_0_idx_1, vec_find_any_eq_or_0_idx, i32x4, i32x4 -> u32x4,
6574+
test_vec_2! { test_vec_find_any_eq_or_0_idx_1, vec_find_any_eq_or_0_idx, i32x4, i32x4 -> i32x4,
65506575
[1, 2, 0, 4],
65516576
[5, 6, 7, 8],
65526577
[0, 8, 0, 0]
65536578
}
6554-
test_vec_2! { test_vec_find_any_ne_or_0_idx_1, vec_find_any_ne_or_0_idx, i32x4, i32x4 -> u32x4,
6579+
test_vec_2! { test_vec_find_any_ne_or_0_idx_1, vec_find_any_ne_or_0_idx, i32x4, i32x4 -> i32x4,
65556580
[1, 2, 0, 4],
65566581
[1, 2, 3, 4],
65576582
[0, 8, 0, 0]

0 commit comments

Comments
 (0)