llvm-6502/test/MC/Mips/hilo-addressing.s
Jack Carter 77217229ba Mips specific standalone assembler addressing mode %hi and %lo.
The constructs %hi() and %lo() represent the high and low 16 
bits of the address. 
Because the 16 bit offset field of an LW instruction is 
interpreted as signed, if bit 15 of the low part is 1 then the 
low part will act as a negative and 1 needs to be added to the 
high part.

Contributer: Vladimir Medic


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 02:09:31 +00:00

12 lines
331 B
ArmAsm

# RUN: llvm-mc -show-encoding -triple mips-unknown-unknown %s | FileCheck %s
.ent hilo_test
.equ addr, 0xdeadbeef
# CHECK: # encoding: [0x3c,0x04,0xde,0xae]
lui $4,%hi(addr)
# CHECK: # encoding: [0x03,0xe0,0x00,0x08]
jr $31
# CHECK: # encoding: [0x80,0x82,0xbe,0xef]
lb $2,%lo(addr)($4)
.end hilo_test