Patch implements DCLO, DCLZ, DROTR, DROTR32 and DROTRV instructions for microMIPS64r6.
Details
Diff Detail
Event Timeline
Can you rebase and repost this patch?
You should also extend test/CodeGen/Mips/countleading.ll and test/CodeGen/Mips/mips64shift.ll for checking microMIPS64R6 for these instructions.
lib/Target/Mips/MicroMips64r6InstrFormats.td | ||
---|---|---|
222 | Rename this to POOL32S_2R_SA5_FM_MMR6. Putting a '_' between the 2R and SA5 makes it a bit clearer that this class describes a instruction with a 2 register and shift amount of 5 form. | |
lib/Target/Mips/Mips64InstrInfo.td | ||
282–287 | These need to be marked NoInMicroMips too. | |
test/MC/Mips/micromips64r6/valid.s | ||
289 | Please restore the blank line at the end. |
Changed FM classes so that they inherit from MipsR6Inst and MMR6Arch.
Changed DESC classes for DCLO, DCLZ, DSBH_DSHD so that they don't inherit from MipsR6Inst and MMR6Arch.
Added BaseOpcode to desc classes that were missing it.
Added two SHIFT_ROTATE classes to serve as DESC_BASE to all shift and rotate instructions in MM64R6.
Added CodeGen support and tests for DROTR, DROTRV, DCLZ, DCLO in MM64R6.
This update has been contributed by @mamidzic.
Some nits and one minor change+addition.
For convenience, mips64 assemblers treat instructions like drotr as taking an immediate value in the range of 0..63 and then picking the d<op>32 form if required.
You will need to modify MipsMCCodeEmitter::encodeInstruction to do this.
lib/Target/Mips/MicroMips64r6InstrInfo.td | ||
---|---|---|
250–251 | Like DSLL_, DSRA_, DROTR_MM64R6_DESC should take a uimm6 & immZExt6. You will then have to modify MipsMCCodeEmitter::encodeInstruction & LowerLargeShift as well to pick the correct D<op> or D<op>32. | |
lib/Target/Mips/Mips64InstrInfo.td | ||
166–182 | Join these two blocks together. | |
293–295 | These two blocks can also be joined together. | |
lib/Target/Mips/Mips64r6InstrInfo.td | ||
103–111 | Join these two block together. | |
test/CodeGen/Mips/mips64shift.ll | ||
100–101 | Once the above change is made, this can be simplified back to drotr $... 54. |
One further thing: drotr and dclo, dclz do not appear in the instruction mapping tables.
lib/Target/Mips/MicroMips64r6InstrInfo.td | ||
---|---|---|
250–251 | An alternative way to do this is to make the DROTR32_*_DESC class use immZExtPlus32 so that SelectionDAG picks the correct instruction up front. Then the assembler part can be added using an appropriate InstAlias using the uimm5_plus32 operand. The main benefit of this approach is that we can leave the implementation to tablegen instead of writing custom C++. I have a slight preference for the tablegen approach but if you go that route then you should also change the MIPS64 version for consistency. If you don't want to change the MIPS64 version right now then I'm ok with using the uimm6 and MipsMCCodeEmitter approach Simon describes for now. |
Added MM64R6 cases to LowerLargeShift and encodeInstruction for DSLL, DSRA and DROTR instructions.
Instruction mapping tables:
Added StdMMR6Rel to DSLL, DSRA, DCLO, and DCLZ Mips64 instructions. Added R6MMR6Rel to DCLO and DCLZ Mips64R6 instructions.
Joined NotInMicroMips predicate blocks where possible.
This update has been contributed by @mamidzic.
Rename this to POOL32S_2R_SA5_FM_MMR6. Putting a '_' between the 2R and SA5 makes it a bit clearer that this class describes a instruction with a 2 register and shift amount of 5 form.