Questions tagged [x86-64]

x86-64 is a 64 bit extension to the Intel x86 architecture

x86-64 is a 64 bit instruction set, backwards compatible with the 16 and 32 bit architectures originating from the Intel 8086 processor. It is sometimes known as amd64 (common in GNU/Linux) or x64 (usually only seen in Windows).

The specification was created by AMD, and has been implemented by AMD, Intel, VIA, and others.

See the x86 tag for programming and optimising guides and other resources.

6825 questions
859
votes
17 answers

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?
user200557
  • 8,779
  • 3
  • 18
  • 8
696
votes
4 answers

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 achieved on a modern x86-64 Intel CPU? As far as I understand it takes three cycles for an SSE add and five cycles for a mul to complete on most…
user1059432
  • 7,518
  • 3
  • 19
  • 16
509
votes
6 answers

Why does GCC generate 15-20% faster code if I optimize for size instead of speed?

I first noticed in 2009 that GCC (at least on my projects and on my machines) have the tendency to generate noticeably faster code if I optimize for size (-Os) instead of speed (-O2 or -O3), and I have been wondering ever since why. I have managed…
Ali
  • 56,466
  • 29
  • 168
  • 265
370
votes
16 answers

How can I determine if a .NET assembly was built for x86 or x64?

I've got an arbitrary list of .NET assemblies. I need to programmatically check if each DLL was built for x86 (as opposed to x64 or Any CPU). Is this possible?
Judah Gabriel Himango
  • 58,906
  • 38
  • 158
  • 212
319
votes
7 answers

Why does this code execute more slowly after strength-reducing multiplications to loop-carried additions?

I was reading Agner Fog's optimization manuals, and I came across this example: double data[LEN]; void compute() { const double A = 1.1, B = 2.2, C = 3.3; int i; for(i=0; i
ttsiodras
  • 10,602
  • 6
  • 55
  • 71
285
votes
17 answers

Submit to App Store issues: Unsupported Architecture x86

So I am trying to use the Shopify API. When I archive the app and validate it then there are no issues but when I submit it to the app store then it gives me the following issues. ERROR ITMS-90087: "Unsupported Architecture. Your executable…
Saurabh Jain
  • 3,013
  • 3
  • 11
  • 9
268
votes
5 answers

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 simple program in C: File division.c #include #include int main() { size_t i = 9; size_t j = i / 5; …
qiubit
  • 4,708
  • 6
  • 23
  • 37
233
votes
4 answers

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 instruction, and removed it. To my surprise, removing the un-necessary instruction caused my program to slow down. I found that adding…
tangentstorm
  • 7,183
  • 2
  • 29
  • 38
194
votes
4 answers

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.int80h.org/bsdasm/#system-calls http://www.freebsd.org/doc/en/books/developers-handbook/x86-system-calls.html But what are the x86-64 system call…
claws
  • 52,236
  • 58
  • 146
  • 195
184
votes
4 answers

How does Rust's 128-bit integer `i128` work on a 64-bit system?

Rust has 128-bit integers, these are denoted with the data type i128 (and u128 for unsigned ints): let a: i128 = 170141183460469231731687303715884105727; How does Rust make these i128 values work on a 64-bit system; e.g. how does it do arithmetic…
ruohola
  • 21,987
  • 6
  • 62
  • 97
172
votes
4 answers

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 as MOV EAX, EBX automatically zeroes upper 32 bits of RAX register. The Intel documentation (3.4.1.1 General-Purpose Registers in 64-Bit Mode…
Nubok
  • 3,502
  • 7
  • 27
  • 47
149
votes
1 answer

Bubble sort slower with -O3 than -O2 with GCC

I made a bubble sort implementation in C, and was testing its performance when I noticed that the -O3 flag made it run even slower than no flags at all! Meanwhile -O2 was making it run a lot faster as expected. Without optimisations: time ./sort…
anon
  • 1,269
  • 2
  • 4
  • 6
149
votes
12 answers

How to find if a native DLL file is compiled as x64 or x86?

I want to determine if a native assembly is complied as x64 or x86 from a managed code application (C#). I think it must be somewhere in the PE header since the OS loader needs to know this information, but I couldn't find it. Of course I prefer to…
Ohad Horesh
  • 4,340
  • 6
  • 28
  • 45
140
votes
2 answers

What is the purpose of the RBP register in x86_64 assembler?

So I'm trying to learn a little bit of assembly, because I need it for Computer Architecture class. I wrote a few programs, like printing the Fibonacci sequence. I recognized that whenever I write a function I use those 3 lines (as I learned from…
user6827707
137
votes
4 answers

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, except for Windows which has it's own x86-64 calling convention. Why? Does anyone know the technical, historical, or political reasons for this…
JanKanis
  • 6,346
  • 5
  • 38
  • 42
1
2 3
99 100