i965: Add an is_negative_one() method.
authorMatt Turner <mattst88@gmail.com>
Thu, 5 Feb 2015 02:08:21 +0000 (18:08 -0800)
committerMatt Turner <mattst88@gmail.com>
Sun, 15 Feb 2015 20:24:10 +0000 (12:24 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h

index ad2e22adbc0f88871a81cf58dff520d3760a8968..f876932788394b9f5e8f62c58efaab2c62ba46f7 100644 (file)
@@ -731,6 +731,22 @@ backend_reg::is_one() const
           : fixed_hw_reg.dw1.d == 1;
 }
 
+bool
+backend_reg::is_negative_one() const
+{
+   if (file != IMM)
+      return false;
+
+   switch (type) {
+   case BRW_REGISTER_TYPE_F:
+      return fixed_hw_reg.dw1.f == -1.0;
+   case BRW_REGISTER_TYPE_D:
+      return fixed_hw_reg.dw1.d == -1;
+   default:
+      return false;
+   }
+}
+
 bool
 backend_reg::is_null() const
 {
index 4b5c57364e80d0ca852c6fb812e1c549a9331b30..7bff186dc49fc512ab49b798b40edd5782efb047 100644 (file)
@@ -51,6 +51,7 @@ struct backend_reg
 #ifdef __cplusplus
    bool is_zero() const;
    bool is_one() const;
+   bool is_negative_one() const;
    bool is_null() const;
    bool is_accumulator() const;
 #endif