Module: Mesa
Branch: main
Commit: 261c1f9ee140e77007dfba2da49aefa6aa0fd3fd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=261c1f9ee140e77007dfba2da49aefa6aa0fd3fd

Author: Emma Anholt <[email protected]>
Date:   Thu Mar 23 12:14:05 2023 -0700

glsl/softfp64: Add fisfinite lowering.

This is generated by nir_lower_frexp, and if we leave fisfinite in place
then the late algebraic pass lowering it to this pattern will cause an
un-lowered fabs64 to be emitted.

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22083>

---

 src/compiler/glsl/float64.glsl          | 6 ++++++
 src/compiler/nir/nir_lower_double_ops.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index 5086c23dd7b..64bdbee2421 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -1716,3 +1716,9 @@ __ffract64(uint64_t a)
 {
    return __fadd64(a, __fneg64(__ffloor64(a)));
 }
+
+bool
+__fisfinite64(uint64_t __a)
+{
+   return __extractFloat64Exp(__a) != 0x7ff;
+}
diff --git a/src/compiler/nir/nir_lower_double_ops.c 
b/src/compiler/nir/nir_lower_double_ops.c
index 6615c775c14..66bfe11b8c6 100644
--- a/src/compiler/nir/nir_lower_double_ops.c
+++ b/src/compiler/nir/nir_lower_double_ops.c
@@ -600,6 +600,11 @@ lower_doubles_instr_to_soft(nir_builder *b, nir_alu_instr 
*instr,
       name = "__fsat64";
       mangled_name = "__fsat64(u641;";
       break;
+   case nir_op_fisfinite:
+      name = "__fisfinite64";
+      mangled_name = "__fisfinite64(u641;";
+      return_type = glsl_bool_type();
+      break;
    default:
       return false;
    }

Reply via email to