[Mesa-dev] [PATCH 26/47] glsl: Add a lowering pass for 64-bit float mul()

Elie Tournier tournier.elie at gmail.com
Wed Aug 23 11:07:56 UTC 2017


Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
---
 src/compiler/glsl/lower_64bit.cpp          | 5 ++++-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 414e8414f9..9087cabda2 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -478,7 +478,10 @@ 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_DOUBLE)
+            *rvalue = handle_op(ir, "__builtin_fmul64", generate_ir::fmul64);
+         else
+            *rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
       }
       break;
 
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index fab331edea..488d052336 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -7064,7 +7064,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
                                EQ64 |
                                LE64 |
                                LT64 |
-                               ADD64;
+                               ADD64 |
+                               MUL64;
          lower_64bit_double_instructions(ir, lower_inst);
       }
 
-- 
2.14.1



More information about the mesa-dev mailing list