Implement methods that enable expansion of load immediate
authorJack Carter <jcarter@mips.com>
Thu, 4 Oct 2012 04:03:53 +0000 (04:03 +0000)
committerJack Carter <jcarter@mips.com>
Thu, 4 Oct 2012 04:03:53 +0000 (04:03 +0000)
commit9d577c861414c28967d77c2a1edf64b68efdeaee
treea63152b36a6d8437c3ba11914e687e1183dda3fe
parent34c6b7e925566cfa71e3087f70c6e4453f51cd25
Implement methods that enable expansion of load immediate
macro instruction (li) in the assembler.

We have identified three possible expansions depending on
the size of immediate operand:
  1) for 0 ≤ j ≤ 65535.
     li d,j =>
     ori d,$zero,j

  2) for −32768 ≤ j < 0.
     li d,j =>
     addiu d,$zero,j

  3) for any other value of j that is representable as a 32-bit integer.
     li d,j =>
     lui d,hi16(j)
     ori d,d,lo16(j)

All of the above have been implemented in ths patch.

Contributer: Vladimir Medic

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165199 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
lib/Target/Mips/MipsInstrFormats.td
lib/Target/Mips/MipsInstrInfo.td
test/MC/Mips/mips-expansions.s [new file with mode: 0644]