]> git.lizzy.rs Git - rust.git/blob - tests/ui/target-feature/aarch64-neon-works.rs
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
[rust.git] / tests / ui / target-feature / aarch64-neon-works.rs
1 // only-aarch64
2 // run-pass
3 #![allow(dead_code)]
4 use std::arch::*;
5 use std::arch::aarch64::*;
6
7 // Smoke test to verify aarch64 code that enables NEON compiles.
8 fn main() {
9     let _zero = if is_aarch64_feature_detected!("neon") {
10         unsafe {
11             let zeros = zero_vector();
12             vgetq_lane_u8::<1>(zeros)
13         }
14     } else {
15         0
16     };
17 }
18
19
20 #[target_feature(enable = "neon")]
21 unsafe fn zero_vector() -> uint8x16_t {
22     vmovq_n_u8(0)
23 }