Skip to content

Commit ebfb95a

Browse files
committed
add a test
1 parent a06f355 commit ebfb95a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// build-pass
2+
// revisions: arm
3+
//[arm] compile-flags: --target arm-unknown-linux-gnueabi
4+
//[arm] needs-llvm-components: arm
5+
// revisions: aarch64
6+
//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
7+
//[aarch64] needs-llvm-components: aarch64
8+
#![feature(
9+
no_core, lang_items, link_llvm_intrinsics,
10+
abi_unadjusted, repr_simd, arm_target_feature,
11+
)]
12+
#![no_std]
13+
#![no_core]
14+
#![crate_type = "lib"]
15+
#![allow(non_camel_case_types)]
16+
17+
/// To work cross-target this test must be no_core.
18+
/// This little prelude supplies what we need.
19+
#[lang = "sized"]
20+
pub trait Sized {}
21+
22+
#[lang = "copy"]
23+
pub trait Copy: Sized {}
24+
impl Copy for i8 {}
25+
impl<T: ?Sized> Copy for *const T {}
26+
impl<T: ?Sized> Copy for *mut T {}
27+
28+
29+
// Regression test for https://github.com/rust-lang/rust/issues/118124.
30+
31+
#[repr(simd)]
32+
pub struct int8x16_t(
33+
pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
34+
pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
35+
pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
36+
pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
37+
);
38+
impl Copy for int8x16_t {}
39+
40+
#[repr(C)]
41+
pub struct int8x16x4_t(pub int8x16_t, pub int8x16_t, pub int8x16_t, pub int8x16_t);
42+
impl Copy for int8x16x4_t {}
43+
44+
#[target_feature(enable = "neon")]
45+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
46+
pub unsafe fn vld1q_s8_x4(a: *const i8) -> int8x16x4_t {
47+
#[allow(improper_ctypes)]
48+
extern "unadjusted" {
49+
#[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vld1x4.v16i8.p0i8")]
50+
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.ld1x4.v16i8.p0i8")]
51+
fn vld1q_s8_x4_(a: *const i8) -> int8x16x4_t;
52+
}
53+
vld1q_s8_x4_(a)
54+
}

0 commit comments

Comments
 (0)