This is the mail archive of the gcc@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]

Re: Instruction scheduling for the R5900's 2 integer pipelines


On 01/19/2016 05:04 AM, Woon yung Liu wrote:
Hi,




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
reference to?

AFAIK, no other MIPS processors have this 2nd pipeline design as the R5900.
There was a time where GCC would generate mult/multiply-add instructions that would issue into the 2nd R5900 pipeline.

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 allocation problem.

You might dig out the old Cygnus releases. They may provide clues, particularly on the register allocation tweak.

Jeff


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