From 6a39d35df062603a2e20467fa27575ac3c9e7eae Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Wed, 19 Apr 2023 13:03:03 +0800 Subject: [PATCH] aco: fix nir_f2u64 translation mantissa needs to be at the lower part for shift left. This fixes large integer value conversion. Cc: mesa-stable Reviewed-by: Georg Lehmann Signed-off-by: Qiang Yu Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 0139a8d..2e09da8 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -3275,7 +3275,7 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr) mantissa = bld.vop2(aco_opcode::v_or_b32, bld.def(v1), Operand::c32(0x800000u), mantissa); Temp exponent_small = bld.vsub32(bld.def(v1), Operand::c32(24u), exponent); Temp small = bld.vop2(aco_opcode::v_lshrrev_b32, bld.def(v1), exponent_small, mantissa); - mantissa = bld.pseudo(aco_opcode::p_create_vector, bld.def(v2), Operand::zero(), mantissa); + mantissa = bld.pseudo(aco_opcode::p_create_vector, bld.def(v2), mantissa, Operand::zero()); Temp new_exponent = bld.tmp(v1); Temp cond_small = bld.vsub32(Definition(new_exponent), exponent, Operand::c32(24u), true).def(1).getTemp(); @@ -3311,7 +3311,7 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr) Operand::c32(24u), exponent); Temp small = bld.sop2(aco_opcode::s_lshr_b32, bld.def(s1), bld.def(s1, scc), mantissa, exponent_small); - mantissa = bld.pseudo(aco_opcode::p_create_vector, bld.def(s2), Operand::zero(), mantissa); + mantissa = bld.pseudo(aco_opcode::p_create_vector, bld.def(s2), mantissa, Operand::zero()); Temp exponent_large = bld.sop2(aco_opcode::s_sub_u32, bld.def(s1), bld.def(s1, scc), exponent, Operand::c32(24u)); mantissa = bld.sop2(aco_opcode::s_lshl_b64, bld.def(s2), bld.def(s1, scc), mantissa, @@ -3319,7 +3319,7 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr) Temp cond = bld.sopc(aco_opcode::s_cmp_ge_i32, bld.def(s1, scc), Operand::c32(64u), exponent); mantissa = bld.sop2(aco_opcode::s_cselect_b64, bld.def(s2), mantissa, - Operand::c32(0xffffffffu), cond); + Operand::c64(~0llu), cond); Temp lower = bld.tmp(s1), upper = bld.tmp(s1); bld.pseudo(aco_opcode::p_split_vector, Definition(lower), Definition(upper), mantissa); Temp cond_small = -- 2.7.4