amd64: the biggest disaster in computing history

So recently I have been moving towards switching all my development to 64bits. And I am of increasing opinion that amd64 is an absolute disaster. The rex prefix and passing arguments in registers has completely ruined the code density. This absolute disaster amd saddled us with forever never had to be this way, all those opcodes they freed up could have been put to good use. 22 opcodes, 22 single byte opcodes wasted by these absolute retards. Imagine what could have been done with those 22 opcodes, so much wasted opportunity.

void test(void*, void*, long long, long long);

void test2(void* a, void* b)
    test(b, a, 1, 2);

mov     r9d, 2       [6]
mov     r8d, 1       [6]
mov     r10, rcx     [3]
mov     rcx, rdx     [3]
mov     rdx, r10     [3]
jmp     test         [5]

Those rex prefixes are pretty painful, but those small constants are what really kills it. 6 bytes to initialize a register with 1, absurd.
Imagine if just a few of those unused opcodes had been repurposed to encode some shorter 64bit operations.
Here are a few proposals.

[movq][reg|reg] – move 64bit register to register : 2 bytes
[movq][reg|000|sign][imm] – set 64bit register to 9 bit signed immediate : 3 bytes
With just these two simple instructions we could have saved 7 bytes from this function call.
Imagine what savings could have been made with careful use of all 22 spare opcodes
But of course we live in the worst timeline where everything has to suck
Fuck you amd, you fucked us all.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *