1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ensures that public symbols are not removed completely
12 #![crate_type = "lib"]
13 // we can compile to a variety of platforms, because we don't need
14 // cross-compiled standard libraries.
15 #![feature(no_core, optin_builtin_traits)]
18 #![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items)]
24 pub struct f32x4(f32, f32, f32, f32);
28 #[link_name = "llvm.sqrt.v4f32"]
29 fn vsqrt(x: f32x4) -> f32x4;
32 pub fn foo(x: f32x4) -> f32x4 {
39 pub struct i32x4(i32, i32, i32, i32);
44 #[cfg(any(target_arch = "x86",
45 target_arch = "x86-64"))]
46 #[link_name = "llvm.x86.sse2.psll.d"]
47 fn integer(a: i32x4, b: i32x4) -> i32x4;
50 #[cfg(target_arch = "arm")]
51 #[link_name = "llvm.arm.neon.vmaxs.v4i32"]
52 fn integer(a: i32x4, b: i32x4) -> i32x4;
54 #[cfg(target_arch = "aarch64")]
55 #[link_name = "llvm.aarch64.neon.maxs.v4i32"]
56 fn integer(a: i32x4, b: i32x4) -> i32x4;
58 // just some substitute foreign symbol, not an LLVM intrinsic; so
59 // we still get type checking, but not as detailed as (ab)using
61 #[cfg(not(any(target_arch = "x86",
62 target_arch = "x86-64",
64 target_arch = "aarch64")))]
65 fn integer(a: i32x4, b: i32x4) -> i32x4;
68 pub fn bar(a: i32x4, b: i32x4) -> i32x4 {
69 unsafe {integer(a, b)}