1# RUN: llvm-mc -triple mips64-unknown-unknown -mattr=-n64,+o32 -filetype=obj -o - %s | \
2# RUN:   llvm-objdump -d -r -arch=mips64 - | \
3# RUN:     FileCheck -check-prefix=O32 %s
4
5# RUN: llvm-mc -triple mips64-unknown-unknown -mattr=-n64,+o32 %s | \
6# RUN:   FileCheck -check-prefix=ASM %s
7
8# RUN: llvm-mc -triple mips64-unknown-unknown -mattr=-n64,+n32 -filetype=obj -o - %s | \
9# RUN:   llvm-objdump -d -r -arch=mips64 - | \
10# RUN:     FileCheck -check-prefix=NXX -check-prefix=N32 %s
11
12# RUN: llvm-mc -triple mips64-unknown-unknown -mattr=-n64,+n32 %s | \
13# RUN:   FileCheck -check-prefix=ASM %s
14
15# RUN: llvm-mc -triple mips64-unknown-unknown %s -filetype=obj -o - | \
16# RUN:   llvm-objdump -d -r -arch=mips64 - | \
17# RUN:     FileCheck -check-prefix=NXX -check-prefix=N64 %s
18
19# RUN: llvm-mc -triple mips64-unknown-unknown %s | \
20# RUN:   FileCheck -check-prefix=ASM %s
21
22        .text
23        .option pic2
24t1:
25        .cpsetup $25, 8, __cerror
26
27
28# O32-NOT: __cerror
29
30# FIXME: Direct object emission for N32 is still under development.
31# N32 doesn't allow 3 operations to be specified in the same relocation
32# record like N64 does.
33
34# NXX: sd       $gp, 8($sp)
35# NXX: lui      $gp, 0
36# NXX: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  __cerror
37# NXX: addiu    $gp, $gp, 0
38# NXX: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  __cerror
39# N32: addu     $gp, $gp, $25
40# N64: daddu    $gp, $gp, $25
41
42# ASM: .cpsetup $25, 8, __cerror
43
44t2:
45
46        .cpsetup $25, $2, __cerror
47
48# O32-NOT: __cerror
49
50# FIXME: Direct object emission for N32 is still under development.
51# N32 doesn't allow 3 operations to be specified in the same relocation
52# record like N64 does.
53
54# NXX: move     $2, $gp
55# NXX: lui      $gp, 0
56# NXX: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  __cerror
57# NXX: addiu    $gp, $gp, 0
58# NXX: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  __cerror
59# N32: addu     $gp, $gp, $25
60# N64: daddu    $gp, $gp, $25
61
62# ASM: .cpsetup $25, $2, __cerror
63
64t3:
65        .option pic0
66        nop
67        .cpsetup $25, 8, __cerror
68        nop
69
70# Testing that .cpsetup expands to nothing in this case
71# by checking that the next instruction after the first
72# nop is also a 'nop'.
73# NXX: nop
74# NXX-NEXT: nop
75
76# ASM: nop
77# ASM: .cpsetup $25, 8, __cerror
78# ASM: nop
79