summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-11-22 13:25:05 -0800
committerMatt Turner <[email protected]>2015-11-24 09:58:33 -0800
commit309a44d63c75a7d688157486b094e555f49c907d (patch)
tree76d4f95daa2609a602245e2716420fa3a816827b /src
parent6c6a439e9868469654021a9d102040aa4c0c71ee (diff)
i965: Add and use backend_reg::equals().
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp7
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp6
4 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 777cee5c809..2e7b73f07c5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -393,8 +393,7 @@ fs_reg::fs_reg(struct brw_reg reg) :
bool
fs_reg::equals(const fs_reg &r) const
{
- return (memcmp((brw_reg *)this, (brw_reg *)&r, sizeof(brw_reg)) == 0 &&
- reg_offset == r.reg_offset &&
+ return (this->backend_reg::equals(r) &&
subreg_offset == r.subreg_offset &&
!reladdr && !r.reladdr &&
stride == r.stride);
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index cf0136ac86b..810a36abe04 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -684,6 +684,13 @@ backend_shader::backend_shader(const struct brw_compiler *compiler,
}
bool
+backend_reg::equals(const backend_reg &r) const
+{
+ return memcmp((brw_reg *)this, (brw_reg *)&r, sizeof(brw_reg)) == 0 &&
+ reg_offset == r.reg_offset;
+}
+
+bool
backend_reg::is_zero() const
{
if (file != IMM)
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index a4139cf3ddb..718a22520de 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -44,6 +44,8 @@ struct backend_reg : public brw_reg
backend_reg() {}
backend_reg(struct brw_reg reg) : brw_reg(reg) {}
+ bool equals(const backend_reg &r) const;
+
bool is_zero() const;
bool is_one() const;
bool is_negative_one() const;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index ae3cf728443..9f748dcd1d8 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -147,8 +147,7 @@ dst_reg::dst_reg(const src_reg &reg) :
bool
dst_reg::equals(const dst_reg &r) const
{
- return (memcmp((brw_reg *)this, (brw_reg *)&r, sizeof(brw_reg)) == 0 &&
- reg_offset == r.reg_offset &&
+ return (this->backend_reg::equals(r) &&
(reladdr == r.reladdr ||
(reladdr && r.reladdr && reladdr->equals(*r.reladdr))));
}
@@ -285,8 +284,7 @@ vec4_visitor::implied_mrf_writes(vec4_instruction *inst)
bool
src_reg::equals(const src_reg &r) const
{
- return (memcmp((brw_reg *)this, (brw_reg *)&r, sizeof(brw_reg)) == 0 &&
- reg_offset == r.reg_offset &&
+ return (this->backend_reg::equals(r) &&
!reladdr && !r.reladdr);
}