Lines Matching refs:inst
103 qir_get_non_sideband_nsrc(struct qinst *inst)
105 assert(qir_op_info[inst->op].name);
106 return qir_op_info[inst->op].nsrc;
110 qir_get_nsrc(struct qinst *inst)
112 assert(qir_op_info[inst->op].name);
114 int nsrc = qir_get_non_sideband_nsrc(inst);
119 if (qir_is_tex(inst) && inst->dst.file != QFILE_TEX_S_DIRECT)
129 qir_get_tex_uniform_src(struct qinst *inst)
131 return qir_get_nsrc(inst) - 1;
139 qir_has_side_effects(struct vc4_compile *c, struct qinst *inst)
141 switch (inst->dst.file) {
156 return qir_op_info[inst->op].has_side_effects;
160 qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst)
167 for (int i = 0; i < qir_get_nsrc(inst); i++) {
168 if (inst->src[i].file == QFILE_VARY &&
169 c->input_slots[inst->src[i].index].slot == 0xff) {
173 if (inst->src[i].file == QFILE_VPM)
177 if (inst->dst.file == QFILE_VPM)
184 qir_has_uniform_read(struct qinst *inst)
186 for (int i = 0; i < qir_get_nsrc(inst); i++) {
187 if (inst->src[i].file == QFILE_UNIF)
195 qir_is_mul(struct qinst *inst)
197 switch (inst->op) {
214 qir_is_float_input(struct qinst *inst)
216 switch (inst->op) {
233 qir_is_raw_mov(struct qinst *inst)
235 return ((inst->op == QOP_MOV ||
236 inst->op == QOP_FMOV ||
237 inst->op == QOP_MMOV) &&
238 inst->cond == QPU_COND_ALWAYS &&
239 !inst->dst.pack &&
240 !inst->src[0].pack);
244 qir_is_tex(struct qinst *inst)
246 switch (inst->dst.file) {
259 qir_has_implicit_tex_uniform(struct qinst *inst)
261 switch (inst->dst.file) {
273 qir_depends_on_flags(struct qinst *inst)
275 if (inst->op == QOP_BRANCH) {
276 return inst->cond != QPU_COND_BRANCH_ALWAYS;
278 return (inst->cond != QPU_COND_ALWAYS &&
279 inst->cond != QPU_COND_NEVER);
284 qir_writes_r4(struct qinst *inst)
286 switch (inst->op) {
300 qir_channels_written(struct qinst *inst)
302 if (qir_is_mul(inst)) {
303 switch (inst->dst.pack) {
317 switch (inst->dst.pack) {
466 qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
468 fprintf(stderr, "%s", qir_get_op_name(inst->op));
469 if (inst->op == QOP_BRANCH)
470 vc4_qpu_disasm_cond_branch(stderr, inst->cond);
472 vc4_qpu_disasm_cond(stderr, inst->cond);
473 if (inst->sf)
477 if (inst->op != QOP_BRANCH) {
478 qir_print_reg(c, inst->dst, true);
479 if (inst->dst.pack) {
480 if (inst->dst.pack) {
481 if (qir_is_mul(inst))
482 vc4_qpu_disasm_pack_mul(stderr, inst->dst.pack);
484 vc4_qpu_disasm_pack_a(stderr, inst->dst.pack);
489 for (int i = 0; i < qir_get_nsrc(inst); i++) {
491 qir_print_reg(c, inst->src[i], false);
492 vc4_qpu_disasm_unpack(stderr, inst->src[i].pack);
504 qir_for_each_inst(inst, block) {
551 qir_dump_inst(c, inst);
590 struct qinst *inst = CALLOC_STRUCT(qinst);
592 inst->op = op;
593 inst->dst = dst;
594 inst->src[0] = src0;
595 inst->src[1] = src1;
596 inst->cond = QPU_COND_ALWAYS;
598 return inst;
602 qir_emit(struct vc4_compile *c, struct qinst *inst)
604 list_addtail(&inst->link, &c->cur_block->instructions);
607 /* Updates inst to write to a new temporary, emits it, and notes the def. */
609 qir_emit_def(struct vc4_compile *c, struct qinst *inst)
611 assert(inst->dst.file == QFILE_NULL);
613 inst->dst = qir_get_temp(c);
615 if (inst->dst.file == QFILE_TEMP)
616 c->defs[inst->dst.index] = inst;
618 qir_emit(c, inst);
620 return inst->dst;
624 qir_emit_nondef(struct vc4_compile *c, struct qinst *inst)
626 if (inst->dst.file == QFILE_TEMP)
627 c->defs[inst->dst.index] = NULL;
629 qir_emit(c, inst);
631 return inst;