From 29da9856826fa6a4b5117c43c78b4301a49bc6dd Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Mon, 17 Oct 2022 14:00:59 -0700 Subject: [PATCH] nir/lower_int64: Enable lowering of 64-bit float to 64-bit integer conversions. The existing code for this appears to work okay for conversions involving 64-bit floats, relax the assert and enable the lowering path. This fixes 64-bit float to 64-bit integer integer conversions on devices that have native support for 64-bit floats but lack 64-bit integer support, like Intel MTL hardware. Reviewed-by: Boris Brezillon Reviewed-by: Ian Romanick Part-of: --- src/compiler/nir/nir_lower_int64.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/compiler/nir/nir_lower_int64.c b/src/compiler/nir/nir_lower_int64.c index da393c807c6..10db7cde9b3 100644 --- a/src/compiler/nir/nir_lower_int64.c +++ b/src/compiler/nir/nir_lower_int64.c @@ -754,7 +754,7 @@ lower_2f(nir_builder *b, nir_ssa_def *x, unsigned dest_bit_size, static nir_ssa_def * lower_f2(nir_builder *b, nir_ssa_def *x, bool dst_is_signed) { - assert(x->bit_size == 16 || x->bit_size == 32); + assert(x->bit_size == 16 || x->bit_size == 32 || x->bit_size == 64); nir_ssa_def *x_sign = NULL; if (dst_is_signed) @@ -977,10 +977,6 @@ lower_int64_alu_instr(nir_builder *b, nir_alu_instr *alu) return lower_2f(b, src[0], nir_dest_bit_size(alu->dest.dest), false); case nir_op_f2i64: case nir_op_f2u64: - /* We don't support f64toi64 (yet?). */ - if (src[0]->bit_size > 32) - return false; - return lower_f2(b, src[0], alu->op == nir_op_f2i64); default: unreachable("Invalid ALU opcode to lower");