[Mesa-dev] [PATCH 07/16] i965: Add is_3src() to backend_instruction.
Matt Turner
mattst88 at gmail.com
Mon Jan 19 15:31:06 PST 2015
---
src/mesa/drivers/dri/i965/brw_shader.cpp | 10 ++++++++++
src/mesa/drivers/dri/i965/brw_shader.h | 1 +
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 6 +-----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index cbdf976..c6fead7 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -678,6 +678,16 @@ backend_reg::is_accumulator() const
}
bool
+backend_instruction::is_3src() const
+{
+ return opcode == BRW_OPCODE_LRP ||
+ opcode == BRW_OPCODE_MAD ||
+ opcode == BRW_OPCODE_BFE ||
+ opcode == BRW_OPCODE_BFI2 ||
+ opcode == BRW_OPCODE_CSEL;
+}
+
+bool
backend_instruction::is_tex() const
{
return (opcode == SHADER_OPCODE_TEX ||
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 54d770e..6fc86e1 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -82,6 +82,7 @@ struct bblock_t;
#ifdef __cplusplus
struct backend_instruction : public exec_node {
+ bool is_3src() const;
bool is_tex() const;
bool is_math() const;
bool is_control_flow() const;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 9e47dd9..bf15941 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -308,11 +308,7 @@ try_copy_propagate(struct brw_context *brw, vec4_instruction *inst,
inst->opcode == SHADER_OPCODE_GEN4_SCRATCH_WRITE)
return false;
- bool is_3src_inst = (inst->opcode == BRW_OPCODE_LRP ||
- inst->opcode == BRW_OPCODE_MAD ||
- inst->opcode == BRW_OPCODE_BFE ||
- inst->opcode == BRW_OPCODE_BFI2);
- if (is_3src_inst && value.file == UNIFORM)
+ if (inst->is_3src() && value.file == UNIFORM)
return false;
if (inst->is_send_from_grf())
--
2.0.4
More information about the mesa-dev
mailing list