]> git.proxmox.com Git - rustc.git/blame - vendor/packed_simd/src/codegen/math/float/cos_pi.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / vendor / packed_simd / src / codegen / math / float / cos_pi.rs
CommitLineData
f20569fa
XL
1//! Vertical floating-point `cos`
2#![allow(unused)]
3
4// FIXME 64-bit 1 elem vectors cos_pi
5
6use crate::*;
7
8crate trait CosPi {
9 fn cos_pi(self) -> Self;
10}
11
12gen_unary_impl_table!(CosPi, cos_pi);
13
14macro_rules! impl_def {
15 ($vid:ident, $PI:path) => {
16 impl CosPi for $vid {
17 #[inline]
18 fn cos_pi(self) -> Self {
19 (self * Self::splat($PI)).cos()
20 }
21 }
22 };
23}
24macro_rules! impl_def32 {
25 ($vid:ident) => {
26 impl_def!($vid, crate::f32::consts::PI);
27 };
28}
29macro_rules! impl_def64 {
30 ($vid:ident) => {
31 impl_def!($vid, crate::f64::consts::PI);
32 };
33}
34
35cfg_if! {
36 if #[cfg(all(target_arch = "x86_64", feature = "sleef-sys"))] {
37 use sleef_sys::*;
38 cfg_if! {
39 if #[cfg(target_feature = "avx2")] {
40 impl_unary!(f32x2[t => f32x4]: Sleef_cospif4_u05avx2128);
41 impl_unary!(f32x16[h => f32x8]: Sleef_cospif8_u05avx2);
42 impl_unary!(f64x8[h => f64x4]: Sleef_cospid4_u05avx2);
43
44 impl_unary!(f32x4: Sleef_cospif4_u05avx2128);
45 impl_unary!(f32x8: Sleef_cospif8_u05avx2);
46 impl_unary!(f64x2: Sleef_cospid2_u05avx2128);
47 impl_unary!(f64x4: Sleef_cospid4_u05avx2);
48 } else if #[cfg(target_feature = "avx")] {
49 impl_unary!(f32x2[t => f32x4]: Sleef_cospif4_u05sse4);
50 impl_unary!(f32x16[h => f32x8]: Sleef_cospif8_u05avx);
51 impl_unary!(f64x8[h => f64x4]: Sleef_cospid4_u05avx);
52
53 impl_unary!(f32x4: Sleef_cospif4_u05sse4);
54 impl_unary!(f32x8: Sleef_cospif8_u05avx);
55 impl_unary!(f64x2: Sleef_cospid2_u05sse4);
56 impl_unary!(f64x4: Sleef_cospid4_u05avx);
57 } else if #[cfg(target_feature = "sse4.2")] {
58 impl_unary!(f32x2[t => f32x4]: Sleef_cospif4_u05sse4);
59 impl_unary!(f32x16[q => f32x4]: Sleef_cospif4_u05sse4);
60 impl_unary!(f64x8[q => f64x2]: Sleef_cospid2_u05sse4);
61
62 impl_unary!(f32x4: Sleef_cospif4_u05sse4);
63 impl_unary!(f32x8[h => f32x4]: Sleef_cospif4_u05sse4);
64 impl_unary!(f64x2: Sleef_cospid2_u05sse4);
65 impl_unary!(f64x4[h => f64x2]: Sleef_cospid2_u05sse4);
66 } else {
67 impl_def32!(f32x2);
68 impl_def32!(f32x4);
69 impl_def32!(f32x8);
70 impl_def32!(f32x16);
71
72 impl_def64!(f64x2);
73 impl_def64!(f64x4);
74 impl_def64!(f64x8);
75 }
76 }
77 } else {
78 impl_def32!(f32x2);
79 impl_def32!(f32x4);
80 impl_def32!(f32x8);
81 impl_def32!(f32x16);
82
83 impl_def64!(f64x2);
84 impl_def64!(f64x4);
85 impl_def64!(f64x8);
86 }
87}