[Mesa-dev] [PATCH 31/50] glsl: Add a lowering pass for 64-bit float d2f()
Dave Airlie
airlied at gmail.com
Tue Mar 13 04:24:56 UTC 2018
From: Elie Tournier <tournier.elie at gmail.com>
Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
---
src/compiler/glsl/ir_optimization.h | 4 +++-
src/compiler/glsl/lower_64bit.cpp | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index f73faec..e7860ef 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -69,9 +69,11 @@
#define U2D (1U << 10)
#define D2I (1U << 11)
#define I2D (1U << 12)
+#define D2F (1U << 13)
#define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64 | SIGN64 | EQ64 | LT64 | \
- ADD64 | MUL64 | D2U | U2D | D2I | I2D)
+ ADD64 | MUL64 | D2U | U2D | D2I | I2D | \
+ D2F)
/**
* \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 2900409..e76ebdc 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -424,6 +424,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
}
break;
+ case ir_unop_d2f:
+ if (lowering(D2F)) {
+ if (ir->type->base_type == GLSL_TYPE_FLOAT)
+ *rvalue = handle_op(ir, "__builtin_fp64_to_fp32", generate_ir::fp64_to_fp32);
+ }
+ break;
+
case ir_unop_d2i:
if (lowering(D2I)) {
if (ir->type->base_type == GLSL_TYPE_INT)
--
2.9.5
More information about the mesa-dev
mailing list