diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-02-21 13:07:24 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-02-21 13:42:01 +0000 |
| commit | d0dc36eccca3f058956702f2281110119bbbfd5c (patch) | |
| tree | 7235c11f50125c91be251d57a1d87c8135dbf729 /src/tools | |
| parent | eb4720dc8e09476d99a846b5e9f78137038e62aa (diff) | |
| download | rust-d0dc36eccca3f058956702f2281110119bbbfd5c.tar.gz rust-d0dc36eccca3f058956702f2281110119bbbfd5c.zip | |
Add tests
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/miri/tests/pass/shims/aarch64/intrinsics-aarch64-neon.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass/shims/aarch64/intrinsics-aarch64-neon.rs b/src/tools/miri/tests/pass/shims/aarch64/intrinsics-aarch64-neon.rs new file mode 100644 index 00000000000..84485dbad8c --- /dev/null +++ b/src/tools/miri/tests/pass/shims/aarch64/intrinsics-aarch64-neon.rs @@ -0,0 +1,40 @@ +// We're testing aarch64 target specific features +//@only-target: aarch64 +//@compile-flags: -C target-feature=+neon + +use std::arch::aarch64::*; +use std::arch::is_aarch64_feature_detected; + +fn main() { + assert!(is_aarch64_feature_detected!("neon")); + + unsafe { + test_neon(); + } +} + +#[target_feature(enable = "neon")] +unsafe fn test_neon() { + // Adapted from library/stdarch/crates/core_arch/src/aarch64/neon/mod.rs + unsafe fn test_vpmaxq_u8() { + let a = vld1q_u8([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8].as_ptr()); + let b = vld1q_u8([0, 3, 2, 5, 4, 7, 6, 9, 0, 3, 2, 5, 4, 7, 6, 9].as_ptr()); + let e = [2, 4, 6, 8, 2, 4, 6, 8, 3, 5, 7, 9, 3, 5, 7, 9]; + let mut r = [0; 16]; + vst1q_u8(r.as_mut_ptr(), vpmaxq_u8(a, b)); + assert_eq!(r, e); + } + test_vpmaxq_u8(); + + unsafe fn test_vpmaxq_u8_is_unsigned() { + let a = vld1q_u8( + [255, 0, 253, 252, 251, 250, 249, 248, 255, 254, 253, 252, 251, 250, 249, 248].as_ptr(), + ); + let b = vld1q_u8([254, 3, 2, 5, 4, 7, 6, 9, 0, 3, 2, 5, 4, 7, 6, 9].as_ptr()); + let e = [255, 253, 251, 249, 255, 253, 251, 249, 254, 5, 7, 9, 3, 5, 7, 9]; + let mut r = [0; 16]; + vst1q_u8(r.as_mut_ptr(), vpmaxq_u8(a, b)); + assert_eq!(r, e); + } + test_vpmaxq_u8_is_unsigned(); +} |
