Changeset 331 for EcnlProtoTool/trunk/tcc-0.9.27/tests/asmtest.S
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/tcc-0.9.27
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/tcc-0.9.27/tests/asmtest.S
- Property svn:keywords deleted
r279 r331 12 12 .byte 1 13 13 /* .align 16, 0x90 gas is too clever for us with 0x90 fill */ 14 .balign 4, 0x92 14 15 .align 16, 0x91 /* 0x91 tests the non-clever behaviour */ 15 16 .skip 3 16 17 .skip 15, 0x90 17 18 .string "hello\0world" 18 19 /* Macro expansion should work like with C, the #n shouldn't be parsed 20 as asm line comment */ 21 #define __stringify(n) #n 22 #define stringify(n) __stringify(n) 23 .skip 8,0x90 24 .asciz stringify(BLA) 25 .skip 8,0x90 26 27 # 28 "asmtest.S" # a line directive (and a line comment) 28 movl %eax, %ebx # some more asm comment 19 29 /* some label tests */ 20 21 movl %eax, %ebx22 30 L1: 23 31 movl %eax, %ebx … … 39 47 mov $1, %edx 40 48 mov $1, %dx 41 mov $1, % dl49 mov $1, %cl 42 50 movb $2, 0x100(%ebx,%edx,2) 43 51 movw $2, 0x100(%ebx,%edx,2) … … 47 55 movw %ax, 0x100(%ebx,%edx,2) 48 56 57 movw $0x1122,%si 58 movl $0x112233,%edx 59 movl $0x80000000, %esi 60 movl $-0x7fffffff, %edi 61 #ifdef __x86_64__ 62 mov $0x11223344,%rbx 63 movq $0x11223344,%rbx 64 mov $0x1122334455,%rbx 65 movq $0x1122334455,%rbx 66 movl $0x11334455,(%rbx) 67 #endif 68 49 69 mov %eax, 0x12(,%edx,2) 50 70 71 #ifdef __i386__ 51 72 mov %cr3, %edx 52 73 mov %ecx, %cr3 … … 55 76 movl %db3, %ebx 56 77 movl %dr6, %eax 78 #else 79 mov %cr3, %rdx 80 mov %rcx, %cr3 81 movq %cr3, %rax 82 movq %db3, %rbx 83 movq %dr6, %rax 84 mov %cr8, %rsi 85 mov %rdi, %cr8 86 #endif 57 87 movl %fs, %ecx 58 88 movl %ebx, %fs 89 90 #ifdef __x86_64__ 91 movq %r8, %r9 92 movq %r10, %r11 93 movq %r12, %r13 94 movq %r14, %r15 95 movq %rax, %r9 96 movq %r15, %rsi 97 inc %r9b 98 dec %r10w 99 not %r11d 100 negq %r12 101 decb %r13b 102 incw %r14w 103 notl %r15d 104 #endif 59 105 60 106 movsbl 0x1000, %eax … … 69 115 movzb 0x1000, %ax 70 116 117 mov $0x12345678,%eax 118 119 #ifdef __x86_64__ 120 movzb 0x1000, %rax 121 movzbq 0x1000, %rbx 122 movsbq 0x1000, %rdx 123 movzwq 0x1000, %rdi 124 movswq 0x1000, %rdx 125 movslq %eax, %rcx 126 mov $0x12345678,%rax 127 mov $0x12345678,%rdx 128 mov $0x12345678,%r10 129 mov $0x123456789abcdef0,%rax 130 mov $0x123456789abcdef0,%rcx 131 mov $0x123456789abcdef0,%r11 132 #endif 71 133 134 #ifdef __i386__ 72 135 pushl %eax 73 pushw %ax74 136 push %eax 75 137 push %cs 138 #else 139 pushq %rax 140 push %rax 141 #endif 142 pushw %ax 76 143 push %gs 77 144 push $1 78 145 push $100 146 push 0x42(%eax) 147 pop 0x43(%esi) 79 148 149 #ifdef __i386__ 80 150 popl %eax 81 popw %ax82 151 pop %eax 83 152 pop %ds 153 #else 154 popq %rax 155 pop %rax 156 #endif 157 popw %ax 84 158 pop %fs 85 159 … … 112 186 lea 0x1000(%ebx), %ecx 113 187 188 #ifdef __i386__ 114 189 les 0x2000, %eax 115 190 lds 0x2000, %ebx 191 lss 0x2000, %edx 192 #endif 116 193 lfs 0x2000, %ecx 117 194 lgs 0x2000, %edx 118 lss 0x2000, %edx119 195 120 196 addl $0x123, %eax 121 197 add $0x123, %ebx 198 add $-16, %ecx 199 add $-0x123, %esi 200 add $1, %bx 201 add $1, %ebx 202 add $-1, %bx 203 add $-1, %ebx 204 add $127, %bx 205 addl $127, %ebx 206 addl $-128, %ebx 207 addl $-128, %ebx 208 addl $-129, %ebx 209 addl $128, %ebx 210 addl $255, %ebx 211 addl $256, %ebx 212 andb $0xf, %ah 213 andb $-15, %cl 214 xorb $127, %dh 215 cmpb $42, (%eax) 122 216 addl $0x123, 0x100 123 217 addl $0x123, 0x100(%ebx) … … 128 222 addl $0x123, (%esp) 129 223 cmpl $0x123, (%esp) 224 225 #ifdef __x86_64__ 226 xor %bl,%ah 227 xor %bl,%r8b 228 xor %r9b,%bl 229 xor %sil,%cl 230 add %eax,(%r8d) 231 add %ebx,(%r9) 232 add %edx,(%r10d,%r11d) 233 add %ecx,(%r12,%r13) 234 add %esi,(%r14,%r15,4) 235 add %edi,0x1000(%rbx,%r12,8) 236 add %r11,0x1000(%ebp,%r9d,8) 237 movb $12, %ah 238 movb $13, %bpl 239 movb $14, %dil 240 movb $15, %r12b 241 #endif 130 242 131 243 add %eax, (%ebx) … … 180 292 div %ecx, %eax 181 293 294 and $15,%bx 295 and $-20,%edx 182 296 183 297 shl %edx … … 196 310 call 0x1000 197 311 call L4 312 #ifdef __i386__ 198 313 call *%eax 314 #else 315 call *%rax 316 #endif 199 317 call *0x1000 200 318 call func1 … … 205 323 L6: 206 324 325 #ifdef __i386__ 207 326 lcall $0x100, $0x1000 327 #else 328 lcall *0x100 329 lcall *(%rax) 330 #endif 208 331 209 332 jmp 0x1000 333 jmp *(%edi) 334 #ifdef __i386__ 210 335 jmp *%eax 336 #else 337 jmp *%rax 338 #endif 211 339 jmp *0x1000 212 340 341 #ifdef __i386__ 213 342 ljmp $0x100, $0x1000 343 #else 344 ljmp *0x100 345 ljmp *(%rdi) 346 ljmpl *(%esi) 347 ljmpw *(%esi) 348 #endif 214 349 215 350 ret 351 ret $10 352 #ifdef __i386__ 216 353 retl 217 218 ret $10219 354 retl $10 355 #else 356 retq 357 retq $10 358 #endif 220 359 221 360 lret … … 245 384 246 385 seto %al 386 setc %al 387 setcb %al 247 388 setnp 0x1000 248 389 setl 0xaaaa … … 402 543 403 544 bswap %edx 545 bswapl %ecx 404 546 xadd %ecx, %edx 405 547 xaddb %dl, 0x1000 … … 412 554 invlpg 0x1000 413 555 cmpxchg8b 0x1002 556 #ifdef __x86_64__ 557 cmpxchg16b (%rax) 558 cmpxchg16b (%r10,%r11) 559 #endif 414 560 415 561 fcmovb %st(5), %st … … 431 577 cmovs 0x1000, %eax 432 578 cmovns %edx, %edi 579 cmovne %ax, %si 580 cmovbw %ax, %di 581 cmovnbel %edx, %ecx 582 #ifdef __x86_64__ 583 bswapq %rsi 584 bswapq %r10 585 cmovz %rdi,%rbx 586 cmovpeq %rsi, %rdx 587 #endif 433 588 434 589 int $3 435 590 int $0x10 436 591 592 #ifdef __i386__ 437 593 pusha 438 594 popa 439 clc 440 cld 595 #endif 596 clc # another comment 597 cld # a comment with embedded ' tick 441 598 cli 442 599 clts … … 444 601 lahf 445 602 sahf 603 #ifdef __i386__ 446 604 pushfl 447 605 popfl 606 #else 607 pushfq 608 popfq 609 #endif 448 610 pushf 449 611 popf … … 451 613 std 452 614 sti 615 #ifdef __i386__ 453 616 aaa 454 617 aas … … 457 620 aad 458 621 aam 622 into 623 #endif 459 624 cbw 460 625 cwd … … 467 632 leave 468 633 int3 469 into470 634 iret 471 635 rsm … … 512 676 rdpmc 513 677 ud2 514 678 #ifdef __x86_64__ 679 syscall 680 sysret 681 sysretq 682 lfence 683 mfence 684 sfence 685 prefetchnta 0x18(%rdx) 686 prefetcht0 (%rcx) 687 prefetcht1 (%rsi) 688 prefetcht2 (%rdi) 689 prefetchw (%rdi) 690 clflush 0x1000(%rax,%rcx) 691 fxsaveq (%rdx) 692 fxsaveq (%r11) 693 fxrstorq (%rcx) 694 fxrstorq (%r10) 695 696 #endif 697 698 lar %ax,%dx 699 lar %eax,%dx 700 lar %ax,%edx 701 lar %eax,%edx 702 #ifdef __x86_64__ 703 lar %ax,%rdx 704 lar %eax,%rdx 705 #endif 515 706 emms 516 707 movd %edx, %mm3 … … 557 748 558 749 750 #ifdef __i386__ 559 751 boundl %edx, 0x10000 560 752 boundw %bx, 0x1000 561 753 562 754 arpl %bx, 0x1000 755 #endif 563 756 lar 0x1000, %eax 564 757 lgdt 0x1000 565 758 lidt 0x1000 566 759 lldt 0x1000 760 sgdt 0x1000 761 sidt 0x1000 762 sldt 0x1000 763 #ifdef __x86_64__ 764 lgdtq 0x1000 765 lidtq 0x1000 766 sgdtq 0x1000 767 sidtq 0x1000 768 769 swapgs 770 771 str %rdx 772 str %r9 773 #endif 774 567 775 lmsw 0x1000 568 776 lsl 0x1000, %ecx 569 777 ltr 0x1000 570 571 sgdt 0x1000 572 sidt 0x1000 573 sldt 0x1000 778 ltr %si 574 779 smsw 0x1000 575 780 str 0x1000 781 str %ecx 782 str %dx 576 783 577 784 verr 0x1000 578 785 verw 0x1000 579 786 787 #ifdef __i386__ 580 788 push %ds 581 789 pushw %ds … … 584 792 popw %ds 585 793 popl %ds 794 #endif 586 795 fxsave 1(%ebx) 587 796 fxrstor 1(%ecx) 797 #ifdef __i386__ 588 798 pushl $1 799 #else 800 pushq $1 801 #endif 589 802 pushw $1 590 803 push $1 … … 594 807 #endif 595 808 809 #ifndef _WIN32 596 810 ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9: 597 811 xor %eax, %eax … … 606 820 .type ft7,%function 607 821 .type ft8,"function" 822 #endif 608 823 609 824 pause 825 .rept 6 826 nop 827 .endr 828 .fill 4,1,0x90 829 830 .section .text.one,"ax" 831 nop 832 .previous 833 .pushsection .text.one,"ax" 834 nop 835 .pushsection .text.two,"ax" 836 nop 837 .popsection 838 .popsection 839 840 1: ud2 841 .pushsection __bug_table,"a" 842 .align 8 843 2: .long 1b - 2b 844 .long 0x600000 - 2b 845 .long 1b + 42 846 .long 43 + 1b 847 .long 2b + 144 848 .long 145 + 2b 849 .word 164, 0 850 .org 2b+32 851 #ifdef __x86_64__ 852 .quad 1b 853 #else 854 .long 1b 855 #endif 856 .popsection 857 3: mov %eax,%ecx 858 4: 859 .pushsection .text.three, "ax" 860 nop 861 .skip (-((4b-3b) > 0) * 2) , 0x90 862 .popsection 863 864 .globl overrideme 865 .weak overrideme 866 nop 867 .globl notimplemented 868 notimplemented: 869 ret 870 .set overrideme, notimplemented 871 overrideme = notimplemented 872 overrideme: 873 ret 874 875 movd %esi, %mm1 876 movd %edi, %xmm2 877 movd (%ebx), %mm3 878 movd (%ebx), %xmm3 879 movd %mm1, %esi 880 movd %xmm2, %edi 881 movd %mm3, (%edx) 882 movd %xmm3, (%edx) 883 #ifdef __x86_64__ 884 movd %rsi, %mm1 885 movd %rdi, %xmm2 886 movd (%rbx), %mm3 887 movd (%rbx), %xmm3 888 movd %mm1, %r12 889 movd %xmm2, %rdi 890 movd %mm3, (%r8) 891 movd %xmm3, (%r13) 892 #endif 893 894 movq (%ebp), %mm1 895 movq %mm2, (%edi) 896 movq (%edi), %xmm3 897 movq %mm4, %mm5 898 #ifdef __x86_64__ 899 movq %rcx, %mm1 900 movq %rdx, %xmm2 901 movq %r13, %xmm3 902 /* movq mem64->xmm is encoded as f30f7e by GAS, but as 903 660f6e by tcc (which really is a movd and would need 904 a REX.W prefix to be movq). */ 905 movq (%rsi), %xmm3 906 movq %mm1, %rdx 907 movq %xmm3, %rcx 908 movq %xmm4, (%rsi) 909 #endif 910 911 #define TEST_MMX_SSE(insn) \ 912 insn %mm1, %mm2; \ 913 insn %xmm2, %xmm3; \ 914 insn (%ebx), %xmm3; 915 #define TEST_MMX_SSE_I8(insn) \ 916 TEST_MMX_SSE(insn) \ 917 insn $0x42, %mm4; \ 918 insn $0x42, %xmm4; 919 920 TEST_MMX_SSE(packssdw) 921 TEST_MMX_SSE(packsswb) 922 TEST_MMX_SSE(packuswb) 923 TEST_MMX_SSE(paddb) 924 TEST_MMX_SSE(paddw) 925 TEST_MMX_SSE(paddd) 926 TEST_MMX_SSE(paddsb) 927 TEST_MMX_SSE(paddsw) 928 TEST_MMX_SSE(paddusb) 929 TEST_MMX_SSE(paddusw) 930 TEST_MMX_SSE(pand) 931 TEST_MMX_SSE(pandn) 932 TEST_MMX_SSE(pcmpeqb) 933 TEST_MMX_SSE(pcmpeqw) 934 TEST_MMX_SSE(pcmpeqd) 935 TEST_MMX_SSE(pcmpgtb) 936 TEST_MMX_SSE(pcmpgtw) 937 TEST_MMX_SSE(pcmpgtd) 938 TEST_MMX_SSE(pmaddwd) 939 TEST_MMX_SSE(pmulhw) 940 TEST_MMX_SSE(pmullw) 941 TEST_MMX_SSE(por) 942 TEST_MMX_SSE(psllw) 943 TEST_MMX_SSE_I8(psllw) 944 TEST_MMX_SSE(pslld) 945 TEST_MMX_SSE_I8(pslld) 946 TEST_MMX_SSE(psllq) 947 TEST_MMX_SSE_I8(psllq) 948 TEST_MMX_SSE(psraw) 949 TEST_MMX_SSE_I8(psraw) 950 TEST_MMX_SSE(psrad) 951 TEST_MMX_SSE_I8(psrad) 952 TEST_MMX_SSE(psrlw) 953 TEST_MMX_SSE_I8(psrlw) 954 TEST_MMX_SSE(psrld) 955 TEST_MMX_SSE_I8(psrld) 956 TEST_MMX_SSE(psrlq) 957 TEST_MMX_SSE_I8(psrlq) 958 TEST_MMX_SSE(psubb) 959 TEST_MMX_SSE(psubw) 960 TEST_MMX_SSE(psubd) 961 TEST_MMX_SSE(psubsb) 962 TEST_MMX_SSE(psubsw) 963 TEST_MMX_SSE(psubusb) 964 TEST_MMX_SSE(psubusw) 965 TEST_MMX_SSE(punpckhbw) 966 TEST_MMX_SSE(punpckhwd) 967 TEST_MMX_SSE(punpckhdq) 968 TEST_MMX_SSE(punpcklbw) 969 TEST_MMX_SSE(punpcklwd) 970 TEST_MMX_SSE(punpckldq) 971 TEST_MMX_SSE(pxor) 972 973 cvtpi2ps %mm1, %xmm2 974 cvtpi2ps (%ebx), %xmm2 975 TEST_MMX_SSE(pmaxsw) 976 TEST_MMX_SSE(pmaxub) 977 TEST_MMX_SSE(pminsw) 978 TEST_MMX_SSE(pminub)
Note:
See TracChangeset
for help on using the changeset viewer.