Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: test/mjsunit/wasm/filter-jit.js

Issue 2168343002: Revert "[wasm] Adding a convolution matrix filter test to highlight the performance advantages of J… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | test/mjsunit/wasm/wasm-constants.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-wasm
6 // Flags: --wasm-jit-prototype
7
8 load("test/mjsunit/wasm/wasm-constants.js");
9 load("test/mjsunit/wasm/wasm-module-builder.js");
10
11 var builder = (function () {
12 var builder = new WasmModuleBuilder();
13
14 var kSig_i_iiii = makeSig([kAstI32, kAstI32, kAstI32, kAstI32], [kAstI32]);
15 var sig_index4 = builder.addType(kSig_i_iiii);
16
17 builder.addMemory(1, 1, true);
18 var filter1 = [
19 01, 03, 01,
20 // count = columns + 1;
21 kExprGetLocal, 01,
22 kExprI32Const, 01,
23 kExprI32Add,
24 kExprSetLocal, 04,
25 // Offset: 10
26 // Bytes:
27 // for (i = 0; i < columns, ++i) {
28 // dst[i] = src[i];
29 // }
30 kExprI32Const, 00,
31 kExprSetLocal, 06,
32 kExprLoop,
33 kExprGetLocal, 06,
34 kExprGetLocal, 01,
35 kExprI32GeS,
36 kExprBrIf, 00, 01,
37 kExprGetLocal, 03,
38 kExprGetLocal, 06,
39 kExprI32Add,
40 kExprGetLocal, 02,
41 kExprGetLocal, 06,
42 kExprI32Add,
43 kExprI32LoadMem8U, 00, 00,
44 kExprI32StoreMem8, 00, 00,
45 kExprGetLocal, 06,
46 kExprI32Const, 01,
47 kExprI32Add,
48 kExprSetLocal, 06,
49 kExprBr, 00, 00,
50 kExprEnd,
51 // Offset: 50
52 // Bytes:
53 // for (i = (rows - 1) * columns;
54 // i < row * columns, ++i) {
55 // dst[i] = src[i];
56 // }
57 kExprGetLocal, 00,
58 kExprI32Const, 01,
59 kExprI32Sub,
60 kExprGetLocal, 01,
61 kExprI32Mul,
62 kExprSetLocal, 06,
63 kExprLoop,
64 kExprGetLocal, 06,
65 kExprGetLocal, 00,
66 kExprGetLocal, 01,
67 kExprI32Mul,
68 kExprI32GeS,
69 kExprBrIf, 00, 01,
70 kExprGetLocal, 03,
71 kExprGetLocal, 06,
72 kExprI32Add,
73 kExprGetLocal, 02,
74 kExprGetLocal, 06,
75 kExprI32Add,
76 kExprI32LoadMem8U, 00, 00,
77 kExprI32StoreMem8, 00, 00,
78 kExprGetLocal, 06,
79 kExprI32Const, 01,
80 kExprI32Add,
81 kExprSetLocal, 06,
82 kExprBr, 00, 00,
83 kExprEnd,
84 // Offset: 99
85 // for(int i = 1; i < rows - 1; ++i) {
86 // dst[count - 1] = src[count - 1];
87 // dst[count + columns - 1]
88 // = src[count _ columns -1];
89 // }
90 kExprI32Const, 01,
91 kExprSetLocal, 05,
92 kExprLoop,
93 kExprGetLocal, 05,
94 kExprGetLocal, 00,
95 kExprI32Const, 01,
96 kExprI32Sub,
97 kExprI32GeS,
98 kExprBrIf, 00, 01,
99 // Offset 115
100 kExprGetLocal, 04,
101 kExprI32Const, 01,
102 kExprI32Sub,
103 kExprSetLocal, 06,
104 kExprGetLocal, 03,
105 kExprGetLocal, 06,
106 kExprI32Add,
107 kExprGetLocal, 02,
108 kExprGetLocal, 06,
109 kExprI32Add,
110 kExprI32LoadMem8U, 00, 00,
111 kExprI32StoreMem8, 00, 00,
112 kExprGetLocal, 04,
113 kExprI32Const, 02,
114 kExprI32Sub,
115 kExprGetLocal, 01,
116 kExprI32Add,
117 kExprSetLocal, 06,
118 kExprGetLocal, 03,
119 kExprGetLocal, 06,
120 kExprI32Add,
121 kExprGetLocal, 02,
122 kExprGetLocal, 06,
123 kExprI32Add,
124 kExprI32LoadMem8U, 00, 00,
125 kExprI32StoreMem8, 00, 00,
126 // Offset: 164
127 // Bytes:
128 // for (int j = 1; j < columns -1; ++j) {
129 // <Kernel to be jitted will be placed here>
130 // }
131 kExprI32Const, 01,
132 kExprSetLocal, 06,
133 kExprLoop,
134 kExprGetLocal, 06,
135 kExprGetLocal, 01,
136 kExprI32Const, 01,
137 kExprI32Sub,
138 kExprI32GeS,
139 kExprBrIf, 00, 01,
140 kExprGetLocal, 03,
141 kExprGetLocal, 04,
142 kExprI32Add,
143 kExprI32Const, 00
144 /* Offset 187 */
145 ];
146 builder.addDataSegment(0x1000, filter1, false);
147
148 builder.addPadFunctionTable(10);
149 builder.addFunction("main", sig_index4)
150 .addLocals({i32_count: 1})
151 .addBody([
152 kExprI32Const, 0xbb, 0x21,
153 kExprSetLocal, 04,
154 // if (matrix[0] != 0)
155 // emit (sum += matrix[0] * src[count - columns - 1])
156 kExprGetLocal, 03,
157 kExprI32LoadMem8U, 00, 00,
158 kExprI32Const, 00,
159 kExprI32Ne,
160 kExprIf,
161 kExprGetLocal, 04,
162 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
163 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
164 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
165 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
166 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
167 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
168 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
169 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
170 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
171 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
172 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
173 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
174 kExprI8Const, kExprI32Sub, kExprI32StoreMem8, 00, 00,
175 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
176 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
177 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
178 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
179 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
180 kExprI8Const, kExprI32Sub, kExprI32StoreMem8, 00, 00,
181 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
182 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
183 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
184 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
185 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
186 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
187 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
188 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
189 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
190 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
191 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
192 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
193 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
194 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
195 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
196 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
197 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
198 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
199 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
200 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
201 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
202 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
203 kExprGetLocal, 04, kExprI32Const, 0x15, kExprI32Add,
204 kExprGetLocal, 03,
205 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
206 kExprGetLocal, 04, kExprI32Const, 0x16, kExprI32Add,
207 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
208 kExprGetLocal, 04, kExprI32Const, 0x17, kExprI32Add,
209 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
210 kExprGetLocal, 04,
211 kExprI32Const, 0x18,
212 kExprI32Add,
213 kExprSetLocal, 04,
214 kExprEnd,
215 // if (matrix[1] != 0)
216 // emit (sum += matrix[1] * src[count - columns])
217 kExprGetLocal, 03,
218 kExprI32Const, 01,
219 kExprI32Add,
220 kExprI32LoadMem8U, 00, 00,
221 kExprI32Const, 00,
222 kExprI32Ne,
223 kExprIf,
224 kExprGetLocal, 04,
225 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
226 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
227 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
228 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
229 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
230 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
231 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
232 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
233 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
234 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
235 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
236 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
237 kExprI8Const, kExprI32Sub, kExprI32StoreMem8, 00, 00,
238 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
239 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
240 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
241 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
242 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
243 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
244 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
245 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
246 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
247 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
248 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
249 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
250 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
251 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
252 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
253 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
254 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
255 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
256 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
257 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
258 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
259 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
260 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
261 kExprGetLocal, 03, kExprI32Const, 01, kExprI32Add,
262 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
263 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
264 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
265 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
266 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
267 kExprGetLocal, 04,
268 kExprI32Const, 0x15,
269 kExprI32Add,
270 kExprSetLocal, 04,
271 kExprEnd,
272 // if (matrix[2] != 0)
273 // emit (sum += matrix[2] * src[count - columns + 1])
274 kExprGetLocal, 03,
275 kExprI32Const, 02,
276 kExprI32Add,
277 kExprI32LoadMem8U, 00, 00,
278 kExprI32Const, 00,
279 kExprI32Ne,
280 kExprIf,
281 kExprGetLocal, 04,
282 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
283 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
284 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
285 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
286 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
287 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
288 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
289 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
290 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
291 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
292 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
293 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
294 kExprI8Const, kExprI32Sub, kExprI32StoreMem8, 00, 00,
295 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
296 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
297 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
298 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
299 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
300 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
301 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
302 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
303 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
304 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
305 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
306 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
307 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
308 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
309 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
310 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
311 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
312 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
313 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
314 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
315 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
316 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
317 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
318 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
319 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
320 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
321 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
322 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
323 kExprGetLocal, 04, kExprI32Const, 0x15, kExprI32Add,
324 kExprGetLocal, 03, kExprI32Const, 02, kExprI32Add,
325 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
326 kExprGetLocal, 04, kExprI32Const, 0x16, kExprI32Add,
327 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
328 kExprGetLocal, 04, kExprI32Const, 0x17, kExprI32Add,
329 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
330 kExprGetLocal, 04,
331 kExprI32Const, 0x18,
332 kExprI32Add,
333 kExprSetLocal, 04,
334 kExprEnd,
335 // if (matrix[3] != 0)
336 // emit (sum += matrix[3] * src[count - 1])
337 kExprGetLocal, 03,
338 kExprI32Const, 03,
339 kExprI32Add,
340 kExprI32LoadMem8U, 00, 00,
341 kExprI32Const, 00,
342 kExprI32Ne,
343 kExprIf,
344 kExprGetLocal, 04,
345 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
346 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
347 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
348 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
349 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
350 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
351 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
352 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
353 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
354 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
355 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
356 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
357 kExprI8Const, kExprI32Sub, kExprI32StoreMem8, 00, 00,
358 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
359 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
360 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
361 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
362 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
363 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
364 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
365 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
366 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
367 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
368 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
369 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
370 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
371 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
372 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
373 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
374 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
375 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
376 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
377 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
378 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
379 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
380 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
381 kExprGetLocal, 03, kExprI32Const, 03, kExprI32Add,
382 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
383 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
384 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
385 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
386 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
387 kExprGetLocal, 04,
388 kExprI32Const, 0x15,
389 kExprI32Add,
390 kExprSetLocal, 04,
391 kExprEnd,
392 // if (matrix[4] != 0)
393 // emit (sum += matrix[4] * src[count])
394 kExprGetLocal, 03,
395 kExprI32Const, 04,
396 kExprI32Add,
397 kExprI32LoadMem8U, 00, 00,
398 kExprI32Const, 00,
399 kExprI32Ne,
400 kExprIf,
401 kExprGetLocal, 04,
402 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
403 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
404 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
405 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
406 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
407 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
408 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
409 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
410 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
411 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
412 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
413 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
414 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
415 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
416 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
417 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
418 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
419 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
420 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
421 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
422 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
423 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
424 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
425 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
426 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
427 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
428 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
429 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
430 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
431 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
432 kExprGetLocal, 03, kExprI32Const, 04, kExprI32Add,
433 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
434 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
435 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
436 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
437 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
438 kExprGetLocal, 04,
439 kExprI32Const, 0x12,
440 kExprI32Add,
441 kExprSetLocal, 04,
442 kExprEnd,
443 // if (matrix[5] != 0)
444 // emit (sum += matrix[5] * src[count + 1])
445 kExprGetLocal, 03,
446 kExprI32Const, 05,
447 kExprI32Add,
448 kExprI32LoadMem8U, 00, 00,
449 kExprI32Const, 00,
450 kExprI32Ne,
451 kExprIf,
452 kExprGetLocal, 04,
453 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
454 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
455 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
456 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
457 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
458 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
459 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
460 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
461 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
462 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
463 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
464 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
465 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
466 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
467 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
468 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
469 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
470 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
471 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
472 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
473 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
474 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
475 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
476 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
477 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
478 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
479 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
480 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
481 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
482 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
483 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
484 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
485 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
486 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
487 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
488 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
489 kExprGetLocal, 03, kExprI32Const, 05, kExprI32Add,
490 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
491 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
492 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
493 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
494 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
495 kExprGetLocal, 04,
496 kExprI32Const, 0x15,
497 kExprI32Add,
498 kExprSetLocal, 04,
499 kExprEnd,
500 // if (matrix[6] != 0)
501 // emit (sum += matrix[6] * src[count + columns - 1])
502 kExprGetLocal, 03,
503 kExprI32Const, 06,
504 kExprI32Add,
505 kExprI32LoadMem8U, 00, 00,
506 kExprI32Const, 00,
507 kExprI32Ne,
508 kExprIf,
509 kExprGetLocal, 04,
510 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
511 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
512 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
513 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
514 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
515 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
516 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
517 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
518 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
519 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
520 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
521 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
522 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
523 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
524 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
525 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
526 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
527 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
528 kExprI8Const, kExprI32Sub, kExprI32StoreMem8, 00, 00,
529 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
530 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
531 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
532 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
533 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
534 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
535 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
536 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
537 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
538 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
539 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
540 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
541 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
542 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
543 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
544 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
545 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
546 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
547 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
548 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
549 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
550 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
551 kExprGetLocal, 04, kExprI32Const, 0x15, kExprI32Add,
552 kExprGetLocal, 03, kExprI32Const, 06, kExprI32Add,
553 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
554 kExprGetLocal, 04, kExprI32Const, 0x16, kExprI32Add,
555 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
556 kExprGetLocal, 04, kExprI32Const, 0x17, kExprI32Add,
557 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
558 kExprGetLocal, 04,
559 kExprI32Const, 0x18,
560 kExprI32Add,
561 kExprSetLocal, 04,
562 kExprEnd,
563 // if (matrix[7] != 0)
564 // emit (sum += matrix[7] * src[count + columns])
565 kExprGetLocal, 03,
566 kExprI32Const, 07,
567 kExprI32Add,
568 kExprI32LoadMem8U, 00, 00,
569 kExprI32Const, 00,
570 kExprI32Ne,
571 kExprIf,
572 kExprGetLocal, 04,
573 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
574 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
575 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
576 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
577 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
578 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
579 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
580 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
581 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
582 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
583 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
584 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
585 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
586 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
587 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
588 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
589 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
590 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
591 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
592 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
593 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
594 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
595 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
596 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
597 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
598 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
599 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
600 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
601 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
602 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
603 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
604 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
605 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
606 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
607 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
608 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
609 kExprGetLocal, 03, kExprI32Const, 07, kExprI32Add,
610 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
611 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
612 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
613 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
614 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
615 kExprGetLocal, 04,
616 kExprI32Const, 0x15,
617 kExprI32Add,
618 kExprSetLocal, 04,
619 kExprEnd,
620 // if (matrix[8] != 0)
621 // emit (sum += matrix[8] * src[count + columns])
622 kExprGetLocal, 03,
623 kExprI32Const, 08,
624 kExprI32Add,
625 kExprI32LoadMem8U, 00, 00,
626 kExprI32Const, 00,
627 kExprI32Ne,
628 kExprIf,
629 kExprGetLocal, 04,
630 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
631 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
632 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
633 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
634 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
635 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
636 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
637 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
638 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
639 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
640 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
641 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
642 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
643 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
644 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
645 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
646 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
647 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
648 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
649 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
650 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
651 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
652 kExprI8Const, kExprI32LoadMem8U, kExprI32StoreMem8, 00, 00,
653 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
654 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
655 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
656 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
657 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
658 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
659 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
660 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
661 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
662 kExprI8Const, kExprI32Shl, kExprI32StoreMem8, 00, 00,
663 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
664 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
665 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
666 kExprI8Const, 0x18, kExprI32StoreMem8, 00, 00,
667 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
668 kExprI8Const, kExprI32ShrS, kExprI32StoreMem8, 00, 00,
669 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
670 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
671 kExprGetLocal, 04, kExprI32Const, 0x15, kExprI32Add,
672 kExprGetLocal, 03, kExprI32Const, 08, kExprI32Add,
673 kExprI32LoadMem8U, 00, 00, kExprI32StoreMem8, 00, 00,
674 kExprGetLocal, 04, kExprI32Const, 0x16, kExprI32Add,
675 kExprI8Const, kExprI32Mul, kExprI32StoreMem8, 00, 00,
676 kExprGetLocal, 04, kExprI32Const, 0x17, kExprI32Add,
677 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
678 kExprGetLocal, 04,
679 kExprI32Const, 0x18,
680 kExprI32Add,
681 kExprSetLocal, 04,
682 kExprEnd,
683 // Emit:
684 // kExprI32Const, 80, 02,
685 // kExprI32RemS,
686 // kExprI32Const, 7f,
687 // kExprI32And,
688 // kExprI32Const, ff, 01,
689 // kExprI32And,
690 // kExprI32StoreMem8, 00, 00,
691 // kExprGetLocal, kExprBr,
692 // kExprI32Const, 01,
693 // kExprI32Add,
694 // kExprSetLocal, 06,
695 // kExprGetLocal, 04,
696 // kExprI32Const, 01,
697 // kExprI32Add,
698 // kExprSetLocal, 04,
699 // kExprBr, 00, 00,
700 // kExprEnd,
701 // kExprGetLocal, 05,
702 // kExprI32Const, 01,
703 // kExprI32Add,
704 // kExprSetLocal, 05,
705 // kExprGetLocal, 04,
706 // kExprI32Const, 02,
707 // kExprI32Add,
708 // kExprSetLocal, 04,
709 // kExprBr, 00, 00,
710 // kExprEnd,
711 kExprGetLocal, 04,
712 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
713 kExprGetLocal, 04, kExprI32Const, 0x01, kExprI32Add,
714 kExprI32Const, 0x80, 01, kExprI32StoreMem8, 00, 00,
715 kExprGetLocal, 04, kExprI32Const, 0x02, kExprI32Add,
716 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
717 kExprGetLocal, 04, kExprI32Const, 0x03, kExprI32Add,
718 kExprI8Const, kExprI32RemS, kExprI32StoreMem8, 00, 00,
719 kExprGetLocal, 04, kExprI32Const, 0x04, kExprI32Add,
720 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
721 kExprGetLocal, 04, kExprI32Const, 0x05, kExprI32Add,
722 kExprI8Const, 0x7f, kExprI32StoreMem8, 00, 00,
723 kExprGetLocal, 04, kExprI32Const, 0x06, kExprI32Add,
724 kExprI8Const, kExprI32And, kExprI32StoreMem8, 00, 00,
725 kExprGetLocal, 04, kExprI32Const, 0x07, kExprI32Add,
726 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
727 kExprGetLocal, 04, kExprI32Const, 0x08, kExprI32Add,
728 kExprI32Const, 0xff, 01, kExprI32StoreMem8, 00, 00,
729 kExprGetLocal, 04, kExprI32Const, 0x09, kExprI32Add,
730 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
731 kExprGetLocal, 04, kExprI32Const, 0x0a, kExprI32Add,
732 kExprI8Const, kExprI32And, kExprI32StoreMem8, 00, 00,
733 kExprGetLocal, 04, kExprI32Const, 0x0b, kExprI32Add,
734 kExprI8Const, kExprI32StoreMem8, kExprI32StoreMem8, 00, 00,
735 kExprGetLocal, 04, kExprI32Const, 0x0c, kExprI32Add,
736 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
737 kExprGetLocal, 04, kExprI32Const, 0x0d, kExprI32Add,
738 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
739 kExprGetLocal, 04, kExprI32Const, 0x0e, kExprI32Add,
740 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
741 kExprGetLocal, 04, kExprI32Const, 0x0f, kExprI32Add,
742 kExprI8Const, 06, kExprI32StoreMem8, 00, 00,
743 kExprGetLocal, 04, kExprI32Const, 0x10, kExprI32Add,
744 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
745 kExprGetLocal, 04, kExprI32Const, 0x11, kExprI32Add,
746 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
747 kExprGetLocal, 04, kExprI32Const, 0x12, kExprI32Add,
748 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
749 kExprGetLocal, 04, kExprI32Const, 0x13, kExprI32Add,
750 kExprI8Const, kExprSetLocal, kExprI32StoreMem8, 00, 00,
751 kExprGetLocal, 04, kExprI32Const, 0x14, kExprI32Add,
752 kExprI8Const, 0x06, kExprI32StoreMem8, 00, 00,
753 kExprGetLocal, 04, kExprI32Const, 0x15, kExprI32Add,
754 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
755 kExprGetLocal, 04, kExprI32Const, 0x16, kExprI32Add,
756 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
757 kExprGetLocal, 04, kExprI32Const, 0x17, kExprI32Add,
758 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
759 kExprGetLocal, 04, kExprI32Const, 0x18, kExprI32Add,
760 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
761 kExprGetLocal, 04, kExprI32Const, 0x19, kExprI32Add,
762 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
763 kExprGetLocal, 04, kExprI32Const, 0x1a, kExprI32Add,
764 kExprI8Const, kExprSetLocal, kExprI32StoreMem8, 00, 00,
765 kExprGetLocal, 04, kExprI32Const, 0x1b, kExprI32Add,
766 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
767 kExprGetLocal, 04, kExprI32Const, 0x1c, kExprI32Add,
768 kExprI8Const, kExprBr, kExprI32StoreMem8, 00, 00,
769 kExprGetLocal, 04, kExprI32Const, 0x1d, kExprI32Add,
770 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
771 kExprGetLocal, 04, kExprI32Const, 0x1e, kExprI32Add,
772 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
773 kExprGetLocal, 04, kExprI32Const, 0x1f, kExprI32Add,
774 kExprI8Const, kExprEnd, kExprI32StoreMem8, 00, 00,
775 kExprGetLocal, 04, kExprI32Const, 0x20, kExprI32Add,
776 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
777 kExprGetLocal, 04, kExprI32Const, 0x21, kExprI32Add,
778 kExprI8Const, 05, kExprI32StoreMem8, 00, 00,
779 kExprGetLocal, 04, kExprI32Const, 0x22, kExprI32Add,
780 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
781 kExprGetLocal, 04, kExprI32Const, 0x23, kExprI32Add,
782 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
783 kExprGetLocal, 04, kExprI32Const, 0x24, kExprI32Add,
784 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
785 kExprGetLocal, 04, kExprI32Const, 0x25, kExprI32Add,
786 kExprI8Const, kExprSetLocal, kExprI32StoreMem8, 00, 00,
787 kExprGetLocal, 04, kExprI32Const, 0x26, kExprI32Add,
788 kExprI8Const, 05, kExprI32StoreMem8, 00, 00,
789 kExprGetLocal, 04, kExprI32Const, 0x27, kExprI32Add,
790 kExprI8Const, kExprGetLocal, kExprI32StoreMem8, 00, 00,
791 kExprGetLocal, 04, kExprI32Const, 0x28, kExprI32Add,
792 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
793 kExprGetLocal, 04, kExprI32Const, 0x29, kExprI32Add,
794 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
795 kExprGetLocal, 04, kExprI32Const, 0x2a, kExprI32Add,
796 kExprI8Const, 02, kExprI32StoreMem8, 00, 00,
797 kExprGetLocal, 04, kExprI32Const, 0x2b, kExprI32Add,
798 kExprI8Const, kExprI32Add, kExprI32StoreMem8, 00, 00,
799 kExprGetLocal, 04, kExprI32Const, 0x2c, kExprI32Add,
800 kExprI8Const, kExprSetLocal, kExprI32StoreMem8, 00, 00,
801 kExprGetLocal, 04, kExprI32Const, 0x2d, kExprI32Add,
802 kExprI8Const, 04, kExprI32StoreMem8, 00, 00,
803 kExprGetLocal, 04, kExprI32Const, 0x2e, kExprI32Add,
804 kExprI8Const, kExprBr, kExprI32StoreMem8, 00, 00,
805 kExprGetLocal, 04, kExprI32Const, 0x2f, kExprI32Add,
806 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
807 kExprGetLocal, 04, kExprI32Const, 0x30, kExprI32Add,
808 kExprI8Const, 00, kExprI32StoreMem8, 00, 00,
809 kExprGetLocal, 04, kExprI32Const, 0x31, kExprI32Add,
810 kExprI8Const, kExprEnd, kExprI32StoreMem8, 00, 00,
811 // Change this
812 kExprGetLocal, 04, kExprI32Const, 0x32, kExprI32Add,
813 kExprI8Const, kExprI32Const, kExprI32StoreMem8, 00, 00,
814 kExprGetLocal, 04, kExprI32Const, 0x33, kExprI32Add,
815 kExprI8Const, 01, kExprI32StoreMem8, 00, 00,
816 kExprGetLocal, 04,
817 kExprI32Const, 0x34,
818 kExprI32Add,
819 kExprSetLocal, 04,
820 // Call Filter function
821 kExprI32Const, 0x80, 0x20,
822 kExprGetLocal, 04,
823 kExprI32Const, 0x80, 0x20,
824 kExprI32Sub,
825 kExprI32Const, 01,
826 kExprJITSingleFunction, sig_index4,
827 kExprI32Const, 01,
828 kExprGetLocal, 00,
829 kExprGetLocal, 01,
830 kExprGetLocal, 02,
831 kExprI32Const, 0x80, 0xc0, 0x00,
832 kExprCallIndirect, kArity4, sig_index4
833 ])
834 .exportFunc()
835 builder.appendToTable([0]);
836 return builder;
837 })();
838
839 // Check that the module is properly defined
840 function testBasics() {
841 var module = builder.instantiate({});
842
843 assertFalse(module === undefined);
844 assertFalse(module === null);
845 assertFalse(module === 0);
846 assertEquals("object", typeof module.exports);
847 assertEquals("function", typeof module.exports.main);
848 }
849
850 testBasics();
851
852
853 function testMatrix(rows, columns, input_buffer, matrix_buffer,
854 expected_buffer) {
855 var matrix_start = 0;
856 builder.addDataSegment(matrix_start, matrix_buffer, false);
857
858 var input_start = 9;
859 var input_size = input_buffer.length;
860 builder.addDataSegment(input_start, input_buffer, false);
861
862 var test_module = builder.instantiate();
863
864 // Check that the filter function returns 1
865 assertEquals(1, test_module.exports.main(rows, columns,
866 input_start, matrix_start));
867
868 // Check filtered data
869 var output_buffer = new Uint8Array(test_module.exports.memory);
870 for (var i = 0; i < input_size; ++i) {
871 assertEquals(expected_buffer[i], output_buffer[i + 8192]);
872 }
873 }
874
875 function testZeroMatrix(){
876 var matrix, input, expected;
877 matrix = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
878
879 input = [0x05];
880 expected = [0x05];
881 testMatrix(1, 1, input, matrix, expected);
882
883 input = [0x0d, 0x2e, 0x2f, 0x01, 0x36, 0x20, 0x19, 0x12, 0x11];
884 expected = [0x0d, 0x2e, 0x2f, 0x01, 0x00, 0x20, 0x19, 0x12, 0x11];
885 testMatrix(3, 3, input, matrix, expected);
886
887 input = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
888 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
889 0x16, 0x17, 0x18];
890 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, 0x09, 0x0a,
891 0x00, 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x14, 0x15,
892 0x16, 0x17, 0x18];
893 testMatrix(5, 5, input, matrix, expected);
894
895 input = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
896 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b];
897 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x00,
898 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0b];
899 testMatrix(3, 4, input, matrix, expected);
900 }
901
902 testZeroMatrix();
903
904 function testSingleEntryMatrix(){
905 var input, expected;
906 var matrix1 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
907 var matrix2 = [0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00];
908 var matrix3 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00];
909
910 // 3 x 3 input
911 input = [0x0d, 0x2e, 0x2f, 0x01, 0x36, 0x20, 0x19, 0x12, 0x11];
912 expected = [0x0d, 0x2e, 0x2f, 0x01, 0x0d, 0x20, 0x19, 0x12, 0x11];
913 testMatrix(3, 3, input, matrix1, expected);
914 expected = [0x0d, 0x2e, 0x2f, 0x01, 0x36, 0x20, 0x19, 0x12, 0x11];
915 testMatrix(3, 3, input, matrix2, expected);
916 expected = [0x0d, 0x2e, 0x2f, 0x01, 0x20, 0x20, 0x19, 0x12, 0x11];
917 testMatrix(3, 3, input, matrix3, expected);
918
919 // 5 x 5 input
920 input = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
921 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
922 0x16, 0x17, 0x18];
923 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x01, 0x02, 0x09, 0x0a,
924 0x05, 0x06, 0x07, 0x0e, 0x0f, 0x0a, 0x0b, 0x0c, 0x13, 0x14, 0x15,
925 0x16, 0x17, 0x18];
926 testMatrix(5, 5, input, matrix1, expected);
927 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
928 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
929 0x16, 0x17, 0x18];
930 testMatrix(5, 5, input, matrix2, expected);
931 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x08, 0x09, 0x09, 0x0a,
932 0x0c, 0x0d, 0x0e, 0x0e, 0x0f, 0x11, 0x12, 0x13, 0x13, 0x14, 0x15,
933 0x16, 0x17, 0x18];
934 testMatrix(5, 5, input, matrix3, expected);
935
936 // 3 x 4 input
937 input = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
938 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b];
939 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x00,
940 0x01, 0x07, 0x08, 0x09, 0x0a, 0x0b];
941 testMatrix(3, 4, input, matrix1, expected);
942 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
943 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b];
944 testMatrix(3, 4, input, matrix2, expected);
945 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x06,
946 0x07, 0x07, 0x08, 0x09, 0x0a, 0x0b];
947 testMatrix(3, 4, input, matrix3, expected);
948 }
949
950 testSingleEntryMatrix();
951
952 function testComplexMatrix() {
953 var input, expected;
954 var matrix1 = [0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01];
955 var matrix2 = [0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04];
956 var matrix3 = [0x00, 0x01, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00];
957
958 // 3 x 3 input
959 input = [0x0d, 0x2e, 0x2f, 0x01, 0x36, 0x20, 0x19, 0x12, 0x11];
960 expected = [0x0d, 0x2e, 0x2f, 0x01, 0x87, 0x20, 0x19, 0x12, 0x11];
961 testMatrix(3, 3, input, matrix1, expected);
962 expected = [0x0d, 0x2e, 0x2f, 0x01, 0xf4, 0x20, 0x19, 0x12, 0x11];
963 testMatrix(3, 3, input, matrix2, expected);
964 expected = [0x0d, 0x2e, 0x2f, 0x01, 0x39, 0x20, 0x19, 0x12, 0x11];
965 testMatrix(3, 3, input, matrix3, expected);
966
967 // 5 x 5 input
968 input = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
969 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
970 0x16, 0x17, 0x18];
971 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x24, 0x2a, 0x30, 0x09, 0x0a,
972 0x42, 0x48, 0x4e, 0x0e, 0x0f, 0x60, 0x66, 0x6c, 0x13, 0x14, 0x15,
973 0x16, 0x17, 0x18];
974 testMatrix(5, 5, input, matrix1, expected);
975 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0xd8, 0xfc, 0x20, 0x09, 0x0a,
976 0x8c, 0xb0, 0xd4, 0x0e, 0x0f, 0x40, 0x64, 0x88, 0x13, 0x14, 0x15,
977 0x16, 0x17, 0x18];
978 testMatrix(5, 5, input, matrix2, expected);
979 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x30, 0x38, 0x40, 0x09, 0x0a,
980 0x58, 0x60, 0x68, 0x0e, 0x0f, 0x80, 0x88, 0x90, 0x13, 0x14, 0x15,
981 0x16, 0x17, 0x18];
982 testMatrix(5, 5, input, matrix3, expected);
983
984 // 3 x 4 input
985 input = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
986 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b];
987 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x1e,
988 0x24, 0x07, 0x08, 0x09, 0x0a, 0x0b];
989 testMatrix(3, 4, input, matrix1, expected);
990 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0xb4,
991 0xd8, 0x07, 0x08, 0x09, 0x0a, 0x0b];
992 testMatrix(3, 4, input, matrix2, expected);
993 expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x28,
994 0x30, 0x07, 0x08, 0x09, 0x0a, 0x0b];
995 testMatrix(3, 4, input, matrix3, expected);
996 }
997
998 testComplexMatrix();
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | test/mjsunit/wasm/wasm-constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698