[Mesa-dev] [PATCH 23/50] glsl: Add a lowering pass for 64-bit float equal()

Dave Airlie airlied at gmail.com
Tue Mar 13 04:24:48 UTC 2018


From: Elie Tournier <tournier.elie at gmail.com>

Signed-off-by: Elie Tournier <elie.tournier at 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 3a406ce..17db074 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -62,8 +62,9 @@
 #define MOD64                     (1U << 3)
 #define ABS64                     (1U << 4)
 #define NEG64                     (1U << 5)
+#define EQ64                      (1U << 6)
 
-#define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64 | SIGN64)
+#define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64 | SIGN64 | EQ64)
 /**
  * \see class lower_packing_builtins_visitor
  */
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 88df912..d5e0f32 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -450,6 +450,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
       }
       break;
 
+   case ir_binop_equal:
+      if (lowering(EQ64)) {
+         if (ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE)
+            *rvalue = handle_op(ir, "__builtin_feq64", generate_ir::feq64);
+      }
+      break;
+
    case ir_binop_mod:
       if (lowering(MOD64)) {
          if (ir->type->base_type == GLSL_TYPE_UINT64) {
-- 
2.9.5



More information about the mesa-dev mailing list