Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,907 of 4,675    |
|    antispam@nospicedham.math.uni.wroc. to All    |
|    Prologue and epilogue    |
|    12 Jul 19 01:15:45    |
      There was recently discussion about speed of various       ways of saving and restoring registers. I did a little       microbenchmark, saving and restorin 7 registers in       different ways:              a - save and restore using moves in ascending order       b - save using moves in descending order, restore in ascending order       c - save using pushes, restore using moves in ascending order       d - save and restore using pushes and pops              Called function had 17 instructions (two arithmethic instructions       for stack adjustments, 14 save/restore instructions and return).       Version b (with descending stores and ascending loads):              foo1:        subq $0x78, %rsp        movq %rbp, 0x70(%rsp)        movq %r10, 0x68(%rsp)        movq %r11, 0x60(%rsp)        movq %r12, 0x58(%rsp)        movq %r13, 0x50(%rsp)        movq %r14, 0x48(%rsp)        movq %r15, 0x40(%rsp)               movq 0x40(%rsp), %r15        movq 0x48(%rsp), %r14        movq 0x50(%rsp), %r13        movq 0x58(%rsp), %r12        movq 0x60(%rsp), %r11        movq 0x68(%rsp), %r10        movq 0x70(%rsp), %rbp        addq $0x78, %rsp              Version a had stores in opposite order, vesrsion c replaced stores       by pushed and moved stack adjustment after pushed, version d       additionaly replaced loads by pops and moved stack adjustment       befor pushes.              This function was called from loop consisting of 3 instructions:               4003d0: e8 2b 01 00 00 callq 400500 |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca