C OFFSET(i) C Expands to 4*i, or to the empty string if i is zero define(, ) C OFFSET64(i) C Expands to 8*i, or to the empty string if i is zero define(, ) dnl LREG(reg) gives the 8-bit register corresponding to the given 64-bit register. define(,)dnl define(,)dnl define(,)dnl define(,)dnl dnl W64_ENTRY(nargs, xmm_used) define(, < changequote([,])dnl ifelse(<<<<<<<<<<<<<<<<<< ignored; only for balancing) ifelse(W64_ABI,yes,[ dnl unconditionally push %rdi, making %rsp 16-byte aligned push %rdi dnl Save %xmm6, ..., if needed ifelse(eval($2 > 6), 1, [ sub [$]eval(16*($2 - 6)), %rsp movdqa %xmm6, 0(%rsp) ]) ifelse(eval($2 > 7), 1, [ movdqa %xmm7, 16(%rsp) ]) ifelse(eval($2 > 8), 1, [ movdqa %xmm8, 32(%rsp) ]) ifelse(eval($2 > 9), 1, [ movdqa %xmm9, 48(%rsp) ]) ifelse(eval($2 > 10), 1, [ movdqa %xmm10, 64(%rsp) ]) ifelse(eval($2 > 11), 1, [ movdqa %xmm11, 80(%rsp) ]) ifelse(eval($2 > 12), 1, [ movdqa %xmm12, 96(%rsp) ]) ifelse(eval($2 > 13), 1, [ movdqa %xmm13, 112(%rsp) ]) ifelse(eval($2 > 14), 1, [ movdqa %xmm14, 128(%rsp) ]) ifelse(eval($2 > 15), 1, [ movdqa %xmm15, 144(%rsp) ]) dnl Move around arguments ifelse(eval($1 >= 1), 1, [ mov %rcx, %rdi ]) ifelse(eval($1 >= 2), 1, [ dnl NOTE: Breaks 16-byte %rsp alignment push %rsi mov %rdx, %rsi ]) ifelse(eval($1 >= 3), 1, [ mov %r8, %rdx ]) ifelse(eval($1 >= 4), 1, [ mov %r9, %rcx ]) ifelse(eval($1 >= 5), 1, [ mov ifelse(eval($2 > 6), 1, eval(16*($2-6)+56),56)(%rsp), %r8 ]) ifelse(eval($1 >= 6), 1, [ mov ifelse(eval($2 > 6), 1, eval(16*($2-6)+64),64)(%rsp), %r9 ]) ]) changequote(<,>)dnl >) dnl W64_EXIT(nargs, xmm_used) define(, < changequote([,])dnl ifelse(<<<<<<<<<<< ignored; only for balancing) ifelse(W64_ABI,yes,[ ifelse(eval($1 >= 2), 1, [ pop %rsi ]) ifelse(eval($2 > 15), 1, [ movdqa 144(%rsp), %xmm15 ]) ifelse(eval($2 > 14), 1, [ movdqa 128(%rsp), %xmm14 ]) ifelse(eval($2 > 13), 1, [ movdqa 112(%rsp), %xmm13 ]) ifelse(eval($2 > 12), 1, [ movdqa 96(%rsp), %xmm12 ]) ifelse(eval($2 > 11), 1, [ movdqa 80(%rsp), %xmm11 ]) ifelse(eval($2 > 10), 1, [ movdqa 64(%rsp), %xmm10 ]) ifelse(eval($2 > 9), 1, [ movdqa 48(%rsp), %xmm9 ]) ifelse(eval($2 > 8), 1, [ movdqa 32(%rsp), %xmm8 ]) ifelse(eval($2 > 7), 1, [ movdqa 16(%rsp), %xmm7 ]) ifelse(eval($2 > 6), 1, [ movdqa (%rsp), %xmm6 add [$]eval(16*($2 - 6)), %rsp ]) pop %rdi ]) changequote(<,>)dnl >)