OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/wasm/wasm-macro-gen.h" | 5 #include "src/wasm/wasm-macro-gen.h" |
6 #include "src/wasm/wasm-module.h" | 6 #include "src/wasm/wasm-module.h" |
7 | 7 |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 #include "test/cctest/compiler/value-helper.h" | 9 #include "test/cctest/compiler/value-helper.h" |
10 #include "test/cctest/wasm/wasm-run-utils.h" | 10 #include "test/cctest/wasm/wasm-run-utils.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))), | 91 WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))), |
92 WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)), | 92 WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)), |
93 WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))), | 93 WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))), |
94 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); | 94 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); |
95 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } | 95 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
96 } | 96 } |
97 | 97 |
98 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Local) { | 98 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Local) { |
99 FLAG_wasm_simd_prototype = true; | 99 FLAG_wasm_simd_prototype = true; |
100 WasmRunner<int32_t> r(kExecuteCompiled); | 100 WasmRunner<int32_t> r(kExecuteCompiled); |
101 r.AllocateLocal(kAstS128); | 101 r.AllocateLocal(kWasmS128); |
102 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), | 102 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
103 WASM_RETURN1( | 103 WASM_RETURN1( |
104 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(0))))); | 104 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(0))))); |
105 FOR_INT32_INPUTS(i) { CHECK_EQ(31, r.Call()); } | 105 FOR_INT32_INPUTS(i) { CHECK_EQ(31, r.Call()); } |
106 } | 106 } |
107 | 107 |
108 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Replace_Lane) { | 108 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Replace_Lane) { |
109 FLAG_wasm_simd_prototype = true; | 109 FLAG_wasm_simd_prototype = true; |
110 WasmRunner<int32_t> r(kExecuteCompiled); | 110 WasmRunner<int32_t> r(kExecuteCompiled); |
111 r.AllocateLocal(kAstS128); | 111 r.AllocateLocal(kWasmS128); |
112 BUILD(r, | 112 BUILD(r, |
113 WASM_BLOCK( | 113 WASM_BLOCK( |
114 WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), | 114 WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
115 WASM_SET_LOCAL(0, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(0), | 115 WASM_SET_LOCAL(0, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(0), |
116 WASM_I32V(53))), | 116 WASM_I32V(53))), |
117 WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(0))))); | 117 WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(0))))); |
118 FOR_INT32_INPUTS(i) { CHECK_EQ(53, r.Call()); } | 118 FOR_INT32_INPUTS(i) { CHECK_EQ(53, r.Call()); } |
119 } | 119 } |
120 | 120 |
121 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Replace_Lane) { | 121 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Replace_Lane) { |
122 FLAG_wasm_simd_prototype = true; | 122 FLAG_wasm_simd_prototype = true; |
123 WasmRunner<int32_t> r(kExecuteCompiled); | 123 WasmRunner<int32_t> r(kExecuteCompiled); |
124 r.AllocateLocal(kAstF32); | 124 r.AllocateLocal(kWasmF32); |
125 r.AllocateLocal(kAstS128); | 125 r.AllocateLocal(kWasmS128); |
126 BUILD(r, WASM_BLOCK( | 126 BUILD(r, WASM_BLOCK( |
127 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(23.5))), | 127 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(23.5))), |
128 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE( | 128 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE( |
129 3, WASM_GET_LOCAL(1), WASM_F32(65.25))), | 129 3, WASM_GET_LOCAL(1), WASM_F32(65.25))), |
130 WASM_SET_LOCAL( | 130 WASM_SET_LOCAL( |
131 0, WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1))), | 131 0, WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1))), |
132 WASM_IF(WASM_F32_EQ(WASM_GET_LOCAL(0), WASM_F32(65.25)), | 132 WASM_IF(WASM_F32_EQ(WASM_GET_LOCAL(0), WASM_F32(65.25)), |
133 WASM_RETURN1(WASM_I32V(1))), | 133 WASM_RETURN1(WASM_I32V(1))), |
134 WASM_RETURN1(WASM_I32V(0)))); | 134 WASM_RETURN1(WASM_I32V(0)))); |
135 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } | 135 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
136 } | 136 } |
137 | 137 |
138 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Splat_From_Extract) { | 138 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Splat_From_Extract) { |
139 FLAG_wasm_simd_prototype = true; | 139 FLAG_wasm_simd_prototype = true; |
140 WasmRunner<int32_t> r(kExecuteCompiled); | 140 WasmRunner<int32_t> r(kExecuteCompiled); |
141 r.AllocateLocal(kAstI32); | 141 r.AllocateLocal(kWasmI32); |
142 r.AllocateLocal(kAstS128); | 142 r.AllocateLocal(kWasmS128); |
143 BUILD(r, | 143 BUILD(r, |
144 WASM_BLOCK( | 144 WASM_BLOCK( |
145 WASM_SET_LOCAL(0, WASM_SIMD_I32x4_EXTRACT_LANE( | 145 WASM_SET_LOCAL(0, WASM_SIMD_I32x4_EXTRACT_LANE( |
146 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(76)))), | 146 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(76)))), |
147 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), | 147 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), |
148 WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(1))))); | 148 WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(1))))); |
149 FOR_INT32_INPUTS(i) { CHECK_EQ(76, r.Call()); } | 149 FOR_INT32_INPUTS(i) { CHECK_EQ(76, r.Call()); } |
150 } | 150 } |
151 | 151 |
152 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Get_Global) { | 152 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Get_Global) { |
153 FLAG_wasm_simd_prototype = true; | 153 FLAG_wasm_simd_prototype = true; |
154 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 154 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
155 int32_t* global = r.module().AddGlobal<int32_t>(kAstS128); | 155 int32_t* global = r.module().AddGlobal<int32_t>(kWasmS128); |
156 *(global) = 0; | 156 *(global) = 0; |
157 *(global + 1) = 1; | 157 *(global + 1) = 1; |
158 *(global + 2) = 2; | 158 *(global + 2) = 2; |
159 *(global + 3) = 3; | 159 *(global + 3) = 3; |
160 r.AllocateLocal(kAstI32); | 160 r.AllocateLocal(kWasmI32); |
161 BUILD(r, WASM_BLOCK( | 161 BUILD(r, WASM_BLOCK( |
162 WASM_SET_LOCAL(1, WASM_I32V(1)), | 162 WASM_SET_LOCAL(1, WASM_I32V(1)), |
163 WASM_IF(WASM_I32_NE(WASM_I32V(0), WASM_SIMD_I32x4_EXTRACT_LANE( | 163 WASM_IF(WASM_I32_NE(WASM_I32V(0), WASM_SIMD_I32x4_EXTRACT_LANE( |
164 0, WASM_GET_GLOBAL(0))), | 164 0, WASM_GET_GLOBAL(0))), |
165 WASM_SET_LOCAL(1, WASM_I32V(0))), | 165 WASM_SET_LOCAL(1, WASM_I32V(0))), |
166 WASM_IF(WASM_I32_NE(WASM_I32V(1), WASM_SIMD_I32x4_EXTRACT_LANE( | 166 WASM_IF(WASM_I32_NE(WASM_I32V(1), WASM_SIMD_I32x4_EXTRACT_LANE( |
167 1, WASM_GET_GLOBAL(0))), | 167 1, WASM_GET_GLOBAL(0))), |
168 WASM_SET_LOCAL(1, WASM_I32V(0))), | 168 WASM_SET_LOCAL(1, WASM_I32V(0))), |
169 WASM_IF(WASM_I32_NE(WASM_I32V(2), WASM_SIMD_I32x4_EXTRACT_LANE( | 169 WASM_IF(WASM_I32_NE(WASM_I32V(2), WASM_SIMD_I32x4_EXTRACT_LANE( |
170 2, WASM_GET_GLOBAL(0))), | 170 2, WASM_GET_GLOBAL(0))), |
171 WASM_SET_LOCAL(1, WASM_I32V(0))), | 171 WASM_SET_LOCAL(1, WASM_I32V(0))), |
172 WASM_IF(WASM_I32_NE(WASM_I32V(3), WASM_SIMD_I32x4_EXTRACT_LANE( | 172 WASM_IF(WASM_I32_NE(WASM_I32V(3), WASM_SIMD_I32x4_EXTRACT_LANE( |
173 3, WASM_GET_GLOBAL(0))), | 173 3, WASM_GET_GLOBAL(0))), |
174 WASM_SET_LOCAL(1, WASM_I32V(0))), | 174 WASM_SET_LOCAL(1, WASM_I32V(0))), |
175 WASM_RETURN1(WASM_GET_LOCAL(1)))); | 175 WASM_RETURN1(WASM_GET_LOCAL(1)))); |
176 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } | 176 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } |
177 } | 177 } |
178 | 178 |
179 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Set_Global) { | 179 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Set_Global) { |
180 FLAG_wasm_simd_prototype = true; | 180 FLAG_wasm_simd_prototype = true; |
181 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 181 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
182 int32_t* global = r.module().AddGlobal<int32_t>(kAstS128); | 182 int32_t* global = r.module().AddGlobal<int32_t>(kWasmS128); |
183 BUILD(r, WASM_BLOCK( | 183 BUILD(r, WASM_BLOCK( |
184 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(23))), | 184 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(23))), |
185 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( | 185 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( |
186 1, WASM_GET_GLOBAL(0), WASM_I32V(34))), | 186 1, WASM_GET_GLOBAL(0), WASM_I32V(34))), |
187 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( | 187 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( |
188 2, WASM_GET_GLOBAL(0), WASM_I32V(45))), | 188 2, WASM_GET_GLOBAL(0), WASM_I32V(45))), |
189 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( | 189 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( |
190 3, WASM_GET_GLOBAL(0), WASM_I32V(56))), | 190 3, WASM_GET_GLOBAL(0), WASM_I32V(56))), |
191 WASM_RETURN1(WASM_I32V(1)))); | 191 WASM_RETURN1(WASM_I32V(1)))); |
192 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } | 192 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } |
193 CHECK_EQ(*global, 23); | 193 CHECK_EQ(*global, 23); |
194 CHECK_EQ(*(global + 1), 34); | 194 CHECK_EQ(*(global + 1), 34); |
195 CHECK_EQ(*(global + 2), 45); | 195 CHECK_EQ(*(global + 2), 45); |
196 CHECK_EQ(*(global + 3), 56); | 196 CHECK_EQ(*(global + 3), 56); |
197 } | 197 } |
198 | 198 |
199 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Get_Global) { | 199 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Get_Global) { |
200 FLAG_wasm_simd_prototype = true; | 200 FLAG_wasm_simd_prototype = true; |
201 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 201 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
202 float* global = r.module().AddGlobal<float>(kAstS128); | 202 float* global = r.module().AddGlobal<float>(kWasmS128); |
203 *(global) = 0.0; | 203 *(global) = 0.0; |
204 *(global + 1) = 1.5; | 204 *(global + 1) = 1.5; |
205 *(global + 2) = 2.25; | 205 *(global + 2) = 2.25; |
206 *(global + 3) = 3.5; | 206 *(global + 3) = 3.5; |
207 r.AllocateLocal(kAstI32); | 207 r.AllocateLocal(kWasmI32); |
208 BUILD(r, WASM_BLOCK( | 208 BUILD(r, WASM_BLOCK( |
209 WASM_SET_LOCAL(1, WASM_I32V(1)), | 209 WASM_SET_LOCAL(1, WASM_I32V(1)), |
210 WASM_IF(WASM_F32_NE(WASM_F32(0.0), WASM_SIMD_F32x4_EXTRACT_LANE( | 210 WASM_IF(WASM_F32_NE(WASM_F32(0.0), WASM_SIMD_F32x4_EXTRACT_LANE( |
211 0, WASM_GET_GLOBAL(0))), | 211 0, WASM_GET_GLOBAL(0))), |
212 WASM_SET_LOCAL(1, WASM_I32V(0))), | 212 WASM_SET_LOCAL(1, WASM_I32V(0))), |
213 WASM_IF(WASM_F32_NE(WASM_F32(1.5), WASM_SIMD_F32x4_EXTRACT_LANE( | 213 WASM_IF(WASM_F32_NE(WASM_F32(1.5), WASM_SIMD_F32x4_EXTRACT_LANE( |
214 1, WASM_GET_GLOBAL(0))), | 214 1, WASM_GET_GLOBAL(0))), |
215 WASM_SET_LOCAL(1, WASM_I32V(0))), | 215 WASM_SET_LOCAL(1, WASM_I32V(0))), |
216 WASM_IF(WASM_F32_NE(WASM_F32(2.25), WASM_SIMD_F32x4_EXTRACT_LANE( | 216 WASM_IF(WASM_F32_NE(WASM_F32(2.25), WASM_SIMD_F32x4_EXTRACT_LANE( |
217 2, WASM_GET_GLOBAL(0))), | 217 2, WASM_GET_GLOBAL(0))), |
218 WASM_SET_LOCAL(1, WASM_I32V(0))), | 218 WASM_SET_LOCAL(1, WASM_I32V(0))), |
219 WASM_IF(WASM_F32_NE(WASM_F32(3.5), WASM_SIMD_F32x4_EXTRACT_LANE( | 219 WASM_IF(WASM_F32_NE(WASM_F32(3.5), WASM_SIMD_F32x4_EXTRACT_LANE( |
220 3, WASM_GET_GLOBAL(0))), | 220 3, WASM_GET_GLOBAL(0))), |
221 WASM_SET_LOCAL(1, WASM_I32V(0))), | 221 WASM_SET_LOCAL(1, WASM_I32V(0))), |
222 WASM_RETURN1(WASM_GET_LOCAL(1)))); | 222 WASM_RETURN1(WASM_GET_LOCAL(1)))); |
223 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } | 223 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } |
224 } | 224 } |
225 | 225 |
226 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Set_Global) { | 226 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Set_Global) { |
227 FLAG_wasm_simd_prototype = true; | 227 FLAG_wasm_simd_prototype = true; |
228 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 228 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
229 float* global = r.module().AddGlobal<float>(kAstS128); | 229 float* global = r.module().AddGlobal<float>(kWasmS128); |
230 BUILD(r, WASM_BLOCK( | 230 BUILD(r, WASM_BLOCK( |
231 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))), | 231 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))), |
232 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( | 232 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( |
233 1, WASM_GET_GLOBAL(0), WASM_F32(45.5))), | 233 1, WASM_GET_GLOBAL(0), WASM_F32(45.5))), |
234 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( | 234 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( |
235 2, WASM_GET_GLOBAL(0), WASM_F32(32.25))), | 235 2, WASM_GET_GLOBAL(0), WASM_F32(32.25))), |
236 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( | 236 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( |
237 3, WASM_GET_GLOBAL(0), WASM_F32(65.0))), | 237 3, WASM_GET_GLOBAL(0), WASM_F32(65.0))), |
238 WASM_RETURN1(WASM_I32V(1)))); | 238 WASM_RETURN1(WASM_I32V(1)))); |
239 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } | 239 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } |
240 CHECK_EQ(*global, 13.5); | 240 CHECK_EQ(*global, 13.5); |
241 CHECK_EQ(*(global + 1), 45.5); | 241 CHECK_EQ(*(global + 1), 45.5); |
242 CHECK_EQ(*(global + 2), 32.25); | 242 CHECK_EQ(*(global + 2), 32.25); |
243 CHECK_EQ(*(global + 3), 65.0); | 243 CHECK_EQ(*(global + 3), 65.0); |
244 } | 244 } |
245 | 245 |
246 WASM_EXEC_COMPILED_TEST(Simd_I32x4_For) { | 246 WASM_EXEC_COMPILED_TEST(Simd_I32x4_For) { |
247 FLAG_wasm_simd_prototype = true; | 247 FLAG_wasm_simd_prototype = true; |
248 WasmRunner<int32_t> r(kExecuteCompiled); | 248 WasmRunner<int32_t> r(kExecuteCompiled); |
249 r.AllocateLocal(kAstI32); | 249 r.AllocateLocal(kWasmI32); |
250 r.AllocateLocal(kAstS128); | 250 r.AllocateLocal(kWasmS128); |
251 BUILD( | 251 BUILD( |
252 r, | 252 r, |
253 WASM_BLOCK( | 253 WASM_BLOCK( |
254 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), | 254 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
255 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(1), | 255 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(1), |
256 WASM_I32V(53))), | 256 WASM_I32V(53))), |
257 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(1), | 257 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(1), |
258 WASM_I32V(23))), | 258 WASM_I32V(23))), |
259 WASM_SET_LOCAL(0, WASM_I32V(0)), | 259 WASM_SET_LOCAL(0, WASM_I32V(0)), |
260 WASM_LOOP(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_ADD( | 260 WASM_LOOP(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_ADD( |
(...skipping 18 matching lines...) Expand all Loading... |
279 WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), | 279 WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), |
280 WASM_I32V(36)), | 280 WASM_I32V(36)), |
281 WASM_SET_LOCAL(0, WASM_I32V(0))), | 281 WASM_SET_LOCAL(0, WASM_I32V(0))), |
282 WASM_RETURN1(WASM_GET_LOCAL(0)))); | 282 WASM_RETURN1(WASM_GET_LOCAL(0)))); |
283 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } | 283 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
284 } | 284 } |
285 | 285 |
286 WASM_EXEC_COMPILED_TEST(Simd_F32x4_For) { | 286 WASM_EXEC_COMPILED_TEST(Simd_F32x4_For) { |
287 FLAG_wasm_simd_prototype = true; | 287 FLAG_wasm_simd_prototype = true; |
288 WasmRunner<int32_t> r(kExecuteCompiled); | 288 WasmRunner<int32_t> r(kExecuteCompiled); |
289 r.AllocateLocal(kAstI32); | 289 r.AllocateLocal(kWasmI32); |
290 r.AllocateLocal(kAstS128); | 290 r.AllocateLocal(kWasmS128); |
291 BUILD(r, WASM_BLOCK( | 291 BUILD(r, WASM_BLOCK( |
292 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), | 292 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), |
293 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE( | 293 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE( |
294 3, WASM_GET_LOCAL(1), WASM_F32(19.5))), | 294 3, WASM_GET_LOCAL(1), WASM_F32(19.5))), |
295 WASM_SET_LOCAL(0, WASM_I32V(0)), | 295 WASM_SET_LOCAL(0, WASM_I32V(0)), |
296 WASM_LOOP( | 296 WASM_LOOP( |
297 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_ADD( | 297 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_ADD( |
298 WASM_GET_LOCAL(1), | 298 WASM_GET_LOCAL(1), |
299 WASM_SIMD_F32x4_SPLAT(WASM_F32(2.0)))), | 299 WASM_SIMD_F32x4_SPLAT(WASM_F32(2.0)))), |
300 WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(0), WASM_I32V(3)), | 300 WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(0), WASM_I32V(3)), |
301 WASM_BR(1))), | 301 WASM_BR(1))), |
302 WASM_SET_LOCAL(0, WASM_I32V(1)), | 302 WASM_SET_LOCAL(0, WASM_I32V(1)), |
303 WASM_IF(WASM_F32_NE( | 303 WASM_IF(WASM_F32_NE( |
304 WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)), | 304 WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)), |
305 WASM_F32(27.25)), | 305 WASM_F32(27.25)), |
306 WASM_SET_LOCAL(0, WASM_I32V(0))), | 306 WASM_SET_LOCAL(0, WASM_I32V(0))), |
307 WASM_IF(WASM_F32_NE( | 307 WASM_IF(WASM_F32_NE( |
308 WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), | 308 WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), |
309 WASM_F32(25.5)), | 309 WASM_F32(25.5)), |
310 WASM_SET_LOCAL(0, WASM_I32V(0))), | 310 WASM_SET_LOCAL(0, WASM_I32V(0))), |
311 WASM_RETURN1(WASM_GET_LOCAL(0)))); | 311 WASM_RETURN1(WASM_GET_LOCAL(0)))); |
312 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } | 312 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
313 } | 313 } |
OLD | NEW |