Skip to content

Commit c50c9fc

Browse files
committed
correct llvm link and assert_instr
1 parent eda93d1 commit c50c9fc

File tree

4 files changed

+68
-52
lines changed

4 files changed

+68
-52
lines changed

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

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4610,25 +4610,15 @@ pub unsafe fn vreinterpretq_f32_f64(a: float64x2_t) -> float32x4_t {
46104610
#[target_feature(enable = "neon")]
46114611
#[cfg_attr(test, assert_instr(srshl))]
46124612
pub unsafe fn vrshld_s64(a: i64, b: i64) -> i64 {
4613-
#[allow(improper_ctypes)]
4614-
extern "C" {
4615-
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.srshl.i64")]
4616-
fn vrshld_s64_(a: i64, b: i64) -> i64;
4617-
}
4618-
vrshld_s64_(a, b)
4613+
transmute(vrshl_s64(transmute(a), transmute(b)))
46194614
}
46204615

46214616
/// Unsigned rounding shift left
46224617
#[inline]
46234618
#[target_feature(enable = "neon")]
46244619
#[cfg_attr(test, assert_instr(urshl))]
46254620
pub unsafe fn vrshld_u64(a: u64, b: i64) -> u64 {
4626-
#[allow(improper_ctypes)]
4627-
extern "C" {
4628-
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.urshl.i64")]
4629-
fn vrshld_u64_(a: u64, b: i64) -> u64;
4630-
}
4631-
vrshld_u64_(a, b)
4621+
transmute(vrshl_u64(transmute(a), transmute(b)))
46324622
}
46334623

46344624
/// Signed rounding shift right
@@ -4714,7 +4704,7 @@ pub unsafe fn vrshrn_high_n_u64<const N: i32>(a: uint32x2_t, b: uint64x2_t) -> u
47144704
/// Signed rounding shift right and accumulate
47154705
#[inline]
47164706
#[target_feature(enable = "neon")]
4717-
#[cfg_attr(test, assert_instr(srsra, N = 2))]
4707+
#[cfg_attr(test, assert_instr(nop, N = 2))]
47184708
#[rustc_legacy_const_generics(2)]
47194709
pub unsafe fn vrsrad_n_s64<const N: i32>(a: i64, b: i64) -> i64 {
47204710
static_assert!(N : i32 where N >= 1 && N <= 64);
@@ -4725,7 +4715,7 @@ pub unsafe fn vrsrad_n_s64<const N: i32>(a: i64, b: i64) -> i64 {
47254715
/// Ungisned rounding shift right and accumulate
47264716
#[inline]
47274717
#[target_feature(enable = "neon")]
4728-
#[cfg_attr(test, assert_instr(ursra, N = 2))]
4718+
#[cfg_attr(test, assert_instr(nop, N = 2))]
47294719
#[rustc_legacy_const_generics(2)]
47304720
pub unsafe fn vrsrad_n_u64<const N: i32>(a: u64, b: u64) -> u64 {
47314721
static_assert!(N : i32 where N >= 1 && N <= 64);
@@ -4738,25 +4728,15 @@ pub unsafe fn vrsrad_n_u64<const N: i32>(a: u64, b: u64) -> u64 {
47384728
#[target_feature(enable = "neon")]
47394729
#[cfg_attr(test, assert_instr(sshl))]
47404730
pub unsafe fn vshld_s64(a: i64, b: i64) -> i64 {
4741-
#[allow(improper_ctypes)]
4742-
extern "C" {
4743-
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.sshl.i64")]
4744-
fn vshld_s64_(a: i64, b: i64) -> i64;
4745-
}
4746-
vshld_s64_(a, b)
4731+
transmute(vshl_s64(transmute(a), transmute(b)))
47474732
}
47484733

47494734
/// Unsigned Shift left
47504735
#[inline]
47514736
#[target_feature(enable = "neon")]
47524737
#[cfg_attr(test, assert_instr(ushl))]
47534738
pub unsafe fn vshld_u64(a: u64, b: i64) -> u64 {
4754-
#[allow(improper_ctypes)]
4755-
extern "C" {
4756-
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.ushl.i64")]
4757-
fn vshld_u64_(a: u64, b: i64) -> u64;
4758-
}
4759-
vshld_u64_(a, b)
4739+
transmute(vshl_u64(transmute(a), transmute(b)))
47604740
}
47614741

47624742
/// Signed shift left long

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,7 @@ pub unsafe fn vqtbx4q_p8(a: poly8x16_t, t: poly8x16x4_t, idx: uint8x16_t) -> pol
24502450
/// Shift left
24512451
#[inline]
24522452
#[target_feature(enable = "neon")]
2453-
#[cfg_attr(test, assert_instr(shl, N = 2))]
2453+
#[cfg_attr(test, assert_instr(nop, N = 2))]
24542454
#[rustc_legacy_const_generics(1)]
24552455
pub unsafe fn vshld_n_s64<const N: i32>(a: i64) -> i64 {
24562456
static_assert_imm6!(N);
@@ -2460,7 +2460,7 @@ pub unsafe fn vshld_n_s64<const N: i32>(a: i64) -> i64 {
24602460
/// Shift left
24612461
#[inline]
24622462
#[target_feature(enable = "neon")]
2463-
#[cfg_attr(test, assert_instr(shl, N = 2))]
2463+
#[cfg_attr(test, assert_instr(nop, N = 2))]
24642464
#[rustc_legacy_const_generics(1)]
24652465
pub unsafe fn vshld_n_u64<const N: i32>(a: u64) -> u64 {
24662466
static_assert_imm6!(N);
@@ -2470,7 +2470,7 @@ pub unsafe fn vshld_n_u64<const N: i32>(a: u64) -> u64 {
24702470
/// Signed shift right
24712471
#[inline]
24722472
#[target_feature(enable = "neon")]
2473-
#[cfg_attr(test, assert_instr(sshr, N = 2))]
2473+
#[cfg_attr(test, assert_instr(nop, N = 2))]
24742474
#[rustc_legacy_const_generics(1)]
24752475
pub unsafe fn vshrd_n_s64<const N: i32>(a: i64) -> i64 {
24762476
static_assert!(N : i32 where N >= 1 && N <= 64);
@@ -2480,7 +2480,7 @@ pub unsafe fn vshrd_n_s64<const N: i32>(a: i64) -> i64 {
24802480
/// Unsigned shift right
24812481
#[inline]
24822482
#[target_feature(enable = "neon")]
2483-
#[cfg_attr(test, assert_instr(ushr, N = 2))]
2483+
#[cfg_attr(test, assert_instr(nop, N = 2))]
24842484
#[rustc_legacy_const_generics(1)]
24852485
pub unsafe fn vshrd_n_u64<const N: i32>(a: u64) -> u64 {
24862486
static_assert!(N : i32 where N >= 1 && N <= 64);
@@ -2490,7 +2490,7 @@ pub unsafe fn vshrd_n_u64<const N: i32>(a: u64) -> u64 {
24902490
/// Signed shift right and accumulate
24912491
#[inline]
24922492
#[target_feature(enable = "neon")]
2493-
#[cfg_attr(test, assert_instr(ssra, N = 2))]
2493+
#[cfg_attr(test, assert_instr(nop, N = 2))]
24942494
#[rustc_legacy_const_generics(2)]
24952495
pub unsafe fn vsrad_n_s64<const N: i32>(a: i64, b: i64) -> i64 {
24962496
static_assert!(N : i32 where N >= 1 && N <= 64);
@@ -2500,7 +2500,7 @@ pub unsafe fn vsrad_n_s64<const N: i32>(a: i64, b: i64) -> i64 {
25002500
/// Unsigned shift right and accumulate
25012501
#[inline]
25022502
#[target_feature(enable = "neon")]
2503-
#[cfg_attr(test, assert_instr(usra, N = 2))]
2503+
#[cfg_attr(test, assert_instr(nop, N = 2))]
25042504
#[rustc_legacy_const_generics(2)]
25052505
pub unsafe fn vsrad_n_u64<const N: i32>(a: u64, b: u64) -> u64 {
25062506
static_assert!(N : i32 where N >= 1 && N <= 64);

crates/stdarch-gen/neon.spec

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,12 +2717,21 @@ validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
27172717

27182718
aarch64 = srshl
27192719
link-aarch64 = srshl._EXT_
2720-
generate i64
27212720

27222721
arm = vrshl
27232722
link-arm = vrshifts._EXT_
27242723
generate int*_t, int64x*_t
27252724

2725+
/// Signed rounding shift left
2726+
name = vrshl
2727+
multi_fn = transmute, {vrshl-in_ntt-noext, transmute(a), transmute(b)}
2728+
a = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
2729+
b = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
2730+
validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
2731+
2732+
aarch64 = srshl
2733+
generate i64
2734+
27262735
/// Unsigned rounding shift left
27272736
name = vrshl
27282737
out-suffix
@@ -2732,13 +2741,23 @@ validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
27322741

27332742
aarch64 = urshl
27342743
link-aarch64 = urshl._EXT_
2735-
generate u64:i64:u64
27362744

27372745
arm = vrshl
27382746
link-arm = vrshiftu._EXT_
27392747
generate uint8x8_t:int8x8_t:uint8x8_t, uint8x16_t:int8x16_t:uint8x16_t, uint16x4_t:int16x4_t:uint16x4_t, uint16x8_t:int16x8_t:uint16x8_t
27402748
generate uint32x2_t:int32x2_t:uint32x2_t, uint32x4_t:int32x4_t:uint32x4_t, uint64x1_t:int64x1_t:uint64x1_t, uint64x2_t:int64x2_t:uint64x2_t
27412749

2750+
/// Unsigned rounding shift left
2751+
name = vrshl
2752+
out-suffix
2753+
multi_fn = transmute, {vrshl-out_ntt-noext, transmute(a), transmute(b)}
2754+
a = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
2755+
b = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
2756+
validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
2757+
2758+
aarch64 = urshl
2759+
generate u64:i64:u64
2760+
27422761
/// Signed rounding shift right
27432762
name = vrshr
27442763
n-suffix
@@ -2882,7 +2901,7 @@ b = 4
28822901
n = 2
28832902
validate 2
28842903

2885-
aarch64 = srsra
2904+
aarch64 = nop
28862905
generate i64
28872906

28882907
/// Ungisned rounding shift right and accumulate
@@ -2897,7 +2916,7 @@ b = 4
28972916
n = 2
28982917
validate 2
28992918

2900-
aarch64 = ursra
2919+
aarch64 = nop
29012920
generate u64
29022921

29032922
/// Signed Shift left
@@ -2906,30 +2925,47 @@ a = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
29062925
b = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
29072926
validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
29082927

2909-
aarch64 = sshl
2910-
link-aarch64 = sshl._EXT_
2911-
generate i64
2912-
29132928
arm = vshl
29142929
link-arm = vshifts._EXT_
2930+
aarch64 = sshl
2931+
link-aarch64 = sshl._EXT_
29152932
generate int*_t, int64x*_t
29162933

2934+
/// Signed Shift left
2935+
name = vshl
2936+
multi_fn = transmute, {vshl-in_ntt-noext, transmute(a), transmute(b)}
2937+
a = 1
2938+
b = 2
2939+
validate 4
2940+
2941+
aarch64 = sshl
2942+
generate i64
2943+
29172944
/// Unsigned Shift left
29182945
name = vshl
29192946
out-suffix
29202947
a = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
29212948
b = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
29222949
validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
29232950

2924-
aarch64 = ushl
2925-
link-aarch64 = ushl._EXT_
2926-
generate u64:i64:u64
2927-
29282951
arm = vshl
29292952
link-arm = vshiftu._EXT_
2953+
aarch64 = ushl
2954+
link-aarch64 = ushl._EXT_
29302955
generate uint8x8_t:int8x8_t:uint8x8_t, uint8x16_t:int8x16_t:uint8x16_t, uint16x4_t:int16x4_t:uint16x4_t, uint16x8_t:int16x8_t:uint16x8_t
29312956
generate uint32x2_t:int32x2_t:uint32x2_t, uint32x4_t:int32x4_t:uint32x4_t, uint64x1_t:int64x1_t:uint64x1_t, uint64x2_t:int64x2_t:uint64x2_t
29322957

2958+
/// Unsigned Shift left
2959+
out-suffix
2960+
name = vshl
2961+
multi_fn = transmute, {vshl-out_ntt-noext, transmute(a), transmute(b)}
2962+
a = 1
2963+
b = 2
2964+
validate 4
2965+
2966+
aarch64 = ushl
2967+
generate u64:i64:u64
2968+
29332969
/// Shift left
29342970
name = vshl
29352971
n-suffix

crates/stdarch-gen/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,14 +482,14 @@ fn type_to_ext(t: &str) -> &str {
482482
"poly8x16_t" => "v16i8",
483483
"poly16x4_t" => "v4i16",
484484
"poly16x8_t" => "v8i16",
485-
"i8" => "i8",
486-
"i16" => "i16",
487-
"i32" => "i32",
488-
"i64" => "i64",
489-
"u8" => "i8",
490-
"u16" => "i16",
491-
"u32" => "i32",
492-
"u64" => "i64",
485+
"i8" => "v8i8",
486+
"i16" => "v4i16",
487+
"i32" => "v2i32",
488+
"i64" => "v1i64",
489+
"u8" => "v8i8",
490+
"u16" => "v4i16",
491+
"u32" => "v2i32",
492+
"u64" => "v1i64",
493493
/*
494494
"poly64x1_t" => "i64x1",
495495
"poly64x2_t" => "i64x2",

0 commit comments

Comments
 (0)