[Mesa-dev] [PATCH 19/50] glsl: Add a lowering pass for 64-bit float abs()
Dave Airlie
airlied at gmail.com
Tue Mar 13 04:24:44 UTC 2018
From: Elie Tournier <tournier.elie at gmail.com>
Squashed with:
glsl/lower_64bit: fix return type conversion (airlied)
Only do conversion for the 64-bit types, add a path
to do result merging without conversion.
Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
---
src/compiler/glsl/ir_optimization.h | 1 +
src/compiler/glsl/lower_64bit.cpp | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index 931bffb..c48d0a9 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -60,6 +60,7 @@
#define SIGN64 (1U << 1)
#define DIV64 (1U << 2)
#define MOD64 (1U << 3)
+#define ABS64 (1U << 4)
/**
* \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index d181f63..debedfc 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -416,6 +416,14 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
assert(ir != NULL);
switch (ir->operation) {
+
+ case ir_unop_abs:
+ if (lowering(ABS64)) {
+ if (ir->type->base_type == GLSL_TYPE_DOUBLE)
+ *rvalue = handle_op(ir, "__builtin_fabs64", generate_ir::fabs64);
+ }
+ 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