]> git.proxmox.com Git - rustc.git/blame - vendor/packed_simd/src/codegen/math/float/cos.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / vendor / packed_simd / src / codegen / math / float / cos.rs
CommitLineData
f20569fa
XL
1//! Vertical floating-point `cos`
2#![allow(unused)]
3
4// FIXME 64-bit 1 elem vector cos
5
6use crate::*;
7
8crate trait Cos {
9 fn cos(self) -> Self;
10}
11
12#[allow(improper_ctypes)]
13extern "C" {
14 #[link_name = "llvm.cos.v2f32"]
15 fn cos_v2f32(x: f32x2) -> f32x2;
16 #[link_name = "llvm.cos.v4f32"]
17 fn cos_v4f32(x: f32x4) -> f32x4;
18 #[link_name = "llvm.cos.v8f32"]
19 fn cos_v8f32(x: f32x8) -> f32x8;
20 #[link_name = "llvm.cos.v16f32"]
21 fn cos_v16f32(x: f32x16) -> f32x16;
22 /* FIXME 64-bit cosgle elem vectors
23 #[link_name = "llvm.cos.v1f64"]
24 fn cos_v1f64(x: f64x1) -> f64x1;
25 */
26 #[link_name = "llvm.cos.v2f64"]
27 fn cos_v2f64(x: f64x2) -> f64x2;
28 #[link_name = "llvm.cos.v4f64"]
29 fn cos_v4f64(x: f64x4) -> f64x4;
30 #[link_name = "llvm.cos.v8f64"]
31 fn cos_v8f64(x: f64x8) -> f64x8;
32
33 #[link_name = "llvm.cos.f32"]
34 fn cos_f32(x: f32) -> f32;
35 #[link_name = "llvm.cos.f64"]
36 fn cos_f64(x: f64) -> f64;
37}
38
39gen_unary_impl_table!(Cos, cos);
40
41cfg_if! {
42 if #[cfg(target_arch = "s390x")] {
43 // FIXME: https://github.com/rust-lang-nursery/packed_simd/issues/14
44 impl_unary!(f32x2[f32; 2]: cos_f32);
45 impl_unary!(f32x4[f32; 4]: cos_f32);
46 impl_unary!(f32x8[f32; 8]: cos_f32);
47 impl_unary!(f32x16[f32; 16]: cos_f32);
48
49 impl_unary!(f64x2[f64; 2]: cos_f64);
50 impl_unary!(f64x4[f64; 4]: cos_f64);
51 impl_unary!(f64x8[f64; 8]: cos_f64);
52 } else if #[cfg(all(target_arch = "x86_64", feature = "sleef-sys"))] {
53 use sleef_sys::*;
54 cfg_if! {
55 if #[cfg(target_feature = "avx2")] {
56 impl_unary!(f32x2[t => f32x4]: Sleef_cosf4_u10avx2128);
57 impl_unary!(f32x16[h => f32x8]: Sleef_cosf8_u10avx2);
58 impl_unary!(f64x8[h => f64x4]: Sleef_cosd4_u10avx2);
59
60 impl_unary!(f32x4: Sleef_cosf4_u10avx2128);
61 impl_unary!(f32x8: Sleef_cosf8_u10avx2);
62 impl_unary!(f64x2: Sleef_cosd2_u10avx2128);
63 impl_unary!(f64x4: Sleef_cosd4_u10avx2);
64 } else if #[cfg(target_feature = "avx")] {
65 impl_unary!(f32x2[t => f32x4]: Sleef_cosf4_u10sse4);
66 impl_unary!(f32x16[h => f32x8]: Sleef_cosf8_u10avx);
67 impl_unary!(f64x8[h => f64x4]: Sleef_cosd4_u10avx);
68
69 impl_unary!(f32x4: Sleef_cosf4_u10sse4);
70 impl_unary!(f32x8: Sleef_cosf8_u10avx);
71 impl_unary!(f64x2: Sleef_cosd2_u10sse4);
72 impl_unary!(f64x4: Sleef_cosd4_u10avx);
73 } else if #[cfg(target_feature = "sse4.2")] {
74 impl_unary!(f32x2[t => f32x4]: Sleef_cosf4_u10sse4);
75 impl_unary!(f32x16[q => f32x4]: Sleef_cosf4_u10sse4);
76 impl_unary!(f64x8[q => f64x2]: Sleef_cosd2_u10sse4);
77
78 impl_unary!(f32x4: Sleef_cosf4_u10sse4);
79 impl_unary!(f32x8[h => f32x4]: Sleef_cosf4_u10sse4);
80 impl_unary!(f64x2: Sleef_cosd2_u10sse4);
81 impl_unary!(f64x4[h => f64x2]: Sleef_cosd2_u10sse4);
82 } else {
83 impl_unary!(f32x2[f32; 2]: cos_f32);
84 impl_unary!(f32x16: cos_v16f32);
85 impl_unary!(f64x8: cos_v8f64);
86
87 impl_unary!(f32x4: cos_v4f32);
88 impl_unary!(f32x8: cos_v8f32);
89 impl_unary!(f64x2: cos_v2f64);
90 impl_unary!(f64x4: cos_v4f64);
91 }
92 }
93 } else {
94 impl_unary!(f32x2[f32; 2]: cos_f32);
95 impl_unary!(f32x4: cos_v4f32);
96 impl_unary!(f32x8: cos_v8f32);
97 impl_unary!(f32x16: cos_v16f32);
98
99 impl_unary!(f64x2: cos_v2f64);
100 impl_unary!(f64x4: cos_v4f64);
101 impl_unary!(f64x8: cos_v8f64);
102 }
103}