tccpe: get rid of kludgy export-symbol sort
[tinycc/miki.git] / lib / alloca86_64.S
blob684a3e933adce366c6040b43c75fdb34d26e7520
1 /* ---------------------------------------------- */
2 /* alloca86_64.S */
4 #include "../config.h"
6 .globl alloca
8 alloca:
9     pop     %rdx
10     mov     %rdi,%rax
11     add     $15,%rax
12     and     $-16,%rax
13     jz      p3
15 #ifdef TCC_TARGET_PE
16     /* XXX: not tested */
17 p1:
18     cmp     $4096,%rax
19     jle     p2
20     sub     $4096,%rsp
21     sub     $4096,%rax
22     test    %rax,(%rsp)
23     jmp p1
24 p2:
25 #endif
27     sub     %rax,%rsp
28     mov     %rsp,%rax
29 p3:
30     push    %rdx
31     ret
33 /* ---------------------------------------------- */