This is an archive of the discontinued LLVM Phabricator instance.

[mips][mips64r6] Added mul/mulu/muh/muhu
ClosedPublic

Authored by dsanders on May 8 2014, 6:03 AM.

Details

Summary

The 'mul' line of the test is temporarily commented out because it currently matches the MIPS32 mul instead of the MIPS32r6 mul. This line will be uncommented when we disable the MIPS32 mul on MIPS32r6.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 9209.May 8 2014, 6:03 AM
dsanders retitled this revision from to [mips][mips64r6] Added mul/mulu/muh/muhu.
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added reviewers: jkolek, zoran.jovanovic.
vmedic accepted this revision.May 8 2014, 7:39 AM
vmedic edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 8 2014, 7:39 AM
jkolek added inline comments.May 8 2014, 8:35 AM
lib/Target/Mips/Mips32r6InstrFormats.td
20

I would like to move this MipsR6Inst base class to be inherited by *_DESC_BASE classes in Mips32r2InstrInfo.td, because when I'm trying to do something like this:

class BRANCH_DESC_BASE<string instr_asm, DAGOperand opnd> {

...
let isBranch = 1;
...

}
I'm receiving an error message:
llvm/lib/Target/Mips/Mips32r6InstrInfo.td:88:18: error: Value 'isBranch' unknown!

let isBranch = 1;

So I would like to do this:
Mips32r6InstFormats.td:
class SPECIAL_3R_FM<bits<5> mulop, bits<6> funct> {

...

}

Mips32r6InstInfo.td:
class BRANCH_DESC_BASE<string instr_asm, DAGOperand opnd> : MipsR6Inst {

...

}

class MUL_R6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> : MipsR6Inst {

...

}

dsanders added inline comments.May 8 2014, 8:56 AM
lib/Target/Mips/Mips32r6InstrFormats.td
20

Unfortunately deriving the *_DESC classes from MipsR6Inst has other problems. It overrides the changes specified by the *_ENC classes, resetting the encodings to zero.

This should do what you want:

class BRANCH_DESC_BASE<string instr_asm, DAGOperand opnd> {
...
bit isBranch = 1;
...
}
jkolek added inline comments.May 8 2014, 9:23 AM
lib/Target/Mips/Mips32r6InstrFormats.td
20

I just changed 'let isBranch = 1;' to 'bit isBranch = 1;', now everything is fine.

zoran.jovanovic added inline comments.May 9 2014, 6:02 AM
lib/Target/Mips/Mips32r6InstrInfo.td
74

Is it possible, at least for some instructions, to use "_DESC" classes from MIPS32 instructions descriptions?
E.g. MULU r6 instruction has same structure as MUL r2 (and r6) instruction - only encoding is different, everything else is the same.

dsanders added inline comments.May 9 2014, 8:12 AM
lib/Target/Mips/Mips32r6InstrInfo.td
74

It should be possible. If we are going to merge them, we should probably do so when we add codegen support

I've just re-tested this and 'mul $2,$3,$4' has started matching the old 'mul' instruction instead of the new one. This patch is the bottleneck for the rest of the branch so for now, I'm going to comment out the 'mul' line and I will restore it when we disable the old mul in MIPS32r6/MIPS64r6.

dsanders updated this object.May 12 2014, 8:19 AM
dsanders edited edge metadata.
dsanders closed this revision.May 12 2014, 8:20 AM