Skip to content

Commit 609906f

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 609906f

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

crates/core_arch/src/arm/dsp.rs

+24-35
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@
2323
#[cfg(test)]
2424
use stdarch_test::assert_instr;
2525

26-
use crate::mem::transmute;
27-
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-
3726
extern "unadjusted" {
3827
#[link_name = "llvm.arm.smulbb"]
3928
fn arm_smulbb(a: i32, b: i32) -> i32;
@@ -85,8 +74,8 @@ extern "unadjusted" {
8574
#[inline]
8675
#[cfg_attr(test, assert_instr(smulbb))]
8776
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
88-
pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
89-
arm_smulbb(transmute(a), transmute(b))
77+
pub unsafe fn __smulbb(a: i32, b: i32) -> i32 {
78+
arm_smulbb(a, b)
9079
}
9180

9281
/// Insert a SMULTB instruction
@@ -96,8 +85,8 @@ pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
9685
#[inline]
9786
#[cfg_attr(test, assert_instr(smultb))]
9887
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
99-
pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
100-
arm_smultb(transmute(a), transmute(b))
88+
pub unsafe fn __smultb(a: i32, b: i32) -> i32 {
89+
arm_smultb(a, b)
10190
}
10291

10392
/// Insert a SMULTB instruction
@@ -107,8 +96,8 @@ pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
10796
#[inline]
10897
#[cfg_attr(test, assert_instr(smulbt))]
10998
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
110-
pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
111-
arm_smulbt(transmute(a), transmute(b))
99+
pub unsafe fn __smulbt(a: i32, b: i32) -> i32 {
100+
arm_smulbt(a, b)
112101
}
113102

114103
/// Insert a SMULTT instruction
@@ -118,8 +107,8 @@ pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
118107
#[inline]
119108
#[cfg_attr(test, assert_instr(smultt))]
120109
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
121-
pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
122-
arm_smultt(transmute(a), transmute(b))
110+
pub unsafe fn __smultt(a: i32, b: i32) -> i32 {
111+
arm_smultt(a, b)
123112
}
124113

125114
/// Insert a SMULWB instruction
@@ -130,8 +119,8 @@ pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
130119
#[inline]
131120
#[cfg_attr(test, assert_instr(smulwb))]
132121
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
133-
pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
134-
arm_smulwb(transmute(a), b)
122+
pub unsafe fn __smulwb(a: i32, b: i32) -> i32 {
123+
arm_smulwb(a, b)
135124
}
136125

137126
/// Insert a SMULWT instruction
@@ -142,8 +131,8 @@ pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
142131
#[inline]
143132
#[cfg_attr(test, assert_instr(smulwt))]
144133
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
145-
pub unsafe fn __smulwt(a: int16x2_t, b: i32) -> i32 {
146-
arm_smulwt(transmute(a), b)
134+
pub unsafe fn __smulwt(a: i32, b: i32) -> i32 {
135+
arm_smulwt(a, b)
147136
}
148137

149138
/// Signed saturating addition
@@ -187,8 +176,8 @@ pub unsafe fn __qdbl(a: i32) -> i32 {
187176
#[inline]
188177
#[cfg_attr(test, assert_instr(smlabb))]
189178
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
190-
pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
191-
arm_smlabb(transmute(a), transmute(b), c)
179+
pub unsafe fn __smlabb(a: i32, b: i32, c: i32) -> i32 {
180+
arm_smlabb(a, b, c)
192181
}
193182

194183
/// Insert a SMLABT instruction
@@ -199,8 +188,8 @@ pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
199188
#[inline]
200189
#[cfg_attr(test, assert_instr(smlabt))]
201190
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
202-
pub unsafe fn __smlabt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
203-
arm_smlabt(transmute(a), transmute(b), c)
191+
pub unsafe fn __smlabt(a: i32, b: i32, c: i32) -> i32 {
192+
arm_smlabt(a, b, c)
204193
}
205194

206195
/// Insert a SMLATB instruction
@@ -211,8 +200,8 @@ pub unsafe fn __smlabt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
211200
#[inline]
212201
#[cfg_attr(test, assert_instr(smlatb))]
213202
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
214-
pub unsafe fn __smlatb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
215-
arm_smlatb(transmute(a), transmute(b), c)
203+
pub unsafe fn __smlatb(a: i32, b: i32, c: i32) -> i32 {
204+
arm_smlatb(a, b, c)
216205
}
217206

218207
/// Insert a SMLATT instruction
@@ -223,8 +212,8 @@ pub unsafe fn __smlatb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
223212
#[inline]
224213
#[cfg_attr(test, assert_instr(smlatt))]
225214
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
226-
pub unsafe fn __smlatt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
227-
arm_smlatt(transmute(a), transmute(b), c)
215+
pub unsafe fn __smlatt(a: i32, b: i32, c: i32) -> i32 {
216+
arm_smlatt(a, b, c)
228217
}
229218

230219
/// Insert a SMLAWB instruction
@@ -235,8 +224,8 @@ pub unsafe fn __smlatt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
235224
#[inline]
236225
#[cfg_attr(test, assert_instr(smlawb))]
237226
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
238-
pub unsafe fn __smlawb(a: i32, b: int16x2_t, c: i32) -> i32 {
239-
arm_smlawb(a, transmute(b), c)
227+
pub unsafe fn __smlawb(a: i32, b: i32, c: i32) -> i32 {
228+
arm_smlawb(a, b, c)
240229
}
241230

242231
/// Insert a SMLAWT instruction
@@ -247,8 +236,8 @@ pub unsafe fn __smlawb(a: i32, b: int16x2_t, c: i32) -> i32 {
247236
#[inline]
248237
#[cfg_attr(test, assert_instr(smlawt))]
249238
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
250-
pub unsafe fn __smlawt(a: i32, b: int16x2_t, c: i32) -> i32 {
251-
arm_smlawt(a, transmute(b), c)
239+
pub unsafe fn __smlawt(a: i32, b: i32, c: i32) -> i32 {
240+
arm_smlawt(a, b, c)
252241
}
253242

254243
#[cfg(test)]

crates/core_arch/src/arm/simd32.rs

+19-8
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)