|
1 | 1 | use crate::core_arch::arm_shared::neon::*;
|
2 | 2 |
|
| 3 | +#[cfg(test)] |
| 4 | +use stdarch_test::assert_instr; |
| 5 | + |
3 | 6 | #[allow(improper_ctypes)]
|
4 | 7 | unsafe extern "unadjusted" {
|
5 | 8 | #[link_name = "llvm.arm.neon.vbsl.v8i8"]
|
6 | 9 | fn vbsl_s8_(a: int8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t;
|
7 | 10 | #[link_name = "llvm.arm.neon.vbsl.v16i8"]
|
8 | 11 | fn vbslq_s8_(a: int8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t;
|
9 | 12 | }
|
| 13 | + |
| 14 | +#[doc = "Shift Left and Insert (immediate)"] |
| 15 | +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsli_n_p64)"] |
| 16 | +#[doc = "## Safety"] |
| 17 | +#[doc = " * Neon instrinsic unsafe"] |
| 18 | +#[inline] |
| 19 | +#[cfg(target_arch = "arm")] |
| 20 | +#[target_feature(enable = "neon,v7,aes")] |
| 21 | +#[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] |
| 22 | +#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vsli.64", N = 1))] |
| 23 | +#[rustc_legacy_const_generics(2)] |
| 24 | +pub unsafe fn vsli_n_p64<const N: i32>(a: poly64x1_t, b: poly64x1_t) -> poly64x1_t { |
| 25 | + static_assert!(0 <= N && N <= 63); |
| 26 | + transmute(vshiftins_v1i64( |
| 27 | + transmute(a), |
| 28 | + transmute(b), |
| 29 | + int64x1_t::splat(N as i64), |
| 30 | + )) |
| 31 | +} |
| 32 | + |
| 33 | +#[doc = "Shift Left and Insert (immediate)"] |
| 34 | +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsliq_n_p64)"] |
| 35 | +#[doc = "## Safety"] |
| 36 | +#[doc = " * Neon instrinsic unsafe"] |
| 37 | +#[inline] |
| 38 | +#[cfg(target_endian = "little")] |
| 39 | +#[cfg(target_arch = "arm")] |
| 40 | +#[target_feature(enable = "neon,v7,aes")] |
| 41 | +#[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] |
| 42 | +#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vsli.64", N = 1))] |
| 43 | +#[rustc_legacy_const_generics(2)] |
| 44 | +pub unsafe fn vsliq_n_p64<const N: i32>(a: poly64x2_t, b: poly64x2_t) -> poly64x2_t { |
| 45 | + static_assert!(0 <= N && N <= 63); |
| 46 | + transmute(vshiftins_v2i64( |
| 47 | + transmute(a), |
| 48 | + transmute(b), |
| 49 | + int64x2_t::splat(N as i64), |
| 50 | + )) |
| 51 | +} |
| 52 | + |
| 53 | +#[doc = "Shift Left and Insert (immediate)"] |
| 54 | +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsliq_n_p64)"] |
| 55 | +#[doc = "## Safety"] |
| 56 | +#[doc = " * Neon instrinsic unsafe"] |
| 57 | +#[inline] |
| 58 | +#[cfg(target_endian = "big")] |
| 59 | +#[cfg(target_arch = "arm")] |
| 60 | +#[target_feature(enable = "neon,v7,aes")] |
| 61 | +#[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] |
| 62 | +#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vsli.64", N = 1))] |
| 63 | +#[rustc_legacy_const_generics(2)] |
| 64 | +pub unsafe fn vsliq_n_p64<const N: i32>(a: poly64x2_t, b: poly64x2_t) -> poly64x2_t { |
| 65 | + static_assert!(0 <= N && N <= 63); |
| 66 | + let a: poly64x2_t = simd_shuffle!(a, a, [0, 1]); |
| 67 | + let b: poly64x2_t = simd_shuffle!(b, b, [0, 1]); |
| 68 | + let ret_val: poly64x2_t = transmute(vshiftins_v2i64( |
| 69 | + transmute(a), |
| 70 | + transmute(b), |
| 71 | + int64x2_t::splat(N as i64), |
| 72 | + )); |
| 73 | + simd_shuffle!(ret_val, ret_val, [0, 1]) |
| 74 | +} |
| 75 | + |
| 76 | +#[doc = "Shift Right and Insert (immediate)"] |
| 77 | +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsri_n_p64)"] |
| 78 | +#[doc = "## Safety"] |
| 79 | +#[doc = " * Neon instrinsic unsafe"] |
| 80 | +#[inline] |
| 81 | +#[cfg(target_arch = "arm")] |
| 82 | +#[target_feature(enable = "neon,v7,aes")] |
| 83 | +#[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] |
| 84 | +#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vsri.64", N = 1))] |
| 85 | +#[rustc_legacy_const_generics(2)] |
| 86 | +pub unsafe fn vsri_n_p64<const N: i32>(a: poly64x1_t, b: poly64x1_t) -> poly64x1_t { |
| 87 | + static_assert!(1 <= N && N <= 64); |
| 88 | + transmute(vshiftins_v1i64( |
| 89 | + transmute(a), |
| 90 | + transmute(b), |
| 91 | + int64x1_t::splat(-N as i64), |
| 92 | + )) |
| 93 | +} |
| 94 | + |
| 95 | +#[doc = "Shift Right and Insert (immediate)"] |
| 96 | +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsriq_n_p64)"] |
| 97 | +#[doc = "## Safety"] |
| 98 | +#[doc = " * Neon instrinsic unsafe"] |
| 99 | +#[inline] |
| 100 | +#[cfg(target_endian = "little")] |
| 101 | +#[cfg(target_arch = "arm")] |
| 102 | +#[target_feature(enable = "neon,v7,aes")] |
| 103 | +#[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] |
| 104 | +#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vsri.64", N = 1))] |
| 105 | +#[rustc_legacy_const_generics(2)] |
| 106 | +pub unsafe fn vsriq_n_p64<const N: i32>(a: poly64x2_t, b: poly64x2_t) -> poly64x2_t { |
| 107 | + static_assert!(1 <= N && N <= 64); |
| 108 | + transmute(vshiftins_v2i64( |
| 109 | + transmute(a), |
| 110 | + transmute(b), |
| 111 | + int64x2_t::splat(-N as i64), |
| 112 | + )) |
| 113 | +} |
| 114 | + |
| 115 | +#[doc = "Shift Right and Insert (immediate)"] |
| 116 | +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsriq_n_p64)"] |
| 117 | +#[doc = "## Safety"] |
| 118 | +#[doc = " * Neon instrinsic unsafe"] |
| 119 | +#[inline] |
| 120 | +#[cfg(target_endian = "big")] |
| 121 | +#[cfg(target_arch = "arm")] |
| 122 | +#[target_feature(enable = "neon,v7,aes")] |
| 123 | +#[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] |
| 124 | +#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vsri.64", N = 1))] |
| 125 | +#[rustc_legacy_const_generics(2)] |
| 126 | +pub unsafe fn vsriq_n_p64<const N: i32>(a: poly64x2_t, b: poly64x2_t) -> poly64x2_t { |
| 127 | + static_assert!(1 <= N && N <= 64); |
| 128 | + let a: poly64x2_t = simd_shuffle!(a, a, [0, 1]); |
| 129 | + let b: poly64x2_t = simd_shuffle!(b, b, [0, 1]); |
| 130 | + let ret_val: poly64x2_t = transmute(vshiftins_v2i64( |
| 131 | + transmute(a), |
| 132 | + transmute(b), |
| 133 | + int64x2_t::splat(-N as i64), |
| 134 | + )); |
| 135 | + simd_shuffle!(ret_val, ret_val, [0, 1]) |
| 136 | +} |
0 commit comments