intel/fs/cse: Split create_copy_instr into three cases
Previously, we tried to combine all cases where the instruction being CSE'd writes to more than one MOV worth of registers into one case with a bit of special casing for LOAD_PAYLOAD. This commit splits things so that LOAD_PAYLOAD is entirely it's own case. This makes tweaking the LOAD_PAYLOAD case simpler in the next commit. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
f409a08e5f
commit
f02914a991
|
@ -207,30 +207,30 @@ create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate)
|
||||||
DIV_ROUND_UP(inst->dst.component_size(inst->exec_size), REG_SIZE);
|
DIV_ROUND_UP(inst->dst.component_size(inst->exec_size), REG_SIZE);
|
||||||
fs_inst *copy;
|
fs_inst *copy;
|
||||||
|
|
||||||
if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD ||
|
if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
|
||||||
written != dst_width) {
|
|
||||||
fs_reg *payload;
|
|
||||||
int sources, header_size;
|
|
||||||
if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
|
|
||||||
sources = inst->sources;
|
|
||||||
header_size = inst->header_size;
|
|
||||||
} else {
|
|
||||||
assert(written % dst_width == 0);
|
|
||||||
sources = written / dst_width;
|
|
||||||
header_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(src.file == VGRF);
|
assert(src.file == VGRF);
|
||||||
payload = ralloc_array(bld.shader->mem_ctx, fs_reg, sources);
|
fs_reg *payload = ralloc_array(bld.shader->mem_ctx, fs_reg,
|
||||||
for (int i = 0; i < header_size; i++) {
|
inst->sources);
|
||||||
|
for (int i = 0; i < inst->header_size; i++) {
|
||||||
payload[i] = src;
|
payload[i] = src;
|
||||||
src.offset += REG_SIZE;
|
src.offset += REG_SIZE;
|
||||||
}
|
}
|
||||||
for (int i = header_size; i < sources; i++) {
|
for (int i = inst->header_size; i < inst->sources; i++) {
|
||||||
payload[i] = src;
|
payload[i] = src;
|
||||||
src = offset(src, bld, 1);
|
src = offset(src, bld, 1);
|
||||||
}
|
}
|
||||||
copy = bld.LOAD_PAYLOAD(inst->dst, payload, sources, header_size);
|
copy = bld.LOAD_PAYLOAD(inst->dst, payload, inst->sources,
|
||||||
|
inst->header_size);
|
||||||
|
} else if (written != dst_width) {
|
||||||
|
assert(src.file == VGRF);
|
||||||
|
assert(written % dst_width == 0);
|
||||||
|
const int sources = written / dst_width;
|
||||||
|
fs_reg *payload = ralloc_array(bld.shader->mem_ctx, fs_reg, sources);
|
||||||
|
for (int i = 0; i < sources; i++) {
|
||||||
|
payload[i] = src;
|
||||||
|
src = offset(src, bld, 1);
|
||||||
|
}
|
||||||
|
copy = bld.LOAD_PAYLOAD(inst->dst, payload, sources, 0);
|
||||||
} else {
|
} else {
|
||||||
copy = bld.MOV(inst->dst, src);
|
copy = bld.MOV(inst->dst, src);
|
||||||
copy->group = inst->group;
|
copy->group = inst->group;
|
||||||
|
|
Loading…
Reference in New Issue