llvm-6502/test/MC/Mips/cpload.s
Matheus Almeida 00bdeb4c54 [mips] Add support for .cpload.
Summary:
This directive is used for setting up $gp in the beginning of a function.
It expands to three instructions if PIC is enabled:
lui   $gp, %hi(_gp_disp)
addui $gp, $gp, %lo(_gp_disp)
addu  $gp, $gp, $reg

_gp_disp is a special symbol that the linker sets to the distance between
the lui instruction and the context pointer (_gp).

Reviewers: dsanders

Reviewed By: dsanders

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207637 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-30 11:28:42 +00:00

34 lines
842 B
ArmAsm

# RUN: llvm-mc %s -arch=mips -mcpu=mips32r2 | FileCheck %s -check-prefix=ASM
#
# RUN: llvm-mc %s -arch=mips -mcpu=mips32r2 -filetype=obj -o -| \
# RUN: llvm-objdump -d -r -arch=mips - | \
# RUN: FileCheck %s -check-prefix=OBJ
# RUN: llvm-mc %s -arch=mips64 -mcpu=mips64r2 -filetype=obj -o -| \
# RUN: llvm-objdump -d -r -arch=mips - | \
# RUN: FileCheck %s -check-prefix=OBJ64
# ASM: .text
# ASM: .option pic2
# ASM: .set noreorder
# ASM: .cpload $25
# ASM: .set reorder
# OBJ: .text
# OBJ: lui $gp, 0
# OBJ: R_MIPS_HI16 _gp_disp
# OBJ: addiu $gp, $gp, 0
# OBJ: R_MIPS_LO16 _gp_disp
# OBJ: addu $gp, $gp, $25
# OBJ64: .text
# OBJ64-NOT: lui $gp, 0
# OBJ64-NOT: addiu $gp, $gp, 0
# OBJ64-NOT: addu $gp, $gp, $25
.text
.option pic2
.set noreorder
.cpload $25
.set reorder