Skip to content

Commit 50e72a2

Browse files
SparrowLiiAmanieu
authored andcommitted
Add vqrdmulh, vqrdmlah, vqrdmlsh neon instructions
1 parent c313294 commit 50e72a2

File tree

5 files changed

+1395
-0
lines changed

5 files changed

+1395
-0
lines changed

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

Lines changed: 342 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5343,6 +5343,174 @@ pub unsafe fn vqdmulhs_laneq_s32<const N: i32>(a: i32, b: int32x4_t) -> i32 {
53435343
vqdmulhs_s32(a, b)
53445344
}
53455345

5346+
/// Signed saturating rounding doubling multiply returning high half
5347+
#[inline]
5348+
#[target_feature(enable = "neon")]
5349+
#[cfg_attr(test, assert_instr(sqrdmulh))]
5350+
pub unsafe fn vqrdmulhh_s16(a: i16, b: i16) -> i16 {
5351+
simd_extract(vqrdmulh_s16(vdup_n_s16(a), vdup_n_s16(b)), 0)
5352+
}
5353+
5354+
/// Signed saturating rounding doubling multiply returning high half
5355+
#[inline]
5356+
#[target_feature(enable = "neon")]
5357+
#[cfg_attr(test, assert_instr(sqrdmulh))]
5358+
pub unsafe fn vqrdmulhs_s32(a: i32, b: i32) -> i32 {
5359+
simd_extract(vqrdmulh_s32(vdup_n_s32(a), vdup_n_s32(b)), 0)
5360+
}
5361+
5362+
/// Signed saturating rounding doubling multiply returning high half
5363+
#[inline]
5364+
#[target_feature(enable = "neon")]
5365+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5366+
#[rustc_legacy_const_generics(2)]
5367+
pub unsafe fn vqrdmulhh_lane_s16<const LANE: i32>(a: i16, b: int16x4_t) -> i16 {
5368+
static_assert_imm2!(LANE);
5369+
vqrdmulhh_s16(a, simd_extract(b, LANE as u32))
5370+
}
5371+
5372+
/// Signed saturating rounding doubling multiply returning high half
5373+
#[inline]
5374+
#[target_feature(enable = "neon")]
5375+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5376+
#[rustc_legacy_const_generics(2)]
5377+
pub unsafe fn vqrdmulhh_laneq_s16<const LANE: i32>(a: i16, b: int16x8_t) -> i16 {
5378+
static_assert_imm3!(LANE);
5379+
vqrdmulhh_s16(a, simd_extract(b, LANE as u32))
5380+
}
5381+
5382+
/// Signed saturating rounding doubling multiply returning high half
5383+
#[inline]
5384+
#[target_feature(enable = "neon")]
5385+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5386+
#[rustc_legacy_const_generics(2)]
5387+
pub unsafe fn vqrdmulhs_lane_s32<const LANE: i32>(a: i32, b: int32x2_t) -> i32 {
5388+
static_assert_imm1!(LANE);
5389+
vqrdmulhs_s32(a, simd_extract(b, LANE as u32))
5390+
}
5391+
5392+
/// Signed saturating rounding doubling multiply returning high half
5393+
#[inline]
5394+
#[target_feature(enable = "neon")]
5395+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5396+
#[rustc_legacy_const_generics(2)]
5397+
pub unsafe fn vqrdmulhs_laneq_s32<const LANE: i32>(a: i32, b: int32x4_t) -> i32 {
5398+
static_assert_imm2!(LANE);
5399+
vqrdmulhs_s32(a, simd_extract(b, LANE as u32))
5400+
}
5401+
5402+
/// Signed saturating rounding doubling multiply accumulate returning high half
5403+
#[inline]
5404+
#[target_feature(enable = "neon")]
5405+
#[cfg_attr(test, assert_instr(sqrdmulh))]
5406+
pub unsafe fn vqrdmlahh_s16(a: i16, b: i16, c: i16) -> i16 {
5407+
vqaddh_s16(a, vqrdmulhh_s16(b, c))
5408+
}
5409+
5410+
/// Signed saturating rounding doubling multiply accumulate returning high half
5411+
#[inline]
5412+
#[target_feature(enable = "neon")]
5413+
#[cfg_attr(test, assert_instr(sqrdmulh))]
5414+
pub unsafe fn vqrdmlahs_s32(a: i32, b: i32, c: i32) -> i32 {
5415+
vqadds_s32(a, vqrdmulhs_s32(b, c))
5416+
}
5417+
5418+
/// Signed saturating rounding doubling multiply accumulate returning high half
5419+
#[inline]
5420+
#[target_feature(enable = "neon")]
5421+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5422+
#[rustc_legacy_const_generics(3)]
5423+
pub unsafe fn vqrdmlahh_lane_s16<const LANE: i32>(a: i16, b: i16, c: int16x4_t) -> i16 {
5424+
static_assert_imm2!(LANE);
5425+
vqaddh_s16(a, vqrdmulhh_lane_s16::<LANE>(b, c))
5426+
}
5427+
5428+
/// Signed saturating rounding doubling multiply accumulate returning high half
5429+
#[inline]
5430+
#[target_feature(enable = "neon")]
5431+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5432+
#[rustc_legacy_const_generics(3)]
5433+
pub unsafe fn vqrdmlahh_laneq_s16<const LANE: i32>(a: i16, b: i16, c: int16x8_t) -> i16 {
5434+
static_assert_imm3!(LANE);
5435+
vqaddh_s16(a, vqrdmulhh_laneq_s16::<LANE>(b, c))
5436+
}
5437+
5438+
/// Signed saturating rounding doubling multiply accumulate returning high half
5439+
#[inline]
5440+
#[target_feature(enable = "neon")]
5441+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5442+
#[rustc_legacy_const_generics(3)]
5443+
pub unsafe fn vqrdmlahs_lane_s32<const LANE: i32>(a: i32, b: i32, c: int32x2_t) -> i32 {
5444+
static_assert_imm1!(LANE);
5445+
vqadds_s32(a, vqrdmulhs_lane_s32::<LANE>(b, c))
5446+
}
5447+
5448+
/// Signed saturating rounding doubling multiply accumulate returning high half
5449+
#[inline]
5450+
#[target_feature(enable = "neon")]
5451+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5452+
#[rustc_legacy_const_generics(3)]
5453+
pub unsafe fn vqrdmlahs_laneq_s32<const LANE: i32>(a: i32, b: i32, c: int32x4_t) -> i32 {
5454+
static_assert_imm2!(LANE);
5455+
vqadds_s32(a, vqrdmulhs_laneq_s32::<LANE>(b, c))
5456+
}
5457+
5458+
/// Signed saturating rounding doubling multiply subtract returning high half
5459+
#[inline]
5460+
#[target_feature(enable = "neon")]
5461+
#[cfg_attr(test, assert_instr(sqrdmulh))]
5462+
pub unsafe fn vqrdmlshh_s16(a: i16, b: i16, c: i16) -> i16 {
5463+
vqsubh_s16(a, vqrdmulhh_s16(b, c))
5464+
}
5465+
5466+
/// Signed saturating rounding doubling multiply subtract returning high half
5467+
#[inline]
5468+
#[target_feature(enable = "neon")]
5469+
#[cfg_attr(test, assert_instr(sqrdmulh))]
5470+
pub unsafe fn vqrdmlshs_s32(a: i32, b: i32, c: i32) -> i32 {
5471+
vqsubs_s32(a, vqrdmulhs_s32(b, c))
5472+
}
5473+
5474+
/// Signed saturating rounding doubling multiply subtract returning high half
5475+
#[inline]
5476+
#[target_feature(enable = "neon")]
5477+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5478+
#[rustc_legacy_const_generics(3)]
5479+
pub unsafe fn vqrdmlshh_lane_s16<const LANE: i32>(a: i16, b: i16, c: int16x4_t) -> i16 {
5480+
static_assert_imm2!(LANE);
5481+
vqsubh_s16(a, vqrdmulhh_lane_s16::<LANE>(b, c))
5482+
}
5483+
5484+
/// Signed saturating rounding doubling multiply subtract returning high half
5485+
#[inline]
5486+
#[target_feature(enable = "neon")]
5487+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5488+
#[rustc_legacy_const_generics(3)]
5489+
pub unsafe fn vqrdmlshh_laneq_s16<const LANE: i32>(a: i16, b: i16, c: int16x8_t) -> i16 {
5490+
static_assert_imm3!(LANE);
5491+
vqsubh_s16(a, vqrdmulhh_laneq_s16::<LANE>(b, c))
5492+
}
5493+
5494+
/// Signed saturating rounding doubling multiply subtract returning high half
5495+
#[inline]
5496+
#[target_feature(enable = "neon")]
5497+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5498+
#[rustc_legacy_const_generics(3)]
5499+
pub unsafe fn vqrdmlshs_lane_s32<const LANE: i32>(a: i32, b: i32, c: int32x2_t) -> i32 {
5500+
static_assert_imm1!(LANE);
5501+
vqsubs_s32(a, vqrdmulhs_lane_s32::<LANE>(b, c))
5502+
}
5503+
5504+
/// Signed saturating rounding doubling multiply subtract returning high half
5505+
#[inline]
5506+
#[target_feature(enable = "neon")]
5507+
#[cfg_attr(test, assert_instr(sqrdmulh, LANE = 1))]
5508+
#[rustc_legacy_const_generics(3)]
5509+
pub unsafe fn vqrdmlshs_laneq_s32<const LANE: i32>(a: i32, b: i32, c: int32x4_t) -> i32 {
5510+
static_assert_imm2!(LANE);
5511+
vqsubs_s32(a, vqrdmulhs_laneq_s32::<LANE>(b, c))
5512+
}
5513+
53465514
/// Signed saturating rounding shift left
53475515
#[inline]
53485516
#[target_feature(enable = "neon")]
@@ -12437,6 +12605,180 @@ mod test {
1243712605
assert_eq!(r, e);
1243812606
}
1243912607

