Skip to content

Commit 8695dd5

Browse files
committed
Avoid calling non-#[inline(always)] functions from intrinsics.
This avoids the need to force-enable the +neon feature on ARM.
1 parent 2701ae6 commit 8695dd5

File tree

7 files changed

+606
-608
lines changed

7 files changed

+606
-608
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ jobs:
116116
os: ubuntu-latest
117117
- target: armv7-unknown-linux-gnueabihf
118118
os: ubuntu-latest
119-
rustflags: -C target-feature=+neon
120119
- target: mips-unknown-linux-gnu
121120
os: ubuntu-latest
122121
norun: true

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

Lines changed: 113 additions & 113 deletions
Large diffs are not rendered by default.

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

Lines changed: 472 additions & 472 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ mod generated;
66
pub use self::generated::*;
77

88
use crate::{
9-
convert::TryInto, core_arch::simd::*, core_arch::simd_llvm::*, hint::unreachable_unchecked,
10-
mem::transmute,
9+
core_arch::simd::*, core_arch::simd_llvm::*, hint::unreachable_unchecked, mem::transmute,
1110
};
1211
#[cfg(test)]
1312
use stdarch_test::assert_instr;

crates/core_arch/src/simd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ macro_rules! simd_ty {
1010

1111
#[allow(clippy::use_self)]
1212
impl $id {
13-
#[inline]
13+
#[inline(always)]
1414
pub(crate) const fn new($($elem_name: $elem_ty),*) -> Self {
1515
$id($($elem_name),*)
1616
}
@@ -43,12 +43,12 @@ macro_rules! simd_m_ty {
4343

4444
#[allow(clippy::use_self)]
4545
impl $id {
46-
#[inline]
46+
#[inline(always)]
4747
const fn bool_to_internal(x: bool) -> $ety {
4848
[0 as $ety, !(0 as $ety)][x as usize]
4949
}
5050

51-
#[inline]
51+
#[inline(always)]
5252
pub(crate) const fn new($($elem_name: bool),*) -> Self {
5353
$id($(Self::bool_to_internal($elem_name)),*)
5454
}

crates/stdarch-gen/neon.spec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5894,7 +5894,7 @@ name = vqshl
58945894
n-suffix
58955895
constn = N
58965896
multi_fn = static_assert_imm-out_bits_exp_len-N
5897-
multi_fn = vqshl-self-noext, a, {vdup-nself-noext, N.try_into().unwrap()}
5897+
multi_fn = vqshl-self-noext, a, {vdup-nself-noext, N as _}
58985898
a = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
58995899
n = 2
59005900
validate 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60
@@ -5921,7 +5921,7 @@ name = vqshl
59215921
n-suffix
59225922
constn = N
59235923
multi_fn = static_assert_imm-out_bits_exp_len-N
5924-
multi_fn = vqshl-self-noext, a, {vdup-nsigned-noext, N.try_into().unwrap()}
5924+
multi_fn = vqshl-self-noext, a, {vdup-nsigned-noext, N as _}
59255925
a = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
59265926
n = 2
59275927
validate 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60
@@ -6480,7 +6480,7 @@ name = vrshr
64806480
n-suffix
64816481
constn = N
64826482
multi_fn = static_assert-N-1-bits
6483-
multi_fn = vrshl-self-noext, a, {vdup-nself-noext, (-N).try_into().unwrap()}
6483+
multi_fn = vrshl-self-noext, a, {vdup-nself-noext, (-N) as _}
64846484
a = 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
64856485
n = 2
64866486
validate 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
@@ -6507,7 +6507,7 @@ name = vrshr
65076507
n-suffix
65086508
constn = N
65096509
multi_fn = static_assert-N-1-bits
6510-
multi_fn = vrshl-self-noext, a, {vdup-nsigned-noext, (-N).try_into().unwrap()}
6510+
multi_fn = vrshl-self-noext, a, {vdup-nsigned-noext, (-N) as _}
65116511
a = 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
65126512
n = 2
65136513
validate 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
@@ -6804,7 +6804,7 @@ name = vshl
68046804
n-suffix
68056805
constn = N
68066806
multi_fn = static_assert_imm-out_bits_exp_len-N
6807-
multi_fn = simd_shl, a, {vdup-nself-noext, N.try_into().unwrap()}
6807+
multi_fn = simd_shl, a, {vdup-nself-noext, N as _}
68086808
a = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
68096809
n = 2
68106810
validate 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
@@ -6818,7 +6818,7 @@ name = vshll
68186818
n-suffix
68196819
constn = N
68206820
multi_fn = static_assert-N-0-bits
6821-
multi_fn = simd_shl, {simd_cast, a}, {vdup-nout-noext, N.try_into().unwrap()}
6821+
multi_fn = simd_shl, {simd_cast, a}, {vdup-nout-noext, N as _}
68226822
a = 1, 2, 3, 4, 5, 6, 7, 8
68236823
n = 2
68246824
validate 4, 8, 12, 16, 20, 24, 28, 32
@@ -6851,7 +6851,7 @@ n-suffix
68516851
constn = N
68526852
multi_fn = static_assert-N-1-bits
68536853
multi_fn = fix_right_shift_imm-N-bits
6854-
multi_fn = simd_shr, a, {vdup-nself-noext, n.try_into().unwrap()}
6854+
multi_fn = simd_shr, a, {vdup-nself-noext, n as _}
68556855
a = 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
68566856
n = 2
68576857
validate 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
@@ -6867,7 +6867,7 @@ name = vshrn_n
68676867
no-q
68686868
constn = N
68696869
multi_fn = static_assert-N-1-halfbits
6870-
multi_fn = simd_cast, {simd_shr, a, {vdup-nself-noext, N.try_into().unwrap()}}
6870+
multi_fn = simd_cast, {simd_shr, a, {vdup-nself-noext, N as _}}
68716871
a = 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64
68726872
n = 2
68736873
validate 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16

crates/stdarch-gen/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ fn gen_aarch64(
13041304
};
13051305
format!(
13061306
r#"{}
1307-
{}{}({}, {} as i64, a.cast())"#,
1307+
{}{}({}, {} as i64, a as _)"#,
13081308
multi_calls,
13091309
ext_c,
13101310
current_fn,
@@ -1327,7 +1327,7 @@ fn gen_aarch64(
13271327
}
13281328
}
13291329
} else if link_aarch64.is_some() && matches!(fn_type, Fntype::Store) {
1330-
let cast = if is_vstx(&name) { ".cast()" } else { "" };
1330+
let cast = if is_vstx(&name) { " as _" } else { "" };
13311331
match type_sub_len(in_t[1]) {
13321332
1 => format!(r#"{}{}(b, a{})"#, ext_c, current_fn, cast),
13331333
2 => format!(r#"{}{}(b.0, b.1, a{})"#, ext_c, current_fn, cast),
@@ -1336,7 +1336,7 @@ fn gen_aarch64(
13361336
_ => panic!("unsupported type: {}", in_t[1]),
13371337
}
13381338
} else if link_aarch64.is_some() && is_vldx(&name) {
1339-
format!(r#"{}{}(a.cast())"#, ext_c, current_fn,)
1339+
format!(r#"{}{}(a as _)"#, ext_c, current_fn,)
13401340
} else {
13411341
let trans: [&str; 2] = if link_t[3] != out_t {
13421342
["transmute(", ")"]
@@ -1553,7 +1553,7 @@ fn gen_store_test(
15531553
let a: [{}; {}] = {};
15541554
let e: [{}; {}] = {};
15551555
let mut r: [{}; {}] = [0{}; {}];
1556-
{}{}(r.as_mut_ptr(), core::ptr::read_unaligned(a[1..].as_ptr().cast()));
1556+
{}{}(r.as_mut_ptr(), core::ptr::read_unaligned(a[1..].as_ptr() as _));
15571557
assert_eq!(r, e);
15581558
"#,
15591559
type_to_native_type(in_t[1]),
@@ -2196,7 +2196,7 @@ fn gen_arm(
21962196
_ => "",
21972197
};
21982198
format!(
2199-
"{}(a.cast(), {}, {}, {})",
2199+
"{}(a as _, {}, {}, {})",
22002200
current_fn,
22012201
subs,
22022202
constn.as_deref().unwrap(),
@@ -2235,7 +2235,7 @@ fn gen_arm(
22352235
} else if matches!(fn_type, Fntype::Store) {
22362236
let (cast, size) = if is_vstx(&name) {
22372237
(
2238-
".cast()",
2238+
" as _",
22392239
format!(", {}", type_bits(&type_to_sub_type(in_t[1])) / 8),
22402240
)
22412241
} else {
@@ -2276,7 +2276,7 @@ fn gen_arm(
22762276
_ => "",
22772277
};
22782278
format!(
2279-
"{}({}, {} as i64, a.cast())",
2279+
"{}({}, {} as i64, a as _)",
22802280
current_fn,
22812281
subs,
22822282
constn.as_deref().unwrap()
@@ -2307,7 +2307,7 @@ fn gen_arm(
23072307
_ => String::new(),
23082308
}
23092309
} else if matches!(fn_type, Fntype::Store) {
2310-
let cast = if is_vstx(&name) { ".cast()" } else { "" };
2310+
let cast = if is_vstx(&name) { " as _" } else { "" };
23112311
match type_sub_len(in_t[1]) {
23122312
1 => format!("{}(b, a{})", current_fn, cast),
23132313
2 => format!("{}(b.0, b.1, a{})", current_fn, cast),
@@ -2316,7 +2316,7 @@ fn gen_arm(
23162316
_ => String::new(),
23172317
}
23182318
} else if link_aarch64.is_some() && is_vldx(&name) {
2319-
format!("{}(a.cast())", current_fn)
2319+
format!("{}(a as _)", current_fn)
23202320
} else {
23212321
String::new()
23222322
};

0 commit comments

Comments
 (0)