• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc %s -triple mips-unknown-linux-gnu --position-independent \
2# RUN:            -show-encoding | FileCheck %s
3
4# RUN: llvm-mc %s -triple mips-unknown-linux-gnu --position-independent \
5# RUN:            -filetype=obj -o - \
6# RUN:   | llvm-objdump -d -r - | FileCheck %s --check-prefix=CHECK-FOR-STORE
7
8# RUN: llvm-mc %s -triple mips-unknown-linux-gnu -mattr=+micromips \
9# RUN:            --position-independent -show-encoding \
10# RUN:   | FileCheck %s -check-prefix=MICROMIPS
11
12# RUN: llvm-mc %s -triple mips-unknown-linux-gnu -show-encoding \
13# RUN:   | FileCheck %s -check-prefix=NO-PIC
14
15# RUN: llvm-mc %s -triple mips64-unknown-linux-gnuabin32 \
16# RUN:            --position-independent -show-encoding \
17# RUN:   | FileCheck %s -check-prefixes=BAD-ABI,BAD-ABI-N32
18
19# RUN: llvm-mc %s -triple mips64-unknown-linux-gnu --position-independent \
20# RUN:            -show-encoding \
21# RUN:   | FileCheck %s -check-prefixes=BAD-ABI,BAD-ABI-N64
22
23  .text
24  .ent foo
25foo:
26  .frame  $sp, 0, $ra
27  .set noreorder
28
29  .cpload $25
30  .cprestore 8
31
32  jal $25
33  jal $4, $25
34  jal foo
35
36  .end foo
37
38# CHECK-FOR-STORE: sw  $gp, 8($sp)
39
40# CHECK: .cprestore 8
41# CHECK: jalr  $25                 # encoding: [0x03,0x20,0xf8,0x09]
42# CHECK: nop                       # encoding: [0x00,0x00,0x00,0x00]
43# CHECK: lw    $gp, 8($sp)         # encoding: [0x8f,0xbc,0x00,0x08]
44
45# CHECK: jalr  $4,  $25            # encoding: [0x03,0x20,0x20,0x09]
46# CHECK: nop                       # encoding: [0x00,0x00,0x00,0x00]
47# CHECK: lw    $gp, 8($sp)         # encoding: [0x8f,0xbc,0x00,0x08]
48
49# CHECK: lw    $25, %got(foo)($gp) # encoding: [0x8f,0x99,A,A]
50# CHECK:                           #   fixup A - offset: 0, value: %got(foo), kind: fixup_Mips_GOT
51# CHECK: addiu $25, $25, %lo(foo)  # encoding: [0x27,0x39,A,A]
52# CHECK:                           #   fixup A - offset: 0, value: %lo(foo), kind: fixup_Mips_LO16
53# CHECK: jalr  $25                 # encoding: [0x03,0x20,0xf8,0x09]
54# CHECK: nop                       # encoding: [0x00,0x00,0x00,0x00]
55# CHECK: lw    $gp, 8($sp)         # encoding: [0x8f,0xbc,0x00,0x08]
56# CHECK: .end  foo
57
58# MICROMIPS: .cprestore 8
59# MICROMIPS: jalrs16 $25                 # encoding: [0x45,0xf9]
60# MICROMIPS: nop                         # encoding: [0x00,0x00,0x00,0x00]
61# MICROMIPS: lw      $gp, 8($sp)         # encoding: [0xff,0x9d,0x00,0x08]
62
63# MICROMIPS: jalrs   $4,  $25            # encoding: [0x00,0x99,0x4f,0x3c]
64# MICROMIPS: nop                         # encoding: [0x00,0x00,0x00,0x00]
65# MICROMIPS: lw      $gp, 8($sp)         # encoding: [0xff,0x9d,0x00,0x08]
66
67# MICROMIPS: lw      $25, %got(foo)($gp) # encoding: [0xff,0x3c,A,A]
68# MICROMIPS:                             #   fixup A - offset: 0, value: %got(foo), kind: fixup_MICROMIPS_GOT16
69# MICROMIPS: addiu   $25, $25, %lo(foo)  # encoding: [0x33,0x39,A,A]
70# MICROMIPS:                             #   fixup A - offset: 0, value: %lo(foo), kind: fixup_MICROMIPS_LO16
71# MICROMIPS: jalrs   $ra, $25            # encoding: [0x03,0xf9,0x4f,0x3c]
72# MICROMIPS: nop                         # encoding: [0x0c,0x00]
73# MICROMIPS: lw      $gp, 8($sp)         # encoding: [0xff,0x9d,0x00,0x08]
74# MICROMIPS: .end  foo
75
76# NO-PIC:     .cprestore  8
77# NO-PIC:     jalr  $25         # encoding: [0x03,0x20,0xf8,0x09]
78# NO-PIC-NOT: lw    $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
79
80# NO-PIC:     jalr  $4,  $25    # encoding: [0x03,0x20,0x20,0x09]
81# NO-PIC-NOT: lw    $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
82
83# NO-PIC:     jal   foo         # encoding: [0b000011AA,A,A,A]
84# NO-PIC:                       #   fixup A - offset: 0, value: foo, kind: fixup_Mips_26
85# NO-PIC-NOT: lw    $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
86# NO-PIC:     .end  foo
87
88# BAD-ABI:     .cprestore  8
89# BAD-ABI:     jalr  $25                      # encoding: [0x03,0x20,0xf8,0x09]
90# BAD-ABI-NOT: lw    $gp, 8($sp)              # encoding: [0x8f,0xbc,0x00,0x08]
91
92# BAD-ABI:     jalr  $4,  $25                 # encoding: [0x03,0x20,0x20,0x09]
93# BAD-ABI-NOT: lw    $gp, 8($sp)              # encoding: [0x8f,0xbc,0x00,0x08]
94
95# BAD-ABI-N32: lw    $25, %got_disp(foo)($gp) # encoding: [0x8f,0x99,A,A]
96# BAD-ABI-N64: ld    $25, %got_disp(foo)($gp) # encoding: [0xdf,0x99,A,A]
97# BAD-ABI:                                    #   fixup A - offset: 0, value: %got_disp(foo), kind: fixup_Mips_GOT_DISP
98# BAD-ABI:     jalr  $25                      # encoding: [0x03,0x20,0xf8,0x09]
99# BAD-ABI-NOT: lw    $gp, 8($sp)              # encoding: [0x8f,0xbc,0x00,0x08]
100# BAD-ABI:  .end  foo
101