Skip to content

Commit

Permalink
feat - FEAT_FAMINMAX neon intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamesbarford authored and Amanieu committed Mar 4, 2025
1 parent 3eca9a8 commit 84a6f72
Show file tree
Hide file tree
Showing 3 changed files with 312 additions and 0 deletions.
108 changes: 108 additions & 0 deletions crates/core_arch/src/aarch64/neon/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,114 @@ pub fn vaddvq_u64(a: uint64x2_t) -> u64 {
}
unsafe { _vaddvq_u64(a) }
}
#[doc = "Multi-vector floating-point absolute maximum"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vamax_f32)"]
#[doc = "## Safety"]
#[doc = " * Neon instrinsic unsafe"]
#[inline]
#[target_feature(enable = "neon,faminmax")]
#[cfg_attr(test, assert_instr(famax))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vamax_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.neon.famax.v2f32"
)]
fn _vamax_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t;
}
_vamax_f32(a, b)
}
#[doc = "Multi-vector floating-point absolute maximum"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vamaxq_f32)"]
#[doc = "## Safety"]
#[doc = " * Neon instrinsic unsafe"]
#[inline]
#[target_feature(enable = "neon,faminmax")]
#[cfg_attr(test, assert_instr(famax))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vamaxq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t {
unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.neon.famax.v4f32"
)]
fn _vamaxq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t;
}
_vamaxq_f32(a, b)
}
#[doc = "Multi-vector floating-point absolute maximum"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vamaxq_f64)"]
#[doc = "## Safety"]
#[doc = " * Neon instrinsic unsafe"]
#[inline]
#[target_feature(enable = "neon,faminmax")]
#[cfg_attr(test, assert_instr(famax))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vamaxq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t {
unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.neon.famax.v2f64"
)]
fn _vamaxq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t;
}
_vamaxq_f64(a, b)
}
#[doc = "Multi-vector floating-point absolute minimum"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vamin_f32)"]
#[doc = "## Safety"]
#[doc = " * Neon instrinsic unsafe"]
#[inline]
#[target_feature(enable = "neon,faminmax")]
#[cfg_attr(test, assert_instr(famin))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vamin_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.neon.famin.v2f32"
)]
fn _vamin_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t;
}
_vamin_f32(a, b)
}
#[doc = "Multi-vector floating-point absolute minimum"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaminq_f32)"]
#[doc = "## Safety"]
#[doc = " * Neon instrinsic unsafe"]
#[inline]
#[target_feature(enable = "neon,faminmax")]
#[cfg_attr(test, assert_instr(famin))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vaminq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t {
unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.neon.famin.v4f32"
)]
fn _vaminq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t;
}
_vaminq_f32(a, b)
}
#[doc = "Multi-vector floating-point absolute minimum"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaminq_f64)"]
#[doc = "## Safety"]
#[doc = " * Neon instrinsic unsafe"]
#[inline]
#[target_feature(enable = "neon,faminmax")]
#[cfg_attr(test, assert_instr(famin))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vaminq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t {
unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.neon.famin.v2f64"
)]
fn _vaminq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t;
}
_vaminq_f64(a, b)
}
#[doc = "Bit clear and exclusive OR"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vbcaxq_s8)"]
#[inline]
Expand Down
42 changes: 42 additions & 0 deletions crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13973,3 +13973,45 @@ intrinsics:
- - r
- a
- FnCall: ["vdup{neon_type[1].N}", [{FnCall: [simd_extract!, [b, 'LANE as u32']]}]]

- name: "vamax{neon_type.no}"
doc: "Multi-vector floating-point absolute maximum"
arguments: ["a: {neon_type}", "b: {neon_type}"]
return_type: "{neon_type}"
attr:
- FnCall: [target_feature, ['enable = "neon,faminmax"']]
- FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [famax]]}]]
- FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']]
safety:
unsafe: [neon]
types:
- float32x2_t
- float32x4_t
- float64x2_t
compose:
- LLVMLink:
name: "_vamax{neon_type.no}"
links:
- link: "llvm.aarch64.neon.famax.{neon_type}"
arch: aarch64,arm64ec

- name: "vamin{neon_type.no}"
doc: "Multi-vector floating-point absolute minimum"
arguments: ["a: {neon_type}", "b: {neon_type}"]
return_type: "{neon_type}"
attr:
- FnCall: [target_feature, ['enable = "neon,faminmax"']]
- FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [famin]]}]]
- FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']]
safety:
unsafe: [neon]
types:
- float32x2_t
- float32x4_t
- float64x2_t
compose:
- LLVMLink:
name: "_vamin{neon_type.no}"
links:
- link: "llvm.aarch64.neon.famin.{neon_type}"
arch: aarch64,arm64ec
162 changes: 162 additions & 0 deletions intrinsics_data/arm_intrinsics.json
Original file line number Diff line number Diff line change
Expand Up @@ -118681,5 +118681,167 @@
"ZIP2"
]
]
},
{
"SIMD_ISA": "Neon",
"name": "vamin_f32",
"arguments": [
"float32x2_t a",
"float32x2_t b"
],
"return_type": {
"value": "float32x2_t"
},
"Arguments_Preparation": {
"a": {
"register": "Vn.2S"
},
"b": {
"register": "Vm.2S"
}
},
"Architectures": [
"A64"
],
"instructions": [
[
"FAMIN"
]
]
},
{
"SIMD_ISA": "Neon",
"name": "vaminq_f32",
"arguments": [
"float32x4_t a",
"float32x4_t b"
],
"return_type": {
"value": "float32x4_t"
},
"Arguments_Preparation": {
"a": {
"register": "Vn.4S"
},
"b": {
"register": "Vm.4S"
}
},
"Architectures": [
"A64"
],
"instructions": [
[
"FAMIN"
]
]
},
{
"SIMD_ISA": "Neon",
"name": "vaminq_f64",
"arguments": [
"float64x2_t a",
"float64x2_t b"
],
"return_type": {
"value": "float64x2_t"
},
"Arguments_Preparation": {
"a": {
"register": "Vn.2D"
},
"b": {
"register": "Vm.2D"
}
},
"Architectures": [
"A64"
],
"instructions": [
[
"FAMIN"
]
]
},
{
"SIMD_ISA": "Neon",
"name": "vamax_f32",
"arguments": [
"float32x2_t a",
"float32x2_t b"
],
"return_type": {
"value": "float32x2_t"
},
"Arguments_Preparation": {
"a": {
"register": "Vn.2S"
},
"b": {
"register": "Vm.2S"
}
},
"Architectures": [
"A64"
],
"instructions": [
[
"FAMAX"
]
]
},
{
"SIMD_ISA": "Neon",
"name": "vamaxq_f32",
"arguments": [
"float32x4_t a",
"float32x4_t b"
],
"return_type": {
"value": "float32x4_t"
},
"Arguments_Preparation": {
"a": {
"register": "Vn.4S"
},
"b": {
"register": "Vm.4S"
}
},
"Architectures": [
"A64"
],
"instructions": [
[
"FAMAX"
]
]
},
{
"SIMD_ISA": "Neon",
"name": "vamaxq_f64",
"arguments": [
"float64x2_t a",
"float64x2_t b"
],
"return_type": {
"value": "float64x2_t"
},
"Arguments_Preparation": {
"a": {
"register": "Vn.2D"
},
"b": {
"register": "Vm.2D"
}
},
"Architectures": [
"A64"
],
"instructions": [
[
"FAMAX"
]
]
}
]

0 comments on commit 84a6f72

Please sign in to comment.