This is an archive of the discontinued LLVM Phabricator instance.

[mips][mips64r6] Add aui, daui, dahi, and dati
ClosedPublic

Authored by dsanders on May 14 2014, 5:33 AM.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 9384.May 14 2014, 5:33 AM
dsanders retitled this revision from to [mips][mips64r6] Add aui, daui, dahi, and dati.
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
vmedic accepted this revision.May 15 2014, 1:38 AM
vmedic edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 15 2014, 1:38 AM
dsanders updated this revision to Diff 9430.May 15 2014, 2:59 AM
dsanders edited edge metadata.

Refresh patch so it applies cleanly

jkolek added inline comments.May 15 2014, 3:07 AM
lib/Target/Mips/Mips32r6InstrFormats.td
63

I have just a question. Is there any particular reason why is inheritance used here? Couldn't we have single format class for AUI, DAHI, DATI and DAUI, and just to pass opcode as parameter, like we did for all other similar instructions so far? I'm just wondering why not to have a single style for doing a same things.
Maybe the class name should be different, but I was thinking to have something like this:

class AUI_FM<bits<6> opcode> : MipsR6Inst {
 bits<5> rs;
 bits<5> rt;
 bits<16> imm;

 bits<32> Inst;

 let Inst{31-26} = opcode;
 let Inst{25-21} = rs;
 let Inst{20-16} = rt;
 let Inst{15-0} = imm;
}
dsanders added inline comments.May 15 2014, 3:34 AM
lib/Target/Mips/Mips32r6InstrFormats.td
63

DAHI and DATI are actually in the REGIMM_FM format.

For AUI and DAUI: My thinking was that the format is derived from the top 6 bits of the opcode (with a few exceptions such as the SPECIAL formats). AUI and DAUI differ in these format bits and should therefore be different formats. Inheritance is merely used to exploit the similarity between these two formats.

At the moment the compact branch formats are inconsistent with this line of thinking. I'll probably separate them into BLEZL/BGTZL/etc. formats at some point after we have a minimal compiler working. The main advantage of this is that you can glance at the format name and easily see how it maps to the spec since it uses the same names. It's also easier to spot mistakes in words rather than binary values. The OPCODE*_* constants are the result of the same line of thinking.

dsanders closed this revision.May 15 2014, 3:34 AM
dsanders added inline comments.May 15 2014, 3:36 AM
lib/Target/Mips/Mips32r6InstrFormats.td
63

I've just committed the patch (so I can commit the later work) but I'm still open to changing this if that's what we decide to do.