|
4 | 4 | // cross-compiled standard libraries. |
5 | 5 | #![feature(no_core, auto_traits)] |
6 | 6 | #![no_core] |
7 | | -#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)] |
| 7 | +#![feature( |
| 8 | + mips_target_feature, |
| 9 | + repr_simd, |
| 10 | + simd_ffi, |
| 11 | + link_llvm_intrinsics, |
| 12 | + lang_items, |
| 13 | + rustc_attrs |
| 14 | +)] |
8 | 15 |
|
9 | 16 | #[derive(Copy)] |
10 | 17 | #[repr(simd)] |
11 | | -pub struct f32x4(f32, f32, f32, f32); |
| 18 | +pub struct F32x4(f32, f32, f32, f32); |
12 | 19 |
|
13 | 20 | extern "C" { |
14 | 21 | #[link_name = "llvm.sqrt.v4f32"] |
15 | | - fn vsqrt(x: f32x4) -> f32x4; |
| 22 | + fn vsqrt(x: F32x4) -> F32x4; |
16 | 23 | } |
17 | 24 |
|
18 | | -pub fn foo(x: f32x4) -> f32x4 { |
| 25 | +pub fn foo(x: F32x4) -> F32x4 { |
19 | 26 | unsafe { vsqrt(x) } |
20 | 27 | } |
21 | 28 |
|
22 | 29 | #[derive(Copy)] |
23 | 30 | #[repr(simd)] |
24 | | -pub struct i32x4(i32, i32, i32, i32); |
| 31 | +pub struct I32x4(i32, i32, i32, i32); |
25 | 32 |
|
26 | 33 | extern "C" { |
27 | 34 | // _mm_sll_epi32 |
28 | | - #[cfg(any(target_arch = "x86", target_arch = "x86-64"))] |
| 35 | + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
29 | 36 | #[link_name = "llvm.x86.sse2.psll.d"] |
30 | | - fn integer(a: i32x4, b: i32x4) -> i32x4; |
| 37 | + fn integer(a: I32x4, b: I32x4) -> I32x4; |
31 | 38 |
|
32 | 39 | // vmaxq_s32 |
33 | 40 | #[cfg(target_arch = "arm")] |
34 | 41 | #[link_name = "llvm.arm.neon.vmaxs.v4i32"] |
35 | | - fn integer(a: i32x4, b: i32x4) -> i32x4; |
| 42 | + fn integer(a: I32x4, b: I32x4) -> I32x4; |
36 | 43 | // vmaxq_s32 |
37 | 44 | #[cfg(target_arch = "aarch64")] |
38 | 45 | #[link_name = "llvm.aarch64.neon.maxs.v4i32"] |
39 | | - fn integer(a: i32x4, b: i32x4) -> i32x4; |
| 46 | + fn integer(a: I32x4, b: I32x4) -> I32x4; |
40 | 47 |
|
41 | 48 | // just some substitute foreign symbol, not an LLVM intrinsic; so |
42 | 49 | // we still get type checking, but not as detailed as (ab)using |
43 | 50 | // LLVM. |
44 | | - #[cfg(not(any( |
45 | | - target_arch = "x86", |
46 | | - target_arch = "x86-64", |
47 | | - target_arch = "arm", |
48 | | - target_arch = "aarch64" |
49 | | - )))] |
50 | | - fn integer(a: i32x4, b: i32x4) -> i32x4; |
| 51 | + #[cfg(target_arch = "mips")] |
| 52 | + #[target_feature(enable = "msa")] |
| 53 | + fn integer(a: I32x4, b: I32x4) -> I32x4; |
51 | 54 | } |
52 | 55 |
|
53 | | -pub fn bar(a: i32x4, b: i32x4) -> i32x4 { |
| 56 | +pub fn bar(a: I32x4, b: I32x4) -> I32x4 { |
54 | 57 | unsafe { integer(a, b) } |
55 | 58 | } |
56 | 59 |
|
|
0 commit comments