summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-03-13 14:34:06 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-03-15 03:14:53 -0700
commitdb095eb43bd02414e71f93e72ff61b463bef0ece (patch)
tree0af14e2af3c63c5d1c2a7b6614b50c2d9510275a /src/mesa/drivers/dri/i965/brw_fs_cse.cpp
parentf68a973dfb8926ac872b0b0e3b4b5c2163389d06 (diff)
downloadexternal_mesa3d-db095eb43bd02414e71f93e72ff61b463bef0ece.zip
external_mesa3d-db095eb43bd02414e71f93e72ff61b463bef0ece.tar.gz
external_mesa3d-db095eb43bd02414e71f93e72ff61b463bef0ece.tar.bz2
i965: De-duplicate is_expression_commutative() functions.
Create a backend_inst::is_commutative() method to replace two static functions that did the exact same thing. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_cse.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cse.cpp24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index ae069bb..ca5b32f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -109,28 +109,6 @@ is_expression(const fs_inst *const inst)
}
static bool
-is_expression_commutative(const fs_inst *inst)
-{
- switch (inst->opcode) {
- case BRW_OPCODE_AND:
- case BRW_OPCODE_OR:
- case BRW_OPCODE_XOR:
- case BRW_OPCODE_ADD:
- case BRW_OPCODE_MUL:
- return true;
- case BRW_OPCODE_SEL:
- /* MIN and MAX are commutative. */
- if (inst->conditional_mod == BRW_CONDITIONAL_GE ||
- inst->conditional_mod == BRW_CONDITIONAL_L) {
- return true;
- }
- /* fallthrough */
- default:
- return false;
- }
-}
-
-static bool
operands_match(const fs_inst *a, const fs_inst *b)
{
fs_reg *xs = a->src;
@@ -140,7 +118,7 @@ operands_match(const fs_inst *a, const fs_inst *b)
return xs[0].equals(ys[0]) &&
((xs[1].equals(ys[1]) && xs[2].equals(ys[2])) ||
(xs[2].equals(ys[1]) && xs[1].equals(ys[2])));
- } else if (!is_expression_commutative(a)) {
+ } else if (!a->is_commutative()) {
bool match = true;
for (int i = 0; i < a->sources; i++) {
if (!xs[i].equals(ys[i])) {