Hi, The register allocator inserts move preferences when an instruction has one or more dead sources in add_insn_allocno_copies. If an instruction doesn't have a matching constraint (eg. "0"), then any dead source is treated as a copy with all destination registers with a low priority. In reality what appears to happen is that the first dead source is treated as a copy. This leads to non-intuitive allocations in eg. 4-register FMAs. Here you'd prefer to have the accumulator and destination to use the same register when possible: so fmadd d2, d0, d5, d2 instead of fmadd d0, d0, d5, d2.
Would it be reasonable to add an explicit move preference feature? For example use "r#0" to indicate in ira_get_dup_out_num that an operand prefers to be the same as the destination if possible. This would use a lower move priority than "0" to avoid constraining the allocation but a bit higher than a simple dead source (eg. freq / 4 or freq / 2). Wilco