zink: use bitcasts instead of pack/unpack double opcodes

The pack/unpack double opcodes may flush denorms, and the nir ops are pure
bitcasts.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29125>
(cherry picked from commit 925fff229f)
This commit is contained in:
Georg Lehmann 2024-05-09 18:47:33 +02:00 committed by Eric Engestrom
parent f91463e830
commit de656a6afa
2 changed files with 3 additions and 7 deletions

View file

@ -384,7 +384,7 @@
"description": "zink: use bitcasts instead of pack/unpack double opcodes",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1915,13 +1915,7 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
result = emit_builtin_unop(ctx, GLSLstd450PackHalf2x16, get_def_type(ctx, &alu->def, nir_type_uint), src[0]);
break;
case nir_op_unpack_64_2x32:
assert(nir_op_infos[alu->op].num_inputs == 1);
result = emit_builtin_unop(ctx, GLSLstd450UnpackDouble2x32, get_def_type(ctx, &alu->def, nir_type_uint), src[0]);
break;
BUILTIN_UNOPF(nir_op_unpack_half_2x16, GLSLstd450UnpackHalf2x16)
BUILTIN_UNOPF(nir_op_pack_64_2x32, GLSLstd450PackDouble2x32)
#undef BUILTIN_UNOP
#undef BUILTIN_UNOPF
@ -2107,9 +2101,11 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
/* those are all simple bitcasts, we could do better, but it doesn't matter */
case nir_op_pack_32_4x8:
case nir_op_pack_32_2x16:
case nir_op_pack_64_2x32:
case nir_op_pack_64_4x16:
case nir_op_unpack_32_4x8:
case nir_op_unpack_32_2x16:
case nir_op_unpack_64_2x32:
case nir_op_unpack_64_4x16: {
result = emit_bitcast(ctx, dest_type, src[0]);
break;