1# RUN: llvm-mc -filetype=obj -triple=mips64el-unknown-linux -mcpu=mips64r2 %s \ 2# RUN: | llvm-objdump -disassemble -triple mips64el - | FileCheck %s 3 4# RUN: llvm-mc -filetype=obj -triple=mips64el-unknown-linux -mcpu=mips64r2 %s \ 5# RUN: | llvm-readobj -r | FileCheck %s -check-prefix=CHECK-REL 6 7 8# Test that R_MIPS_HIGHER and R_MIPS_HIGHEST relocations are created. By using 9# NEXT we also test that none of the expressions from the test2 generates 10# relocations. 11 12test1: 13# CHECK-LABEL: test1: 14 15 lui $5, %highest(func) 16 daddiu $5, $5, %higher(func) 17 18# CHECK-REL: Relocations [ 19# CHECK-REL-NEXT: { 20# CHECK-REL-NEXT: 0x{{[0-9,A-F]+}} R_MIPS_HIGHEST 21# CHECK-REL-NEXT: 0x{{[0-9,A-F]+}} R_MIPS_HIGHER 22# CHECK-REL-NEXT: } 23 24 25# Test the calculation of %higher and %highest: 26# ((x + 0x80008000) >> 32) & 0xffff (higher) 27# ((x + 0x800080008000) >> 48) & 0xffff (highest). 28 29test2: 30# CHECK-LABEL: test2: 31 32# Check the case where relocations are not modified by adding +1. The constant 33# is chosen so that it is just below the value that triggers the addition of +1 34# to %higher. 35$L1: 36 lui $6, %highest($L2-$L1+0x300047FFF7FF7) 37 daddiu $6, $6, %higher($L2-$L1+0x300047FFF7FF7) 38$L2: 39# CHECK: lui $6, 3 40# CHECK: daddiu $6, $6, 4 41 42 43# Check the case where %higher is modified by adding +1. 44 lui $7, %highest($L2-$L1+0x300047FFF7FF8) 45 ld $7, %higher ($L2-$L1+0x300047FFF7FF8)($7) 46# CHECK: lui $7, 3 47# CHECK: ld $7, 5($7) 48 49 50# Check the case where both %higher and %highest are modified by adding +1. 51 lui $8, %highest(0x37FFF7FFF8000) 52 ld $8, %higher (0x37FFF7FFF8000)($8) 53# CHECK: lui $8, 4 54# CHECK: ld $8, -32768($8) 55