This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFC: Explicit move preference hints
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Vladimir Makarov <vmakarov at redhat dot com>
- Cc: nd <nd at arm dot com>
- Date: Tue, 22 Aug 2017 10:48:17 +0000
- Subject: RFC: Explicit move preference hints
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco dot Dijkstra at arm dot com;
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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