1 # gas comment with ``gnu'' style quotes
3 /* some directive tests */
13 /* .align 16, 0x90 gas is too clever for us with 0x90 fill */
15 .align 16, 0x91 /* 0x91 tests the non-clever behaviour */
18 .string "hello\0world"
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)
27 # 28 "asmtest.S" # a line directive (and a line comment)
28 movl %eax, %ebx # some more asm comment
29 /* some label tests */
40 /* instruction tests */
50 movb $2, 0x100(%ebx,%edx,2)
51 movw $2, 0x100(%ebx,%edx,2)
52 movl $2, 0x100(%ebx,%edx,2)
53 movl %eax, 0x100(%ebx,%edx,2)
54 movl 0x100(%ebx,%edx,2), %edx
55 movw %ax, 0x100(%ebx,%edx,2)
59 movl $0x80000000, %esi
60 movl $-0x7fffffff, %edi
64 mov $0x1122334455,%rbx
65 movq $0x1122334455,%rbx
66 movl $0x11334455,(%rbx)
69 mov %eax, 0x12(,%edx,2)
129 mov $0x123456789abcdef0,%rax
130 mov $0x123456789abcdef0,%rcx
131 mov $0x123456789abcdef0,%r11
180 /* NOTE: gas is bugged here, so size must be added */
185 leal 0x1000(%ebx), %ecx
186 lea 0x1000(%ebx), %ecx
217 addl $0x123, 0x100(%ebx)
218 addl $0x123, 0x100(%ebx,%edx,2)
219 addl $0x123, 0x100(%esp)
220 addl $0x123, (3*8)(%esp)
232 add %edx,(%r10d,%r11d)
234 add %esi,(%r14,%r15,4)
235 add %edi,0x1000(%rbx,%r12,8)
236 add %r11,0x1000(%ebp,%r9d,8)
286 imul $0x1100000, %eax
326 lcall $0x100, $0x1000
428 //fsubp %st(1), %st # not accepted by new GAS anymore
441 //fsubrp %st(1), %st # not accepted by new GAS anymore
454 //fdivp %st(1), %st # not accepted by new GAS anymore
553 cmpxchgl %eax, 0x1000
558 cmpxchg16b (%r10,%r11)
596 clc # another comment
597 cld # a comment with embedded ' tick
649 /* XXX: handle prefixes */
670 /* handle one-line prefix + ops */
694 prefetchnta 0x18(%rdx)
699 clflush 0x1000(%rax,%rcx)
777 lzcnt 0x40(%rcx), %r11
784 tzcntl -24(%edi), %ecx
813 /* Newer gas assemble 'str %rdx' as 'str %edx', based on the observation
814 that the 16bit value of the task register is zero-extended into the
815 destination anyway, and hence storing into %edx is the same as storing
816 into %rdx. TCC doesn't do that micro-optimization, hence just store
817 into the 32bit reg as well. */
852 #ifdef __ASSEMBLER__ // should be defined, for S files
857 ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
877 .section .text.one,"ax"
880 .pushsection .text.one,"ax"
882 .pushsection .text.two,"ax"
888 .pushsection __bug_table,"a"
906 .pushsection .text.three, "ax"
908 .skip (-((4b-3b) > 0) * 2) , 0x90
914 .globl notimplemented
917 .set overrideme, notimplemented
918 overrideme = notimplemented
949 /* movq mem64->xmm is encoded as f30f7e by GAS, but as
950 660f6e by tcc (which really is a movd and would need
951 a REX.W prefix to be movq). */
958 #define TEST_MMX_SSE(insn) \
962 #define TEST_MMX_SSE_I8(insn) \
967 TEST_MMX_SSE(packssdw)
968 TEST_MMX_SSE(packsswb)
969 TEST_MMX_SSE(packuswb)
975 TEST_MMX_SSE(paddusb)
976 TEST_MMX_SSE(paddusw)
979 TEST_MMX_SSE(pcmpeqb)
980 TEST_MMX_SSE(pcmpeqw)
981 TEST_MMX_SSE(pcmpeqd)
982 TEST_MMX_SSE(pcmpgtb)
983 TEST_MMX_SSE(pcmpgtw)
984 TEST_MMX_SSE(pcmpgtd)
985 TEST_MMX_SSE(pmaddwd)
990 TEST_MMX_SSE_I8(psllw)
992 TEST_MMX_SSE_I8(pslld)
994 TEST_MMX_SSE_I8(psllq)
996 TEST_MMX_SSE_I8(psraw)
998 TEST_MMX_SSE_I8(psrad)
1000 TEST_MMX_SSE_I8(psrlw)
1002 TEST_MMX_SSE_I8(psrld)
1004 TEST_MMX_SSE_I8(psrlq)
1008 TEST_MMX_SSE(psubsb)
1009 TEST_MMX_SSE(psubsw)
1010 TEST_MMX_SSE(psubusb)
1011 TEST_MMX_SSE(psubusw)
1012 TEST_MMX_SSE(punpckhbw)
1013 TEST_MMX_SSE(punpckhwd)
1014 TEST_MMX_SSE(punpckhdq)
1015 TEST_MMX_SSE(punpcklbw)
1016 TEST_MMX_SSE(punpcklwd)
1017 TEST_MMX_SSE(punpckldq)
1020 cvtpi2ps %mm1, %xmm2
1021 cvtpi2ps (%ebx), %xmm2
1022 TEST_MMX_SSE(pmaxsw)
1023 TEST_MMX_SSE(pmaxub)
1024 TEST_MMX_SSE(pminsw)
1025 TEST_MMX_SSE(pminub)