This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Explicit move preference hints


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]