Skip to content

Commit 2a1d6b8

Browse files
committed
use static_assert! instead of assert!; use generic const in vld1_lane_* and other methods
1 parent 1b988eb commit 2a1d6b8

File tree

3 files changed

+372
-460
lines changed

3 files changed

+372
-460
lines changed

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

+40-40
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,7 @@ pub unsafe fn vcvtq_u32_f32(a: float32x4_t) -> uint32x4_t {
23202320
#[cfg_attr(test, assert_instr(sli, n = 1))]
23212321
#[rustc_legacy_const_generics(2)]
23222322
pub unsafe fn vsli_n_s8<const N: i32>(a: int8x8_t, b: int8x8_t) -> int8x8_t {
2323-
assert!(0 <= N && N <= 7, "must have 0 ≤ N ≤ 7, but N = {}", N);
2323+
static_assert_imm3!(N);
23242324
vsli_n_s8_(a, b, N)
23252325
}
23262326
/// Shift Left and Insert (immediate)
@@ -2329,7 +2329,7 @@ pub unsafe fn vsli_n_s8<const N: i32>(a: int8x8_t, b: int8x8_t) -> int8x8_t {
23292329
#[cfg_attr(test, assert_instr(sli, n = 1))]
23302330
#[rustc_legacy_const_generics(2)]
23312331
pub unsafe fn vsliq_n_s8<const N: i32>(a: int8x16_t, b: int8x16_t) -> int8x16_t {
2332-
assert!(0 <= N && N <= 7, "must have 0 ≤ N ≤ 7, but N = {}", N);
2332+
static_assert_imm3!(N);
23332333
vsliq_n_s8_(a, b, N)
23342334
}
23352335
/// Shift Left and Insert (immediate)
@@ -2338,7 +2338,7 @@ pub unsafe fn vsliq_n_s8<const N: i32>(a: int8x16_t, b: int8x16_t) -> int8x16_t
23382338
#[cfg_attr(test, assert_instr(sli, n = 1))]
23392339
#[rustc_legacy_const_generics(2)]
23402340
pub unsafe fn vsli_n_s16<const N: i32>(a: int16x4_t, b: int16x4_t) -> int16x4_t {
2341-
assert!(0 <= N && N <= 15, "must have 0 ≤ N ≤ 15, but N = {}", N);
2341+
static_assert_imm4!(N);
23422342
vsli_n_s16_(a, b, N)
23432343
}
23442344
/// Shift Left and Insert (immediate)
@@ -2347,7 +2347,7 @@ pub unsafe fn vsli_n_s16<const N: i32>(a: int16x4_t, b: int16x4_t) -> int16x4_t
23472347
#[cfg_attr(test, assert_instr(sli, n = 1))]
23482348
#[rustc_legacy_const_generics(2)]
23492349
pub unsafe fn vsliq_n_s16<const N: i32>(a: int16x8_t, b: int16x8_t) -> int16x8_t {
2350-
assert!(0 <= N && N <= 15, "must have 0 ≤ N ≤ 15, but N = {}", N);
2350+
static_assert_imm4!(N);
23512351
vsliq_n_s16_(a, b, N)
23522352
}
23532353
/// Shift Left and Insert (immediate)
@@ -2356,7 +2356,7 @@ pub unsafe fn vsliq_n_s16<const N: i32>(a: int16x8_t, b: int16x8_t) -> int16x8_t
23562356
#[cfg_attr(test, assert_instr(sli, n = 1))]
23572357
#[rustc_legacy_const_generics(2)]
23582358
pub unsafe fn vsli_n_s32<const N: i32>(a: int32x2_t, b: int32x2_t) -> int32x2_t {
2359-
assert!(0 <= N && N <= 31, "must have 0 ≤ N ≤ 31, but N = {}", N);
2359+
static_assert!(N: i32 where N >= 0 && N <= 31);
23602360
vsli_n_s32_(a, b, N)
23612361
}
23622362
/// Shift Left and Insert (immediate)
@@ -2365,7 +2365,7 @@ pub unsafe fn vsli_n_s32<const N: i32>(a: int32x2_t, b: int32x2_t) -> int32x2_t
23652365
#[cfg_attr(test, assert_instr(sli, n = 1))]
23662366
#[rustc_legacy_const_generics(2)]
23672367
pub unsafe fn vsliq_n_s32<const N: i32>(a: int32x4_t, b: int32x4_t) -> int32x4_t {
2368-
assert!(0 <= N && N <= 31, "must have 0 ≤ N ≤ 31, but N = {}", N);
2368+
static_assert!(N: i32 where N >= 0 && N <= 31);
23692369
vsliq_n_s32_(a, b, N)
23702370
}
23712371
/// Shift Left and Insert (immediate)
@@ -2374,7 +2374,7 @@ pub unsafe fn vsliq_n_s32<const N: i32>(a: int32x4_t, b: int32x4_t) -> int32x4_t
23742374
#[cfg_attr(test, assert_instr(sli, n = 1))]
23752375
#[rustc_legacy_const_generics(2)]
23762376
pub unsafe fn vsli_n_s64<const N: i32>(a: int64x1_t, b: int64x1_t) -> int64x1_t {
2377-
assert!(0 <= N && N <= 63, "must have 0 ≤ N ≤ 63, but N = {}", N);
2377+
static_assert!(N: i32 where N >= 0 && N <= 63);
23782378
vsli_n_s64_(a, b, N)
23792379
}
23802380
/// Shift Left and Insert (immediate)
@@ -2383,7 +2383,7 @@ pub unsafe fn vsli_n_s64<const N: i32>(a: int64x1_t, b: int64x1_t) -> int64x1_t
23832383
#[cfg_attr(test, assert_instr(sli, n = 1))]
23842384
#[rustc_legacy_const_generics(2)]
23852385
pub unsafe fn vsliq_n_s64<const N: i32>(a: int64x2_t, b: int64x2_t) -> int64x2_t {
2386-
assert!(0 <= N && N <= 63, "must have 0 ≤ N ≤ 63, but N = {}", N);
2386+
static_assert!(N: i32 where N >= 0 && N <= 63);
23872387
vsliq_n_s64_(a, b, N)
23882388
}
23892389
/// Shift Left and Insert (immediate)
@@ -2392,7 +2392,7 @@ pub unsafe fn vsliq_n_s64<const N: i32>(a: int64x2_t, b: int64x2_t) -> int64x2_t
23922392
#[cfg_attr(test, assert_instr(sli, n = 1))]
23932393
#[rustc_legacy_const_generics(2)]
23942394
pub unsafe fn vsli_n_u8<const N: i32>(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
2395-
assert!(0 <= N && N <= 7, "must have 0 ≤ N ≤ 7, but N = {}", N);
2395+
static_assert_imm3!(N);
23962396
transmute(vsli_n_s8_(transmute(a), transmute(b), N))
23972397
}
23982398
/// Shift Left and Insert (immediate)
@@ -2401,7 +2401,7 @@ pub unsafe fn vsli_n_u8<const N: i32>(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
24012401
#[cfg_attr(test, assert_instr(sli, n = 1))]
24022402
#[rustc_legacy_const_generics(2)]
24032403
pub unsafe fn vsliq_n_u8<const N: i32>(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
2404-
assert!(0 <= N && N <= 7, "must have 0 ≤ N ≤ 7, but N = {}", N);
2404+
static_assert_imm3!(N);
24052405
transmute(vsliq_n_s8_(transmute(a), transmute(b), N))
24062406
}
24072407
/// Shift Left and Insert (immediate)
@@ -2410,7 +2410,7 @@ pub unsafe fn vsliq_n_u8<const N: i32>(a: uint8x16_t, b: uint8x16_t) -> uint8x16
24102410
#[cfg_attr(test, assert_instr(sli, n = 1))]
24112411
#[rustc_legacy_const_generics(2)]
24122412
pub unsafe fn vsli_n_u16<const N: i32>(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
2413-
assert!(0 <= N && N <= 15, "must have 0 ≤ N ≤ 15, but N = {}", N);
2413+
static_assert_imm4!(N);
24142414
transmute(vsli_n_s16_(transmute(a), transmute(b), N))
24152415
}
24162416
/// Shift Left and Insert (immediate)
@@ -2419,7 +2419,7 @@ pub unsafe fn vsli_n_u16<const N: i32>(a: uint16x4_t, b: uint16x4_t) -> uint16x4
24192419
#[cfg_attr(test, assert_instr(sli, n = 1))]
24202420
#[rustc_legacy_const_generics(2)]
24212421
pub unsafe fn vsliq_n_u16<const N: i32>(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
2422-
assert!(0 <= N && N <= 15, "must have 0 ≤ N ≤ 15, but N = {}", N);
2422+
static_assert_imm4!(N);
24232423
transmute(vsliq_n_s16_(transmute(a), transmute(b), N))
24242424
}
24252425
/// Shift Left and Insert (immediate)
@@ -2428,7 +2428,7 @@ pub unsafe fn vsliq_n_u16<const N: i32>(a: uint16x8_t, b: uint16x8_t) -> uint16x
24282428
#[cfg_attr(test, assert_instr(sli, n = 1))]
24292429
#[rustc_legacy_const_generics(2)]
24302430
pub unsafe fn vsli_n_u32<const N: i32>(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
2431-
assert!(0 <= N && N <= 31, "must have 0 ≤ N ≤ 31, but N = {}", N);
2431+
static_assert!(N: i32 where N >= 0 && N <= 31);
24322432
transmute(vsli_n_s32_(transmute(a), transmute(b), N))
24332433
}
24342434
/// Shift Left and Insert (immediate)
@@ -2437,7 +2437,7 @@ pub unsafe fn vsli_n_u32<const N: i32>(a: uint32x2_t, b: uint32x2_t) -> uint32x2
24372437
#[cfg_attr(test, assert_instr(sli, n = 1))]
24382438
#[rustc_legacy_const_generics(2)]
24392439
pub unsafe fn vsliq_n_u32<const N: i32>(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
2440-
assert!(0 <= N && N <= 31, "must have 0 ≤ N ≤ 31, but N = {}", N);
2440+
static_assert!(N: i32 where N >= 0 && N <= 31);
24412441
transmute(vsliq_n_s32_(transmute(a), transmute(b), N))
24422442
}
24432443
/// Shift Left and Insert (immediate)
@@ -2446,7 +2446,7 @@ pub unsafe fn vsliq_n_u32<const N: i32>(a: uint32x4_t, b: uint32x4_t) -> uint32x
24462446
#[cfg_attr(test, assert_instr(sli, n = 1))]
24472447
#[rustc_legacy_const_generics(2)]
24482448
pub unsafe fn vsli_n_u64<const N: i32>(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
2449-
assert!(0 <= N && N <= 63, "must have 0 ≤ N ≤ 63, but N = {}", N);
2449+
static_assert!(N: i32 where N >= 0 && N <= 63);
24502450
transmute(vsli_n_s64_(transmute(a), transmute(b), N))
24512451
}
24522452
/// Shift Left and Insert (immediate)
@@ -2455,7 +2455,7 @@ pub unsafe fn vsli_n_u64<const N: i32>(a: uint64x1_t, b: uint64x1_t) -> uint64x1
24552455
#[cfg_attr(test, assert_instr(sli, n = 1))]
24562456
#[rustc_legacy_const_generics(2)]
24572457
pub unsafe fn vsliq_n_u64<const N: i32>(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
2458-
assert!(0 <= N && N <= 63, "must have 0 ≤ N ≤ 63, but N = {}", N);
2458+
static_assert!(N: i32 where N >= 0 && N <= 63);
24592459
transmute(vsliq_n_s64_(transmute(a), transmute(b), N))
24602460
}
24612461
/// Shift Left and Insert (immediate)
@@ -2464,7 +2464,7 @@ pub unsafe fn vsliq_n_u64<const N: i32>(a: uint64x2_t, b: uint64x2_t) -> uint64x
24642464
#[cfg_attr(test, assert_instr(sli, n = 1))]
24652465
#[rustc_legacy_const_generics(2)]
24662466
pub unsafe fn vsli_n_p8<const N: i32>(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t {
2467-
assert!(0 <= N && N <= 7, "must have 0 ≤ N ≤ 7, but N = {}", N);
2467+
static_assert_imm3!(N);
24682468
transmute(vsli_n_s8_(transmute(a), transmute(b), N))
24692469
}
24702470
/// Shift Left and Insert (immediate)
@@ -2473,7 +2473,7 @@ pub unsafe fn vsli_n_p8<const N: i32>(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t {
24732473
#[cfg_attr(test, assert_instr(sli, n = 1))]
24742474
#[rustc_legacy_const_generics(2)]
24752475
pub unsafe fn vsliq_n_p8<const N: i32>(a: poly8x16_t, b: poly8x16_t) -> poly8x16_t {
2476-
assert!(0 <= N && N <= 7, "must have 0 ≤ N ≤ 7, but N = {}", N);
2476+
static_assert_imm3!(N);
24772477
transmute(vsliq_n_s8_(transmute(a), transmute(b), N))
24782478
}
24792479
/// Shift Left and Insert (immediate)
@@ -2482,7 +2482,7 @@ pub unsafe fn vsliq_n_p8<const N: i32>(a: poly8x16_t, b: poly8x16_t) -> poly8x16
24822482
#[cfg_attr(test, assert_instr(sli, n = 1))]
24832483
#[rustc_legacy_const_generics(2)]
24842484
pub unsafe fn vsli_n_p16<const N: i32>(a: poly16x4_t, b: poly16x4_t) -> poly16x4_t {
2485-
assert!(0 <= N && N <= 15, "must have 0 ≤ N ≤ 15, but N = {}", N);
2485+
static_assert_imm4!(N);
24862486
transmute(vsli_n_s16_(transmute(a), transmute(b), N))
24872487
}
24882488
/// Shift Left and Insert (immediate)
@@ -2491,7 +2491,7 @@ pub unsafe fn vsli_n_p16<const N: i32>(a: poly16x4_t, b: poly16x4_t) -> poly16x4
24912491
#[cfg_attr(test, assert_instr(sli, n = 1))]
24922492
#[rustc_legacy_const_generics(2)]
24932493
pub unsafe fn vsliq_n_p16<const N: i32>(a: poly16x8_t, b: poly16x8_t) -> poly16x8_t {
2494-
assert!(0 <= N && N <= 15, "must have 0 ≤ N ≤ 15, but N = {}", N);
2494+
static_assert_imm4!(N);
24952495
transmute(vsliq_n_s16_(transmute(a), transmute(b), N))
24962496
}
24972497

@@ -2501,7 +2501,7 @@ pub unsafe fn vsliq_n_p16<const N: i32>(a: poly16x8_t, b: poly16x8_t) -> poly16x
25012501
#[cfg_attr(test, assert_instr(sri, n = 1))]
25022502
#[rustc_legacy_const_generics(2)]
25032503
pub unsafe fn vsri_n_s8<const N: i32>(a: int8x8_t, b: int8x8_t) -> int8x8_t {
2504-
assert!(1 <= N && N <= 8, "must have 1 ≤ N ≤ 8, but N = {}", N);
2504+
static_assert!(N: i32 where N >= 1 && N <= 8);
25052505
vsri_n_s8_(a, b, N)
25062506
}
25072507
/// Shift Right and Insert (immediate)
@@ -2510,7 +2510,7 @@ pub unsafe fn vsri_n_s8<const N: i32>(a: int8x8_t, b: int8x8_t) -> int8x8_t {
25102510
#[cfg_attr(test, assert_instr(sri, n = 1))]
25112511
#[rustc_legacy_const_generics(2)]
25122512
pub unsafe fn vsriq_n_s8<const N: i32>(a: int8x16_t, b: int8x16_t) -> int8x16_t {
2513-
assert!(1 <= N && N <= 8, "must have 1 ≤ N ≤ 8, but N = {}", N);
2513+
static_assert!(N: i32 where N >= 1 && N <= 8);
25142514
vsriq_n_s8_(a, b, N)
25152515
}
25162516
/// Shift Right and Insert (immediate)
@@ -2519,7 +2519,7 @@ pub unsafe fn vsriq_n_s8<const N: i32>(a: int8x16_t, b: int8x16_t) -> int8x16_t
25192519
#[cfg_attr(test, assert_instr(sri, n = 1))]
25202520
#[rustc_legacy_const_generics(2)]
25212521
pub unsafe fn vsri_n_s16<const N: i32>(a: int16x4_t, b: int16x4_t) -> int16x4_t {
2522-
assert!(1 <= N && N <= 16, "must have 1 ≤ N ≤ 16, but N = {}", N);
2522+
static_assert!(N: i32 where N >= 1 && N <= 16);
25232523
vsri_n_s16_(a, b, N)
25242524
}
25252525
/// Shift Right and Insert (immediate)
@@ -2528,7 +2528,7 @@ pub unsafe fn vsri_n_s16<const N: i32>(a: int16x4_t, b: int16x4_t) -> int16x4_t
25282528
#[cfg_attr(test, assert_instr(sri, n = 1))]
25292529
#[rustc_legacy_const_generics(2)]
25302530
pub unsafe fn vsriq_n_s16<const N: i32>(a: int16x8_t, b: int16x8_t) -> int16x8_t {
2531-
assert!(1 <= N && N <= 16, "must have 1 ≤ N ≤ 16, but N = {}", N);
2531+
static_assert!(N: i32 where N >= 1 && N <= 16);
25322532
vsriq_n_s16_(a, b, N)
25332533
}
25342534
/// Shift Right and Insert (immediate)
@@ -2537,7 +2537,7 @@ pub unsafe fn vsriq_n_s16<const N: i32>(a: int16x8_t, b: int16x8_t) -> int16x8_t
25372537
#[cfg_attr(test, assert_instr(sri, n = 1))]
25382538
#[rustc_legacy_const_generics(2)]
25392539
pub unsafe fn vsri_n_s32<const N: i32>(a: int32x2_t, b: int32x2_t) -> int32x2_t {
2540-
assert!(1 <= N && N <= 32, "must have 1 ≤ N ≤ 32, but N = {}", N);
2540+
static_assert!(N: i32 where N >= 1 && N <= 32);
25412541
vsri_n_s32_(a, b, N)
25422542
}
25432543
/// Shift Right and Insert (immediate)
@@ -2546,7 +2546,7 @@ pub unsafe fn vsri_n_s32<const N: i32>(a: int32x2_t, b: int32x2_t) -> int32x2_t
25462546
#[cfg_attr(test, assert_instr(sri, n = 1))]
25472547
#[rustc_legacy_const_generics(2)]
25482548
pub unsafe fn vsriq_n_s32<const N: i32>(a: int32x4_t, b: int32x4_t) -> int32x4_t {
2549-
assert!(1 <= N && N <= 32, "must have 1 ≤ N ≤ 32, but N = {}", N);
2549+
static_assert!(N: i32 where N >= 1 && N <= 32);
25502550
vsriq_n_s32_(a, b, N)
25512551
}
25522552
/// Shift Right and Insert (immediate)
@@ -2555,7 +2555,7 @@ pub unsafe fn vsriq_n_s32<const N: i32>(a: int32x4_t, b: int32x4_t) -> int32x4_t
25552555
#[cfg_attr(test, assert_instr(sri, n = 1))]
25562556
#[rustc_legacy_const_generics(2)]
25572557
pub unsafe fn vsri_n_s64<const N: i32>(a: int64x1_t, b: int64x1_t) -> int64x1_t {
2558-
assert!(1 <= N && N <= 64, "must have 1 ≤ N ≤ 64, but N = {}", N);
2558+
static_assert!(N: i32 where N >= 1 && N <= 64);
25592559
vsri_n_s64_(a, b, N)
25602560
}
25612561
/// Shift Right and Insert (immediate)
@@ -2564,7 +2564,7 @@ pub unsafe fn vsri_n_s64<const N: i32>(a: int64x1_t, b: int64x1_t) -> int64x1_t
25642564
#[cfg_attr(test, assert_instr(sri, n = 1))]
25652565
#[rustc_legacy_const_generics(2)]
25662566
pub unsafe fn vsriq_n_s64<const N: i32>(a: int64x2_t, b: int64x2_t) -> int64x2_t {
2567-
assert!(1 <= N && N <= 64, "must have 1 ≤ N ≤ 64, but N = {}", N);
2567+
static_assert!(N: i32 where N >= 1 && N <= 64);
25682568
vsriq_n_s64_(a, b, N)
25692569
}
25702570
/// Shift Right and Insert (immediate)
@@ -2573,7 +2573,7 @@ pub unsafe fn vsriq_n_s64<const N: i32>(a: int64x2_t, b: int64x2_t) -> int64x2_t
25732573
#[cfg_attr(test, assert_instr(sri, n = 1))]
25742574
#[rustc_legacy_const_generics(2)]
25752575
pub unsafe fn vsri_n_u8<const N: i32>(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
2576-
assert!(1 <= N && N <= 8, "must have 1 ≤ N ≤ 8, but N = {}", N);
2576+
static_assert!(N: i32 where N >= 1 && N <= 8);
25772577
transmute(vsri_n_s8_(transmute(a), transmute(b), N))
25782578
}
25792579
/// Shift Right and Insert (immediate)
@@ -2582,7 +2582,7 @@ pub unsafe fn vsri_n_u8<const N: i32>(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
25822582
#[cfg_attr(test, assert_instr(sri, n = 1))]
25832583
#[rustc_legacy_const_generics(2)]
25842584
pub unsafe fn vsriq_n_u8<const N: i32>(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
2585-
assert!(1 <= N && N <= 8, "must have 1 ≤ N ≤ 8, but N = {}", N);
2585+
static_assert!(N: i32 where N >= 1 && N <= 8);
25862586
transmute(vsriq_n_s8_(transmute(a), transmute(b), N))
25872587
}
25882588
/// Shift Right and Insert (immediate)
@@ -2591,7 +2591,7 @@ pub unsafe fn vsriq_n_u8<const N: i32>(a: uint8x16_t, b: uint8x16_t) -> uint8x16
25912591
#[cfg_attr(test, assert_instr(sri, n = 1))]
25922592
#[rustc_legacy_const_generics(2)]
25932593
pub unsafe fn vsri_n_u16<const N: i32>(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
2594-
assert!(1 <= N && N <= 16, "must have 1 ≤ N ≤ 16, but N = {}", N);
2594+
static_assert!(N: i32 where N >= 1 && N <= 16);
25952595
transmute(vsri_n_s16_(transmute(a), transmute(b), N))
25962596
}
25972597
/// Shift Right and Insert (immediate)
@@ -2600,7 +2600,7 @@ pub unsafe fn vsri_n_u16<const N: i32>(a: uint16x4_t, b: uint16x4_t) -> uint16x4
26002600
#[cfg_attr(test, assert_instr(sri, n = 1))]
26012601
#[rustc_legacy_const_generics(2)]
26022602
pub unsafe fn vsriq_n_u16<const N: i32>(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
2603-
assert!(1 <= N && N <= 16, "must have 1 ≤ N ≤ 16, but N = {}", N);
2603+
static_assert!(N: i32 where N >= 1 && N <= 16);
26042604
transmute(vsriq_n_s16_(transmute(a), transmute(b), N))
26052605
}
26062606
/// Shift Right and Insert (immediate)
@@ -2609,7 +2609,7 @@ pub unsafe fn vsriq_n_u16<const N: i32>(a: uint16x8_t, b: uint16x8_t) -> uint16x
26092609
#[cfg_attr(test, assert_instr(sri, n = 1))]
26102610
#[rustc_legacy_const_generics(2)]
26112611
pub unsafe fn vsri_n_u32<const N: i32>(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
2612-
assert!(1 <= N && N <= 32, "must have 1 ≤ N ≤ 32, but N = {}", N);
2612+
static_assert!(N: i32 where N >= 1 && N <= 32);
26132613
transmute(vsri_n_s32_(transmute(a), transmute(b), N))
26142614
}
26152615
/// Shift Right and Insert (immediate)
@@ -2618,7 +2618,7 @@ pub unsafe fn vsri_n_u32<const N: i32>(a: uint32x2_t, b: uint32x2_t) -> uint32x2
26182618
#[cfg_attr(test, assert_instr(sri, n = 1))]
26192619
#[rustc_legacy_const_generics(2)]
26202620
pub unsafe fn vsriq_n_u32<const N: i32>(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
2621-
assert!(1 <= N && N <= 32, "must have 1 ≤ N ≤ 32, but N = {}", N);
2621+
static_assert!(N: i32 where N >= 1 && N <= 32);
26222622
transmute(vsriq_n_s32_(transmute(a), transmute(b), N))
26232623
}
26242624
/// Shift Right and Insert (immediate)
@@ -2627,7 +2627,7 @@ pub unsafe fn vsriq_n_u32<const N: i32>(a: uint32x4_t, b: uint32x4_t) -> uint32x
26272627
#[cfg_attr(test, assert_instr(sri, n = 1))]
26282628
#[rustc_legacy_const_generics(2)]
26292629
pub unsafe fn vsri_n_u64<const N: i32>(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
2630-
assert!(1 <= N && N <= 64, "must have 1 ≤ N ≤ 64, but N = {}", N);
2630+
static_assert!(N: i32 where N >= 1 && N <= 64);
26312631
transmute(vsri_n_s64_(transmute(a), transmute(b), N))
26322632
}
26332633
/// Shift Right and Insert (immediate)
@@ -2636,7 +2636,7 @@ pub unsafe fn vsri_n_u64<const N: i32>(a: uint64x1_t, b: uint64x1_t) -> uint64x1
26362636
#[cfg_attr(test, assert_instr(sri, n = 1))]
26372637
#[rustc_legacy_const_generics(2)]
26382638
pub unsafe fn vsriq_n_u64<const N: i32>(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
2639-
assert!(1 <= N && N <= 64, "must have 1 ≤ N ≤ 64, but N = {}", N);
2639+
static_assert!(N: i32 where N >= 1 && N <= 64);
26402640
transmute(vsriq_n_s64_(transmute(a), transmute(b), N))
26412641
}
26422642
/// Shift Right and Insert (immediate)
@@ -2645,7 +2645,7 @@ pub unsafe fn vsriq_n_u64<const N: i32>(a: uint64x2_t, b: uint64x2_t) -> uint64x
26452645
#[cfg_attr(test, assert_instr(sri, n = 1))]
26462646
#[rustc_legacy_const_generics(2)]
26472647
pub unsafe fn vsri_n_p8<const N: i32>(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t {
2648-
assert!(1 <= N && N <= 8, "must have 1 ≤ N ≤ 8, but N = {}", N);
2648+
static_assert!(N: i32 where N >= 1 && N <= 8);
26492649
transmute(vsri_n_s8_(transmute(a), transmute(b), N))
26502650
}
26512651
/// Shift Right and Insert (immediate)
@@ -2654,7 +2654,7 @@ pub unsafe fn vsri_n_p8<const N: i32>(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t {
26542654
#[cfg_attr(test, assert_instr(sri, n = 1))]
26552655
#[rustc_legacy_const_generics(2)]
26562656
pub unsafe fn vsriq_n_p8<const N: i32>(a: poly8x16_t, b: poly8x16_t) -> poly8x16_t {
2657-
assert!(1 <= N && N <= 8, "must have 1 ≤ N ≤ 8, but N = {}", N);
2657+
static_assert!(N: i32 where N >= 1 && N <= 8);
26582658
transmute(vsriq_n_s8_(transmute(a), transmute(b), N))
26592659
}
26602660
/// Shift Right and Insert (immediate)
@@ -2663,7 +2663,7 @@ pub unsafe fn vsriq_n_p8<const N: i32>(a: poly8x16_t, b: poly8x16_t) -> poly8x16
26632663
#[cfg_attr(test, assert_instr(sri, n = 1))]
26642664
#[rustc_legacy_const_generics(2)]
26652665
pub unsafe fn vsri_n_p16<const N: i32>(a: poly16x4_t, b: poly16x4_t) -> poly16x4_t {
2666-
assert!(1 <= N && N <= 16, "must have 1 ≤ N ≤ 16, but N = {}", N);
2666+
static_assert!(N: i32 where N >= 1 && N <= 16);
26672667
transmute(vsri_n_s16_(transmute(a), transmute(b), N))
26682668
}
26692669
/// Shift Right and Insert (immediate)
@@ -2672,7 +2672,7 @@ pub unsafe fn vsri_n_p16<const N: i32>(a: poly16x4_t, b: poly16x4_t) -> poly16x4
26722672
#[cfg_attr(test, assert_instr(sri, n = 1))]
26732673
#[rustc_legacy_const_generics(2)]
26742674
pub unsafe fn vsriq_n_p16<const N: i32>(a: poly16x8_t, b: poly16x8_t) -> poly16x8_t {
2675-
assert!(1 <= N && N <= 16, "must have 1 ≤ N ≤ 16, but N = {}", N);
2675+
static_assert!(N: i32 where N >= 1 && N <= 16);
26762676
transmute(vsriq_n_s16_(transmute(a), transmute(b), N))
26772677
}
26782678

0 commit comments

Comments
 (0)