From 261c1f9ee140e77007dfba2da49aefa6aa0fd3fd Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 23 Mar 2023 12:14:05 -0700 Subject: [PATCH] glsl/softfp64: Add fisfinite lowering. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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; }