[PATCH] D110240: [MSP430] Implement PUSHM and POPM instructions

Jozef Lawrynowicz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 06:06:45 PDT 2021


jozefl created this revision.
jozefl added reviewers: asl, atrosinenko.
Herald added a subscriber: hiraditya.
jozefl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The MSP430X CPU supports the PUSHM and POPM instructions, which can push
and pop multiple registers to and from the stack in a single
instruction.

For example:

  pushm #2, r10
  popm  #2, r10

is equivalent to:

  push r10
  push r9
  pop r9
  pop r10

PUSHM and POPM only cost 2+n cycles, with a size of one word, so their
use can significantly improve performance and reduce code size,
compared to using individual PUSH and POP instructions.

In addition to the LLVM regression tests, I also ran the dg.exp, execute.exp,
and dg-torture.exp testsuites from GCC, using the MSP430 Binutils simulator.
The results for -mcpu=msp430{,x} were unchanged compared to the results for
without the patch.

If the patch is acceptable, I would appreciate it if someone would apply it
for me using the name and email
"Jozef Lawrynowicz <jozefl.opensrc at gmail.com>",
as I do not have commit access.

Thanks,
Jozef


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110240

Files:
  llvm/lib/Target/MSP430/Disassembler/MSP430Disassembler.cpp
  llvm/lib/Target/MSP430/MCTargetDesc/MSP430MCCodeEmitter.cpp
  llvm/lib/Target/MSP430/MSP430FrameLowering.cpp
  llvm/lib/Target/MSP430/MSP430InstrFormats.td
  llvm/lib/Target/MSP430/MSP430InstrInfoExtended.td
  llvm/test/CodeGen/MSP430/callee-saved-fp.ll
  llvm/test/CodeGen/MSP430/pushm-popm.ll
  llvm/test/MC/MSP430/pushm-popm-invalid.s
  llvm/test/MC/MSP430/pushm-popm.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110240.374197.patch
Type: text/x-patch
Size: 18957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210922/7b98421f/attachment.bin>


More information about the llvm-commits mailing list