i965: fix is_zero(), is_one() and is_negative_one() for doubles
authorConnor Abbott <connor.w.abbott@intel.com>
Wed, 18 Nov 2015 11:38:31 +0000 (12:38 +0100)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Tue, 10 May 2016 09:25:03 +0000 (11:25 +0200)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/mesa/drivers/dri/i965/brw_shader.cpp

index 9cf57541cf9d052ad7bdadafa50e5fc2c5e4df81..b3c6c58f9246929e457734d55a93421fd269203b 100644 (file)
@@ -666,7 +666,17 @@ backend_reg::is_zero() const
    if (file != IMM)
       return false;
 
-   return d == 0;
+   switch (type) {
+   case BRW_REGISTER_TYPE_F:
+      return f == 0;
+   case BRW_REGISTER_TYPE_DF:
+      return df == 0;
+   case BRW_REGISTER_TYPE_D:
+   case BRW_REGISTER_TYPE_UD:
+      return d == 0;
+   default:
+      return false;
+   }
 }
 
 bool
@@ -675,9 +685,17 @@ backend_reg::is_one() const
    if (file != IMM)
       return false;
 
-   return type == BRW_REGISTER_TYPE_F
-          ? f == 1.0
-          : d == 1;
+   switch (type) {
+   case BRW_REGISTER_TYPE_F:
+      return f == 1.0f;
+   case BRW_REGISTER_TYPE_DF:
+      return df == 1.0;
+   case BRW_REGISTER_TYPE_D:
+   case BRW_REGISTER_TYPE_UD:
+      return d == 1;
+   default:
+      return false;
+   }
 }
 
 bool
@@ -689,6 +707,8 @@ backend_reg::is_negative_one() const
    switch (type) {
    case BRW_REGISTER_TYPE_F:
       return f == -1.0;
+   case BRW_REGISTER_TYPE_DF:
+      return df == -1.0;
    case BRW_REGISTER_TYPE_D:
       return d == -1;
    default: