[Mesa-dev] [PATCH 33/50] glsl: Add a lowering pass for 64-bit float sqrt()
Dave Airlie
airlied at gmail.com
Tue Mar 13 04:24:58 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 | 3 ++-
src/compiler/glsl/lower_64bit.cpp | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index c649c80..1b5d50a 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -71,10 +71,11 @@
#define I2D (1U << 12)
#define D2F (1U << 13)
#define F2D (1U << 14)
+#define SQRT64 (1U << 15)
#define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64 | SIGN64 | EQ64 | LT64 | \
ADD64 | MUL64 | D2U | U2D | D2I | I2D | \
- D2F | F2D)
+ D2F | F2D | SQRT64)
/**
* \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 126c961..4920150 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -475,6 +475,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
}
break;
+ case ir_unop_sqrt:
+ if (lowering(SQRT64)) {
+ if (ir->type->base_type == GLSL_TYPE_DOUBLE)
+ *rvalue = handle_op(ir, "__builtin_fsqrt64", generate_ir::fsqrt64);
+ }
+ break;
+
case ir_unop_u2d:
if (lowering(U2D)) {
if (ir->type->base_type == GLSL_TYPE_DOUBLE)
--
2.9.5
More information about the mesa-dev
mailing list