From 6a9825bc1bd55c403461111fc8b8c0cec9c97af7 Mon Sep 17 00:00:00 2001 From: Danilo Krummrich Date: Fri, 12 Aug 2022 16:54:49 +0200 Subject: [PATCH] nv50/ir/nir: always round towards zero for f2i/f2u Conversions to integers must be rounded towards zero, hence, actually do this for all integers including 8/16 bit sources. Reviewed-by: Karol Herbst Signed-off-by: Danilo Krummrich Part-of: --- src/nouveau/codegen/nv50_ir_from_nir.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp b/src/nouveau/codegen/nv50_ir_from_nir.cpp index 9aa7ce3827a..3c3a4795178 100644 --- a/src/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp @@ -2672,10 +2672,11 @@ Converter::visit(nir_alu_instr *insn) case nir_op_u2u64: { DEFAULT_CHECKS; LValues &newDefs = convert(&insn->dest); + DataType stype = sTypes[0]; Instruction *i = mkOp1(getOperation(op), dType, newDefs[0], getSrc(&insn->src[0])); - if (op == nir_op_f2i32 || op == nir_op_f2i64 || op == nir_op_f2u32 || op == nir_op_f2u64) + if (::isFloatType(stype) && isIntType(dType)) i->rnd = ROUND_Z; - i->sType = sTypes[0]; + i->sType = stype; break; } // compare instructions