vc4: Add a QIR value for the QPU element register.
[mesa.git] / src / gallium / drivers / vc4 / vc4_qir.c
1 /*
2 * Copyright © 2014 Broadcom
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "util/u_memory.h"
25 #include "util/ralloc.h"
26
27 #include "vc4_qir.h"
28 #include "vc4_qpu.h"
29
30 struct qir_op_info {
31 const char *name;
32 uint8_t ndst, nsrc;
33 bool has_side_effects;
34 };
35
36 static const struct qir_op_info qir_op_info[] = {
37 [QOP_MOV] = { "mov", 1, 1 },
38 [QOP_FMOV] = { "fmov", 1, 1 },
39 [QOP_MMOV] = { "mmov", 1, 1 },
40 [QOP_FADD] = { "fadd", 1, 2 },
41 [QOP_FSUB] = { "fsub", 1, 2 },
42 [QOP_FMUL] = { "fmul", 1, 2 },
43 [QOP_MUL24] = { "mul24", 1, 2 },
44 [QOP_V8MULD] = {"v8muld", 1, 2 },
45 [QOP_V8MIN] = {"v8min", 1, 2 },
46 [QOP_V8MAX] = {"v8max", 1, 2 },
47 [QOP_V8ADDS] = {"v8adds", 1, 2 },
48 [QOP_V8SUBS] = {"v8subs", 1, 2 },
49 [QOP_FMIN] = { "fmin", 1, 2 },
50 [QOP_FMAX] = { "fmax", 1, 2 },
51 [QOP_FMINABS] = { "fminabs", 1, 2 },
52 [QOP_FMAXABS] = { "fmaxabs", 1, 2 },
53 [QOP_FTOI] = { "ftoi", 1, 1 },
54 [QOP_ITOF] = { "itof", 1, 1 },
55 [QOP_ADD] = { "add", 1, 2 },
56 [QOP_SUB] = { "sub", 1, 2 },
57 [QOP_SHR] = { "shr", 1, 2 },
58 [QOP_ASR] = { "asr", 1, 2 },
59 [QOP_SHL] = { "shl", 1, 2 },
60 [QOP_MIN] = { "min", 1, 2 },
61 [QOP_MAX] = { "max", 1, 2 },
62 [QOP_AND] = { "and", 1, 2 },
63 [QOP_OR] = { "or", 1, 2 },
64 [QOP_XOR] = { "xor", 1, 2 },
65 [QOP_NOT] = { "not", 1, 1 },
66
67 [QOP_RCP] = { "rcp", 1, 1 },
68 [QOP_RSQ] = { "rsq", 1, 1 },
69 [QOP_EXP2] = { "exp2", 1, 1 },
70 [QOP_LOG2] = { "log2", 1, 1 },
71 [QOP_TLB_COLOR_READ] = { "tlb_color_read", 1, 0 },
72 [QOP_MS_MASK] = { "ms_mask", 0, 1, true },
73 [QOP_VARY_ADD_C] = { "vary_add_c", 1, 1 },
74
75 [QOP_FRAG_Z] = { "frag_z", 1, 0 },
76 [QOP_FRAG_W] = { "frag_w", 1, 0 },
77
78 [QOP_TEX_S] = { "tex_s", 0, 2, true },
79 [QOP_TEX_T] = { "tex_t", 0, 2, true },
80 [QOP_TEX_R] = { "tex_r", 0, 2, true },
81 [QOP_TEX_B] = { "tex_b", 0, 2, true },
82 [QOP_TEX_DIRECT] = { "tex_direct", 0, 2, true },
83 [QOP_TEX_RESULT] = { "tex_result", 1, 0, true },
84
85 [QOP_LOAD_IMM] = { "load_imm", 0, 1 },
86
87 [QOP_BRANCH] = { "branch", 0, 0, true },
88 [QOP_UNIFORMS_RESET] = { "uniforms_reset", 0, 2, true },
89 };
90
91 static const char *
92 qir_get_op_name(enum qop qop)
93 {
94 if (qop < ARRAY_SIZE(qir_op_info) && qir_op_info[qop].name)
95 return qir_op_info[qop].name;
96 else
97 return "???";
98 }
99
100 int
101 qir_get_op_nsrc(enum qop qop)
102 {
103 if (qop < ARRAY_SIZE(qir_op_info) && qir_op_info[qop].name)
104 return qir_op_info[qop].nsrc;
105 else
106 abort();
107 }
108
109 /**
110 * Returns whether the instruction has any side effects that must be
111 * preserved.
112 */
113 bool
114 qir_has_side_effects(struct vc4_compile *c, struct qinst *inst)
115 {
116 switch (inst->dst.file) {
117 case QFILE_TLB_Z_WRITE:
118 case QFILE_TLB_COLOR_WRITE:
119 case QFILE_TLB_COLOR_WRITE_MS:
120 case QFILE_TLB_STENCIL_SETUP:
121 return true;
122 default:
123 break;
124 }
125
126 return qir_op_info[inst->op].has_side_effects;
127 }
128
129 bool
130 qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst)
131 {
132 /* We can dead-code eliminate varyings, because we only tell the VS
133 * about the live ones at the end. But we have to preserve the
134 * point/line coordinates reads, because they're generated by
135 * fixed-function hardware.
136 */
137 for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
138 if (inst->src[i].file == QFILE_VARY &&
139 c->input_slots[inst->src[i].index].slot == 0xff) {
140 return true;
141 }
142
143 if (inst->src[i].file == QFILE_VPM)
144 return true;
145 }
146
147 if (inst->dst.file == QFILE_VPM)
148 return true;
149
150 return false;
151 }
152
153 bool
154 qir_is_mul(struct qinst *inst)
155 {
156 switch (inst->op) {
157 case QOP_MMOV:
158 case QOP_FMUL:
159 case QOP_MUL24:
160 case QOP_V8MULD:
161 case QOP_V8MIN:
162 case QOP_V8MAX:
163 case QOP_V8ADDS:
164 case QOP_V8SUBS:
165 return true;
166 default:
167 return false;
168 }
169 }
170
171 bool
172 qir_is_float_input(struct qinst *inst)
173 {
174 switch (inst->op) {
175 case QOP_FMOV:
176 case QOP_FMUL:
177 case QOP_FADD:
178 case QOP_FSUB:
179 case QOP_FMIN:
180 case QOP_FMAX:
181 case QOP_FMINABS:
182 case QOP_FMAXABS:
183 case QOP_FTOI:
184 return true;
185 default:
186 return false;
187 }
188 }
189
190 bool
191 qir_is_raw_mov(struct qinst *inst)
192 {
193 return ((inst->op == QOP_MOV ||
194 inst->op == QOP_FMOV ||
195 inst->op == QOP_MMOV) &&
196 inst->cond == QPU_COND_ALWAYS &&
197 !inst->dst.pack &&
198 !inst->src[0].pack);
199 }
200
201 bool
202 qir_is_tex(struct qinst *inst)
203 {
204 return inst->op >= QOP_TEX_S && inst->op <= QOP_TEX_DIRECT;
205 }
206
207 bool
208 qir_depends_on_flags(struct qinst *inst)
209 {
210 if (inst->op == QOP_BRANCH) {
211 return inst->cond != QPU_COND_BRANCH_ALWAYS;
212 } else {
213 return (inst->cond != QPU_COND_ALWAYS &&
214 inst->cond != QPU_COND_NEVER);
215 }
216 }
217
218 bool
219 qir_writes_r4(struct qinst *inst)
220 {
221 switch (inst->op) {
222 case QOP_TEX_RESULT:
223 case QOP_TLB_COLOR_READ:
224 case QOP_RCP:
225 case QOP_RSQ:
226 case QOP_EXP2:
227 case QOP_LOG2:
228 return true;
229 default:
230 return false;
231 }
232 }
233
234 uint8_t
235 qir_channels_written(struct qinst *inst)
236 {
237 if (qir_is_mul(inst)) {
238 switch (inst->dst.pack) {
239 case QPU_PACK_MUL_NOP:
240 case QPU_PACK_MUL_8888:
241 return 0xf;
242 case QPU_PACK_MUL_8A:
243 return 0x1;
244 case QPU_PACK_MUL_8B:
245 return 0x2;
246 case QPU_PACK_MUL_8C:
247 return 0x4;
248 case QPU_PACK_MUL_8D:
249 return 0x8;
250 }
251 } else {
252 switch (inst->dst.pack) {
253 case QPU_PACK_A_NOP:
254 case QPU_PACK_A_8888:
255 case QPU_PACK_A_8888_SAT:
256 case QPU_PACK_A_32_SAT:
257 return 0xf;
258 case QPU_PACK_A_8A:
259 case QPU_PACK_A_8A_SAT:
260 return 0x1;
261 case QPU_PACK_A_8B:
262 case QPU_PACK_A_8B_SAT:
263 return 0x2;
264 case QPU_PACK_A_8C:
265 case QPU_PACK_A_8C_SAT:
266 return 0x4;
267 case QPU_PACK_A_8D:
268 case QPU_PACK_A_8D_SAT:
269 return 0x8;
270 case QPU_PACK_A_16A:
271 case QPU_PACK_A_16A_SAT:
272 return 0x3;
273 case QPU_PACK_A_16B:
274 case QPU_PACK_A_16B_SAT:
275 return 0xc;
276 }
277 }
278 unreachable("Bad pack field");
279 }
280
281 static void
282 qir_print_reg(struct vc4_compile *c, struct qreg reg, bool write)
283 {
284 static const char *files[] = {
285 [QFILE_TEMP] = "t",
286 [QFILE_VARY] = "v",
287 [QFILE_UNIF] = "u",
288 [QFILE_TLB_COLOR_WRITE] = "tlb_c",
289 [QFILE_TLB_COLOR_WRITE_MS] = "tlb_c_ms",
290 [QFILE_TLB_Z_WRITE] = "tlb_z",
291 [QFILE_TLB_STENCIL_SETUP] = "tlb_stencil",
292 [QFILE_FRAG_X] = "frag_x",
293 [QFILE_FRAG_Y] = "frag_y",
294 [QFILE_FRAG_REV_FLAG] = "frag_rev_flag",
295 [QFILE_QPU_ELEMENT] = "elem",
296 };
297
298 switch (reg.file) {
299
300 case QFILE_NULL:
301 fprintf(stderr, "null");
302 break;
303
304 case QFILE_LOAD_IMM:
305 fprintf(stderr, "0x%08x (%f)", reg.index, uif(reg.index));
306 break;
307
308 case QFILE_SMALL_IMM:
309 if ((int)reg.index >= -16 && (int)reg.index <= 15)
310 fprintf(stderr, "%d", reg.index);
311 else
312 fprintf(stderr, "%f", uif(reg.index));
313 break;
314
315 case QFILE_VPM:
316 if (write) {
317 fprintf(stderr, "vpm");
318 } else {
319 fprintf(stderr, "vpm%d.%d",
320 reg.index / 4, reg.index % 4);
321 }
322 break;
323
324 case QFILE_TLB_COLOR_WRITE:
325 case QFILE_TLB_COLOR_WRITE_MS:
326 case QFILE_TLB_Z_WRITE:
327 case QFILE_TLB_STENCIL_SETUP:
328 fprintf(stderr, "%s", files[reg.file]);
329 break;
330
331 default:
332 fprintf(stderr, "%s%d", files[reg.file], reg.index);
333 break;
334 }
335
336 if (reg.file == QFILE_UNIF &&
337 c->uniform_contents[reg.index] == QUNIFORM_CONSTANT) {
338 fprintf(stderr, " (0x%08x / %f)",
339 c->uniform_data[reg.index],
340 uif(c->uniform_data[reg.index]));
341 }
342 }
343
344 void
345 qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
346 {
347 fprintf(stderr, "%s", qir_get_op_name(inst->op));
348 if (inst->op == QOP_BRANCH)
349 vc4_qpu_disasm_cond_branch(stderr, inst->cond);
350 else
351 vc4_qpu_disasm_cond(stderr, inst->cond);
352 if (inst->sf)
353 fprintf(stderr, ".sf");
354 fprintf(stderr, " ");
355
356 if (inst->op != QOP_BRANCH) {
357 qir_print_reg(c, inst->dst, true);
358 if (inst->dst.pack) {
359 if (inst->dst.pack) {
360 if (qir_is_mul(inst))
361 vc4_qpu_disasm_pack_mul(stderr, inst->dst.pack);
362 else
363 vc4_qpu_disasm_pack_a(stderr, inst->dst.pack);
364 }
365 }
366 }
367
368 for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
369 fprintf(stderr, ", ");
370 qir_print_reg(c, inst->src[i], false);
371 vc4_qpu_disasm_unpack(stderr, inst->src[i].pack);
372 }
373 }
374
375 void
376 qir_dump(struct vc4_compile *c)
377 {
378 int ip = 0;
379
380 qir_for_each_block(block, c) {
381 fprintf(stderr, "BLOCK %d:\n", block->index);
382 qir_for_each_inst(inst, block) {
383 if (c->temp_start) {
384 bool first = true;
385
386 for (int i = 0; i < c->num_temps; i++) {
387 if (c->temp_start[i] != ip)
388 continue;
389
390 if (first) {
391 first = false;
392 } else {
393 fprintf(stderr, ", ");
394 }
395 fprintf(stderr, "S%4d", i);
396 }
397
398 if (first)
399 fprintf(stderr, " ");
400 else
401 fprintf(stderr, " ");
402 }
403
404 if (c->temp_end) {
405 bool first = true;
406
407 for (int i = 0; i < c->num_temps; i++) {
408 if (c->temp_end[i] != ip)
409 continue;
410
411 if (first) {
412 first = false;
413 } else {
414 fprintf(stderr, ", ");
415 }
416 fprintf(stderr, "E%4d", i);
417 }
418
419 if (first)
420 fprintf(stderr, " ");
421 else
422 fprintf(stderr, " ");
423 }
424
425 qir_dump_inst(c, inst);
426 fprintf(stderr, "\n");
427 ip++;
428 }
429 if (block->successors[1]) {
430 fprintf(stderr, "-> BLOCK %d, %d\n",
431 block->successors[0]->index,
432 block->successors[1]->index);
433 } else if (block->successors[0]) {
434 fprintf(stderr, "-> BLOCK %d\n",
435 block->successors[0]->index);
436 }
437 }
438 }
439
440 struct qreg
441 qir_get_temp(struct vc4_compile *c)
442 {
443 struct qreg reg;
444
445 reg.file = QFILE_TEMP;
446 reg.index = c->num_temps++;
447 reg.pack = 0;
448
449 if (c->num_temps > c->defs_array_size) {
450 uint32_t old_size = c->defs_array_size;
451 c->defs_array_size = MAX2(old_size * 2, 16);
452 c->defs = reralloc(c, c->defs, struct qinst *,
453 c->defs_array_size);
454 memset(&c->defs[old_size], 0,
455 sizeof(c->defs[0]) * (c->defs_array_size - old_size));
456 }
457
458 return reg;
459 }
460
461 struct qinst *
462 qir_inst(enum qop op, struct qreg dst, struct qreg src0, struct qreg src1)
463 {
464 struct qinst *inst = CALLOC_STRUCT(qinst);
465
466 inst->op = op;
467 inst->dst = dst;
468 inst->src = calloc(2, sizeof(inst->src[0]));
469 inst->src[0] = src0;
470 inst->src[1] = src1;
471 inst->cond = QPU_COND_ALWAYS;
472
473 return inst;
474 }
475
476 struct qinst *
477 qir_inst4(enum qop op, struct qreg dst,
478 struct qreg a,
479 struct qreg b,
480 struct qreg c,
481 struct qreg d)
482 {
483 struct qinst *inst = CALLOC_STRUCT(qinst);
484
485 inst->op = op;
486 inst->dst = dst;
487 inst->src = calloc(4, sizeof(*inst->src));
488 inst->src[0] = a;
489 inst->src[1] = b;
490 inst->src[2] = c;
491 inst->src[3] = d;
492
493 return inst;
494 }
495
496 static void
497 qir_emit(struct vc4_compile *c, struct qinst *inst)
498 {
499 list_addtail(&inst->link, &c->cur_block->instructions);
500 }
501
502 /* Updates inst to write to a new temporary, emits it, and notes the def. */
503 struct qreg
504 qir_emit_def(struct vc4_compile *c, struct qinst *inst)
505 {
506 assert(inst->dst.file == QFILE_NULL);
507
508 inst->dst = qir_get_temp(c);
509
510 if (inst->dst.file == QFILE_TEMP)
511 c->defs[inst->dst.index] = inst;
512
513 qir_emit(c, inst);
514
515 return inst->dst;
516 }
517
518 struct qinst *
519 qir_emit_nondef(struct vc4_compile *c, struct qinst *inst)
520 {
521 if (inst->dst.file == QFILE_TEMP)
522 c->defs[inst->dst.index] = NULL;
523
524 qir_emit(c, inst);
525
526 return inst;
527 }
528
529 bool
530 qir_reg_equals(struct qreg a, struct qreg b)
531 {
532 return a.file == b.file && a.index == b.index && a.pack == b.pack;
533 }
534
535 struct qblock *
536 qir_new_block(struct vc4_compile *c)
537 {
538 struct qblock *block = rzalloc(c, struct qblock);
539
540 list_inithead(&block->instructions);
541 list_inithead(&block->qpu_inst_list);
542
543 block->predecessors = _mesa_set_create(block,
544 _mesa_hash_pointer,
545 _mesa_key_pointer_equal);
546
547 block->index = c->next_block_index++;
548
549 return block;
550 }
551
552 void
553 qir_set_emit_block(struct vc4_compile *c, struct qblock *block)
554 {
555 c->cur_block = block;
556 list_addtail(&block->link, &c->blocks);
557 }
558
559 struct qblock *
560 qir_entry_block(struct vc4_compile *c)
561 {
562 return list_first_entry(&c->blocks, struct qblock, link);
563 }
564
565 struct qblock *
566 qir_exit_block(struct vc4_compile *c)
567 {
568 return list_last_entry(&c->blocks, struct qblock, link);
569 }
570
571 void
572 qir_link_blocks(struct qblock *predecessor, struct qblock *successor)
573 {
574 _mesa_set_add(successor->predecessors, predecessor);
575 if (predecessor->successors[0]) {
576 assert(!predecessor->successors[1]);
577 predecessor->successors[1] = successor;
578 } else {
579 predecessor->successors[0] = successor;
580 }
581 }
582
583 struct vc4_compile *
584 qir_compile_init(void)
585 {
586 struct vc4_compile *c = rzalloc(NULL, struct vc4_compile);
587
588 list_inithead(&c->blocks);
589 qir_set_emit_block(c, qir_new_block(c));
590
591 c->output_position_index = -1;
592 c->output_color_index = -1;
593 c->output_point_size_index = -1;
594 c->output_sample_mask_index = -1;
595
596 c->def_ht = _mesa_hash_table_create(c, _mesa_hash_pointer,
597 _mesa_key_pointer_equal);
598
599 return c;
600 }
601
602 void
603 qir_remove_instruction(struct vc4_compile *c, struct qinst *qinst)
604 {
605 if (qinst->dst.file == QFILE_TEMP)
606 c->defs[qinst->dst.index] = NULL;
607
608 list_del(&qinst->link);
609 free(qinst->src);
610 free(qinst);
611 }
612
613 struct qreg
614 qir_follow_movs(struct vc4_compile *c, struct qreg reg)
615 {
616 int pack = reg.pack;
617
618 while (reg.file == QFILE_TEMP &&
619 c->defs[reg.index] &&
620 (c->defs[reg.index]->op == QOP_MOV ||
621 c->defs[reg.index]->op == QOP_FMOV ||
622 c->defs[reg.index]->op == QOP_MMOV)&&
623 !c->defs[reg.index]->dst.pack &&
624 !c->defs[reg.index]->src[0].pack) {
625 reg = c->defs[reg.index]->src[0];
626 }
627
628 reg.pack = pack;
629 return reg;
630 }
631
632 void
633 qir_compile_destroy(struct vc4_compile *c)
634 {
635 qir_for_each_block(block, c) {
636 while (!list_empty(&block->instructions)) {
637 struct qinst *qinst =
638 list_first_entry(&block->instructions,
639 struct qinst, link);
640 qir_remove_instruction(c, qinst);
641 }
642 }
643
644 ralloc_free(c);
645 }
646
647 const char *
648 qir_get_stage_name(enum qstage stage)
649 {
650 static const char *names[] = {
651 [QSTAGE_FRAG] = "FS",
652 [QSTAGE_VERT] = "VS",
653 [QSTAGE_COORD] = "CS",
654 };
655
656 return names[stage];
657 }
658
659 struct qreg
660 qir_uniform(struct vc4_compile *c,
661 enum quniform_contents contents,
662 uint32_t data)
663 {
664 for (int i = 0; i < c->num_uniforms; i++) {
665 if (c->uniform_contents[i] == contents &&
666 c->uniform_data[i] == data) {
667 return qir_reg(QFILE_UNIF, i);
668 }
669 }
670
671 uint32_t uniform = c->num_uniforms++;
672
673 if (uniform >= c->uniform_array_size) {
674 c->uniform_array_size = MAX2(MAX2(16, uniform + 1),
675 c->uniform_array_size * 2);
676
677 c->uniform_data = reralloc(c, c->uniform_data,
678 uint32_t,
679 c->uniform_array_size);
680 c->uniform_contents = reralloc(c, c->uniform_contents,
681 enum quniform_contents,
682 c->uniform_array_size);
683 }
684
685 c->uniform_contents[uniform] = contents;
686 c->uniform_data[uniform] = data;
687
688 return qir_reg(QFILE_UNIF, uniform);
689 }
690
691 void
692 qir_SF(struct vc4_compile *c, struct qreg src)
693 {
694 struct qinst *last_inst = NULL;
695
696 if (!list_empty(&c->cur_block->instructions))
697 last_inst = (struct qinst *)c->cur_block->instructions.prev;
698
699 /* We don't have any way to guess which kind of MOV is implied. */
700 assert(!src.pack);
701
702 if (src.file != QFILE_TEMP ||
703 !c->defs[src.index] ||
704 last_inst != c->defs[src.index]) {
705 last_inst = qir_MOV_dest(c, qir_reg(QFILE_NULL, 0), src);
706 last_inst = (struct qinst *)c->cur_block->instructions.prev;
707 }
708 last_inst->sf = true;
709 }
710
711 #define OPTPASS(func) \
712 do { \
713 bool stage_progress = func(c); \
714 if (stage_progress) { \
715 progress = true; \
716 if (print_opt_debug) { \
717 fprintf(stderr, \
718 "QIR opt pass %2d: %s progress\n", \
719 pass, #func); \
720 } \
721 qir_validate(c); \
722 } \
723 } while (0)
724
725 void
726 qir_optimize(struct vc4_compile *c)
727 {
728 bool print_opt_debug = false;
729 int pass = 1;
730
731 while (true) {
732 bool progress = false;
733
734 OPTPASS(qir_opt_algebraic);
735 OPTPASS(qir_opt_constant_folding);
736 OPTPASS(qir_opt_copy_propagation);
737 OPTPASS(qir_opt_peephole_sf);
738 OPTPASS(qir_opt_dead_code);
739 OPTPASS(qir_opt_small_immediates);
740 OPTPASS(qir_opt_vpm);
741
742 if (!progress)
743 break;
744
745 pass++;
746 }
747 }