[mips] [IAS] Add support for the DLA pseudo-instruction and fix problems with DLI
[oota-llvm.git] / test / MC / Mips / cpsetup.s
1 # RUN: llvm-mc -triple mips64-unknown-unknown -target-abi 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 -target-abi o32 %s | \
6 # RUN:   FileCheck -check-prefix=ASM %s
7
8 # RUN: llvm-mc -triple mips64-unknown-unknown -target-abi n32 -filetype=obj -o - %s | \
9 # RUN:   llvm-objdump -d -r -t -arch=mips64 - | \
10 # RUN:     FileCheck -check-prefix=NXX -check-prefix=N32 %s
11
12 # RUN: llvm-mc -triple mips64-unknown-unknown -target-abi 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 -t -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
24 t1:
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
44 t2:
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
64 # .cpsetup with local labels (PR22518):
65 1:
66         .cpsetup $25, $2, 1b
67         nop
68         sub $3, $3, $2
69         nop
70
71 # O32: t2:
72 # O32:   nop
73 # O32:   sub $3, $3, $2
74 # O32:   nop
75
76 # FIXME: Direct object emission for N32 is still under development.
77 # N32 doesn't allow 3 operations to be specified in the same relocation
78 # record like N64 does.
79
80 # NXX: move     $2, $gp
81 # NXX: lui      $gp, 0
82 # NXX: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  $tmp0
83 # NXX: addiu    $gp, $gp, 0
84 # NXX: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  $tmp0
85 # N32: addu     $gp, $gp, $25
86 # N64: daddu    $gp, $gp, $25
87 # NXX: nop
88 # NXX: sub $3, $3, $2
89 # NXX: nop
90
91 # ASM: .cpsetup $25, $2, $tmp0
92
93 t3:
94         .option pic0
95         nop
96         .cpsetup $25, 8, __cerror
97         nop
98
99 # Testing that .cpsetup expands to nothing in this case
100 # by checking that the next instruction after the first
101 # nop is also a 'nop'.
102 # NXX: nop
103 # NXX-NEXT: nop
104
105 # ASM: nop
106 # ASM: .cpsetup $25, 8, __cerror
107 # ASM: nop
108
109 # For .cpsetup with local labels, we need to check if $tmp0 is in the symbol
110 # table:
111 # NXX: .text  00000000 $tmp0