12608+
#[simd_test(enable = "neon")]
12609+
unsafe fn test_vqrdmulhh_s16() {
12610+
let a: i16 = 1;
12611+
let b: i16 = 2;
12612+
let e: i16 = 0;
12613+
let r: i16 = transmute(vqrdmulhh_s16(transmute(a), transmute(b)));
12614+
assert_eq!(r, e);
12615+
}
12616+
12617+
#[simd_test(enable = "neon")]
12618+
unsafe fn test_vqrdmulhs_s32() {
12619+
let a: i32 = 1;
12620+
let b: i32 = 2;
12621+
let e: i32 = 0;
12622+
let r: i32 = transmute(vqrdmulhs_s32(transmute(a), transmute(b)));
12623+
assert_eq!(r, e);
12624+
}
12625+
12626+
#[simd_test(enable = "neon")]
12627+
unsafe fn test_vqrdmulhh_lane_s16() {
12628+
let a: i16 = 1;
12629+
let b: i16x4 = i16x4::new(0, 2, 0, 0);
12630+
let e: i16 = 0;
12631+
let r: i16 = transmute(vqrdmulhh_lane_s16::<1>(transmute(a), transmute(b)));
12632+
assert_eq!(r, e);
12633+
}
12634+
12635+
#[simd_test(enable = "neon")]
12636+
unsafe fn test_vqrdmulhh_laneq_s16() {
12637+
let a: i16 = 1;
12638+
let b: i16x8 = i16x8::new(0, 2, 0, 0, 0, 0, 0, 0);
12639+
let e: i16 = 0;
12640+
let r: i16 = transmute(vqrdmulhh_laneq_s16::<1>(transmute(a), transmute(b)));
12641+
assert_eq!(r, e);
12642+
}
12643+
12644+
#[simd_test(enable = "neon")]
12645+
unsafe fn test_vqrdmulhs_lane_s32() {
12646+
let a: i32 = 1;
12647+
let b: i32x2 = i32x2::new(0, 2);
12648+
let e: i32 = 0;
12649+
let r: i32 = transmute(vqrdmulhs_lane_s32::<1>(transmute(a), transmute(b)));
12650+
assert_eq!(r, e);
12651+
}
12652+
12653+
#[simd_test(enable = "neon")]
12654+
unsafe fn test_vqrdmulhs_laneq_s32() {
12655+
let a: i32 = 1;
12656+
let b: i32x4 = i32x4::new(0, 2, 0, 0);
12657+
let e: i32 = 0;
12658+
let r: i32 = transmute(vqrdmulhs_laneq_s32::<1>(transmute(a), transmute(b)));
12659+
assert_eq!(r, e);
12660+
}
12661+
12662+
#[simd_test(enable = "neon")]
12663+
unsafe fn test_vqrdmlahh_s16() {
12664+
let a: i16 = 1;
12665+
let b: i16 = 1;
12666+
let c: i16 = 2;
12667+
let e: i16 = 1;
12668+
let r: i16 = transmute(vqrdmlahh_s16(transmute(a), transmute(b), transmute(c)));
12669+
assert_eq!(r, e);
12670+
}
12671+
12672+
#[simd_test(enable = "neon")]
12673+
unsafe fn test_vqrdmlahs_s32() {
12674+
let a: i32 = 1;
12675+
let b: i32 = 1;
12676+
let c: i32 = 2;
12677+
let e: i32 = 1;
12678+
let r: i32 = transmute(vqrdmlahs_s32(transmute(a), transmute(b), transmute(c)));
12679+
assert_eq!(r, e);
12680+
}
12681+
12682+
#[simd_test(enable = "neon")]
12683+
unsafe fn test_vqrdmlahh_lane_s16() {
12684+
let a: i16 = 1;
12685+
let b: i16 = 1;
12686+
let c: i16x4 = i16x4::new(0, 2, 0, 0);
12687+
let e: i16 = 1;
12688+
let r: i16 = transmute(vqrdmlahh_lane_s16::<1>(transmute(a), transmute(b), transmute(c)));
12689+
assert_eq!(r, e);
12690+
}
12691+
12692+
#[simd_test(enable = "neon")]
12693+
unsafe fn test_vqrdmlahh_laneq_s16() {
12694+
let a: i16 = 1;
12695+
let b: i16 = 1;
12696+
let c: i16x8 = i16x8::new(0, 2, 0, 0, 0, 0, 0, 0);
12697+
let e: i16 = 1;
12698+
let r: i16 = transmute(vqrdmlahh_laneq_s16::<1>(transmute(a), transmute(b), transmute(c)));
12699+
assert_eq!(r, e);
12700+
}
12701+
12702+
#[simd_test(enable = "neon")]
12703+
unsafe fn test_vqrdmlahs_lane_s32() {
12704+
let a: i32 = 1;
12705+
let b: i32 = 1;
12706+
let c: i32x2 = i32x2::new(0, 2);
12707+
let e: i32 = 1;
12708+
let r: i32 = transmute(vqrdmlahs_lane_s32::<1>(transmute(a), transmute(b), transmute(c)));
12709+
assert_eq!(r, e);
12710+
}
12711+
12712+
#[simd_test(enable = "neon")]
12713+
unsafe fn test_vqrdmlahs_laneq_s32() {
12714+
let a: i32 = 1;
12715+
let b: i32 = 1;
12716+
let c: i32x4 = i32x4::new(0, 2, 0, 0);
12717+
let e: i32 = 1;
12718+
let r: i32 = transmute(vqrdmlahs_laneq_s32::<1>(transmute(a), transmute(b), transmute(c)));
12719+
assert_eq!(r, e);
12720+
}
12721+
12722+
#[simd_test(enable = "neon")]
12723+
unsafe fn test_vqrdmlshh_s16() {
12724+
let a: i16 = 1;
12725+
let b: i16 = 1;
12726+
let c: i16 = 2;
12727+
let e: i16 = 1;
12728+
let r: i16 = transmute(vqrdmlshh_s16(transmute(a), transmute(b), transmute(c)));
12729+
assert_eq!(r, e);
12730+
}
12731+
12732+
#[simd_test(enable = "neon")]
12733+
unsafe fn test_vqrdmlshs_s32() {
12734+
let a: i32 = 1;
12735+
let b: i32 = 1;
12736+
let c: i32 = 2;
12737+
let e: i32 = 1;
12738+
let r: i32 = transmute(vqrdmlshs_s32(transmute(a), transmute(b), transmute(c)));
12739+
assert_eq!(r, e);
12740+
}
12741+
12742+
#[simd_test(enable = "neon")]
12743+
unsafe fn test_vqrdmlshh_lane_s16() {
12744+
let a: i16 = 1;
12745+
let b: i16 = 1;
12746+
let c: i16x4 = i16x4::new(0, 2, 0, 0);
12747+
let e: i16 = 1;
12748+
let r: i16 = transmute(vqrdmlshh_lane_s16::<1>(transmute(a), transmute(b), transmute(c)));
12749+
assert_eq!(r, e);
12750+
}
12751+
12752+
#[simd_test(enable = "neon")]
12753+
unsafe fn test_vqrdmlshh_laneq_s16() {
12754+
let a: i16 = 1;
12755+
let b: i16 = 1;
12756+
let c: i16x8 = i16x8::new(0, 2, 0, 0, 0, 0, 0, 0);
12757+
let e: i16 = 1;
12758+
let r: i16 = transmute(vqrdmlshh_laneq_s16::<1>(transmute(a), transmute(b), transmute(c)));
12759+
assert_eq!(r, e);
12760+
}
12761+
12762+
#[simd_test(enable = "neon")]
12763+
unsafe fn test_vqrdmlshs_lane_s32() {
12764+
let a: i32 = 1;
12765+
let b: i32 = 1;
12766+
let c: i32x2 = i32x2::new(0, 2);
12767+
let e: i32 = 1;
12768+
let r: i32 = transmute(vqrdmlshs_lane_s32::<1>(transmute(a), transmute(b), transmute(c)));
12769+
assert_eq!(r, e);
12770+
}
12771+
12772+
#[simd_test(enable = "neon")]
12773+
unsafe fn test_vqrdmlshs_laneq_s32() {
12774+
let a: i32 = 1;
12775+
let b: i32 = 1;
12776+
let c: i32x4 = i32x4::new(0, 2, 0, 0);
12777+
let e: i32 = 1;
12778+
let r: i32 = transmute(vqrdmlshs_laneq_s32::<1>(transmute(a), transmute(b), transmute(c)));
12779+
assert_eq!(r, e);
12780+
}
12781+
1244012782
#[simd_test(enable = "neon")]
1244112783
unsafe fn test_vqrshlb_s8() {
1244212784
let a: i8 = 1;

0 commit comments

Comments
 (0)