Skip to content

Commit ee1788f

Browse files
committed
Convert vsli_n_* methods to const generics
1 parent 6a79ab2 commit ee1788f

File tree

3 files changed

+508
-420
lines changed

3 files changed

+508
-420
lines changed

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

+100-100
Original file line numberDiff line numberDiff line change
@@ -2498,182 +2498,182 @@ pub unsafe fn vsliq_n_p16<const N: i32>(a: poly16x8_t, b: poly16x8_t) -> poly16x
24982498
/// Shift Right and Insert (immediate)
24992499
#[inline]
25002500
#[target_feature(enable = "neon")]
2501-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2502-
#[rustc_legacy_const_generics(2)]
2503-
pub unsafe fn vsri_n_s8<const N: i32>(a: int8x8_t, b: int8x8_t) -> int8x8_t {
2504-
static_assert!(N: i32 where N >= 1 && N <= 8);
2505-
vsri_n_s8_(a, b, N)
2501+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2502+
#[rustc_args_required_const(2)]
2503+
pub unsafe fn vsri_n_s8(a: int8x8_t, b: int8x8_t, n: i32) -> int8x8_t {
2504+
assert!(1 <= n && n <= 8, "must have 1 ≤ n ≤ 8, but n = {}", n);
2505+
vsri_n_s8_(a, b, n)
25062506
}
25072507
/// Shift Right and Insert (immediate)
25082508
#[inline]
25092509
#[target_feature(enable = "neon")]
2510-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2511-
#[rustc_legacy_const_generics(2)]
2512-
pub unsafe fn vsriq_n_s8<const N: i32>(a: int8x16_t, b: int8x16_t) -> int8x16_t {
2513-
static_assert!(N: i32 where N >= 1 && N <= 8);
2514-
vsriq_n_s8_(a, b, N)
2510+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2511+
#[rustc_args_required_const(2)]
2512+
pub unsafe fn vsriq_n_s8(a: int8x16_t, b: int8x16_t, n: i32) -> int8x16_t {
2513+
assert!(1 <= n && n <= 8, "must have 1 ≤ n ≤ 8, but n = {}", n);
2514+
vsriq_n_s8_(a, b, n)
25152515
}
25162516
/// Shift Right and Insert (immediate)
25172517
#[inline]
25182518
#[target_feature(enable = "neon")]
2519-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2520-
#[rustc_legacy_const_generics(2)]
2521-
pub unsafe fn vsri_n_s16<const N: i32>(a: int16x4_t, b: int16x4_t) -> int16x4_t {
2522-
static_assert!(N: i32 where N >= 1 && N <= 16);
2523-
vsri_n_s16_(a, b, N)
2519+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2520+
#[rustc_args_required_const(2)]
2521+
pub unsafe fn vsri_n_s16(a: int16x4_t, b: int16x4_t, n: i32) -> int16x4_t {
2522+
assert!(1 <= n && n <= 16, "must have 1 ≤ n ≤ 16, but n = {}", n);
2523+
vsri_n_s16_(a, b, n)
25242524
}
25252525
/// Shift Right and Insert (immediate)
25262526
#[inline]
25272527
#[target_feature(enable = "neon")]
2528-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2529-
#[rustc_legacy_const_generics(2)]
2530-
pub unsafe fn vsriq_n_s16<const N: i32>(a: int16x8_t, b: int16x8_t) -> int16x8_t {
2531-
static_assert!(N: i32 where N >= 1 && N <= 16);
2532-
vsriq_n_s16_(a, b, N)
2528+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2529+
#[rustc_args_required_const(2)]
2530+
pub unsafe fn vsriq_n_s16(a: int16x8_t, b: int16x8_t, n: i32) -> int16x8_t {
2531+
assert!(1 <= n && n <= 16, "must have 1 ≤ n ≤ 16, but n = {}", n);
2532+
vsriq_n_s16_(a, b, n)
25332533
}
25342534
/// Shift Right and Insert (immediate)
25352535
#[inline]
25362536
#[target_feature(enable = "neon")]
2537-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2538-
#[rustc_legacy_const_generics(2)]
2539-
pub unsafe fn vsri_n_s32<const N: i32>(a: int32x2_t, b: int32x2_t) -> int32x2_t {
2540-
static_assert!(N: i32 where N >= 1 && N <= 32);
2541-
vsri_n_s32_(a, b, N)
2537+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2538+
#[rustc_args_required_const(2)]
2539+
pub unsafe fn vsri_n_s32(a: int32x2_t, b: int32x2_t, n: i32) -> int32x2_t {
2540+
assert!(1 <= n && n <= 32, "must have 1 ≤ n ≤ 32, but n = {}", n);
2541+
vsri_n_s32_(a, b, n)
25422542
}
25432543
/// Shift Right and Insert (immediate)
25442544
#[inline]
25452545
#[target_feature(enable = "neon")]
2546-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2547-
#[rustc_legacy_const_generics(2)]
2548-
pub unsafe fn vsriq_n_s32<const N: i32>(a: int32x4_t, b: int32x4_t) -> int32x4_t {
2549-
static_assert!(N: i32 where N >= 1 && N <= 32);
2550-
vsriq_n_s32_(a, b, N)
2546+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2547+
#[rustc_args_required_const(2)]
2548+
pub unsafe fn vsriq_n_s32(a: int32x4_t, b: int32x4_t, n: i32) -> int32x4_t {
2549+
assert!(1 <= n && n <= 32, "must have 1 ≤ n ≤ 32, but n = {}", n);
2550+
vsriq_n_s32_(a, b, n)
25512551
}
25522552
/// Shift Right and Insert (immediate)
25532553
#[inline]
25542554
#[target_feature(enable = "neon")]
2555-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2556-
#[rustc_legacy_const_generics(2)]
2557-
pub unsafe fn vsri_n_s64<const N: i32>(a: int64x1_t, b: int64x1_t) -> int64x1_t {
2558-
static_assert!(N: i32 where N >= 1 && N <= 64);
2559-
vsri_n_s64_(a, b, N)
2555+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2556+
#[rustc_args_required_const(2)]
2557+
pub unsafe fn vsri_n_s64(a: int64x1_t, b: int64x1_t, n: i32) -> int64x1_t {
2558+
assert!(1 <= n && n <= 64, "must have 1 ≤ n ≤ 64, but n = {}", n);
2559+
vsri_n_s64_(a, b, n)
25602560
}
25612561
/// Shift Right and Insert (immediate)
25622562
#[inline]
25632563
#[target_feature(enable = "neon")]
2564-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2565-
#[rustc_legacy_const_generics(2)]
2566-
pub unsafe fn vsriq_n_s64<const N: i32>(a: int64x2_t, b: int64x2_t) -> int64x2_t {
2567-
static_assert!(N: i32 where N >= 1 && N <= 64);
2568-
vsriq_n_s64_(a, b, N)
2564+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2565+
#[rustc_args_required_const(2)]
2566+
pub unsafe fn vsriq_n_s64(a: int64x2_t, b: int64x2_t, n: i32) -> int64x2_t {
2567+
assert!(1 <= n && n <= 64, "must have 1 ≤ n ≤ 64, but n = {}", n);
2568+
vsriq_n_s64_(a, b, n)
25692569
}
25702570
/// Shift Right and Insert (immediate)
25712571
#[inline]
25722572
#[target_feature(enable = "neon")]
2573-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2574-
#[rustc_legacy_const_generics(2)]
2575-
pub unsafe fn vsri_n_u8<const N: i32>(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
2576-
static_assert!(N: i32 where N >= 1 && N <= 8);
2577-
transmute(vsri_n_s8_(transmute(a), transmute(b), N))
2573+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2574+
#[rustc_args_required_const(2)]
2575+
pub unsafe fn vsri_n_u8(a: uint8x8_t, b: uint8x8_t, n: i32) -> uint8x8_t {
2576+
assert!(1 <= n && n <= 8, "must have 1 ≤ n ≤ 8, but n = {}", n);
2577+
transmute(vsri_n_s8_(transmute(a), transmute(b), n))
25782578
}
25792579
/// Shift Right and Insert (immediate)
25802580
#[inline]
25812581
#[target_feature(enable = "neon")]
2582-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2583-
#[rustc_legacy_const_generics(2)]
2584-
pub unsafe fn vsriq_n_u8<const N: i32>(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
2585-
static_assert!(N: i32 where N >= 1 && N <= 8);
2586-
transmute(vsriq_n_s8_(transmute(a), transmute(b), N))
2582+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2583+
#[rustc_args_required_const(2)]
2584+
pub unsafe fn vsriq_n_u8(a: uint8x16_t, b: uint8x16_t, n: i32) -> uint8x16_t {
2585+
assert!(1 <= n && n <= 8, "must have 1 ≤ n ≤ 8, but n = {}", n);
2586+
transmute(vsriq_n_s8_(transmute(a), transmute(b), n))
25872587
}
25882588
/// Shift Right and Insert (immediate)
25892589
#[inline]
25902590
#[target_feature(enable = "neon")]
2591-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2592-
#[rustc_legacy_const_generics(2)]
2593-
pub unsafe fn vsri_n_u16<const N: i32>(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
2594-
static_assert!(N: i32 where N >= 1 && N <= 16);
2595-
transmute(vsri_n_s16_(transmute(a), transmute(b), N))
2591+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2592+
#[rustc_args_required_const(2)]
2593+
pub unsafe fn vsri_n_u16(a: uint16x4_t, b: uint16x4_t, n: i32) -> uint16x4_t {
2594+
assert!(1 <= n && n <= 16, "must have 1 ≤ n ≤ 16, but n = {}", n);
2595+
transmute(vsri_n_s16_(transmute(a), transmute(b), n))
25962596
}
25972597
/// Shift Right and Insert (immediate)
25982598
#[inline]
25992599
#[target_feature(enable = "neon")]
2600-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2601-
#[rustc_legacy_const_generics(2)]
2602-
pub unsafe fn vsriq_n_u16<const N: i32>(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
2603-
static_assert!(N: i32 where N >= 1 && N <= 16);
2604-
transmute(vsriq_n_s16_(transmute(a), transmute(b), N))
2600+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2601+
#[rustc_args_required_const(2)]
2602+
pub unsafe fn vsriq_n_u16(a: uint16x8_t, b: uint16x8_t, n: i32) -> uint16x8_t {
2603+
assert!(1 <= n && n <= 16, "must have 1 ≤ n ≤ 16, but n = {}", n);
2604+
transmute(vsriq_n_s16_(transmute(a), transmute(b), n))
26052605
}
26062606
/// Shift Right and Insert (immediate)
26072607
#[inline]
26082608
#[target_feature(enable = "neon")]
2609-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2610-
#[rustc_legacy_const_generics(2)]
2611-
pub unsafe fn vsri_n_u32<const N: i32>(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
2612-
static_assert!(N: i32 where N >= 1 && N <= 32);
2613-
transmute(vsri_n_s32_(transmute(a), transmute(b), N))
2609+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2610+
#[rustc_args_required_const(2)]
2611+
pub unsafe fn vsri_n_u32(a: uint32x2_t, b: uint32x2_t, n: i32) -> uint32x2_t {
2612+
assert!(1 <= n && n <= 32, "must have 1 ≤ n ≤ 32, but n = {}", n);
2613+
transmute(vsri_n_s32_(transmute(a), transmute(b), n))
26142614
}
26152615
/// Shift Right and Insert (immediate)
26162616
#[inline]
26172617
#[target_feature(enable = "neon")]
2618-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2619-
#[rustc_legacy_const_generics(2)]
2620-
pub unsafe fn vsriq_n_u32<const N: i32>(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
2621-
static_assert!(N: i32 where N >= 1 && N <= 32);
2622-
transmute(vsriq_n_s32_(transmute(a), transmute(b), N))
2618+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2619+
#[rustc_args_required_const(2)]
2620+
pub unsafe fn vsriq_n_u32(a: uint32x4_t, b: uint32x4_t, n: i32) -> uint32x4_t {
2621+
assert!(1 <= n && n <= 32, "must have 1 ≤ n ≤ 32, but n = {}", n);
2622+
transmute(vsriq_n_s32_(transmute(a), transmute(b), n))
26232623
}
26242624
/// Shift Right and Insert (immediate)
26252625
#[inline]
26262626
#[target_feature(enable = "neon")]
2627-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2628-
#[rustc_legacy_const_generics(2)]
2629-
pub unsafe fn vsri_n_u64<const N: i32>(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
2630-
static_assert!(N: i32 where N >= 1 && N <= 64);
2631-
transmute(vsri_n_s64_(transmute(a), transmute(b), N))
2627+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2628+
#[rustc_args_required_const(2)]
2629+
pub unsafe fn vsri_n_u64(a: uint64x1_t, b: uint64x1_t, n: i32) -> uint64x1_t {
2630+
assert!(1 <= n && n <= 64, "must have 1 ≤ n ≤ 64, but n = {}", n);
2631+
transmute(vsri_n_s64_(transmute(a), transmute(b), n))
26322632
}
26332633
/// Shift Right and Insert (immediate)
26342634
#[inline]
26352635
#[target_feature(enable = "neon")]
2636-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2637-
#[rustc_legacy_const_generics(2)]
2638-
pub unsafe fn vsriq_n_u64<const N: i32>(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
2639-
static_assert!(N: i32 where N >= 1 && N <= 64);
2640-
transmute(vsriq_n_s64_(transmute(a), transmute(b), N))
2636+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2637+
#[rustc_args_required_const(2)]
2638+
pub unsafe fn vsriq_n_u64(a: uint64x2_t, b: uint64x2_t, n: i32) -> uint64x2_t {
2639+
assert!(1 <= n && n <= 64, "must have 1 ≤ n ≤ 64, but n = {}", n);
2640+
transmute(vsriq_n_s64_(transmute(a), transmute(b), n))
26412641
}
26422642
/// Shift Right and Insert (immediate)
26432643
#[inline]
26442644
#[target_feature(enable = "neon")]
2645-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2646-
#[rustc_legacy_const_generics(2)]
2647-
pub unsafe fn vsri_n_p8<const N: i32>(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t {
2648-
static_assert!(N: i32 where N >= 1 && N <= 8);
2649-
transmute(vsri_n_s8_(transmute(a), transmute(b), N))
2645+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2646+
#[rustc_args_required_const(2)]
2647+
pub unsafe fn vsri_n_p8(a: poly8x8_t, b: poly8x8_t, n: i32) -> poly8x8_t {
2648+
assert!(1 <= n && n <= 8, "must have 1 ≤ n ≤ 8, but n = {}", n);
2649+
transmute(vsri_n_s8_(transmute(a), transmute(b), n))
26502650
}
26512651
/// Shift Right and Insert (immediate)
26522652
#[inline]
26532653
#[target_feature(enable = "neon")]
2654-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2655-
#[rustc_legacy_const_generics(2)]
2656-
pub unsafe fn vsriq_n_p8<const N: i32>(a: poly8x16_t, b: poly8x16_t) -> poly8x16_t {
2657-
static_assert!(N: i32 where N >= 1 && N <= 8);
2658-
transmute(vsriq_n_s8_(transmute(a), transmute(b), N))
2654+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2655+
#[rustc_args_required_const(2)]
2656+
pub unsafe fn vsriq_n_p8(a: poly8x16_t, b: poly8x16_t, n: i32) -> poly8x16_t {
2657+
assert!(1 <= n && n <= 8, "must have 1 ≤ n ≤ 8, but n = {}", n);
2658+
transmute(vsriq_n_s8_(transmute(a), transmute(b), n))
26592659
}
26602660
/// Shift Right and Insert (immediate)
26612661
#[inline]
26622662
#[target_feature(enable = "neon")]
2663-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2664-
#[rustc_legacy_const_generics(2)]
2665-
pub unsafe fn vsri_n_p16<const N: i32>(a: poly16x4_t, b: poly16x4_t) -> poly16x4_t {
2666-
static_assert!(N: i32 where N >= 1 && N <= 16);
2667-
transmute(vsri_n_s16_(transmute(a), transmute(b), N))
2663+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2664+
#[rustc_args_required_const(2)]
2665+
pub unsafe fn vsri_n_p16(a: poly16x4_t, b: poly16x4_t, n: i32) -> poly16x4_t {
2666+
assert!(1 <= n && n <= 16, "must have 1 ≤ n ≤ 16, but n = {}", n);
2667+
transmute(vsri_n_s16_(transmute(a), transmute(b), n))
26682668
}
26692669
/// Shift Right and Insert (immediate)
26702670
#[inline]
26712671
#[target_feature(enable = "neon")]
2672-
#[cfg_attr(test, assert_instr(sri, N = 1))]
2673-
#[rustc_legacy_const_generics(2)]
2674-
pub unsafe fn vsriq_n_p16<const N: i32>(a: poly16x8_t, b: poly16x8_t) -> poly16x8_t {
2675-
static_assert!(N: i32 where N >= 1 && N <= 16);
2676-
transmute(vsriq_n_s16_(transmute(a), transmute(b), N))
2672+
#[cfg_attr(test, assert_instr(sri, n = 1))]
2673+
#[rustc_args_required_const(2)]
2674+
pub unsafe fn vsriq_n_p16(a: poly16x8_t, b: poly16x8_t, n: i32) -> poly16x8_t {
2675+
assert!(1 <= n && n <= 16, "must have 1 ≤ n ≤ 16, but n = {}", n);
2676+
transmute(vsriq_n_s16_(transmute(a), transmute(b), n))
26772677
}
26782678

26792679
#[cfg(test)]

0 commit comments

Comments
 (0)