[Mesa-dev] [PATCH 2/6] lower_64bit: add extra protection around uint64 lowering.
Dave Airlie
airlied at gmail.com
Mon Mar 12 05:14:17 UTC 2018
From: Dave Airlie <airlied at redhat.com>
This will ensure the upcoming changes don't start lowering
doubles using int64 functions.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/compiler/glsl/lower_64bit.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index ac62d1d..f214040 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -355,7 +355,8 @@ 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->is_integer_64())
+ *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
}
break;
@@ -363,7 +364,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);
}
}
@@ -373,7 +374,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);
}
}
@@ -381,7 +382,8 @@ 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->is_integer_64())
+ *rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
}
break;
--
2.9.5
More information about the mesa-dev
mailing list