Lines Matching refs:inst

44 is_direct_copy(vec4_instruction *inst)
46 return (inst->opcode == BRW_OPCODE_MOV &&
47 !inst->predicate &&
48 inst->dst.file == VGRF &&
49 inst->dst.offset % REG_SIZE == 0 &&
50 !inst->dst.reladdr &&
51 !inst->src[0].reladdr &&
52 (inst->dst.type == inst->src[0].type ||
53 (inst->dst.type == BRW_REGISTER_TYPE_F &&
54 inst->src[0].type == BRW_REGISTER_TYPE_VF)));
58 is_dominated_by_previous_instruction(vec4_instruction *inst)
60 return (inst->opcode != BRW_OPCODE_DO &&
61 inst->opcode != BRW_OPCODE_WHILE &&
62 inst->opcode != BRW_OPCODE_ELSE &&
63 inst->opcode != BRW_OPCODE_ENDIF);
67 is_channel_updated(vec4_instruction *inst, src_reg *values[4], int ch)
72 assert(inst->dst.file == VGRF);
76 return regions_overlap(*src, REG_SIZE, inst->dst, inst->size_written) &&
77 (inst->dst.offset != src->offset ||
78 inst->dst.writemask & (1 << BRW_GET_SWZ(src->swizzle, ch)));
136 vec4_instruction *inst,
148 brw_apply_inv_swizzle_to_mask(inst->src[arg].swizzle,
158 if (type_sz(value.type) == 8 || type_sz(inst->src[arg].type) == 8)
165 if (inst->src[arg].type != BRW_REGISTER_TYPE_F)
168 value.type = inst->src[arg].type;
171 if (inst->src[arg].abs) {
172 if ((devinfo->gen >= 8 && is_logic_op(inst->opcode)) ||
178 if (inst->src[arg].negate) {
179 if ((devinfo->gen >= 8 && is_logic_op(inst->opcode)) ||
185 value = swizzle(value, inst->src[arg].swizzle);
187 switch (inst->opcode) {
190 inst->src[arg] = value;
209 inst->src[arg] = value;
223 inst->src[arg] = value;
225 } else if (arg == 0 && inst->src[1].file != IMM) {
229 if ((inst->opcode == BRW_OPCODE_MUL ||
230 inst->opcode == BRW_OPCODE_MACH) &&
231 (inst->src[1].type == BRW_REGISTER_TYPE_D ||
232 inst->src[1].type == BRW_REGISTER_TYPE_UD))
234 inst->src[0] = inst->src[1];
235 inst->src[1] = value;
244 inst->src[arg] = value;
249 inst->src[arg] = value;
251 } else if (arg == 0 && inst->src[1].file != IMM) {
254 new_cmod = brw_swap_cmod(inst->conditional_mod);
259 inst->src[0] = inst->src[1];
260 inst->src[1] = value;
261 inst->conditional_mod = new_cmod;
269 inst->src[arg] = value;
271 } else if (arg == 0 && inst->src[1].file != IMM) {
272 inst->src[0] = inst->src[1];
273 inst->src[1] = value;
278 if (inst->conditional_mod == BRW_CONDITIONAL_NONE) {
279 inst->predicate_inverse = !inst->predicate_inverse;
310 vec4_instruction *inst, int arg,
318 brw_apply_inv_swizzle_to_mask(inst->src[arg].swizzle,
331 if (devinfo->gen < 8 && inst->size_written > REG_SIZE && is_uniform(value))
341 if (inst->exec_size == 4 && value.file == UNIFORM &&
349 if (type_sz(value.type) != type_sz(inst->src[arg].type))
353 is_logic_op(inst->opcode)) {
357 if (inst->src[arg].offset % REG_SIZE || value.offset % REG_SIZE)
366 value.swizzle != BRW_SWIZZLE_XYZW) && !inst->can_do_source_mods(devinfo))
370 value.type != inst->src[arg].type &&
371 !inst->can_change_types())
375 inst->opcode == SHADER_OPCODE_GEN4_SCRATCH_WRITE)
378 unsigned composed_swizzle = brw_compose_swizzle(inst->src[arg].swizzle,
385 if (is_align1_opcode(inst->opcode) && composed_swizzle != BRW_SWIZZLE_XYZW)
388 if (inst->is_3src(devinfo) &&
394 if (inst->is_send_from_grf())
406 if (value.equals(inst->src[arg]))
409 const unsigned dst_saturate_mask = inst->dst.writemask &
410 brw_apply_swizzle_to_mask(inst->src[arg].swizzle, entry->saturatemask);
414 if (dst_saturate_mask != inst->dst.writemask)
420 switch(inst->opcode) {
423 inst->src[0].type != BRW_REGISTER_TYPE_F ||
424 inst->src[1].file != IMM ||
425 inst->src[1].type != BRW_REGISTER_TYPE_F ||
426 inst->src[1].f < 0.0 ||
427 inst->src[1].f > 1.0) {
430 if (!inst->saturate)
431 inst->saturate = true;
439 if (inst->src[arg].abs) {
443 if (inst->src[arg].negate)
448 value.type != inst->src[arg].type) {
449 assert(inst->can_change_types());
451 inst->src[i].type = value.type;
453 inst->dst.type = value.type;
455 value.type = inst->src[arg].type;
458 inst->src[arg] = value;
475 foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
483 if (!is_dominated_by_previous_instruction(inst)) {
496 if (inst->src[i].file != VGRF ||
497 inst->src[i].reladdr)
501 if (inst->size_read(i) != REG_SIZE ||
502 inst->src[i].offset % REG_SIZE)
505 const unsigned reg = (alloc.offsets[inst->src[i].nr] +
506 inst->src[i].offset / REG_SIZE);
509 if (do_constant_prop && try_constant_propagate(devinfo, inst, i, &entry))
511 else if (try_copy_propagate(devinfo, inst, i, &entry, attributes_per_reg))
516 if (inst->dst.file == VGRF) {
518 alloc.offsets[inst->dst.nr] + inst->dst.offset / REG_SIZE;
524 bool direct_copy = is_direct_copy(inst);
525 entries[reg].saturatemask &= ~inst->dst.writemask;
527 if (inst->dst.writemask & (1 << i)) {
528 entries[reg].value[i] = direct_copy ? &inst->src[0] : NULL;
530 inst->saturate && direct_copy ? 1 << i : 0;
537 if (inst->dst.reladdr)
542 if (is_channel_updated(inst, entries[i].value, j)) {