1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/MC/Mips/micromips-expansions.s
Daniel Sanders be0ced1166 [mips] Use MipsMCExpr instead of MCSymbolRefExpr for all relocations.
Summary:
This is much closer to the way MIPS relocation expressions work
(%hi(foo + 2) rather than %hi(foo) + 2) and removes the need for the
various bodges in MipsAsmParser::evaluateRelocExpr().

Removing those bodges ensures that the constant stored in MCValue is the
full 32 or 64-bit (depending on ABI) offset from the symbol. This will be used
to correct the %hi/%lo matching needed to sort the relocation table correctly.

As part of this:
* Gave MCExpr::print() the ability to omit parenthesis when emitting a
  symbol reference inside a MipsMCExpr operator like %hi(X). Without this
  we print things like %lo(($L1)).
* %hi(%neg(%gprel(X))) is now three MipsMCExpr's instead of one. Most of
  the related special cases have been removed or moved to MipsMCExpr. We
  can remove the rest as we gain support for the less common relocations
  when they are not part of this specific combination.
* Renamed MipsMCExpr::VariantKind and the enum prefix ('VK_') to avoid confusion
  with MCSymbolRefExpr::VariantKind and its prefix (also 'VK_').
* fixup_Mips_GOT_Local and fixup_Mips_GOT_Global were found to be identical
  and merged into fixup_Mips_GOT.
* MO_GOT16 and MO_GOT turned out to be identical and have been merged into
  MO_GOT.
* VK_Mips_GOT and VK_Mips_GOT16 turned out to be the same thing so they
  have been merged into MEK_GOT

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

Differential Revision: http://reviews.llvm.org/D19716

llvm-svn: 268379
2016-05-03 13:35:44 +00:00

58 lines
2.9 KiB
ArmAsm

# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding \
# RUN: -mcpu=mips32r2 -mattr=micromips | FileCheck %s
# Check that the assembler can handle the documented syntax
# for macro instructions
#------------------------------------------------------------------------------
# Load immediate instructions
#------------------------------------------------------------------------------
# CHECK: addiu $5, $zero, 123 # encoding: [0xa0,0x30,0x7b,0x00]
# CHECK: addiu $6, $zero, -2345 # encoding: [0xc0,0x30,0xd7,0xf6]
# CHECK: lui $7, 1 # encoding: [0xa7,0x41,0x01,0x00]
# CHECK: ori $7, $7, 2 # encoding: [0xe7,0x50,0x02,0x00]
# CHECK: addiu $4, $zero, 20 # encoding: [0x80,0x30,0x14,0x00]
# CHECK: lui $7, 1 # encoding: [0xa7,0x41,0x01,0x00]
# CHECK: ori $7, $7, 2 # encoding: [0xe7,0x50,0x02,0x00]
# CHECK: addiu $4, $5, 20 # encoding: [0x85,0x30,0x14,0x00]
# CHECK: lui $7, 1 # encoding: [0xa7,0x41,0x01,0x00]
# CHECK: ori $7, $7, 2 # encoding: [0xe7,0x50,0x02,0x00]
# CHECK: addu $7, $7, $8 # encoding: [0x07,0x01,0x50,0x39]
# CHECK: lui $10, %hi(symbol) # encoding: [0xaa'A',0x41'A',0x00,0x00]
# CHECK: # fixup A - offset: 0,
# CHECK: value: %hi(symbol),
# CHECK: kind: fixup_MICROMIPS_HI16
# CHECK: addu $10, $10, $4 # encoding: [0x8a,0x00,0x50,0x51]
# CHECK: lw $10, %lo(symbol)($10) # encoding: [0x4a'A',0xfd'A',0x00,0x00]
# CHECK: # fixup A - offset: 0,
# CHECK: value: %lo(symbol),
# CHECK: kind: fixup_MICROMIPS_LO16
# CHECK: lui $1, %hi(symbol) # encoding: [0xa1'A',0x41'A',0x00,0x00]
# CHECK: # fixup A - offset: 0,
# CHECK: value: %hi(symbol),
# CHECK: kind: fixup_MICROMIPS_HI16
# CHECK: addu $1, $1, $9 # encoding: [0x21,0x01,0x50,0x09]
# CHECK: sw $10, %lo(symbol)($1) # encoding: [0x41'A',0xf9'A',0x00,0x00]
# CHECK: # fixup A - offset: 0,
# CHECK: value: %lo(symbol),
# CHECK: kind: fixup_MICROMIPS_LO16
# CHECK: lui $10, 10 # encoding: [0xaa,0x41,0x0a,0x00]
# CHECK: addu $10, $10, $4 # encoding: [0x8a,0x00,0x50,0x51]
# CHECK: lw $10, 123($10) # encoding: [0x4a,0xfd,0x7b,0x00]
# CHECK: lui $1, 2 # encoding: [0xa1,0x41,0x02,0x00]
# CHECK: addu $1, $1, $9 # encoding: [0x21,0x01,0x50,0x09]
# CHECK: sw $10, -7616($1) # encoding: [0x41,0xf9,0x40,0xe2]
li $5,123
li $6,-2345
li $7,65538
la $a0, 20
la $7,65538
la $a0, 20($a1)
la $7,65538($8)
lw $t2, symbol($a0)
sw $t2, symbol($t1)
lw $t2, 655483($a0)
sw $t2, 123456($t1)