[Mesa-dev] [PATCH 14/19] i965/fs: Emit load_payload instead of multiple MOVs for large VGRFs.
Matt Turner
mattst88 at gmail.com
Fri Apr 18 11:56:50 PDT 2014
---
src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 33 ++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index e40567f..44f1fe4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -177,15 +177,20 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
entry->tmp = tmp;
entry->generator->dst = tmp;
- for (int i = 0; i < written; i++) {
- fs_inst *copy = MOV(orig_dst, tmp);
+ fs_inst *copy;
+ if (written > 1) {
+ fs_reg *sources = ralloc_array(mem_ctx, fs_reg, written);
+ for (int i = 0; i < written; i++) {
+ sources[i] = tmp;
+ sources[i].reg_offset = i;
+ }
+ copy = new(mem_ctx) fs_inst(SHADER_OPCODE_LOAD_PAYLOAD, orig_dst, sources, written);
+ } else {
+ copy = MOV(orig_dst, tmp);
copy->force_writemask_all =
entry->generator->force_writemask_all;
- entry->generator->insert_after(copy);
-
- orig_dst.reg_offset++;
- tmp.reg_offset++;
}
+ entry->generator->insert_after(copy);
}
/* dest <- temp */
@@ -195,15 +200,19 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
assert(inst->dst.type == entry->tmp.type);
fs_reg dst = inst->dst;
fs_reg tmp = entry->tmp;
- fs_inst *copy = NULL;
- for (int i = 0; i < written; i++) {
+ fs_inst *copy;
+ if (written > 1) {
+ fs_reg *sources = ralloc_array(mem_ctx, fs_reg, written);
+ for (int i = 0; i < written; i++) {
+ sources[i] = tmp;
+ sources[i].reg_offset = i;
+ }
+ copy = new(mem_ctx) fs_inst(SHADER_OPCODE_LOAD_PAYLOAD, dst, sources, written);
+ } else {
copy = MOV(dst, tmp);
copy->force_writemask_all = inst->force_writemask_all;
- inst->insert_before(copy);
-
- dst.reg_offset++;
- tmp.reg_offset++;
}
+ inst->insert_before(copy);
}
/* Set our iterator so that next time through the loop inst->next
--
1.8.3.2
More information about the mesa-dev
mailing list