Skip to content

Commit 44f5a55

Browse files
committed
Fix types for ARM SIMD32 intrinsics
These were previously defined using vector types which is incorrect. Instead, `{u}int{8x4,16x2}_t` are aliases for `i32` and `u32`. This also fixes CI since these types don't need to be passed in NEON registers and this was triggering a newly added compiler warning.
1 parent f3f4e1e commit 44f5a55

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

crates/core_arch/src/arm/dsp.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ use stdarch_test::assert_instr;
2525

2626
use crate::mem::transmute;
2727

28-
types! {
29-
#![unstable(feature = "stdarch_arm_dsp", issue = "117237")]
30-
31-
/// ARM-specific 32-bit wide vector of two packed `i16`.
32-
pub struct int16x2_t(2 x i16);
33-
/// ARM-specific 32-bit wide vector of two packed `u16`.
34-
pub struct uint16x2_t(2 x u16);
35-
}
36-
3728
extern "unadjusted" {
3829
#[link_name = "llvm.arm.smulbb"]
3930
fn arm_smulbb(a: i32, b: i32) -> i32;
@@ -85,7 +76,7 @@ extern "unadjusted" {
8576
#[inline]
8677
#[cfg_attr(test, assert_instr(smulbb))]
8778
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
88-
pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
79+
pub unsafe fn __smulbb(a: i32, b: i32) -> i32 {
8980
arm_smulbb(transmute(a), transmute(b))
9081
}
9182

@@ -96,7 +87,7 @@ pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
9687
#[inline]
9788
#[cfg_attr(test, assert_instr(smultb))]
9889
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
99-
pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
90+
pub unsafe fn __smultb(a: i32, b: i32) -> i32 {
10091
arm_smultb(transmute(a), transmute(b))
10192
}
10293

@@ -107,7 +98,7 @@ pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
10798
#[inline]
10899
#[cfg_attr(test, assert_instr(smulbt))]
109100
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
110-
pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
101+
pub unsafe fn __smulbt(a: i32, b: i32) -> i32 {
111102
arm_smulbt(transmute(a), transmute(b))
112103
}
113104

@@ -118,7 +109,7 @@ pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
118109
#[inline]
119110
#[cfg_attr(test, assert_instr(smultt))]
120111
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
121-
pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
112+
pub unsafe fn __smultt(a: i32, b: i32) -> i32 {
122113
arm_smultt(transmute(a), transmute(b))
123114
}
124115

@@ -130,7 +121,7 @@ pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
130121
#[inline]
131122
#[cfg_attr(test, assert_instr(smulwb))]
132123
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
133-
pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
124+
pub unsafe fn __smulwb(a: i32, b: i32) -> i32 {
134125
arm_smulwb(transmute(a), b)
135126
}
136127

@@ -142,7 +133,7 @@ pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
142133
#[inline]
143134
#[cfg_attr(test, assert_instr(smulwt))]
144135
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
145-
pub unsafe fn __smulwt(a: int16x2_t, b: i32) -> i32 {
136+
pub unsafe fn __smulwt(a: i32, b: i32) -> i32 {
146137
arm_smulwt(transmute(a), b)
147138
}
148139

@@ -187,7 +178,7 @@ pub unsafe fn __qdbl(a: i32) -> i32 {
187178
#[inline]
188179
#[cfg_attr(test, assert_instr(smlabb))]
189180
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
190-
pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
181+
pub unsafe fn __smlabb(a: i32, b: i32, c: i32) -> i32 {
191182
arm_smlabb(transmute(a), transmute(b), c)
192183
}
193184

@@ -199,7 +190,7 @@ pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
199190
#[inline]
200191
#[cfg_attr(test, assert_instr(smlabt))]
201192
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
202-
pub unsafe fn __smlabt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
193+
pub unsafe fn __smlabt(a: i32, b: i32, c: i32) -> i32 {
203194
arm_smlabt(transmute(a), transmute(b), c)
204195
}
205196

@@ -211,7 +202,7 @@ pub unsafe fn __smlabt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
211202
#[inline]
212203
#[cfg_attr(test, assert_instr(smlatb))]
213204
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
214-
pub unsafe fn __smlatb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
205+
pub unsafe fn __smlatb(a: i32, b: i32, c: i32) -> i32 {
215206
arm_smlatb(transmute(a), transmute(b), c)
216207
}
217208

@@ -223,7 +214,7 @@ pub unsafe fn __smlatb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
223214
#[inline]
224215
#[cfg_attr(test, assert_instr(smlatt))]
225216
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
226-
pub unsafe fn __smlatt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
217+
pub unsafe fn __smlatt(a: i32, b: i32, c: i32) -> i32 {
227218
arm_smlatt(transmute(a), transmute(b), c)
228219
}
229220

@@ -235,7 +226,7 @@ pub unsafe fn __smlatt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
235226
#[inline]
236227
#[cfg_attr(test, assert_instr(smlawb))]
237228
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
238-
pub unsafe fn __smlawb(a: i32, b: int16x2_t, c: i32) -> i32 {
229+
pub unsafe fn __smlawb(a: i32, b: i32, c: i32) -> i32 {
239230
arm_smlawb(a, transmute(b), c)
240231
}
241232

@@ -247,7 +238,7 @@ pub unsafe fn __smlawb(a: i32, b: int16x2_t, c: i32) -> i32 {
247238
#[inline]
248239
#[cfg_attr(test, assert_instr(smlawt))]
249240
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
250-
pub unsafe fn __smlawt(a: i32, b: int16x2_t, c: i32) -> i32 {
241+
pub unsafe fn __smlawt(a: i32, b: i32, c: i32) -> i32 {
251242
arm_smlawt(a, transmute(b), c)
252243
}
253244

crates/core_arch/src/arm/simd32.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,27 @@
6565
#[cfg(test)]
6666
use stdarch_test::assert_instr;
6767

68-
use crate::{core_arch::arm::dsp::int16x2_t, mem::transmute};
68+
use crate::mem::transmute;
6969

70-
types! {
71-
#![unstable(feature = "stdarch_arm_dsp", issue = "117237")]
70+
/// ARM-specific vector of four packed `i8` packed into a 32-bit integer.
71+
#[allow(non_camel_case_types)]
72+
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
73+
pub type int8x4_t = i32;
7274

73-
/// ARM-specific 32-bit wide vector of four packed `i8`.
74-
pub struct int8x4_t(4 x i8);
75-
/// ARM-specific 32-bit wide vector of four packed `u8`.
76-
pub struct uint8x4_t(4 x u8);
77-
}
75+
/// ARM-specific vector of four packed `u8` packed into a 32-bit integer.
76+
#[allow(non_camel_case_types)]
77+
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
78+
pub type uint8x4_t = u32;
79+
80+
/// ARM-specific vector of two packed `i16` packed into a 32-bit integer.
81+
#[allow(non_camel_case_types)]
82+
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
83+
pub type int16x2_t = i32;
84+
85+
/// ARM-specific vector of two packed `u16` packed into a 32-bit integer.
86+
#[allow(non_camel_case_types)]
87+
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
88+
pub type uint16x2_t = u32;
7889

7990
macro_rules! dsp_call {
8091
($name:expr, $a:expr, $b:expr) => {

0 commit comments

Comments
 (0)