Skip to content

Commit ec35bb4

Browse files
committed
Add vqmovn_u64
1 parent f29a704 commit ec35bb4

File tree

1 file changed

+64
-16
lines changed

1 file changed

+64
-16
lines changed

crates/core_arch/src/arm/neon.rs

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ extern "C" {
101101
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.frsqrte.v2f32")]
102102
fn frsqrte_v2f32(a: float32x2_t) -> float32x2_t;
103103

104+
//uint32x2_t vqmovn_u64 (uint64x2_t a)
105+
#[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqmovnu.v2i32")]
106+
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.uqxtn.v2i32")]
107+
fn vqmovn_u64_(a: uint64x2_t) -> uint32x2_t;
108+
104109
/*
105110
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.vget_lane.v8u8")]
106111
#[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vget_lane.v8u8")]
@@ -180,6 +185,17 @@ extern "C" {
180185
) -> int8x8_t;
181186
}
182187

188+
189+
/// Unsigned saturating extract narrow.
190+
#[inline]
191+
#[target_feature(enable = "neon")]
192+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
193+
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vqmovnu))]
194+
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uqxtn))]
195+
pub unsafe fn vqmovn_u64(a: uint64x2_t) -> uint32x2_t {
196+
vqmovn_u64_(a)
197+
}
198+
183199
/// Vector add.
184200
#[inline]
185201
#[target_feature(enable = "neon")]
@@ -1576,23 +1592,23 @@ arm_reinterpret!(vreinterpretq_u8_s8, int8x16_t, uint8x16_t);
15761592
#[cfg_attr(test, assert_instr(ext))]
15771593
pub unsafe fn vextq_s8(a: int8x16_t, b: int8x16_t, n: i32) -> int8x16_t {
15781594
match n {
1579-
0 => a,
1580-
1 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, a.12, a.13, a.14, b.15),
1581-
2 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, a.12, a.13, b.14, b.15),
1582-
3 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, a.12, b.13, b.14, b.15),
1583-
4 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, b.12, b.13, b.14, b.15),
1584-
5 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, b.11, b.12, b.13, b.14, b.15),
1585-
6 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, b.10, b.11, b.12, b.13, b.14, b.15),
1586-
7 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1595+
0 => b,
1596+
1 => int8x16_t(a.0, b.1, b.2, b.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1597+
2 => int8x16_t(a.0, a.1, b.2, b.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1598+
3 => int8x16_t(a.0, a.1, a.2, b.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1599+
4 => int8x16_t(a.0, a.1, a.2, a.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1600+
5 => int8x16_t(a.0, a.1, a.2, a.3, a.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1601+
6 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1602+
7 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
15871603
8 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1588-
9 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1589-
10 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1590-
11 => int8x16_t(a.0, a.1, a.2, a.3, a.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1591-
12 => int8x16_t(a.0, a.1, a.2, a.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1592-
13 => int8x16_t(a.0, a.1, a.2, b.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1593-
14 => int8x16_t(a.0, a.1, b.2, b.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1594-
15 => int8x16_t(a.0, b.1, b.2, b.3, b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1595-
16 => b,
1604+
9 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, b.9, b.10, b.11, b.12, b.13, b.14, b.15),
1605+
10 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, b.10, b.11, b.12, b.13, b.14, b.15),
1606+
11 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, b.11, b.12, b.13, b.14, b.15),
1607+
12 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, b.12, b.13, b.14, b.15),
1608+
13 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, a.12, b.13, b.14, b.15),
1609+
14 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, a.12, a.13, b.14, b.15),
1610+
15 => int8x16_t(a.0, a.1, a.2, a.3, a.4, a.5, a.6, a.7, a.8, a.9, a.10, a.11, a.12, a.13, a.14, b.15),
1611+
16 => a,
15961612
_ => unreachable_unchecked()
15971613
}
15981614
}
@@ -1605,6 +1621,38 @@ mod tests {
16051621
use std::{i16, i32, i8, mem::transmute, u16, u32, u8};
16061622
use stdarch_test::simd_test;
16071623

1624+
#[simd_test(enable = "neon")]
1625+
unsafe fn test_vqmovn_u64() {
1626+
let a = u64x2::new(1, 2);
1627+
let e = u32x2::new(1, 2);
1628+
let r: u32x2 = transmute(vqmovn_u64(transmute(a)));
1629+
assert_eq!(r, e);
1630+
1631+
}
1632+
1633+
#[simd_test(enable = "neon")]
1634+
unsafe fn test_vextq_s8() {
1635+
let a = i8x16::new(
1636+
1, 2, 3, 4,
1637+
5, 6, 7, 8,
1638+
9, 10, 11, 12,
1639+
13, 14, 15, 16
1640+
);
1641+
let b = i8x16::new(
1642+
42, 42, 42, 42,
1643+
42, 42, 42, 42,
1644+
42, 42, 42, 42,
1645+
42, 42, 42, 42
1646+
);
1647+
let e = i8x16::new(
1648+
1, 2, 3, 42,
1649+
42, 42, 42, 42,
1650+
42, 42, 42, 42,
1651+
42, 42, 42, 42
1652+
);
1653+
let r: i8x16 = transmute(vextq_s8(transmute(a), transmute(b), 3));
1654+
assert_eq!(r, e);
1655+
}
16081656

16091657
#[simd_test(enable = "neon")]
16101658
unsafe fn test_vld1q_s8() {

0 commit comments

Comments
 (0)