Mesa (master): i965: Add is_accumulator() function.

Matt Turner mattst88 at kemper.freedesktop.org
Thu Apr 17 05:44:56 UTC 2014


Module: Mesa
Branch: master
Commit: 30c35d1dcb2fde19b1c968751fda5151b795d257
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=30c35d1dcb2fde19b1c968751fda5151b795d257

Author: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Date:   Wed Apr  9 12:08:12 2014 -0700

i965: Add is_accumulator() function.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp   |    8 ++++++++
 src/mesa/drivers/dri/i965/brw_fs.h     |    1 +
 src/mesa/drivers/dri/i965/brw_vec4.cpp |   17 +++++++++++++++++
 src/mesa/drivers/dri/i965/brw_vec4.h   |    2 ++
 4 files changed, 28 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 88dfdfc..bff38f0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -501,6 +501,14 @@ fs_reg::is_valid_3src() const
    return file == GRF || file == UNIFORM;
 }
 
+bool
+fs_reg::is_accumulator() const
+{
+   return file == HW_REG &&
+          fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE &&
+          fixed_hw_reg.nr == BRW_ARF_ACCUMULATOR;
+}
+
 int
 fs_visitor::type_size(const struct glsl_type *type)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 4c12bd7..2a1a81d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -83,6 +83,7 @@ public:
    bool is_null() const;
    bool is_valid_3src() const;
    bool is_contiguous() const;
+   bool is_accumulator() const;
 
    fs_reg &apply_stride(unsigned stride);
    /** Smear a channel of the reg to all channels. */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 480a309..8aa746d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -151,6 +151,15 @@ src_reg::src_reg(dst_reg reg)
                                 swizzles[2], swizzles[3]);
 }
 
+bool
+src_reg::is_accumulator() const
+{
+   return file == HW_REG &&
+          fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE &&
+          fixed_hw_reg.nr == BRW_ARF_ACCUMULATOR;
+}
+
+
 void
 dst_reg::init()
 {
@@ -221,6 +230,14 @@ dst_reg::is_null() const
 }
 
 bool
+dst_reg::is_accumulator() const
+{
+   return file == HW_REG &&
+          fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE &&
+          fixed_hw_reg.nr == BRW_ARF_ACCUMULATOR;
+}
+
+bool
 vec4_instruction::is_send_from_grf()
 {
    switch (opcode) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 159a5bd..b3549a5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -128,6 +128,7 @@ public:
    bool equals(src_reg *r);
    bool is_zero() const;
    bool is_one() const;
+   bool is_accumulator() const;
 
    src_reg(class vec4_visitor *v, const struct glsl_type *type);
 
@@ -195,6 +196,7 @@ public:
    explicit dst_reg(src_reg reg);
 
    bool is_null() const;
+   bool is_accumulator() const;
 
    int writemask; /**< Bitfield of WRITEMASK_[XYZW] */
 




More information about the mesa-commit mailing list