Tag: x86-64

65 votes
4 answers
1.7K views
Why does Windows64 use a different calling convention from all other OSes on x86-64?

AMD has an ABI specification that describes the calling convention to use on x86-64. All OSes follow it, excep

avatar
Rufus
0 1 0 9
asked 07 September, 2021
60 votes
3 answers
2.7K views
Possible GCC bug when returning struct from a function

I believe I found a bug in GCC while implementing O'Neill's PCG PRNG. (Initial code on Godbolt'

avatar
Vi
0 1 0 9
asked 07 September, 2021
63 votes
4 answers
970 views
Why do x86-64 instructions on 32-bit registers zero the upper part of the full 64-bit register?

In the x86-64 Tour of Intel Manuals, I read Perhaps the most surprising fact is that an instruction such a

avatar
Frederick
0 1 0 9
asked 07 September, 2021
54 votes
4 answers
2K views
What are the calling conventions for UNIX & Linux system calls (and user-space functions) on i386 and x86-64

Following links explain x86-32 system call conventions for both UNIX (BSD flavor) & Linux: http://www.int

avatar
Rufus
0 1 0 9
asked 07 September, 2021
56 votes
4 answers
3K views
Why would introducing useless MOV instructions speed up a tight loop in x86_64 assembly?

Background: While optimizing some Pascal code with embedded assembly language, I noticed an unnecessary MOV i

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
62 votes
5 answers
2.4K views
Why does GCC use multiplication by a strange number in implementing integer division?

I've been reading about div and mul assembly operations, and I decided to see them in action by writing a

avatar
Xavier
0 1 0 9
asked 07 September, 2021
52 votes
4 answers
660 views
How do I achieve the theoretical maximum of 4 FLOPs per cycle?

How can the theoretical peak performance of 4 floating point operations (double precision) per cycle be achiev

avatar
Dorian
0 1 0 9
asked 07 September, 2021
64 votes
17 answers
1.4K views
What's the purpose of the LEA instruction?

For me, it just seems like a funky MOV. What's its purpose and when should I use it?

avatar
Vi
0 1 0 9
asked 07 September, 2021