[Mesa-dev,15/32] i965/vec4: Implement equals() method for dst_reg too.

Submitted by Francisco Jerez on Feb. 6, 2015, 2:42 p.m.

Details

Message ID 1423233792-11767-15-git-send-email-currojerez@riseup.net
State New
Headers show

Not browsing as part of any series.

Commit Message

Francisco Jerez Feb. 6, 2015, 2:42 p.m.
---
 src/mesa/drivers/dri/i965/brw_ir_vec4.h |  2 ++
 src/mesa/drivers/dri/i965/brw_vec4.cpp  | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
index ae024b3..f11a2d2 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -117,6 +117,8 @@  public:
 
    explicit dst_reg(src_reg reg);
 
+   bool equals(const dst_reg &r) const;
+
    int writemask; /**< Bitfield of WRITEMASK_[XYZW] */
 
    src_reg *reladdr;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 884f1b9..c3f68e6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -235,6 +235,22 @@  dst_reg::dst_reg(src_reg reg)
 }
 
 bool
+dst_reg::equals(const dst_reg &r) const
+{
+   return (file == r.file &&
+           reg == r.reg &&
+           reg_offset == r.reg_offset &&
+           type == r.type &&
+           negate == r.negate &&
+           abs == r.abs &&
+           writemask == r.writemask &&
+           (reladdr == r.reladdr ||
+            reladdr->equals(*r.reladdr)) &&
+           memcmp(&fixed_hw_reg, &r.fixed_hw_reg,
+                  sizeof(fixed_hw_reg)) == 0);
+}
+
+bool
 vec4_instruction::is_send_from_grf()
 {
    switch (opcode) {