From: Matt Turner Date: Sun, 22 Nov 2015 21:25:05 +0000 (-0800) Subject: i965: Add and use backend_reg::equals(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=309a44d63c75a7d688157486b094e555f49c907d;p=mesa.git i965: Add and use backend_reg::equals(). Reviewed-by: Francisco Jerez --- 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 @@ -683,6 +683,13 @@ backend_shader::backend_shader(const struct brw_compiler *compiler, stage_abbrev = _mesa_shader_stage_to_abbrev(stage); } +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 { 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 ®) : 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); }