i965: Add is_accumulator() function.
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Wed, 9 Apr 2014 19:08:12 +0000 (12:08 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 17 Apr 2014 05:46:45 +0000 (22:46 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h

index 88dfdfc205645502142c9f09c6ba872679dba372..bff38f0d6e7848140d88a1318d9aa2c1634f82fa 100644 (file)
@@ -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)
 {
index 4c12bd74774011c9924ca05e7a115706bcd9047b..2a1a81d670d53fe8814f765b227ade412b4d1994 100644 (file)
@@ -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. */
index 480a3097b428608800cb732e587987c202252bf5..8aa746d36308930dd906b1aa80102f46b64d1fc5 100644 (file)
@@ -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()
 {
@@ -220,6 +229,14 @@ dst_reg::is_null() const
           fixed_hw_reg.nr == BRW_ARF_NULL;
 }
 
+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()
 {
index 159a5bdfbbb67ea6ef2002ba04d03e7deef041c3..b3549a5c845ee96921adf0865c8c52f8602f42c5 100644 (file)
@@ -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] */