|
| 1 | +//@ only-aarch64 |
| 2 | +//@ build-pass |
| 3 | +//@ compile-flags: --emit=obj -Ctarget-feature=+sve |
| 4 | +//@ edition:2021 |
| 5 | +#![feature(simd_ffi)] |
| 6 | +#![feature(stdarch_aarch64_sve)] |
| 7 | + |
| 8 | +use std::arch::aarch64::*; |
| 9 | + |
| 10 | +// Tests that scalable vectors in transparent wrapper types compile correctly (that is, that |
| 11 | +// alloca we generate in LLVM IR are for scalable vector types and not arrays, because rustc |
| 12 | +// looks through the transparent wrapper). |
| 13 | + |
| 14 | +static I16_147: [i16; 147] = [ |
| 15 | + 0x0, 0x400, 0x37ff, 0x3800, 0x3801, 0x3bff, 0x3c00, 0x3c01, 0x3e00, 0x4900, 0x7bff, 0x7c00, |
| 16 | + 0x7f23, 0x7e00, 0x7d23, 0x7c01, 0x12, 0x3ff, 0x1, -0x8000, -0x7c00, -0x4801, -0x4800, -0x47ff, |
| 17 | + -0x4401, -0x4400, -0x43ff, -0x4200, -0x3700, -0x401, -0x400, -0xdd, -0x200, -0x2dd, -0x3ff, |
| 18 | + -0x7fee, -0x7c01, -0x7fff, -0x400, -0x4000, 0x5140, 0x5800, 0x63d2, 0x5630, 0x3560, -0x6e6f, |
| 19 | + 0x4178, 0x6212, 0x67d0, 0x3312, 0x4cef, 0x4973, 0x3ecc, 0x5166, 0x4d80, 0x6248, 0x46fd, 0x39c4, |
| 20 | + 0x39c5, 0x4866, 0x6050, 0x498e, 0x4a0f, 0x3555, -0x400, -0x4000, -0x6e6f, 0x5140, 0x5800, |
| 21 | + -0x7fff, -0x7c01, 0x63d2, 0x5630, 0x3560, 0x4178, 0x7d23, 0x7c01, 0x12, -0x4800, 0x3ff, 0x1, |
| 22 | + 0x7e00, 0x7f23, -0x8000, -0x7c00, -0x4801, -0x47ff, 0x3312, 0x4cef, 0x4973, 0x39c4, 0x3ecc, |
| 23 | + 0x5166, 0x67d0, 0x6212, 0x4d80, 0x6248, 0x46fd, 0x39c5, -0x43ff, -0x4200, -0x3700, -0x3ff, |
| 24 | + -0x401, -0x400, -0x4400, -0x4401, -0xdd, -0x200, -0x2dd, -0x7fee, 0x37ff, 0x3800, 0x3801, |
| 25 | + 0x7bff, 0x3bff, 0x3c00, 0x400, 0x0, 0x3c01, 0x3e00, 0x4900, 0x7c00, 0x498e, 0x4a0f, 0x6050, |
| 26 | + 0x4866, 0x3555, 0x0, 0x400, 0x37ff, 0x3800, 0x3801, 0x3bff, 0x3c00, 0x3c01, 0x3e00, 0x4900, |
| 27 | + 0x7bff, 0x7c00, 0x7f23, 0x7e00, 0x7d23, 0x7c01, 0x12, 0x3ff, 0x1, |
| 28 | +]; |
| 29 | + |
| 30 | +#[allow(improper_ctypes)] |
| 31 | +unsafe extern "C" { |
| 32 | + fn svcreate2_s16_wrapper(__dst: *mut svint16x2_t, x0: *const svint16_t, x1: *const svint16_t); |
| 33 | +} |
| 34 | + |
| 35 | +fn main() { |
| 36 | + unsafe { |
| 37 | + let __pred = svptrue_b16(); |
| 38 | + let x0_val = svld1_s16(__pred, I16_147.as_ptr().add(0) as _); |
| 39 | + |
| 40 | + let mut __c_return_value = std::mem::MaybeUninit::uninit(); |
| 41 | + svcreate2_s16_wrapper(__c_return_value.as_mut_ptr(), &raw const x0_val, &raw const x0_val); |
| 42 | + let __c_return_value = __c_return_value.assume_init(); |
| 43 | + |
| 44 | + let eq = svcmpeq_s16( |
| 45 | + __pred, |
| 46 | + svget2_s16::<0>(__c_return_value), |
| 47 | + svget2_s16::<0>(__c_return_value), |
| 48 | + ); |
| 49 | + } |
| 50 | +} |
0 commit comments