i965/vec4: Implement equals() method for dst_reg too.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 5 Feb 2015 20:40:07 +0000 (22:40 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 10 Feb 2015 17:09:24 +0000 (19:09 +0200)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_ir_vec4.h
src/mesa/drivers/dri/i965/brw_vec4.cpp

index ae024b328d903b1c82730e6ae9cfd1509d1309fa..f11a2d21d1e5cad9e3fdb06ccac20fba27592971 100644 (file)
@@ -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;
index 622502ef3d91a8dce7313220f519d8a06fcfb332..5ad9da291df66120b17fc930ecad86c29fad6d11 100644 (file)
@@ -234,6 +234,22 @@ dst_reg::dst_reg(src_reg reg)
    this->fixed_hw_reg = reg.fixed_hw_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 && 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()
 {