From 30a5982e7560234e563856961fb0d6d6967801c7 Mon Sep 17 00:00:00 2001 From: Jack Carter Date: Thu, 4 Oct 2012 04:03:53 +0000 Subject: Implement methods that enable expansion of load immediate macro instruction (li) in the assembler. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 llvm-svn: 165199 --- llvm/test/MC/Mips/mips-expansions.s | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 llvm/test/MC/Mips/mips-expansions.s (limited to 'llvm/test/MC') diff --git a/llvm/test/MC/Mips/mips-expansions.s b/llvm/test/MC/Mips/mips-expansions.s new file mode 100644 index 00000000000..b87bfbdc5b2 --- /dev/null +++ b/llvm/test/MC/Mips/mips-expansions.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | FileCheck %s +# Check that the assembler can handle the documented syntax +# for macro instructions +# CHECK: .section __TEXT,__text,regular,pure_instructions +#------------------------------------------------------------------------------ +# Load immediate instructions +#------------------------------------------------------------------------------ +# CHECK: ori $5, $zero, 123 # encoding: [0x7b,0x00,0x05,0x34] +# CHECK: addiu $6, $zero, -2345 # encoding: [0xd7,0xf6,0x06,0x24] +# CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c] +# CHECK: ori $7, $7, 2 # encoding: [0x02,0x00,0xe7,0x34] + li $5,123 + li $6,-2345 + li $7,65538 -- cgit v1.2.3