|
1 | | -#[cfg(not(feature = "std"))] |
2 | | -#[allow(unused_imports)] |
3 | | -use super::no_std_floats::NoStdFloatExt; |
| 1 | +// #[cfg(not(feature = "std"))] |
| 2 | +// #[allow(unused_imports)] |
| 3 | +// use super::no_std_floats::NoStdFloatExt; |
4 | 4 |
|
5 | | -// WIP |
6 | | -struct V128([u8; 16]); |
| 5 | +// // WIP |
| 6 | +// struct V128([u8; 16]); |
7 | 7 |
|
8 | | -impl V128 { |
9 | | - fn f32x4(&self) -> [f32; 4] { |
10 | | - let mut res = [0.0; 4]; |
11 | | - for i in 0..4 { |
12 | | - let mut f = [0; 4]; |
13 | | - for j in 0..4 { |
14 | | - f[j] = self.0[i * 4 + j]; |
15 | | - } |
16 | | - res[i] = f32::from_le_bytes(f); |
17 | | - } |
18 | | - res |
19 | | - } |
| 8 | +// impl V128 { |
| 9 | +// fn f32x4(&self) -> [f32; 4] { |
| 10 | +// let mut res = [0.0; 4]; |
| 11 | +// for i in 0..4 { |
| 12 | +// let mut f = [0; 4]; |
| 13 | +// for j in 0..4 { |
| 14 | +// f[j] = self.0[i * 4 + j]; |
| 15 | +// } |
| 16 | +// res[i] = f32::from_le_bytes(f); |
| 17 | +// } |
| 18 | +// res |
| 19 | +// } |
20 | 20 |
|
21 | | - fn i32x4(&self) -> [i32; 4] { |
22 | | - let mut res = [0; 4]; |
23 | | - for i in 0..4 { |
24 | | - let mut f = [0; 4]; |
25 | | - for j in 0..4 { |
26 | | - f[j] = self.0[i * 4 + j]; |
27 | | - } |
28 | | - res[i] = i32::from_le_bytes(f); |
29 | | - } |
30 | | - res |
31 | | - } |
| 21 | +// fn i32x4(&self) -> [i32; 4] { |
| 22 | +// let mut res = [0; 4]; |
| 23 | +// for i in 0..4 { |
| 24 | +// let mut f = [0; 4]; |
| 25 | +// for j in 0..4 { |
| 26 | +// f[j] = self.0[i * 4 + j]; |
| 27 | +// } |
| 28 | +// res[i] = i32::from_le_bytes(f); |
| 29 | +// } |
| 30 | +// res |
| 31 | +// } |
32 | 32 |
|
33 | | - fn i64x2(&self) -> [i64; 2] { |
34 | | - let mut res = [0; 2]; |
35 | | - for i in 0..2 { |
36 | | - let mut f = [0; 8]; |
37 | | - for j in 0..8 { |
38 | | - f[j] = self.0[i * 8 + j]; |
39 | | - } |
40 | | - res[i] = i64::from_le_bytes(f); |
41 | | - } |
42 | | - res |
43 | | - } |
| 33 | +// fn i64x2(&self) -> [i64; 2] { |
| 34 | +// let mut res = [0; 2]; |
| 35 | +// for i in 0..2 { |
| 36 | +// let mut f = [0; 8]; |
| 37 | +// for j in 0..8 { |
| 38 | +// f[j] = self.0[i * 8 + j]; |
| 39 | +// } |
| 40 | +// res[i] = i64::from_le_bytes(f); |
| 41 | +// } |
| 42 | +// res |
| 43 | +// } |
44 | 44 |
|
45 | | - fn f64x2(&self) -> [f64; 2] { |
46 | | - let mut res = [0.0; 2]; |
47 | | - for i in 0..2 { |
48 | | - let mut f = [0; 8]; |
49 | | - for j in 0..8 { |
50 | | - f[j] = self.0[i * 8 + j]; |
51 | | - } |
52 | | - res[i] = f64::from_le_bytes(f); |
53 | | - } |
54 | | - res |
55 | | - } |
| 45 | +// fn f64x2(&self) -> [f64; 2] { |
| 46 | +// let mut res = [0.0; 2]; |
| 47 | +// for i in 0..2 { |
| 48 | +// let mut f = [0; 8]; |
| 49 | +// for j in 0..8 { |
| 50 | +// f[j] = self.0[i * 8 + j]; |
| 51 | +// } |
| 52 | +// res[i] = f64::from_le_bytes(f); |
| 53 | +// } |
| 54 | +// res |
| 55 | +// } |
56 | 56 |
|
57 | | - fn i16x8(&self) -> [i16; 8] { |
58 | | - let mut res = [0; 8]; |
59 | | - for i in 0..8 { |
60 | | - let mut f = [0; 2]; |
61 | | - for j in 0..2 { |
62 | | - f[j] = self.0[i * 2 + j]; |
63 | | - } |
64 | | - res[i] = i16::from_le_bytes(f); |
65 | | - } |
66 | | - res |
67 | | - } |
| 57 | +// fn i16x8(&self) -> [i16; 8] { |
| 58 | +// let mut res = [0; 8]; |
| 59 | +// for i in 0..8 { |
| 60 | +// let mut f = [0; 2]; |
| 61 | +// for j in 0..2 { |
| 62 | +// f[j] = self.0[i * 2 + j]; |
| 63 | +// } |
| 64 | +// res[i] = i16::from_le_bytes(f); |
| 65 | +// } |
| 66 | +// res |
| 67 | +// } |
68 | 68 |
|
69 | | - fn i8x16(&self) -> [i8; 16] { |
70 | | - let mut res = [0; 16]; |
71 | | - for i in 0..16 { |
72 | | - res[i] = i8::from_le_bytes([self.0[i]]); |
73 | | - } |
74 | | - res |
75 | | - } |
76 | | -} |
| 69 | +// fn i8x16(&self) -> [i8; 16] { |
| 70 | +// let mut res = [0; 16]; |
| 71 | +// for i in 0..16 { |
| 72 | +// res[i] = i8::from_le_bytes([self.0[i]]); |
| 73 | +// } |
| 74 | +// res |
| 75 | +// } |
| 76 | +// } |
77 | 77 |
|
78 | | -fn vvunop(c1: V128) -> V128 { |
79 | | - let mut res = [0; 16]; |
80 | | - for i in 0..16 { |
81 | | - res[i] = !c1.0[i]; |
82 | | - } |
83 | | - V128(res) |
84 | | -} |
| 78 | +// fn vvunop(c1: V128) -> V128 { |
| 79 | +// let mut res = [0; 16]; |
| 80 | +// for i in 0..16 { |
| 81 | +// res[i] = !c1.0[i]; |
| 82 | +// } |
| 83 | +// V128(res) |
| 84 | +// } |
85 | 85 |
|
86 | | -fn vvbinop(c1: V128, c2: V128) -> V128 { |
87 | | - let mut res = [0; 16]; |
88 | | - for i in 0..16 { |
89 | | - res[i] = c1.0[i] & c2.0[i]; |
90 | | - } |
91 | | - V128(res) |
92 | | -} |
| 86 | +// fn vvbinop(c1: V128, c2: V128) -> V128 { |
| 87 | +// let mut res = [0; 16]; |
| 88 | +// for i in 0..16 { |
| 89 | +// res[i] = c1.0[i] & c2.0[i]; |
| 90 | +// } |
| 91 | +// V128(res) |
| 92 | +// } |
93 | 93 |
|
94 | | -fn vvternop(c1: V128, c2: V128, c3: V128) -> V128 { |
95 | | - let mut res = [0; 16]; |
96 | | - for i in 0..16 { |
97 | | - res[i] = c1.0[i] & c2.0[i] | !c1.0[i] & c3.0[i]; |
98 | | - } |
99 | | - V128(res) |
100 | | -} |
| 94 | +// fn vvternop(c1: V128, c2: V128, c3: V128) -> V128 { |
| 95 | +// let mut res = [0; 16]; |
| 96 | +// for i in 0..16 { |
| 97 | +// res[i] = c1.0[i] & c2.0[i] | !c1.0[i] & c3.0[i]; |
| 98 | +// } |
| 99 | +// V128(res) |
| 100 | +// } |
101 | 101 |
|
102 | | -fn any_true(val: V128) -> bool { |
103 | | - val.0.iter().any(|&x| x != 0) |
104 | | -} |
| 102 | +// fn any_true(val: V128) -> bool { |
| 103 | +// val.0.iter().any(|&x| x != 0) |
| 104 | +// } |
105 | 105 |
|
106 | | -fn i8x16_swizzle(c1: V128, c2: V128) -> V128 { |
107 | | - let mut res = [0; 16]; |
108 | | - for i in 0..16 { |
109 | | - res[i] = c1.0[c2.0[i] as usize]; |
110 | | - } |
111 | | - V128(res) |
112 | | -} |
| 106 | +// fn i8x16_swizzle(c1: V128, c2: V128) -> V128 { |
| 107 | +// let mut res = [0; 16]; |
| 108 | +// for i in 0..16 { |
| 109 | +// res[i] = c1.0[c2.0[i] as usize]; |
| 110 | +// } |
| 111 | +// V128(res) |
| 112 | +// } |
113 | 113 |
|
114 | | -fn i18x16_shuffle(c1: V128, c2: V128) -> V128 { |
115 | | - let mut res = [0; 16]; |
116 | | - for i in 0..16 { |
117 | | - res[i] = c1.0[(c2.0[i] & 0xf) as usize]; |
118 | | - } |
119 | | - V128(res) |
120 | | -} |
| 114 | +// fn i18x16_shuffle(c1: V128, c2: V128) -> V128 { |
| 115 | +// let mut res = [0; 16]; |
| 116 | +// for i in 0..16 { |
| 117 | +// res[i] = c1.0[(c2.0[i] & 0xf) as usize]; |
| 118 | +// } |
| 119 | +// V128(res) |
| 120 | +// } |
121 | 121 |
|
122 | | -fn f32x4_abs(val: V128) -> V128 { |
123 | | - let mut res = [0; 16]; |
124 | | - for i in 0..4 { |
125 | | - let f = val.f32x4(); |
126 | | - let f = f32::abs(f[i]); |
127 | | - let f = f.to_le_bytes(); |
128 | | - for j in 0..4 { |
129 | | - res[i * 4 + j] = f[j]; |
130 | | - } |
131 | | - } |
132 | | - V128(res) |
133 | | -} |
| 122 | +// fn f32x4_abs(val: V128) -> V128 { |
| 123 | +// let mut res = [0; 16]; |
| 124 | +// for i in 0..4 { |
| 125 | +// let f = val.f32x4(); |
| 126 | +// let f = f32::abs(f[i]); |
| 127 | +// let f = f.to_le_bytes(); |
| 128 | +// for j in 0..4 { |
| 129 | +// res[i * 4 + j] = f[j]; |
| 130 | +// } |
| 131 | +// } |
| 132 | +// V128(res) |
| 133 | +// } |
0 commit comments