Skip to content

Commit a2725c9

Browse files
authored
Merge pull request #1938 from linkmauve/fjcvtzs
Implement fjcvtzs under the name __jcvt like the C intrinsic
2 parents 0c27594 + c56f5e7 commit a2725c9

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

crates/core_arch/src/aarch64/neon/generated.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ pub fn __crc32d(crc: u32, data: u64) -> u32 {
4444
}
4545
unsafe { ___crc32d(crc, data) }
4646
}
47+
#[doc = "Floating-point JavaScript convert to signed fixed-point, rounding toward zero"]
48+
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/__jcvt)"]
49+
#[inline]
50+
#[target_feature(enable = "jsconv")]
51+
#[cfg_attr(test, assert_instr(fjcvtzs))]
52+
#[unstable(feature = "stdarch_aarch64_jscvt", issue = "147555")]
53+
pub fn __jcvt(a: f64) -> i32 {
54+
unsafe extern "unadjusted" {
55+
#[cfg_attr(
56+
any(target_arch = "aarch64", target_arch = "arm64ec"),
57+
link_name = "llvm.aarch64.fjcvtzs"
58+
)]
59+
fn ___jcvt(a: f64) -> i32;
60+
}
61+
unsafe { ___jcvt(a) }
62+
}
4763
#[doc = "Signed Absolute difference and Accumulate Long"]
4864
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabal_high_s8)"]
4965
#[inline]

crates/intrinsic-test/src/arm/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ pub const AARCH_CONFIGURATIONS: &str = r#"
121121
#![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_i8mm))]
122122
#![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_sm4))]
123123
#![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_ftts))]
124+
#![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_aarch64_jscvt))]
124125
#![feature(fmt_helpers_for_derive)]
125126
#![feature(stdarch_neon_f16)]
126127

crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ neon-unstable-f16: &neon-unstable-f16
5959
neon-unstable-feat-lut: &neon-unstable-feat-lut
6060
FnCall: [unstable, ['feature = "stdarch_neon_feat_lut"', 'issue = "138050"']]
6161

62+
aarch64-unstable-jscvt: &aarch64-unstable-jscvt
63+
FnCall: [unstable, ['feature = "stdarch_aarch64_jscvt"', 'issue = "147555"']]
64+
6265
# #[cfg(target_endian = "little")]
6366
little-endian: &little-endian
6467
FnCall: [cfg, ['target_endian = "little"']]
@@ -14259,3 +14262,21 @@ intrinsics:
1425914262
- 'vluti4q_laneq_{neon_type[5]}_x2::<LANE>'
1426014263
- - FnCall: [transmute, [a]]
1426114264
- b
14265+
14266+
- name: "__jcvt"
14267+
doc: "Floating-point JavaScript convert to signed fixed-point, rounding toward zero"
14268+
arguments: ["a: {type}"]
14269+
return_type: "i32"
14270+
attr:
14271+
- FnCall: [target_feature, ['enable = "jsconv"']]
14272+
- FnCall: [cfg_attr, [test, { FnCall: [assert_instr, ["fjcvtzs"]] }]]
14273+
- *aarch64-unstable-jscvt
14274+
safety: safe
14275+
types:
14276+
- f64
14277+
compose:
14278+
- LLVMLink:
14279+
name: "fjcvtzs"
14280+
links:
14281+
- link: "llvm.aarch64.fjcvtzs"
14282+
arch: aarch64,arm64ec

intrinsics_data/arm_intrinsics.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119753,5 +119753,28 @@
119753119753
"LUTI4"
119754119754
]
119755119755
]
119756+
},
119757+
{
119758+
"SIMD_ISA": "Neon",
119759+
"name": "__jcvt",
119760+
"arguments": [
119761+
"float64_t a"
119762+
],
119763+
"return_type": {
119764+
"value": "int32_t"
119765+
},
119766+
"Arguments_Preparation": {
119767+
"a": {
119768+
"register": "Dn"
119769+
}
119770+
},
119771+
"Architectures": [
119772+
"A64"
119773+
],
119774+
"instructions": [
119775+
[
119776+
"FJCVTZS"
119777+
]
119778+
]
119756119779
}
119757119780
]

0 commit comments

Comments
 (0)