aco: Fix convert_to_SDWA when instruction has 3 operands.
[mesa.git] / src / amd / compiler / aco_ir.cpp
index 2a0a500a7b69c9e2803e2c26ac05af86ce295749..b594b2824e9a1ed4f02b2824df07ba49a3fc81aa 100644 (file)
@@ -34,6 +34,7 @@ static const struct debug_control aco_debug_options[] = {
    {"validateir", DEBUG_VALIDATE_IR},
    {"validatera", DEBUG_VALIDATE_RA},
    {"perfwarn", DEBUG_PERFWARN},
+   {"force-waitcnt", DEBUG_FORCE_WAITCNT},
    {NULL, 0}
 };
 
@@ -237,6 +238,10 @@ aco_ptr<Instruction> convert_to_SDWA(chip_class chip, aco_ptr<Instruction>& inst
    }
 
    for (unsigned i = 0; i < instr->operands.size(); i++) {
+      /* SDWA only uses operands 0 and 1. */
+      if (i >= 2)
+         break;
+
       switch (instr->operands[i].bytes()) {
       case 1:
          sdwa->sel[i] = sdwa_ubyte;