glsl: Add a lowering pass for 64-bit integer sign()
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 17 Oct 2016 20:55:54 +0000 (13:55 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 20 Jan 2017 23:41:23 +0000 (15:41 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/compiler/glsl/ir_optimization.h
src/compiler/glsl/lower_int64.cpp

index 6fc7ff8ffa62570ac40e1453fdd162516c7ecbaf..e4f78f038fddab176ecbf904c0290c7ca88af886 100644 (file)
@@ -52,6 +52,7 @@
 
 /* Opertaions for lower_64bit_integer_instructions() */
 #define MUL64                     (1U << 0)
+#define SIGN64                    (1U << 1)
 
 /**
  * \see class lower_packing_builtins_visitor
index 5952de51c2ef92c0b790db9f1e3fd072c75d1675..a12eba85c58d0759e2a17e1d260655410372114e 100644 (file)
@@ -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);