From: Samuel Pitoiset Date: Thu, 9 Apr 2020 14:41:00 +0000 (+0200) Subject: aco: allow to swap operands for some 16-bit float instructions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c1b55962e0da924bc96a16689c9421888891959;p=mesa.git aco: allow to swap operands for some 16-bit float instructions No fossil-db changes. Signed-off-by: Samuel Pitoiset Reviewed-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 0934a6f3272..5e68e3f3b43 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -509,26 +509,41 @@ bool can_swap_operands(aco_ptr& instr) return false; switch (instr->opcode) { + case aco_opcode::v_add_f16: case aco_opcode::v_add_f32: + case aco_opcode::v_mul_f16: case aco_opcode::v_mul_f32: case aco_opcode::v_or_b32: case aco_opcode::v_and_b32: case aco_opcode::v_xor_b32: + case aco_opcode::v_max_f16: case aco_opcode::v_max_f32: + case aco_opcode::v_min_f16: case aco_opcode::v_min_f32: case aco_opcode::v_max_i32: case aco_opcode::v_min_i32: case aco_opcode::v_max_u32: case aco_opcode::v_min_u32: + case aco_opcode::v_cmp_eq_f16: case aco_opcode::v_cmp_eq_f32: + case aco_opcode::v_cmp_lg_f16: case aco_opcode::v_cmp_lg_f32: return true; + case aco_opcode::v_sub_f16: + instr->opcode = aco_opcode::v_subrev_f16; + return true; case aco_opcode::v_sub_f32: instr->opcode = aco_opcode::v_subrev_f32; return true; + case aco_opcode::v_cmp_lt_f16: + instr->opcode = aco_opcode::v_cmp_gt_f16; + return true; case aco_opcode::v_cmp_lt_f32: instr->opcode = aco_opcode::v_cmp_gt_f32; return true; + case aco_opcode::v_cmp_ge_f16: + instr->opcode = aco_opcode::v_cmp_le_f16; + return true; case aco_opcode::v_cmp_ge_f32: instr->opcode = aco_opcode::v_cmp_le_f32; return true;