[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / Mips / lld-expansion.s
blob48755d59a240033ae863a4157cebc3fdc9d8cd93
1 # RUN: llvm-mc -filetype=obj -triple mips64 -mcpu=mips64 %s -o - \
2 # RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefix=MIPS64
3 # RUN: llvm-mc -filetype=obj -triple mips64 -mcpu=mips64r6 %s -o - \
4 # RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefix=MIPS64R6
6 lld $2, 128($sp)
7 # MIPS64: d3 a2 00 80 lld $2, 128($sp)
8 # MIPS64R6: 7f a2 40 37 lld $2, 128($sp)
10 lld $2, -128($sp)
11 # MIPS64: d3 a2 ff 80 lld $2, -128($sp)
12 # MIPS64R6: 7f a2 c0 37 lld $2, -128($sp)
14 lld $2, 256($sp)
15 # MIPS64: d3 a2 01 00 lld $2, 256($sp)
17 # MIPS64R6: 67 a2 01 00 daddiu $2, $sp, 256
18 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
20 lld $2, -257($sp)
21 # MIPS64: d3 a2 fe ff lld $2, -257($sp)
23 # MIPS64R6: 67 a2 fe ff daddiu $2, $sp, -257
24 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
26 lld $2, 32767($sp)
27 # MIPS64: d3 a2 7f ff lld $2, 32767($sp)
29 # MIPS64R6: 67 a2 7f ff daddiu $2, $sp, 32767
30 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
32 lld $2, 32768($sp)
33 # MIPS64: 3c 02 00 01 lui $2, 1
34 # MIPS64-NEXT: 00 5d 10 2d daddu $2, $2, $sp
35 # MIPS64-NEXT: d0 42 80 00 lld $2, -32768($2)
37 # MIPS64R6: 34 02 80 00 ori $2, $zero, 32768
38 # MIPS64R6-NEXT: 00 5d 10 2d daddu $2, $2, $sp
39 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
41 lld $2, -32768($sp)
42 # MIPS64: d3 a2 80 00 lld $2, -32768($sp)
44 # MIPS64R6: 67 a2 80 00 daddiu $2, $sp, -32768
45 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
47 lld $2, -32769($sp)
48 # MIPS64: 3c 02 ff ff lui $2, 65535
49 # MIPS64-NEXT: 00 5d 10 2d daddu $2, $2, $sp
50 # MIPS64-NEXT: d0 42 7f ff lld $2, 32767($2)
52 # MIPS64R6: 3c 02 ff ff aui $2, $zero, 65535
53 # MIPS64R6-NEXT: 34 42 7f ff ori $2, $2, 32767
54 # MIPS64R6-NEXT: 00 5d 10 2d daddu $2, $2, $sp
55 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
57 lld $2, 2147483648($sp)
58 # MIPS64: 34 02 80 00 ori $2, $zero, 32768
59 # MIPS64-NEXT: 00 02 14 38 dsll $2, $2, 16
60 # MIPS64-NEXT: 00 5d 10 2d daddu $2, $2, $sp
61 # MIPS64-NEXT: d0 42 00 00 lld $2, 0($2)
63 # MIPS64R6: 34 02 80 00 ori $2, $zero, 32768
64 # MIPS64R6-NEXT: 00 02 14 38 dsll $2, $2, 16
65 # MIPS64R6-NEXT: 00 5d 10 2d daddu $2, $2, $sp
66 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
68 lld $2, -2147483648($sp)
69 # MIPS64: 3c 02 80 00 lui $2, 32768
70 # MIPS64-NEXT: 00 5d 10 2d daddu $2, $2, $sp
71 # MIPS64-NEXT: d0 42 00 00 lld $2, 0($2)
73 # MIPS64R6: 3c 02 80 00 aui $2, $zero, 32768
74 # MIPS64R6-NEXT: 00 5d 10 2d daddu $2, $2, $sp
75 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
77 lld $2, 9223372036853775808($sp)
78 # MIPS64: 3c 02 7f ff lui $2, 32767
79 # MIPS64-NEXT: 34 42 ff ff ori $2, $2, 65535
80 # MIPS64-NEXT: 00 02 14 38 dsll $2, $2, 16
81 # MIPS64-NEXT: 34 42 ff f1 ori $2, $2, 65521
82 # MIPS64-NEXT: 00 02 14 38 dsll $2, $2, 16
83 # MIPS64-NEXT: 00 5d 10 2d daddu $2, $2, $sp
84 # MIPS64-NEXT: d0 42 bd c0 lld $2, -16960($2)
86 # MIPS64R6: 3c 02 7f ff aui $2, $zero, 32767
87 # MIPS64R6-NEXT: 34 42 ff ff ori $2, $2, 65535
88 # MIPS64R6-NEXT: 00 02 14 38 dsll $2, $2, 16
89 # MIPS64R6-NEXT: 34 42 ff f0 ori $2, $2, 65520
90 # MIPS64R6-NEXT: 00 02 14 38 dsll $2, $2, 16
91 # MIPS64R6-NEXT: 34 42 bd c0 ori $2, $2, 48576
92 # MIPS64R6-NEXT: 00 5d 10 2d daddu $2, $2, $sp
93 # MIPS64R6-NEXT: 7c 42 00 37 lld $2, 0($2)
95 lld $12, symbol
96 # MIPS64: 3c 0c 00 00 lui $12, 0
97 # MIPS64-NEXT: R_MIPS_HIGHEST/R_MIPS_NONE/R_MIPS_NONE symbol
98 # MIPS64-NEXT: 65 8c 00 00 daddiu $12, $12, 0
99 # MIPS64-NEXT: R_MIPS_HIGHER/R_MIPS_NONE/R_MIPS_NONE symbol
100 # MIPS64-NEXT: 00 0c 64 38 dsll $12, $12, 16
101 # MIPS64-NEXT: 65 8c 00 00 daddiu $12, $12, 0
102 # MIPS64-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE symbol
103 # MIPS64-NEXT: 00 0c 64 38 dsll $12, $12, 16
104 # MIPS64-NEXT: d1 8c 00 00 lld $12, 0($12)
105 # MIPS64-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE symbol
107 # MIPS64R6: 3c 0c 00 00 aui $12, $zero, 0
108 # MIPS64R6-NEXT: R_MIPS_HIGHEST/R_MIPS_NONE/R_MIPS_NONE symbol
109 # MIPS64R6-NEXT: 3c 01 00 00 aui $1, $zero, 0
110 # MIPS64R6-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE symbol
111 # MIPS64R6-NEXT: 65 8c 00 00 daddiu $12, $12, 0
112 # MIPS64R6-NEXT: R_MIPS_HIGHER/R_MIPS_NONE/R_MIPS_NONE symbol
113 # MIPS64R6-NEXT: 64 21 00 00 daddiu $1, $1, 0
114 # MIPS64R6-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE symbol
115 # MIPS64R6-NEXT: 00 0c 60 3c dsll32 $12, $12, 0
116 # MIPS64R6-NEXT: 01 81 60 2d daddu $12, $12, $1
117 # MIPS64R6-NEXT: 7d 8c 00 37 lld $12, 0($12)
119 lld $12, symbol($3)
120 # MIPS64: 3c 0c 00 00 lui $12, 0
121 # MIPS64-NEXT: R_MIPS_HIGHEST/R_MIPS_NONE/R_MIPS_NONE symbol
122 # MIPS64-NEXT: 65 8c 00 00 daddiu $12, $12, 0
123 # MIPS64-NEXT: R_MIPS_HIGHER/R_MIPS_NONE/R_MIPS_NONE symbol
124 # MIPS64-NEXT: 00 0c 64 38 dsll $12, $12, 16
125 # MIPS64-NEXT: 65 8c 00 00 daddiu $12, $12, 0
126 # MIPS64-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE symbol
127 # MIPS64-NEXT: 00 0c 64 38 dsll $12, $12, 16
128 # MIPS64-NEXT: 01 83 60 2d daddu $12, $12, $3
129 # MIPS64-NEXT: d1 8c 00 00 lld $12, 0($12)
130 # MIPS64-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE symbol
132 # MIPS64R6-NEXT: 3c 0c 00 00 aui $12, $zero, 0
133 # MIPS64R6-NEXT: R_MIPS_HIGHEST/R_MIPS_NONE/R_MIPS_NONE symbol
134 # MIPS64R6-NEXT: 3c 01 00 00 aui $1, $zero, 0
135 # MIPS64R6-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE symbol
136 # MIPS64R6-NEXT: 65 8c 00 00 daddiu $12, $12, 0
137 # MIPS64R6-NEXT: R_MIPS_HIGHER/R_MIPS_NONE/R_MIPS_NONE symbol
138 # MIPS64R6-NEXT: 64 21 00 00 daddiu $1, $1, 0
139 # MIPS64R6-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE symbol
140 # MIPS64R6-NEXT: 00 0c 60 3c dsll32 $12, $12, 0
141 # MIPS64R6-NEXT: 01 81 60 2d daddu $12, $12, $1
142 # MIPS64R6-NEXT: 01 83 60 2d daddu $12, $12, $3
143 # MIPS64R6-NEXT: 7d 8c 00 37 lld $12, 0($12)
145 lld $12, symbol+8
146 # MIPS64: 3c 0c 00 00 lui $12, 0
147 # MIPS64-NEXT: R_MIPS_HIGHEST/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
148 # MIPS64-NEXT: 65 8c 00 00 daddiu $12, $12, 0
149 # MIPS64-NEXT: R_MIPS_HIGHER/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
150 # MIPS64-NEXT: 00 0c 64 38 dsll $12, $12, 16
151 # MIPS64-NEXT: 65 8c 00 00 daddiu $12, $12, 0
152 # MIPS64-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
153 # MIPS64-NEXT: 00 0c 64 38 dsll $12, $12, 16
154 # MIPS64-NEXT: d1 8c 00 00 lld $12, 0($12)
155 # MIPS64-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
157 # MIPS64R6-NEXT: 3c 0c 00 00 aui $12, $zero, 0
158 # MIPS64R6-NEXT: R_MIPS_HIGHEST/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
159 # MIPS64R6-NEXT: 3c 01 00 00 aui $1, $zero, 0
160 # MIPS64R6-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
161 # MIPS64R6-NEXT: 65 8c 00 00 daddiu $12, $12, 0
162 # MIPS64R6-NEXT: R_MIPS_HIGHER/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
163 # MIPS64R6-NEXT: 64 21 00 00 daddiu $1, $1, 0
164 # MIPS64R6-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE symbol+0x8
165 # MIPS64R6-NEXT: 00 0c 60 3c dsll32 $12, $12, 0
166 # MIPS64R6-NEXT: 01 81 60 2d daddu $12, $12, $1
167 # MIPS64R6-NEXT: 7d 8c 00 37 lld $12, 0($12)
169 .option pic2
171 lld $12, symbol
172 # MIPS64: df 8c 00 00 ld $12, 0($gp)
173 # MIPS64-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE symbol
174 # MIPS64-NEXT: d1 8c 00 00 lld $12, 0($12)
176 # MIPS64R6: df 8c 00 00 ld $12, 0($gp)
177 # MIPS64R6-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE symbol
178 # MIPS64R6-NEXT: 7d 8c 00 37 lld $12, 0($12)
180 lld $12, symbol+8
181 # MIPS64: df 8c 00 00 ld $12, 0($gp)
182 # MIPS64-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE symbol
183 # MIPS64-NEXT: d1 8c 00 08 lld $12, 8($12)
185 # MIPS64R6: df 8c 00 00 ld $12, 0($gp)
186 # MIPS64R6-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE symbol
187 # MIPS64R6-NEXT: 65 8c 00 08 daddiu $12, $12, 8
188 # MIPS64R6-NEXT: 7d 8c 00 37 lld $12, 0($12)