mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
aco: flush denormals for 16-bit fmin/fmax on GFX8
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26445>
This commit is contained in:
parent
a9a2eabea8
commit
b7725b072b
1 changed files with 9 additions and 6 deletions
|
|
@ -879,8 +879,11 @@ emit_vop2_instruction(isel_context* ctx, nir_alu_instr* instr, aco_opcode opc, T
|
||||||
|
|
||||||
if (flush_denorms && ctx->program->gfx_level < GFX9) {
|
if (flush_denorms && ctx->program->gfx_level < GFX9) {
|
||||||
assert(dst.size() == 1);
|
assert(dst.size() == 1);
|
||||||
Temp tmp = bld.vop2(opc, bld.def(v1), op[0], op[1]);
|
Temp tmp = bld.vop2(opc, bld.def(dst.regClass()), op[0], op[1]);
|
||||||
bld.vop2(aco_opcode::v_mul_f32, Definition(dst), Operand::c32(0x3f800000u), tmp);
|
if (dst.bytes() == 2)
|
||||||
|
bld.vop2(aco_opcode::v_mul_f16, Definition(dst), Operand::c16(0x3c00), tmp);
|
||||||
|
else
|
||||||
|
bld.vop2(aco_opcode::v_mul_f32, Definition(dst), Operand::c32(0x3f800000u), tmp);
|
||||||
} else {
|
} else {
|
||||||
if (nuw) {
|
if (nuw) {
|
||||||
bld.nuw().vop2(opc, Definition(dst), op[0], op[1]);
|
bld.nuw().vop2(opc, Definition(dst), op[0], op[1]);
|
||||||
|
|
@ -2447,8 +2450,8 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
|
||||||
}
|
}
|
||||||
case nir_op_fmax: {
|
case nir_op_fmax: {
|
||||||
if (dst.regClass() == v2b) {
|
if (dst.regClass() == v2b) {
|
||||||
// TODO: check fp_mode.must_flush_denorms16_64
|
emit_vop2_instruction(ctx, instr, aco_opcode::v_max_f16, dst, true, false,
|
||||||
emit_vop2_instruction(ctx, instr, aco_opcode::v_max_f16, dst, true);
|
ctx->block->fp_mode.must_flush_denorms16_64);
|
||||||
} else if (dst.regClass() == v1 && instr->def.bit_size == 16) {
|
} else if (dst.regClass() == v1 && instr->def.bit_size == 16) {
|
||||||
emit_vop3p_instruction(ctx, instr, aco_opcode::v_pk_max_f16, dst);
|
emit_vop3p_instruction(ctx, instr, aco_opcode::v_pk_max_f16, dst);
|
||||||
} else if (dst.regClass() == v1) {
|
} else if (dst.regClass() == v1) {
|
||||||
|
|
@ -2464,8 +2467,8 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
|
||||||
}
|
}
|
||||||
case nir_op_fmin: {
|
case nir_op_fmin: {
|
||||||
if (dst.regClass() == v2b) {
|
if (dst.regClass() == v2b) {
|
||||||
// TODO: check fp_mode.must_flush_denorms16_64
|
emit_vop2_instruction(ctx, instr, aco_opcode::v_min_f16, dst, true, false,
|
||||||
emit_vop2_instruction(ctx, instr, aco_opcode::v_min_f16, dst, true);
|
ctx->block->fp_mode.must_flush_denorms16_64);
|
||||||
} else if (dst.regClass() == v1 && instr->def.bit_size == 16) {
|
} else if (dst.regClass() == v1 && instr->def.bit_size == 16) {
|
||||||
emit_vop3p_instruction(ctx, instr, aco_opcode::v_pk_min_f16, dst, true);
|
emit_vop3p_instruction(ctx, instr, aco_opcode::v_pk_min_f16, dst, true);
|
||||||
} else if (dst.regClass() == v1) {
|
} else if (dst.regClass() == v1) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue