This is the mail archive of the
mailing list for the GCC project.
Re: Instruction scheduling for the R5900's 2 integer pipelines
- From: Jeff Law <law at redhat dot com>
- To: Woon yung Liu <ysai187 at yahoo dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 19 Jan 2016 07:32:02 -0700
- Subject: Re: Instruction scheduling for the R5900's 2 integer pipelines
- Authentication-results: sourceware.org; auth=none
- References: <232007121 dot 5716854 dot 1453172082167 dot JavaMail dot yahoo dot ref at mail dot yahoo dot com> <232007121 dot 5716854 dot 1453172082167 dot JavaMail dot yahoo at mail dot yahoo dot com> <1794212703 dot 5815848 dot 1453205056054 dot JavaMail dot yahoo at mail dot yahoo dot com>
On 01/19/2016 05:04 AM, Woon yung Liu wrote:
There was a time where GCC would generate mult/multiply-add instructions
that would issue into the 2nd R5900 pipeline.
I'm am trying to complete support for the MIPS R5900, by adding support for its second
interger multiplication/division pipe. GCC currently supports only the first one.My target at this moment is the public GCC v5.3.0 release.
To get the 2nd pipeline supported, I've added the hi1 and lo1 registers to GCC, as well as
constraints for them (wr for hi1lo1 and wl for lo1). The existing instructions in mips.md have
been modified to use the new constraints as new alternatives.
A new constraint modifier was added too, which will append a 1 to the instruction (i.e.
changes mult to mult1) if it detects that the specified operand is for pipeline 1 instead of 0.
The 2nd pipeline is utilized by using different instructions (i.e. mult1 instead of mult, as
mult is for the 1st pipeline) and registers (i.e. lo1 and hi1, instead of lo and hi).
Right now, I know that it is possible for GCC to output the new instructions for the 2nd
pipeline if I manipulate the MD constrains for instructions like mult... but GCC doesn't seem
to be ever using the 2nd pipeline on its own otherwise.
I originally believed that it's because I didn't add in a pipeline description into my MD file
(5900.md), but nothing seemed to have changed after I did that.
I followed the documentation on the pipeline description, but I realized that I still don't
understand how the automatron will tell GCC which alternative (and hence which integer pipe)
to use and so I don't think think there's a relationship between the automatron and the two
different sets of multiplication/divisions instructions yet.
Could somebody please advice me on how to get this going? Or at least, tell me which other
target has two integer pipelines that are used in this way, so that I will have something to
AFAIK, no other MIPS processors have this 2nd pipeline design as the R5900.
It's been 15+ years since I looked at that problem, but IIRC I twiddled
the old register allocator, along with the expected changes in the
pipeline and constraints for the mul/mul-add insns in the mips backend
to exploit the dual multiply pipes on the r5900.
The key was to realize that because selection of the pipeline is static
based on the registers used, you have to look at this as a register
You might dig out the old Cygnus releases. They may provide clues,
particularly on the register allocation tweak.