summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-04-09 08:29:59 -1000
committerEric Anholt <[email protected]>2011-04-13 17:57:53 -0700
commit4847f802c28e595130bda14055cd52c9b1f51cd7 (patch)
treeba3193d017e5ded507c65dc8809e12dcd3ec6e15 /src/mesa/drivers/dri/i965/brw_fs.cpp
parent811c147220d2630b769e505ce4d40ef9108fe034 (diff)
i965/fs: Constant-fold immediates in src0 of SEL instructions.
This is like what we do for add/mul, but we have to invert the predicate to choose the other source instead. This removes 5 extra moves of constants in nexuiz shaders. No statistically significant performance difference on my Sandybridge laptop (n=5). Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 128bbe93a32..5426925e372 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2963,6 +2963,14 @@ fs_visitor::propagate_constants()
if (i == 1) {
scan_inst->src[i] = inst->src[0];
progress = true;
+ } else if (i == 0 && scan_inst->src[1].file != IMM) {
+ /* Fit this constant in by swapping the operands and
+ * flipping the predicate
+ */
+ scan_inst->src[0] = scan_inst->src[1];
+ scan_inst->src[1] = inst->src[0];
+ scan_inst->predicate_inverse = !scan_inst->predicate_inverse;
+ progress = true;
}
break;
}
@@ -3450,6 +3458,7 @@ fs_visitor::generate_code()
brw_set_conditionalmod(p, inst->conditional_mod);
brw_set_predicate_control(p, inst->predicated);
+ brw_set_predicate_inverse(p, inst->predicate_inverse);
brw_set_saturate(p, inst->saturate);
switch (inst->opcode) {