[Mesa-dev] [PATCH] glsl/lower_64bit: restrict int64 conversion to int64 instructions.

Dave Airlie airlied at gmail.com
Thu Feb 1 03:57:14 UTC 2018


From: Dave Airlie <airlied at redhat.com>

If the lowering flags for int64 were set we'd try and lower
the wrong things sometimes.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/compiler/glsl/lower_64bit.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index a9b2b98f83..aac5c5a1c7 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -390,7 +390,9 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
    switch (ir->operation) {
    case ir_unop_sign:
       if (lowering(SIGN64)) {
-         *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
+	if (ir->type->base_type == GLSL_TYPE_UINT64 ||
+	    ir->type->base_type == GLSL_TYPE_INT64)
+           *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
       }
       break;
 
@@ -398,7 +400,7 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
       if (lowering(DIV64)) {
          if (ir->type->base_type == GLSL_TYPE_UINT64) {
             *rvalue = handle_op(ir, "__builtin_udiv64", generate_ir::udiv64);
-         } else {
+         } else if (ir->type->base_type == GLSL_TYPE_INT64) {
             *rvalue = handle_op(ir, "__builtin_idiv64", generate_ir::idiv64);
          }
       }
@@ -408,7 +410,7 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
       if (lowering(MOD64)) {
          if (ir->type->base_type == GLSL_TYPE_UINT64) {
             *rvalue = handle_op(ir, "__builtin_umod64", generate_ir::umod64);
-         } else {
+         } else if (ir->type->base_type == GLSL_TYPE_INT64) {
             *rvalue = handle_op(ir, "__builtin_imod64", generate_ir::imod64);
          }
       }
@@ -416,7 +418,9 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
 
    case ir_binop_mul:
       if (lowering(MUL64)) {
-         *rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
+         if (ir->type->base_type == GLSL_TYPE_UINT64 ||
+             ir->type->base_type == GLSL_TYPE_INT64)
+            *rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
       }
       break;
    case ir_unop_i2d:
-- 
2.14.3



More information about the mesa-dev mailing list