File: mips-hilo.s

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (52 lines) | stat: -rw-r--r-- 1,558 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# REQUIRES: mips
# Check R_MIPS_HI16 / LO16 relocations calculation.

# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: echo "SECTIONS { . = 0x20000; .text ALIGN(0x1000) : { *(.text) } }" > %t.script
# RUN: ld.lld %t.o --script %t.script -o %t.exe
# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s

  .text
  .globl  __start
__start:
  lui    $t0,%hi(__start)
  lui    $t1,%hi(g1)
  addi   $t0,$t0,%lo(__start+4)
  addi   $t0,$t0,%lo(g1+8)

  lui    $t0,%hi(l1+0x10000)
  lui    $t1,%hi(l1+0x20000)
  addi   $t0,$t0,%lo(l1+(-4))

  .data
  .type  l1,@object
  .size  l1,4
l1:
  .word 0

  .globl g1
  .type  g1,@object
  .size  g1,4
g1:
  .word 0

# CHECK: SYMBOL TABLE:
# CHECK: 0021020 l     O .data   00000004 l1
# CHECK: 0021000 g       .text   00000000 __start
# CHECK: 0021024 g     O .data   00000004 g1

# CHECK:      <__start>:
# CHECK-NEXT:  21000:   lui    $8, 2
#                                  ^-- %hi(__start+4)
# CHECK-NEXT:  21004:   lui    $9, 2
#                                  ^-- %hi(g1+8)
# CHECK-NEXT:  21008:   addi   $8, $8, 4100
#                                      ^-- %lo(__start+4)
# CHECK-NEXT:  2100c:   addi   $8, $8, 4140
#                                      ^-- %lo(g1+8)
# CHECK-NEXT:  21010:   lui    $8, 3
#                                  ^-- %hi(l1+0x10000-4)
# CHECK-NEXT:  21014:   lui    $9, 4
#                                  ^-- %hi(l1+0x20000-4)
# CHECK-NEXT:  21018:   addi   $8, $8, 4124
#                                      ^-- %lo(l1-4)