tinycc/lib/alloca86_64.S

39 lines
606 B
ArmAsm
Raw Normal View History

2009-06-08 22:23:08 +04:00
/* ---------------------------------------------- */
/* alloca86_64.S */
#ifdef __leading_underscore
# define _(s) _##s
#else
# define _(s) s
#endif
2009-06-08 22:23:08 +04:00
.globl _(alloca)
_(alloca):
2009-06-08 22:23:08 +04:00
pop %rdx
#ifdef _WIN32
2009-07-19 00:06:54 +04:00
mov %rcx,%rax
#else
2009-06-08 22:23:08 +04:00
mov %rdi,%rax
2009-07-19 00:06:54 +04:00
#endif
add $15,%rax
and $-16,%rax
2009-06-08 22:23:08 +04:00
jz p3
#ifdef _WIN32
2009-06-08 22:23:08 +04:00
p1:
cmp $4096,%rax
jbe p2
test %rax,-4096(%rsp)
2009-06-08 22:23:08 +04:00
sub $4096,%rsp
sub $4096,%rax
jmp p1
p2:
#endif
sub %rax,%rsp
mov %rsp,%rax
p3:
push %rdx
ret
/* ---------------------------------------------- */