From: Elie Tournier <tournier.e...@gmail.com>

Signed-off-by: Elie Tournier <elie.tourn...@collabora.com>
---
 src/compiler/glsl/ir_optimization.h | 3 ++-
 src/compiler/glsl/lower_64bit.cpp   | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ir_optimization.h 
b/src/compiler/glsl/ir_optimization.h
index a4cb7b2..3cc7f2e 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -67,9 +67,10 @@
 #define ADD64                     (1U << 8)
 #define D2U                       (1U << 9)
 #define U2D                       (1U << 10)
+#define D2I                       (1U << 11)
 
 #define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64 | SIGN64 | EQ64 | LT64 | \
-                              ADD64 | MUL64 | D2U | U2D)
+                              ADD64 | MUL64 | D2U | U2D | D2I)
 
 /**
  * \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp 
b/src/compiler/glsl/lower_64bit.cpp
index 1e97306..7b2ffe8 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -424,6 +424,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
       }
       break;
 
+   case ir_unop_d2i:
+      if (lowering(D2I)) {
+         if (ir->type->base_type == GLSL_TYPE_INT)
+            *rvalue = handle_op(ir, "__builtin_fp64_to_int", 
generate_ir::fp64_to_int);
+      }
+      break;
+
    case ir_unop_d2u:
       if (lowering(D2U)) {
          if (ir->type->base_type == GLSL_TYPE_UINT)
-- 
2.9.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to