This is an archive of the discontinued LLVM Phabricator instance.

[mips][microMIPS] Implement LWSP and SWSP instructions
ClosedPublic

Authored by jkolek on Nov 26 2014, 4:09 AM.

Diff Detail

Event Timeline

jkolek updated this revision to Diff 16644.Nov 26 2014, 4:09 AM
jkolek retitled this revision from to [mips][microMIPS] Implement LWSP and SWSP instructions.
jkolek updated this object.
jkolek edited the test plan for this revision. (Show Details)
jkolek added reviewers: dsanders, sstankovic, vmedic.
jkolek added subscribers: Unknown Object (MLST), zoran.jovanovic, atanasyan.
jkolek updated this revision to Diff 16704.Nov 27 2014, 11:13 AM

Reused existing assembler operand predicate method isMemWithUimmOffsetSP.

sstankovic added inline comments.Nov 28 2014, 4:39 AM
test/MC/Mips/micromips-16-bit-instructions.s
74

This is another case where there is a difference between microMIPS reference documentation and gas. gas doesn't support lwsp and swsp mnemonics. gas emits these two encodings (0x4868 and 0xc89f ) when assembling following two instructions

lw $3, 32($sp)
sw $4, 124($sp)

I suggest that you (at least for now) print these instructions using the mnemonics that gas supports, and add a comment in the patch that this problem exists.

jkolek updated this revision to Diff 17173.Dec 11 2014, 6:43 AM

Implemented assembler pseudo instructions LW/SW: If offset fits into 7 bits and base register is SP then create LWSP/SWSP encoding instead of LW/SW.

jkolek updated this revision to Diff 17563.Dec 22 2014, 9:44 AM
jkolek added a subscriber: petarj.
sstankovic edited edge metadata.Dec 23 2014, 3:06 AM

This patch doesn't correctly handle the case when (offset % 4) != 0. For example, for the following instruction

lw v1,123(sp)

instead of emitting 32-bit "lw v1,123(sp)" the patch emits 16-bit "lw v1,120(sp)"

Please include this instruction in the tests.

jkolek updated this revision to Diff 17593.Dec 23 2014, 6:25 AM
jkolek edited edge metadata.
sstankovic accepted this revision.Dec 23 2014, 7:22 AM
sstankovic edited edge metadata.
This revision is now accepted and ready to land.Dec 23 2014, 7:22 AM
This revision was automatically updated to reflect the committed changes.