source: EcnlProtoTool/trunk/tcc-0.9.26/tests/asmtest.S@ 279

Last change on this file since 279 was 279, checked in by coas-nagasima, 7 years ago

ファイルを追加、更新。

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/plain
File size: 8.0 KB
Line 
1# gas comment with ``gnu'' style quotes
2
3/* some directive tests */
4
5 .byte 0xff
6 .byte 1, 2, 3
7 .short 1, 2, 3
8 .word 1, 2, 3
9 .long 1, 2, 3
10 .int 1, 2, 3
11 .align 8
12 .byte 1
13/* .align 16, 0x90 gas is too clever for us with 0x90 fill */
14 .align 16, 0x91 /* 0x91 tests the non-clever behaviour */
15 .skip 3
16 .skip 15, 0x90
17 .string "hello\0world"
18
19/* some label tests */
20
21 movl %eax, %ebx
22L1:
23 movl %eax, %ebx
24 mov 0x10000, %eax
25L2:
26 movl $L2 - L1, %ecx
27var1:
28 nop ; nop ; nop ; nop
29
30 mov var1, %eax
31
32/* instruction tests */
33movl %eax, %ebx
34mov 0x10000, %eax
35mov 0x10000, %ax
36mov 0x10000, %al
37mov %al, 0x10000
38
39mov $1, %edx
40mov $1, %dx
41mov $1, %dl
42movb $2, 0x100(%ebx,%edx,2)
43movw $2, 0x100(%ebx,%edx,2)
44movl $2, 0x100(%ebx,%edx,2)
45movl %eax, 0x100(%ebx,%edx,2)
46movl 0x100(%ebx,%edx,2), %edx
47movw %ax, 0x100(%ebx,%edx,2)
48
49mov %eax, 0x12(,%edx,2)
50
51mov %cr3, %edx
52mov %ecx, %cr3
53movl %cr3, %eax
54movl %tr3, %eax
55movl %db3, %ebx
56movl %dr6, %eax
57movl %fs, %ecx
58movl %ebx, %fs
59
60 movsbl 0x1000, %eax
61 movsbw 0x1000, %ax
62 movswl 0x1000, %eax
63
64 movzbl 0x1000, %eax
65 movzbw 0x1000, %ax
66 movzwl 0x1000, %eax
67
68 movzb 0x1000, %eax
69 movzb 0x1000, %ax
70
71
72 pushl %eax
73 pushw %ax
74 push %eax
75 push %cs
76 push %gs
77 push $1
78 push $100
79
80 popl %eax
81 popw %ax
82 pop %eax
83 pop %ds
84 pop %fs
85
86 xchg %eax, %ecx
87 xchg %edx, %eax
88 xchg %bx, 0x10000
89 xchg 0x10000, %ebx
90 xchg 0x10000, %dl
91
92 in $100, %al
93 in $100, %ax
94 in $100, %eax
95 in %dx, %al
96 in %dx, %ax
97 in %dx, %eax
98 inb %dx
99 inw %dx
100 inl %dx
101
102 out %al, $100
103 out %ax, $100
104 out %eax, $100
105
106 /* NOTE: gas is bugged here, so size must be added */
107 outb %al, %dx
108 outw %ax, %dx
109 outl %eax, %dx
110
111 leal 0x1000(%ebx), %ecx
112 lea 0x1000(%ebx), %ecx
113
114 les 0x2000, %eax
115 lds 0x2000, %ebx
116 lfs 0x2000, %ecx
117 lgs 0x2000, %edx
118 lss 0x2000, %edx
119
120addl $0x123, %eax
121add $0x123, %ebx
122addl $0x123, 0x100
123addl $0x123, 0x100(%ebx)
124addl $0x123, 0x100(%ebx,%edx,2)
125addl $0x123, 0x100(%esp)
126addl $0x123, (3*8)(%esp)
127addl $0x123, (%ebp)
128addl $0x123, (%esp)
129cmpl $0x123, (%esp)
130
131add %eax, (%ebx)
132add (%ebx), %eax
133
134or %dx, (%ebx)
135or (%ebx), %si
136
137add %cl, (%ebx)
138add (%ebx), %dl
139
140 inc %edx
141 incl 0x10000
142 incb 0x10000
143 dec %dx
144
145 test $1, %al
146 test $1, %cl
147
148 testl $1, 0x1000
149 testb $1, 0x1000
150 testw $1, 0x1000
151 test %eax, %ebx
152 test %eax, 0x1000
153 test 0x1000, %edx
154
155 not %edx
156 notw 0x10000
157 notl 0x10000
158 notb 0x10000
159
160 neg %edx
161 negw 0x10000
162 negl 0x10000
163 negb 0x10000
164
165 imul %ecx
166 mul %edx
167 mulb %cl
168
169 imul %eax, %ecx
170 imul 0x1000, %cx
171 imul $10, %eax, %ecx
172 imul $10, %ax, %cx
173 imul $10, %eax
174 imul $0x1100000, %eax
175 imul $1, %eax
176
177 idivw 0x1000
178 div %ecx
179 div %bl
180 div %ecx, %eax
181
182
183shl %edx
184shl $10, %edx
185shl %cl, %edx
186
187shld $1, %eax, %edx
188shld %cl, %eax, %edx
189shld %eax, %edx
190
191shrd $1, %eax, %edx
192shrd %cl, %eax, %edx
193shrd %eax, %edx
194
195L4:
196call 0x1000
197call L4
198call *%eax
199call *0x1000
200call func1
201
202.global L5,L6
203
204L5:
205L6:
206
207lcall $0x100, $0x1000
208
209jmp 0x1000
210jmp *%eax
211jmp *0x1000
212
213ljmp $0x100, $0x1000
214
215ret
216retl
217
218ret $10
219retl $10
220
221lret
222
223lret $10
224
225enter $1234, $10
226
227L3:
228 jo 0x1000
229 jnp 0x1001
230 jne 0x1002
231 jg 0x1003
232
233 jo L3
234 jnp L3
235 jne L3
236 jg L3
237
238 loopne L3
239 loopnz L3
240 loope L3
241 loopz L3
242 loop L3
243 jecxz L3
244
245
246 seto %al
247 setnp 0x1000
248 setl 0xaaaa
249 setg %dl
250
251 fadd
252 fadd %st(1), %st
253 fadd %st(0), %st(1)
254 fadd %st(3)
255
256 fmul %st(0),%st(0)
257 fmul %st(0),%st(1)
258
259 faddp %st(5)
260 faddp
261 faddp %st(1), %st
262
263 fadds 0x1000
264 fiadds 0x1002
265 faddl 0x1004
266 fiaddl 0x1006
267
268 fmul
269 fmul %st(1), %st
270 fmul %st(3)
271
272 fmulp %st(5)
273 fmulp
274 fmulp %st(1), %st
275
276 fmuls 0x1000
277 fimuls 0x1002
278 fmull 0x1004
279 fimull 0x1006
280
281 fsub
282 fsub %st(1), %st
283 fsub %st(3)
284
285 fsubp %st(5)
286 fsubp
287 fsubp %st(1), %st
288
289 fsubs 0x1000
290 fisubs 0x1002
291 fsubl 0x1004
292 fisubl 0x1006
293
294 fsubr
295 fsubr %st(1), %st
296 fsubr %st(3)
297
298 fsubrp %st(5)
299 fsubrp
300 fsubrp %st(1), %st
301
302 fsubrs 0x1000
303 fisubrs 0x1002
304 fsubrl 0x1004
305 fisubrl 0x1006
306
307 fdiv
308 fdiv %st(1), %st
309 fdiv %st(3)
310
311 fdivp %st(5)
312 fdivp
313 fdivp %st(1), %st
314
315 fdivs 0x1000
316 fidivs 0x1002
317 fdivl 0x1004
318 fidivl 0x1006
319
320 fcom %st(3)
321
322 fcoms 0x1000
323 ficoms 0x1002
324 fcoml 0x1004
325 ficoml 0x1006
326
327 fcomp %st(5)
328 fcomp
329 fcompp
330
331 fcomps 0x1000
332 ficomps 0x1002
333 fcompl 0x1004
334 ficompl 0x1006
335
336 fld %st(5)
337 fldl 0x1000
338 flds 0x1002
339 fildl 0x1004
340 fst %st(4)
341 fstp %st(6)
342 fstpt 0x1006
343 fbstp 0x1008
344
345 fxch
346 fxch %st(4)
347
348 fucom %st(6)
349 fucomp %st(3)
350 fucompp
351
352 finit
353 fninit
354 fldcw 0x1000
355 fnstcw 0x1002
356 fstcw 0x1002
357 fnstsw 0x1004
358 fnstsw (%eax)
359 fstsw 0x1004
360 fstsw (%eax)
361 fnclex
362 fclex
363 fnstenv 0x1000
364 fstenv 0x1000
365 fldenv 0x1000
366 fnsave 0x1002
367 fsave 0x1000
368 frstor 0x1000
369 ffree %st(7)
370 ffreep %st(6)
371
372 ftst
373 fxam
374 fld1
375 fldl2t
376 fldl2e
377 fldpi
378 fldlg2
379 fldln2
380 fldz
381
382 f2xm1
383 fyl2x
384 fptan
385 fpatan
386 fxtract
387 fprem1
388 fdecstp
389 fincstp
390 fprem
391 fyl2xp1
392 fsqrt
393 fsincos
394 frndint
395 fscale
396 fsin
397 fcos
398 fchs
399 fabs
400 fnop
401 fwait
402
403bswap %edx
404xadd %ecx, %edx
405xaddb %dl, 0x1000
406xaddw %ax, 0x1000
407xaddl %eax, 0x1000
408cmpxchg %ecx, %edx
409cmpxchgb %dl, 0x1000
410cmpxchgw %ax, 0x1000
411cmpxchgl %eax, 0x1000
412invlpg 0x1000
413cmpxchg8b 0x1002
414
415fcmovb %st(5), %st
416fcmove %st(5), %st
417fcmovbe %st(5), %st
418fcmovu %st(5), %st
419fcmovnb %st(5), %st
420fcmovne %st(5), %st
421fcmovnbe %st(5), %st
422fcmovnu %st(5), %st
423fcomi %st(5), %st
424fucomi %st(5), %st
425fcomip %st(5), %st
426fucomip %st(5), %st
427
428
429
430 cmovo 0x1000, %eax
431 cmovs 0x1000, %eax
432 cmovns %edx, %edi
433
434int $3
435int $0x10
436
437 pusha
438 popa
439 clc
440 cld
441 cli
442 clts
443 cmc
444 lahf
445 sahf
446 pushfl
447 popfl
448 pushf
449 popf
450 stc
451 std
452 sti
453 aaa
454 aas
455 daa
456 das
457 aad
458 aam
459 cbw
460 cwd
461 cwde
462 cdq
463 cbtw
464 cwtd
465 cwtl
466 cltd
467 leave
468 int3
469 into
470 iret
471 rsm
472 hlt
473 wait
474 nop
475
476 /* XXX: handle prefixes */
477#if 0
478 aword
479 addr16
480#endif
481 lock
482 rep
483 repe
484 repz
485 repne
486 repnz
487 nop
488
489 lock ;negl (%eax)
490 wait ;pushf
491 rep ;stosb
492 repe ;lodsb
493 repz ;cmpsb
494 repne;movsb
495 repnz;outsb
496
497 /* handle one-line prefix + ops */
498 lock negl (%eax)
499 wait pushf
500 rep stosb
501 repe lodsb
502 repz cmpsb
503 repne movsb
504 repnz outsb
505
506 invd
507 wbinvd
508 cpuid
509 wrmsr
510 rdtsc
511 rdmsr
512 rdpmc
513 ud2
514
515 emms
516 movd %edx, %mm3
517 movd 0x1000, %mm2
518 movd %mm4, %ecx
519 movd %mm5, 0x1000
520
521 movq 0x1000, %mm2
522 movq %mm4, 0x1000
523
524 pand 0x1000, %mm3
525 pand %mm4, %mm5
526
527 psllw $1, %mm6
528 psllw 0x1000, %mm7
529 psllw %mm2, %mm7
530
531 xlat
532 cmpsb
533 scmpw
534 insl
535 outsw
536 lodsb
537 slodl
538 movsb
539 movsl
540 smovb
541 scasb
542 sscaw
543 stosw
544 sstol
545
546 bsf 0x1000, %ebx
547 bsr 0x1000, %ebx
548 bt %edx, 0x1000
549 btl $2, 0x1000
550 btc %edx, 0x1000
551 btcl $2, 0x1000
552 btr %edx, 0x1000
553 btrl $2, 0x1000
554 bts %edx, 0x1000
555 btsl $2, 0x1000
556
557
558
559 boundl %edx, 0x10000
560 boundw %bx, 0x1000
561
562 arpl %bx, 0x1000
563 lar 0x1000, %eax
564 lgdt 0x1000
565 lidt 0x1000
566 lldt 0x1000
567 lmsw 0x1000
568 lsl 0x1000, %ecx
569 ltr 0x1000
570
571 sgdt 0x1000
572 sidt 0x1000
573 sldt 0x1000
574 smsw 0x1000
575 str 0x1000
576
577 verr 0x1000
578 verw 0x1000
579
580 push %ds
581 pushw %ds
582 pushl %ds
583 pop %ds
584 popw %ds
585 popl %ds
586 fxsave 1(%ebx)
587 fxrstor 1(%ecx)
588 pushl $1
589 pushw $1
590 push $1
591
592#ifdef __ASSEMBLER__ // should be defined, for S files
593 inc %eax
594#endif
595
596ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
597 xor %eax, %eax
598 ret
599
600.type ft1,STT_FUNC
601.type ft2,@STT_FUNC
602.type ft3,%STT_FUNC
603.type ft4,"STT_FUNC"
604.type ft5,function
605.type ft6,@function
606.type ft7,%function
607.type ft8,"function"
608
609 pause
Note: See TracBrowser for help on using the repository browser.