1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // This input was created by taking the ppc64 testcase and modified
6 // by hand.
7
8 #include "../../../../../runtime/textflag.h"
9
10 TEXT foo(SB),DUPOK|NOSPLIT,$0
11 //
12 // branch
13 //
14 // LBRA rel
15 // {
16 // outcode(int($1), &nullgen, 0, &$2);
17 // }
18 BEQ R1, 2(PC)
19 label0:
20 JMP 1(PC) // JMP 1(PC) // 10000001
21 BEQ R1, 2(PC)
22 JMP label0+0 // JMP 3 // 1000fffd
23 BEQ R1, 2(PC)
24 JAL 1(PC) // CALL 1(PC) // 0c00000f
25 BEQ R1, 2(PC)
26 JAL label0+0 // CALL 3 // 0c000007
27
28 // LBRA addr
29 // {
30 // outcode(int($1), &nullgen, 0, &$2);
31 // }
32 BEQ R1, 2(PC)
33 JMP 0(R1) // JMP (R1) // 00200008
34 BEQ R1, 2(PC)
35 JMP foo+0(SB) // JMP foo(SB) // 08000019
36 BEQ R1, 2(PC)
37 JAL 0(R1) // CALL (R1) // 0020f809
38 BEQ R1, 2(PC)
39 JAL foo+0(SB) // CALL foo(SB) // 0c000021
40
41 //
42 // BEQ/BNE
43 //
44 // LBRA rreg ',' rel
45 // {
46 // outcode(int($1), &$2, 0, &$4);
47 // }
48 label1:
49 BEQ R1, 1(PC) // BEQ R1, 1(PC) // 10200001
50 BEQ R1, label1 // BEQ R1, 18 // 1020fffd
51
52 // LBRA rreg ',' sreg ',' rel
53 // {
54 // outcode(int($1), &$2, 0, &$4);
55 // }
56 label2:
57 BEQ R1, R2, 1(PC) // BEQ R1, R2, 1(PC) // 10220001
58 BEQ R1, R2, label2 // BEQ R1, R2, 20 // 1022fffd
59
60 //
61 // other integer conditional branch
62 //
63 // LBRA rreg ',' rel
64 // {
65 // outcode(int($1), &$2, 0, &$4);
66 // }
67 label3:
68 BLTZ R1, 1(PC) // BLTZ R1, 1(PC) // 04200001
69 BLTZ R1, label3 // BLTZ R1, 22 // 0420fffd
70
71 //
72 // floating point conditional branch
73 //
74 // LBRA rel
75 label4:
76 BFPT 1(PC) // BFPT 1(PC) // 4501000100000000
77 BFPT label4 // BFPT 24 // 4501fffd00000000
78
79 //inst:
80 //
81 // load ints and bytes
82 //
83 // LMOVV rreg ',' rreg
84 // {
85 // outcode(int($1), &$2, 0, &$4);
86 // }
87 MOVV R25, R17 // 00198825
88 MOVV R1, R2 // 00011025
89 MOVV LO, R1 // 00000812
90 MOVV HI, R1 // 00000810
91 MOVV R1, LO // 00200013
92 MOVV R1, HI // 00200011
93
94
95 // LMOVW rreg ',' rreg
96 // {
97 // outcode(int($1), &$2, 0, &$4);
98 // }
99 MOVW R1, R2 // 00011004
100 MOVW LO, R1 // 00000812
101 MOVW HI, R1 // 00000810
102 MOVW R1, LO // 00200013
103 MOVW R1, HI // 00200011
104 MOVWU R14, R27 // 000ed83c001bd83e
105
106 // LMOVH rreg ',' rreg
107 // {
108 // outcode(int($1), &$2, 0, &$4);
109 // }
110 MOVH R16, R27 // 0010dc00001bdc03
111 MOVHU R1, R3 // 3023ffff
112
113 // LMOVB rreg ',' rreg
114 // {
115 // outcode(int($1), &$2, 0, &$4);
116 // }
117 MOVB R8, R9 // 00084e0000094e03
118 MOVBU R12, R17 // 319100ff
119
120 // LMOVV addr ',' rreg
121 // {
122 // outcode(int($1), &$2, 0, &$4);
123 // }
124 MOVV foo<>+3(SB), R2
125 MOVV (R5), R18 // dcb20000
126 MOVV 8(R16), R4 // de040008
127 MOVV -32(R14), R1 // ddc1ffe0
128 LLV (R1), R2 // d0220000
129
130 // LMOVW addr ',' rreg
131 // {
132 // outcode(int($1), &$2, 0, &$4);
133 // }
134 MOVW foo<>+3(SB), R2
135 MOVW (R11), R22 // 8d760000
136 MOVW 1(R9), R24 // 8d380001
137 MOVW -17(R24), R8 // 8f08ffef
138 MOVWU (R11), R22 // 9d760000
139 MOVWU 1(R9), R24 // 9d380001
140 MOVWU -17(R24), R8 // 9f08ffef
141 LL (R1), R2 // c0220000
142
143 // LMOVH addr ',' rreg
144 // {
145 // outcode(int($1), &$2, 0, &$4);
146 // }
147 MOVH foo<>+3(SB), R2
148 MOVH (R20), R7 // 86870000
149 MOVH 54(R11), R26 // 857a0036
150 MOVH -42(R3), R20 // 8474ffd6
151 MOVHU (R20), R7 // 96870000
152 MOVHU 54(R11), R26 // 957a0036
153 MOVHU -42(R3), R20 // 9474ffd6
154
155 // LMOVB addr ',' rreg
156 // {
157 // outcode(int($1), &$2, 0, &$4);
158 // }
159 MOVB foo<>+3(SB), R2
160 MOVB (R4), R21 // 80950000
161 MOVB 9(R19), R18 // 82720009
162 MOVB -10(R19), R18 // 8272fff6
163 MOVBU (R4), R21 // 90950000
164 MOVBU 9(R19), R18 // 92720009
165 MOVBU -10(R19), R18 // 9272fff6
166
167 //
168 // load floats
169 //
170 // LFMOV addr ',' freg
171 // {
172 // outcode(int($1), &$2, 0, &$4);
173 // }
174 MOVD foo<>+3(SB), F2
175 MOVD 16(R1), F2
176 MOVD (R1), F2
177
178 // LFMOV fimm ',' freg
179 // {
180 // outcode(int($1), &$2, 0, &$4);
181 // }
182 MOVD $0.1, F2 // MOVD $(0.10000000000000001), F2
183
184 // LFMOV freg ',' freg
185 // {
186 // outcode(int($1), &$2, 0, &$4);
187 // }
188 MOVD F1, F2
189
190 // LFMOV freg ',' addr
191 // {
192 // outcode(int($1), &$2, 0, &$4);
193 // }
194 MOVD F2, foo<>+3(SB)
195 MOVD F2, 16(R1)
196 MOVD F2, (R1)
197
198 //
199 // store ints and bytes
200 //
201 // LMOVV rreg ',' addr
202 // {
203 // outcode(int($1), &$2, 0, &$4);
204 // }
205 MOVV R1, foo<>+3(SB)
206 MOVV R18, (R5) // fcb20000
207 MOVV R4, 8(R16) // fe040008
208 MOVV R1, -32(R14) // fdc1ffe0
209 SCV R1, (R2) // f0410000
210
211 // LMOVW rreg ',' addr
212 // {
213 // outcode(int($1), &$2, 0, &$4);
214 // }
215 MOVW R1, foo<>+3(SB)
216 MOVW R8, (R3) // ac680000
217 MOVW R11, 19(R2) // ac4b0013
218 MOVW R25, -89(R22) // aed9ffa7
219 MOVWU R8, (R3) // ac680000
220 MOVWU R11, 19(R2) // ac4b0013
221 MOVWU R25, -89(R22) // aed9ffa7
222 SC R1, (R2) // e0410000
223
224 // LMOVH rreg ',' addr
225 // {
226 // outcode(int($1), &$2, 0, &$4);
227 // }
228 MOVH R13, (R7) // a4ed0000
229 MOVH R10, 61(R23) // a6ea003d
230 MOVH R8, -33(R12) // a588ffdf
231 MOVHU R13, (R7) // a4ed0000
232 MOVHU R10, 61(R23) // a6ea003d
233 MOVHU R8, -33(R12) // a588ffdf
234
235 // LMOVB rreg ',' addr
236 // {
237 // outcode(int($1), &$2, 0, &$4);
238 // }
239 MOVB R1, foo<>+3(SB)
240 MOVB R5, -18(R4) // a085ffee
241 MOVB R10, 9(R13) // a1aa0009
242 MOVB R15, (R13) // a1af0000
243 MOVBU R5, -18(R4) // a085ffee
244 MOVBU R10, 9(R13) // a1aa0009
245 MOVBU R15, (R13) // a1af0000
246
247 //
248 // store floats
249 //
250 // LMOVW freg ',' addr
251 // {
252 // outcode(int($1), &$2, 0, &$4);
253 // }
254 MOVD F1, foo<>+3(SB)
255 MOVD F1, 16(R2)
256 MOVD F1, (R2)
257
258 //
259 // floating point status
260 //
261 // LMOVW fpscr ',' freg
262 // {
263 // outcode(int($1), &$2, 0, &$4);
264 // }
265 MOVW FCR31, R1 // 4441f800
266
267 // LMOVW freg ',' fpscr
268 // {
269 // outcode(int($1), &$2, 0, &$4);
270 // }
271 MOVW R1, FCR31 // 44c1f800
272
273 // LMOVW rreg ',' mreg
274 // {
275 // outcode(int($1), &$2, 0, &$4);
276 // }
277 MOVW R1, M1 // 40810800
278 MOVV R1, M1 // 40a10800
279
280 // LMOVW mreg ',' rreg
281 // {
282 // outcode(int($1), &$2, 0, &$4);
283 // }
284 MOVW M1, R1 // 40010800
285 MOVV M1, R1 // 40210800
286
287
288 //
289 // integer operations
290 // logical instructions
291 // shift instructions
292 // unary instructions
293 //
294 // LADDW rreg ',' sreg ',' rreg
295 // {
296 // outcode(int($1), &$2, int($4), &$6);
297 // }
298 ADD R5, R9, R10 // 01255020
299 ADDU R13, R14, R19 // 01cd9821
300 ADDV R5, R9, R10 // 0125502c
301 ADDVU R13, R14, R19 // 01cd982d
302
303 // LADDW imm ',' sreg ',' rreg
304 // {
305 // outcode(int($1), &$2, int($4), &$6);
306 // }
307 ADD $15176, R14, R9 // 21c93b48
308 ADD $-9, R5, R8 // 20a8fff7
309 ADDU $10, R9, R9 // 2529000a
310 ADDV $15176, R14, R9 // 61c93b48
311 ADDV $-9, R5, R8 // 60a8fff7
312 ADDVU $10, R9, R9 // 6529000a
313
314 // LADDW rreg ',' rreg
315 // {
316 // outcode(int($1), &$2, 0, &$4);
317 // }
318 ADD R1, R2 // 00411020
319 ADDU R1, R2 // 00411021
320 ADDV R1, R2 // 0041102c
321 ADDVU R1, R2 // 0041102d
322
323 // LADDW imm ',' rreg
324 // {
325 // outcode(int($1), &$2, 0, &$4);
326 // }
327 ADD $4, R1 // 20210004
328 ADDV $4, R1 // 60210004
329 ADDU $4, R1 // 24210004
330 ADDVU $4, R1 // 64210004
331 ADD $-7193, R24 // 2318e3e7
332 ADDV $-7193, R24 // 6318e3e7
333
334 // LSUBW rreg ',' sreg ',' rreg
335 // {
336 // outcode(int($1), &$2, int($4), &$6);
337 // }
338 SUB R6, R26, R27 // 0346d822
339 SUBU R6, R26, R27 // 0346d823
340 SUBV R16, R17, R26 // 0230d02e
341 SUBVU R16, R17, R26 // 0230d02f
342
343 // LSUBW imm ',' sreg ',' rreg
344 // {
345 // outcode(int($1), &$2, int($4), &$6);
346 // }
347 SUB $-3126, R17, R22 // 22360c36
348 SUB $3126, R17, R22 // 2236f3ca
349 SUBU $16384, R17, R12 // 262cc000
350 SUBV $-6122, R10, R9 // 614917ea
351 SUBV $6122, R10, R9 // 6149e816
352 SUBVU $1203, R17, R12 // 662cfb4d
353
354 // LSUBW rreg ',' rreg
355 // {
356 // outcode(int($1), &$2, 0, &$4);
357 // }
358 SUB R14, R13 // 01ae6822
359 SUBU R14, R13 // 01ae6823
360 SUBV R4, R3 // 0064182e
361 SUBVU R4, R3 // 0064182f
362 // LSUBW imm ',' rreg
363 // {
364 // outcode(int($1), &$2, 0, &$4);
365 // }
366 SUB $6512, R13 // 21ade690
367 SUB $-6512, R13 // 21ad1970
368 SUBU $6512, R13 // 25ade690
369 SUBV $9531, R16 // 6210dac5
370 SUBV $-9531, R13 // 61ad253b
371 SUBVU $9531, R16 // 6610dac5
372
373 // LMUL rreg ',' rreg
374 // {
375 // outcode(int($1), &$2, 0, &$4);
376 // }
377 MUL R19, R8 // 01130018
378 MULU R21, R13 // 01b50019
379 MULV R19, R8 // 0113001c
380 MULVU R21, R13 // 01b5001d
381
382 // LDIV rreg ',' rreg
383 // {
384 // outcode(int($1), &$2, 0, &$4);
385 // }
386 DIV R18, R22 // 02d2001a
387 DIVU R14, R9 // 012e001b
388 DIVV R8, R13 // 01a8001e
389 DIVVU R16, R19 // 0270001f
390
391 // LREM rreg ',' rreg
392 // {
393 // outcode(int($1), &$2, 0, &$4);
394 // }
395 REM R18, R22 // 02d2001a
396 REMU R14, R9 // 012e001b
397 REMV R8, R13 // 01a8001e
398 REMVU R16, R19 // 0270001f
399
400 // LSHW rreg ',' sreg ',' rreg
401 // {
402 // outcode(int($1), &$2, int($4), &$6);
403 // }
404 SLL R1, R2, R3 // 00221804
405 SLLV R10, R22, R21 // 0156a814
406 SRL R27, R6, R17 // 03668806
407 SRLV R27, R6, R17 // 03668816
408 SRA R11, R19, R20 // 0173a007
409 SRAV R20, R19, R19 // 02939817
410 ROTR R19, R18, R20 // 0272a046
411 ROTRV R9, R13, R16 // 012d8056
412
413 // LSHW rreg ',' rreg
414 // {
415 // outcode(int($1), &$2, 0, &$4);
416 // }
417 SLL R1, R2 // 00221004
418 SLLV R10, R22 // 0156b014
419 SRL R27, R6 // 03663006
420 SRLV R27, R6 // 03663016
421 SRA R11, R19 // 01739807
422 SRAV R20, R19 // 02939817
423 ROTR R20, R19 // 02939846
424 ROTRV R16, R9 // 02094856
425
426 // LSHW imm ',' sreg ',' rreg
427 // {
428 // outcode(int($1), &$2, int($4), &$6);
429 // }
430 SLL $19, R22, R21 // 0016acc0
431 SLLV $19, R22, R21 // 0016acf8
432 SRL $31, R6, R17 // 00068fc2
433 SRLV $31, R6, R17 // 00068ffa
434 SRA $8, R8, R19 // 00089a03
435 SRAV $19, R8, R7 // 00083cfb
436 ROTR $12, R8, R3 // 00281b02
437 ROTRV $8, R22, R22 // 0036b23a
438
439 // LSHW imm ',' rreg
440 // {
441 // outcode(int($1), &$2, 0, &$4);
442 // }
443 SLL $19, R21 // 0015acc0
444 SLLV $19, R21 // 0015acf8
445 SRL $31, R17 // 00118fc2
446 SRLV $31, R17 // 00118ffa
447 SRA $3, R12 // 000c60c3
448 SRAV $12, R3 // 00031b3b
449 ROTR $12, R8 // 00284302
450 ROTRV $63, R22 // 0036b7fe
451
452
453 // LAND/LXOR/LNOR/LOR rreg ',' rreg
454 // {
455 // outcode(int($1), &$2, 0, &$4);
456 // }
457 AND R14, R8 // 010e4024
458 XOR R15, R9 // 012f4826
459 NOR R16, R10 // 01505027
460 OR R17, R11 // 01715825
461
462 // LAND/LXOR/LOR imm ',' rreg
463 // {
464 // outcode(int($1), &$2, 0, &$4);
465 // }
466 AND $11, R17, R7 // 3227000b
467 XOR $341, R1, R23 // 38370155
468 OR $254, R25, R13 // 372d00fe
469 //
470 // move immediate: macro for lui+or, addi, addis, and other combinations
471 //
472 // LMOVW imm ',' rreg
473 // {
474 // outcode(int($1), &$2, 0, &$4);
475 // }
476 MOVW $1, R1
477 MOVV $1, R1
478
479 // LMOVW ximm ',' rreg
480 // {
481 // outcode(int($1), &$2, 0, &$4);
482 // }
483 MOVW $1, R1
484 MOVW $foo(SB), R1
485 MOVV $1, R1
486 MOVV $foo(SB), R1
487
488 //
489 // floating point operate
490 //
491 // LFCONV freg ',' freg
492 // {
493 // outcode(int($1), &$2, 0, &$4);
494 // }
495 ABSD F1, F2
496
497 // LFADD freg ',' freg
498 // {
499 // outcode(int($1), &$2, 0, &$4);
500 // }
501 ADDD F1, F2
502
503 // LFADD freg ',' freg ',' freg
504 // {
505 // outcode(int($1), &$2, int($4.Reg), &$6);
506 // }
507 ADDD F1, F2, F3
508
509 // LFCMP freg ',' freg
510 // {
511 // outcode(int($1), &$2, 0, &$4);
512 // }
513 CMPEQD F1, F2
514
515
516 //
517 // WORD
518 //
519 WORD $1 // 00000001
520 NOOP // 00000000
521 SYNC // 0000000f
522
523 //
524 // NOP
525 //
526 // LNOP comma // asm doesn't support the trailing comma.
527 // {
528 // outcode(int($1), &nullgen, 0, &nullgen);
529 // }
530 NOP
531
532 // LNOP rreg comma // asm doesn't support the trailing comma.
533 // {
534 // outcode(int($1), &$2, 0, &nullgen);
535 // }
536 NOP R2
537
538 // LNOP freg comma // asm doesn't support the trailing comma.
539 // {
540 // outcode(int($1), &$2, 0, &nullgen);
541 // }
542 NOP F2
543
544 // LNOP ',' rreg // asm doesn't support the leading comma.
545 // {
546 // outcode(int($1), &nullgen, 0, &$3);
547 // }
548 NOP R2
549
550 // LNOP ',' freg // asm doesn't support the leading comma.
551 // {
552 // outcode(int($1), &nullgen, 0, &$3);
553 // }
554 NOP F2
555
556 // LNOP imm
557 // {
558 // outcode(int($1), &$2, 0, &nullgen);
559 // }
560 NOP $4
561
562 //
563 // special
564 //
565 SYSCALL
566 BREAK
567 // overloaded cache opcode:
568 BREAK R1, (R1)
569
570 //
571 // RET
572 //
573 // LRETRN comma // asm doesn't support the trailing comma.
574 // {
575 // outcode(int($1), &nullgen, 0, &nullgen);
576 // }
577 SYSCALL
578 BEQ R1, 2(PC)
579 RET
580
581
582 // More JMP/JAL cases, and canonical names JMP, CALL.
583
584 JAL foo(SB) // CALL foo(SB)
585 BEQ R1, 2(PC)
586 JMP foo(SB)
587 CALL foo(SB)
588 RET foo(SB)
589
590 // unary operation
591 NEGW R1, R2 // 00011023
592 NEGV R1, R2 // 0001102f
593
594 WSBH R1, R2 // 7c0110a0
595 DSBH R1, R2 // 7c0110a4
596 DSHD R1, R2 // 7c011164
597
598 SEB R1, R2 // 7c011420
599 SEH R1, R2 // 7c011620
600
601 RET
602
603 // MSA VMOVI
604 VMOVB $511, W0 // 7b0ff807
605 VMOVH $24, W23 // 7b20c5c7
606 VMOVW $-24, W15 // 7b5f43c7
607 VMOVD $-511, W31 // 7b700fc7
608
609 VMOVB (R0), W8 // 78000220
610 VMOVB 511(R3), W0 // 79ff1820
611 VMOVB -512(R12), W21 // 7a006560
612 VMOVH (R24), W12 // 7800c321
613 VMOVH 110(R19), W8 // 78379a21
614 VMOVH -70(R12), W3 // 7bdd60e1
615 VMOVW (R3), W31 // 78001fe2
616 VMOVW 64(R20), W16 // 7810a422
617 VMOVW -104(R17), W24 // 7be68e22
618 VMOVD (R3), W2 // 780018a3
619 VMOVD 128(R23), W19 // 7810bce3
620 VMOVD -256(R31), W0 // 7be0f823
621
622 VMOVB W8, (R0) // 78000224
623 VMOVB W0, 511(R3) // 79ff1824
624 VMOVB W21, -512(R12) // 7a006564
625 VMOVH W12, (R24) // 7800c325
626 VMOVH W8, 110(R19) // 78379a25
627 VMOVH W3, -70(R12) // 7bdd60e5
628 VMOVW W31, (R3) // 78001fe6
629 VMOVW W16, 64(R20) // 7810a426
630 VMOVW W24, -104(R17) // 7be68e26
631 VMOVD W2, (R3) // 780018a7
632 VMOVD W19, 128(R23) // 7810bce7
633 VMOVD W0, -256(R31) // 7be0f827
634 RET
635
636 // END
637 //
638 // LEND comma // asm doesn't support the trailing comma.
639 // {
640 // outcode(int($1), &nullgen, 0, &nullgen);
641 // }
642 END
643
View as plain text