1
1
#![ allow( non_snake_case) ]
2
+ #![ doc( "This code is automatically generated, do not edit." ) ]
2
3
use super :: StdLibm ;
3
4
4
5
use super :: StdFloat ;
@@ -9,22 +10,36 @@ impl<const N: usize> StdLibm for Simd<f32, N>
9
10
where
10
11
LaneCount < N > : SupportedLaneCount ,
11
12
{
13
+ type IntType = Simd < i32 , N > ;
14
+ type UintType = Simd < u32 , N > ;
12
15
#[ inline]
13
16
fn asin ( self ) -> Self {
17
+ let PI_BY_2 = Self :: splat ( 1.57079632679489661923 ) ;
14
18
let arg = self ;
15
- arg. atan2 ( ( Self :: splat ( 1f32 ) - arg * arg) . sqrt ( ) )
19
+ let LIM : Self = Self :: splat ( 0.70710678118654752440 ) ;
20
+ let c: Self = ( ( arg) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -PI_BY_2 , PI_BY_2 ) ;
21
+ let s: Self =
22
+ ( ( arg) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -Self :: splat ( 1.0 ) , Self :: splat ( 1.0 ) ) ;
23
+ let x: Self =
24
+ ( ( arg * arg) . lanes_lt ( LIM * LIM ) ) . select ( arg, ( Self :: splat ( 1.0 ) - arg * arg) . sqrt ( ) ) ;
25
+ let y: Self = ( Self :: splat ( 0.11644821f32 ) )
26
+ . mul_add ( x * x, Self :: splat ( 0.04343228f32 ) )
27
+ . mul_add ( x * x, Self :: splat ( 0.17078044f32 ) )
28
+ . mul_add ( x * x, Self :: splat ( 0.99991643f32 ) )
29
+ * x;
30
+ ( ( arg * arg) . lanes_lt ( LIM * LIM ) ) . select ( y, c - y * s)
16
31
}
17
32
#[ inline]
18
33
fn acos ( self ) -> Self {
19
- let PI_BY_2 = Self :: splat ( 1.5707964f32 ) ;
20
- let PI = Self :: splat ( 3.1415927f32 ) ;
34
+ let PI_BY_2 = Self :: splat ( 1.57079632679489661923 ) ;
35
+ let PI = Self :: splat ( 3.14159265358979323846 ) ;
21
36
let arg = self ;
22
- let LIM : Self = Self :: splat ( 0.9f32 ) ;
23
- let c: Self = ( ( arg) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( PI , Self :: splat ( 0f32 ) ) ;
37
+ let LIM : Self = Self :: splat ( 0.9 ) ;
38
+ let c: Self = ( ( arg) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( PI , Self :: splat ( 0.0 ) ) ;
24
39
let s: Self =
25
- ( ( arg) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( Self :: splat ( 1f32 ) , -Self :: splat ( 1f32 ) ) ;
40
+ ( ( arg) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( Self :: splat ( 1.0 ) , -Self :: splat ( 1.0 ) ) ;
26
41
let x: Self =
27
- ( ( arg * arg) . lanes_lt ( LIM * LIM ) ) . select ( arg, ( Self :: splat ( 1f32 ) - arg * arg) . sqrt ( ) ) ;
42
+ ( ( arg * arg) . lanes_lt ( LIM * LIM ) ) . select ( arg, ( Self :: splat ( 1.0 ) - arg * arg) . sqrt ( ) ) ;
28
43
let y: Self = ( Self :: splat ( 1.3740137f32 ) )
29
44
. mul_add ( x * x, -Self :: splat ( 3.1993167f32 ) )
30
45
. mul_add ( x * x, Self :: splat ( 3.103398f32 ) )
@@ -38,10 +53,10 @@ where
38
53
}
39
54
#[ inline]
40
55
fn atan ( self ) -> Self {
41
- let PI_BY_2 = Self :: splat ( 1.5707964f32 ) ;
56
+ let PI_BY_2 = Self :: splat ( 1.57079632679489661923 ) ;
42
57
let arg = self ;
43
- let LIM : Self = Self :: splat ( 1f32 ) ;
44
- let c: Self = ( ( arg) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( -PI_BY_2 , PI_BY_2 ) ;
58
+ let LIM : Self = Self :: splat ( 1.0 ) ;
59
+ let c: Self = ( ( arg) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -PI_BY_2 , PI_BY_2 ) ;
45
60
let x: Self = ( ( arg. abs ( ) ) . lanes_lt ( LIM ) ) . select ( arg, arg. recip ( ) ) ;
46
61
let y: Self = ( -Self :: splat ( 0.0039602574f32 ) )
47
62
. mul_add ( x * x, Self :: splat ( 0.021659138f32 ) )
@@ -56,14 +71,14 @@ where
56
71
}
57
72
#[ inline]
58
73
fn atan2 ( self , x : Self ) -> Self {
59
- let PI_BY_2 = Self :: splat ( 1.5707964f32 ) ;
60
- let PI = Self :: splat ( 3.1415927f32 ) ;
74
+ let PI_BY_2 = Self :: splat ( 1.57079632679489661923 ) ;
75
+ let PI = Self :: splat ( 3.14159265358979323846 ) ;
61
76
let y = self ;
62
- let offset180: Self = ( ( y) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( -PI , PI ) ;
63
- let x1: Self = ( ( x) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( -x, x) ;
64
- let y1: Self = ( ( x) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( -y, y) ;
65
- let offset1: Self = ( ( x) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( offset180, Self :: splat ( 0f32 ) ) ;
66
- let offset90: Self = ( ( y) . lanes_lt ( Self :: splat ( 0f32 ) ) ) . select ( -PI_BY_2 , PI_BY_2 ) ;
77
+ let offset180: Self = ( ( y) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -PI , PI ) ;
78
+ let x1: Self = ( ( x) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -x, x) ;
79
+ let y1: Self = ( ( x) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -y, y) ;
80
+ let offset1: Self = ( ( x) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( offset180, Self :: splat ( 0.0 ) ) ;
81
+ let offset90: Self = ( ( y) . lanes_lt ( Self :: splat ( 0.0 ) ) ) . select ( -PI_BY_2 , PI_BY_2 ) ;
67
82
let x2: Self = ( ( y1. abs ( ) ) . lanes_gt ( x1) ) . select ( y1, x1) ;
68
83
let y2: Self = ( ( y1. abs ( ) ) . lanes_gt ( x1) ) . select ( -x1, y1) ;
69
84
let offset2: Self = ( ( y1. abs ( ) ) . lanes_gt ( x1) ) . select ( offset1 + offset90, offset1) ;
80
95
y3 + offset2
81
96
}
82
97
#[ inline]
98
+ fn exp2 ( self ) -> Self {
99
+ let arg = self ;
100
+ let r: Self = arg. round ( ) ;
101
+ let mul: Self = Self :: from_bits ( unsafe {
102
+ ( r. mul_add ( Self :: splat ( 8388608.0f32 ) , Self :: splat ( 1065353216.0f32 ) ) ) . to_uint_unchecked ( )
103
+ } ) ;
104
+ let x: Self = arg - r;
105
+ ( Self :: splat ( 0.000015310081f32 ) )
106
+ . mul_add ( x, Self :: splat ( 0.0001547802f32 ) )
107
+ . mul_add ( x, Self :: splat ( 0.0013333454f32 ) )
108
+ . mul_add ( x, Self :: splat ( 0.009617995f32 ) )
109
+ . mul_add ( x, Self :: splat ( 0.05550411f32 ) )
110
+ . mul_add ( x, Self :: splat ( 0.24022652f32 ) )
111
+ . mul_add ( x, Self :: splat ( 0.6931472f32 ) )
112
+ . mul_add ( x, Self :: splat ( 1f32 ) )
113
+ * mul
114
+ }
115
+ #[ inline]
116
+ fn exp ( self ) -> Self {
117
+ let LOG2_E =Self :: splat ( 1.442695040888963407359769137464649992339735961996202908859290566914912486673985594186422766333708408 ) ;
118
+ let arg = self ;
119
+ ( arg * LOG2_E ) . exp2 ( )
120
+ }
121
+ #[ inline]
83
122
fn sin ( self ) -> Self {
84
- let RECIP_2PI = Self :: splat ( 0.15915494f32 ) ;
123
+ let RECIP_2PI = Self :: splat ( 0.15915494309189533577 ) ;
85
124
let arg = self ;
86
125
let scaled: Self = arg * RECIP_2PI ;
87
126
let x: Self = scaled - scaled. round ( ) ;
95
134
}
96
135
#[ inline]
97
136
fn cos ( self ) -> Self {
98
- let RECIP_2PI = Self :: splat ( 0.15915494f32 ) ;
137
+ let RECIP_2PI = Self :: splat ( 0.15915494309189533577 ) ;
99
138
let arg = self ;
100
139
let scaled: Self = arg * RECIP_2PI ;
101
140
let x: Self = scaled - scaled. round ( ) ;
@@ -109,11 +148,11 @@ where
109
148
}
110
149
#[ inline]
111
150
fn tan ( self ) -> Self {
112
- let RECIP_PI = Self :: splat ( 0.31830987f32 ) ;
151
+ let RECIP_PI = Self :: splat ( 0.31830988618379067154 ) ;
113
152
let arg = self ;
114
153
let scaled: Self = arg * RECIP_PI ;
115
154
let x: Self = scaled - scaled. round ( ) ;
116
- let recip: Self = Self :: splat ( 1f32 ) / ( x * x - Self :: splat ( 0.25f32 ) ) ;
155
+ let recip: Self = Self :: splat ( 1.0 ) / ( x * x - Self :: splat ( 0.25 ) ) ;
117
156
let y: Self = ( Self :: splat ( 0.014397301f32 ) )
118
157
. mul_add ( x * x, Self :: splat ( 0.021017345f32 ) )
119
158
. mul_add ( x * x, Self :: splat ( 0.05285888f32 ) )
0 commit comments