diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index 2a89dac6807..400d58e5765 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -170,21 +170,26 @@ bool validate_ir(Program* program) "2nd definition must be fixed to vcc with SDWA", instr.get()); } - check(instr->opcode != aco_opcode::v_madmk_f32 && - instr->opcode != aco_opcode::v_madak_f32 && - instr->opcode != aco_opcode::v_madmk_f16 && - instr->opcode != aco_opcode::v_madak_f16 && - instr->opcode != aco_opcode::v_readfirstlane_b32 && - instr->opcode != aco_opcode::v_clrexcp && - instr->opcode != aco_opcode::v_swap_b32, - "SDWA can't be used with this opcode", instr.get()); - if (program->chip_class != GFX8) { - check(instr->opcode != aco_opcode::v_mac_f32 && - instr->opcode != aco_opcode::v_mac_f16 && - instr->opcode != aco_opcode::v_fmac_f32 && - instr->opcode != aco_opcode::v_fmac_f16, - "SDWA can't be used with this opcode", instr.get()); - } + const bool sdwa_opcodes = + instr->opcode != aco_opcode::v_fmac_f32 && + instr->opcode != aco_opcode::v_fmac_f16 && + instr->opcode != aco_opcode::v_fmamk_f32 && + instr->opcode != aco_opcode::v_fmaak_f32 && + instr->opcode != aco_opcode::v_fmamk_f16 && + instr->opcode != aco_opcode::v_fmaak_f16 && + instr->opcode != aco_opcode::v_madmk_f32 && + instr->opcode != aco_opcode::v_madak_f32 && + instr->opcode != aco_opcode::v_madmk_f16 && + instr->opcode != aco_opcode::v_madak_f16 && + instr->opcode != aco_opcode::v_readfirstlane_b32 && + instr->opcode != aco_opcode::v_clrexcp && instr->opcode != aco_opcode::v_swap_b32; + + const bool feature_mac = + program->chip_class == GFX8 && + (instr->opcode == aco_opcode::v_mac_f32 && + instr->opcode == aco_opcode::v_mac_f16); + + check(sdwa_opcodes || feature_mac, "SDWA can't be used with this opcode", instr.get()); if (instr->definitions[0].regClass().is_subdword()) check((sdwa.dst_sel & sdwa_asuint) == (sdwa_isra | instr->definitions[0].bytes()), "Unexpected SDWA sel for sub-dword definition", instr.get());