[Mesa-dev] [PATCH 35/50] glsl: Add a lowering pass for 64-bit float round()
Dave Airlie
airlied at gmail.com
Tue Mar 13 04:25:00 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 6ef75f5..44d07bc 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -73,10 +73,11 @@
#define F2D (1U << 14)
#define SQRT64 (1U << 15)
#define TRUNC64 (1U << 16)
+#define ROUND64 (1U << 17)
#define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64 | SIGN64 | EQ64 | LT64 | \
ADD64 | MUL64 | D2U | U2D | D2I | I2D | \
- D2F | F2D | SQRT64 | TRUNC64)
+ D2F | F2D | SQRT64 | TRUNC64 | ROUND64)
/**
* \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 3c34211..38c264f 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -466,6 +466,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
}
break;
+ case ir_unop_round_even:
+ if (lowering(ROUND64)) {
+ if (ir->type->base_type == GLSL_TYPE_DOUBLE)
+ *rvalue = handle_op(ir, "__builtin_fround64", generate_ir::fround64);
+ }
+ break;
+
case ir_unop_sign:
if (lowering(SIGN64)) {
if (ir->type->is_integer_64())
--
2.9.5
More information about the mesa-dev
mailing list