From: Tony Wasserka Date: Fri, 12 Mar 2021 10:13:51 +0000 (+0100) Subject: aco/isel: Add documentation for (u)int64->f16 conversion X-Git-Tag: upstream/21.2.3~5876 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8557ac9a1249eac77f6f114f1d8c8884998b5b2c;p=platform%2Fupstream%2Fmesa.git aco/isel: Add documentation for (u)int64->f16 conversion The upper 32 bits are truncated before converting, which still produces correct results since they never meaningfully contribute to the result. Reviewed-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 89b12026..b0264b3 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -2450,6 +2450,11 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr) src = convert_int(ctx, bld, src, input_size, target_size, true); } } else if (input_size == 64) { + /* Truncate down to 32 bits; if any of the upper bits are relevant, + * the value does not fall into the single-precision float range + * anyway. SPIR-V does not mandate any specific behavior for such + * large inputs. + */ src = convert_int(ctx, bld, src, 64, 32, false); } @@ -2525,6 +2530,11 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr) src = convert_int(ctx, bld, src, input_size, target_size, false); } } else if (input_size == 64) { + /* Truncate down to 32 bits; if any of the upper bits are non-zero, + * the value does not fall into the single-precision float range + * anyway. SPIR-V does not mandate any specific behavior for such + * large inputs. + */ src = convert_int(ctx, bld, src, 64, 32, false); }