Skip to content

Commit

Permalink
Fix types for ARM SIMD32 intrinsics
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Amanieu committed Nov 19, 2024
1 parent f3f4e1e commit 44f5a55
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
33 changes: 12 additions & 21 deletions crates/core_arch/src/arm/dsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ use stdarch_test::assert_instr;

use crate::mem::transmute;

types! {
#![unstable(feature = "stdarch_arm_dsp", issue = "117237")]

/// ARM-specific 32-bit wide vector of two packed `i16`.
pub struct int16x2_t(2 x i16);
/// ARM-specific 32-bit wide vector of two packed `u16`.
pub struct uint16x2_t(2 x u16);
}

extern "unadjusted" {
#[link_name = "llvm.arm.smulbb"]
fn arm_smulbb(a: i32, b: i32) -> i32;
Expand Down Expand Up @@ -85,7 +76,7 @@ extern "unadjusted" {
#[inline]
#[cfg_attr(test, assert_instr(smulbb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
pub unsafe fn __smulbb(a: i32, b: i32) -> i32 {
arm_smulbb(transmute(a), transmute(b))
}

Expand All @@ -96,7 +87,7 @@ pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
#[inline]
#[cfg_attr(test, assert_instr(smultb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
pub unsafe fn __smultb(a: i32, b: i32) -> i32 {
arm_smultb(transmute(a), transmute(b))
}

Expand All @@ -107,7 +98,7 @@ pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
#[inline]
#[cfg_attr(test, assert_instr(smulbt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
pub unsafe fn __smulbt(a: i32, b: i32) -> i32 {
arm_smulbt(transmute(a), transmute(b))
}

Expand All @@ -118,7 +109,7 @@ pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
#[inline]
#[cfg_attr(test, assert_instr(smultt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
pub unsafe fn __smultt(a: i32, b: i32) -> i32 {
arm_smultt(transmute(a), transmute(b))
}

Expand All @@ -130,7 +121,7 @@ pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
#[inline]
#[cfg_attr(test, assert_instr(smulwb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
pub unsafe fn __smulwb(a: i32, b: i32) -> i32 {
arm_smulwb(transmute(a), b)
}

Expand All @@ -142,7 +133,7 @@ pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
#[inline]
#[cfg_attr(test, assert_instr(smulwt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulwt(a: int16x2_t, b: i32) -> i32 {
pub unsafe fn __smulwt(a: i32, b: i32) -> i32 {
arm_smulwt(transmute(a), b)
}

Expand Down Expand Up @@ -187,7 +178,7 @@ pub unsafe fn __qdbl(a: i32) -> i32 {
#[inline]
#[cfg_attr(test, assert_instr(smlabb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
pub unsafe fn __smlabb(a: i32, b: i32, c: i32) -> i32 {
arm_smlabb(transmute(a), transmute(b), c)
}

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

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

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

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

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

Expand Down
27 changes: 19 additions & 8 deletions crates/core_arch/src/arm/simd32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,27 @@
#[cfg(test)]
use stdarch_test::assert_instr;

use crate::{core_arch::arm::dsp::int16x2_t, mem::transmute};
use crate::mem::transmute;

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

/// ARM-specific 32-bit wide vector of four packed `i8`.
pub struct int8x4_t(4 x i8);
/// ARM-specific 32-bit wide vector of four packed `u8`.
pub struct uint8x4_t(4 x u8);
}
/// ARM-specific vector of four packed `u8` packed into a 32-bit integer.
#[allow(non_camel_case_types)]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub type uint8x4_t = u32;

/// ARM-specific vector of two packed `i16` packed into a 32-bit integer.
#[allow(non_camel_case_types)]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub type int16x2_t = i32;

/// ARM-specific vector of two packed `u16` packed into a 32-bit integer.
#[allow(non_camel_case_types)]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub type uint16x2_t = u32;

macro_rules! dsp_call {
($name:expr, $a:expr, $b:expr) => {
Expand Down

0 comments on commit 44f5a55

Please sign in to comment.