[Mesa-dev] [PATCH 21/50] glsl: Add a lowering pass for 64-bit float neg()
Dave Airlie
airlied at gmail.com
Tue Mar 13 04:24:46 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 370812f..2d9728d 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -61,8 +61,9 @@
#define DIV64 (1U << 2)
#define MOD64 (1U << 3)
#define ABS64 (1U << 4)
+#define NEG64 (1U << 5)
-#define LOWER_ALL_DOUBLE_OPS (ABS64)
+#define LOWER_ALL_DOUBLE_OPS (ABS64 | NEG64)
/**
* \see class lower_packing_builtins_visitor
*/
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index debedfc..bc9e477 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_neg:
+ if (lowering(NEG64)) {
+ if (ir->type->base_type == GLSL_TYPE_DOUBLE)
+ *rvalue = handle_op(ir, "__builtin_fneg64", generate_ir::fneg64);
+ }
+ 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