Closed faissaloo closed 7 years ago
I had a reason for this back when initially writing this code as I came across something that said inc/dec should not be used in x86-64. I can't recall where I saw this but this would cut down on compiled code size.
Thanks for submitting this! I've also made the appropriate changes to BareMetal-kernel based on this pull request.
No problem, glad to help!
if you're interested in seeing how gcc optimizes a small function:
$ cat t.c && for x in O2 Os; do (gcc -$x -c t.c && objdump -d -Mintel t.o
|sed -ne '/._
On 12 October 2016 at 04:44, Ian Seyler notifications@github.com wrote:
I had a reason for this back when initially writing this code as I came across something that said inc/dec should not be used in x86-64. I can't recall where I saw this but this would cut down on compiled code size.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ReturnInfinity/BareMetal-OS/pull/118#issuecomment-252990778, or mute the thread https://github.com/notifications/unsubscribe-auth/AAn-H9vOG_b_IeJFivYQDtbW5wB6xszWks5qy8sBgaJpZM4KRb2J .
Some really basic optimisations, mostly:
cmp <reg>, 0
->test <reg>, <reg>
mov <reg>, 0
->xor <reg>, <reg>
sub <reg/mem>, 1
->dec <reg/mem>
inc <reg/mem>, 1
->add <reg/mem>
->
dec <reg/mem>