[Mesa-dev] [PATCH 38/59] glsl: Add a lowering pass for 64-bit integer sign()

Ian Romanick idr at freedesktop.org
Wed Oct 26 00:59:44 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/glsl/ir_optimization.h | 1 +
 src/compiler/glsl/lower_64bit.cpp   | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index 4f8a346..b52b7d1 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -52,6 +52,7 @@
 
 /* Opertaions for lower_64bit_integer_instructions() */
 #define MUL64                     (1U << 0)
+#define SIGN64                    (1U << 1)
 
 /**
  * \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index ccf80cab..cc2c4aa 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -361,6 +361,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
    assert(ir != NULL);
 
    switch (ir->operation) {
+   case ir_unop_sign:
+      if (lowering(SIGN64)) {
+         *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
+         this->progress = true;
+      }
+      break;
+
    case ir_binop_mul:
       if (lowering(MUL64)) {
          *rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
-- 
2.5.5



More information about the mesa-dev mailing list