Skip to content

Fix Neon f16 stability #1818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions crates/core_arch/src/arm_shared/neon/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3851,14 +3851,7 @@ pub fn vbicq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
all(test, any(target_arch = "aarch64", target_arch = "arm64ec")),
assert_instr(bsl)
)]
#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
#[cfg_attr(
target_arch = "arm",
unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
)]
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
pub fn vbsl_f16(a: uint16x4_t, b: float16x4_t, c: float16x4_t) -> float16x4_t {
let not = int16x4_t::splat(-1);
unsafe {
Expand All @@ -3878,14 +3871,7 @@ pub fn vbsl_f16(a: uint16x4_t, b: float16x4_t, c: float16x4_t) -> float16x4_t {
all(test, any(target_arch = "aarch64", target_arch = "arm64ec")),
assert_instr(bsl)
)]
#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
#[cfg_attr(
target_arch = "arm",
unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
)]
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
pub fn vbslq_f16(a: uint16x8_t, b: float16x8_t, c: float16x8_t) -> float16x8_t {
let not = int16x8_t::splat(-1);
unsafe {
Expand Down
13 changes: 9 additions & 4 deletions crates/core_arch/src/arm_shared/neon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ types! {
pub struct int16x4_t(4 x pub(crate) i16);
/// Arm-specific 64-bit wide vector of four packed `u16`.
pub struct uint16x4_t(4 x pub(crate) u16);
// Arm-specific 64-bit wide vector of four packed `f16`.
pub struct float16x4_t(4 x pub(crate) f16);
/// Arm-specific 64-bit wide vector of four packed `p16`.
pub struct poly16x4_t(4 x pub(crate) p16);
/// Arm-specific 64-bit wide vector of two packed `i32`.
Expand All @@ -89,8 +87,6 @@ types! {
pub struct int16x8_t(8 x pub(crate) i16);
/// Arm-specific 128-bit wide vector of eight packed `u16`.
pub struct uint16x8_t(8 x pub(crate) u16);
// Arm-specific 128-bit wide vector of eight packed `f16`.
pub struct float16x8_t(8 x pub(crate) f16);
/// Arm-specific 128-bit wide vector of eight packed `p16`.
pub struct poly16x8_t(8 x pub(crate) p16);
/// Arm-specific 128-bit wide vector of four packed `i32`.
Expand All @@ -107,6 +103,15 @@ types! {
pub struct poly64x2_t(2 x pub(crate) p64);
}

types! {
#![unstable(feature = "stdarch_neon_f16", issue = "136306")]

/// Arm-specific 64-bit wide vector of four packed `f16`.
pub struct float16x4_t(4 x pub(crate) f16);
/// Arm-specific 128-bit wide vector of eight packed `f16`.
pub struct float16x8_t(8 x pub(crate) f16);
}

/// Arm-specific type containing two `int8x8_t` vectors.
#[repr(C)]
#[derive(Copy, Clone, Debug)]
Expand Down
3 changes: 1 addition & 2 deletions crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14644,8 +14644,7 @@ intrinsics:
- *neon-v7
- FnCall: [cfg_attr, [*test-is-arm, { FnCall: [assert_instr, ['vbsl']]}]]
- FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, ['bsl']]}]]
- *neon-not-arm-stable
- *neon-cfg-arm-unstable
- *neon-unstable-f16
safety: safe
types:
- ['vbslq_f16', 'uint16x8_t', 'float16x8_t', 'int16x8_t::splat(-1)']
Expand Down