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
87
votes
3 answers

Why can't GCC generate an optimal operator== for a struct of two int32s?

A colleague showed me code that I thought wouldn't be necessary, but sure enough, it was. I would expect most compilers would see all three of these attempts at equality tests as equivalent: #include #include struct Point { …
Ben
  • 9,184
  • 1
  • 43
  • 56
79
votes
1 answer

Why does my Intel Skylake / Kaby Lake CPU incur a mysterious factor 3 slowdown in a simple hash table implementation?

In short: I have implemented a simple (multi-key) hash table with buckets (containing several elements) that exactly fit a cacheline. Inserting into a cacheline bucket is very simple, and the critical part of the main loop. I have implemented three…
Marc Stevens
  • 1,628
  • 1
  • 6
  • 16
76
votes
3 answers

how to run amd64 docker images on arm64 host platform

I have an m1 mac and I am trying to run a amd64 based docker image on my arm64 based host platform. However, when I try to do so (with docker run) I get the following error: WARNING: The requested image's platform (linux/amd64) does not match the…
Sabo Boz
  • 1,683
  • 4
  • 13
  • 29
76
votes
6 answers

How to detect 386, amd64, arm, or arm64 OS architecture via shell/bash

I'm looking for a POSIX shell/bash command to determine if the OS architecture is 386, amd64, arm, or arm64?
Justin
  • 42,716
  • 77
  • 201
  • 296
75
votes
1 answer

C# and SIMD: High and low speedups. What is happening?

Introduction of the problem I am trying to speed up the intersection code of a (2d) ray tracer that I am writing. I am using C# and the System.Numerics library to bring the speed of SIMD instructions. The problem is that I am getting strange…
Willem124
  • 751
  • 5
  • 6
75
votes
2 answers

What is the purpose of the "PAUSE" instruction in x86?

I am trying to create a dumb version of a spin lock. Browsing the web, I came across a assembly instruction called "PAUSE" in x86 which is used to give hint to a processor that a spin-lock is currently running on this CPU. The intel manual and other…
prathmesh.kallurkar
  • 5,468
  • 8
  • 39
  • 50
74
votes
3 answers

Force gcc to compile 32 bit programs on 64 bit platform

I've got a proprietary program that I'm trying to use on a 64 bit system. When I launch the setup it works ok, but after it tries to update itself and compile some modules and it fails to load them. I'm suspecting it's because it's using gcc and…
Jure1873
  • 879
  • 1
  • 7
  • 8
73
votes
4 answers

Why is the construction of std::optional more expensive than a std::pair?

Consider these two approaches that can represent an "optional int": using std_optional_int = std::optional; using my_optional_int = std::pair; Given these two functions... auto get_std_optional_int() -> std_optional_int { …
Vittorio Romeo
  • 90,666
  • 33
  • 258
  • 416
72
votes
6 answers

How to use gdb with LD_PRELOAD

I run a program with LD_PRELOADing a specific library. Like this. LD_PRELOAD=./my.so ./my_program How do I run this program with gdb?
MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
71
votes
1 answer

What happens if you use the 32-bit int 0x80 Linux ABI in 64-bit code?

int 0x80 on Linux always invokes the 32-bit ABI, regardless of what mode it's called from: args in ebx, ecx, ... and syscall numbers from /usr/include/asm/unistd_32.h. (Or crashes on 64-bit kernels compiled without CONFIG_IA32_EMULATION). 64-bit…
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
71
votes
4 answers

Why is memcmp(a, b, 4) only sometimes optimized to a uint32 comparison?

Given this code: #include int equal4(const char* a, const char* b) { return memcmp(a, b, 4) == 0; } int less4(const char* a, const char* b) { return memcmp(a, b, 4) < 0; } GCC 7 on x86_64 introduced an optimization for the…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
71
votes
5 answers

To learn assembly - should I start with 32 bit or 64 bit?

I'm really wanting to learn assembly. I'm pretty good at c/c++, but want a better understanding of what's going on at a lower level. I realize that assembly related questions have been asked before, but I'm just looking for some direction that's…
Cam
  • 14,930
  • 16
  • 77
  • 128
68
votes
4 answers

What are the names of the new X86_64 processors registers?

Where can I find the names of the new registers for assembly on this architecture? I am referring to registers in X86 like EAX, ESP, EBX, etc. But I'd like them in 64bit. I don't think they are the same as when I disassemble my C code, I get r's…
Recursion
  • 2,915
  • 8
  • 38
  • 51
65
votes
2 answers

Performance difference between Windows and Linux using Intel compiler: looking at the assembly

I am running a program on both Windows and Linux (x86-64). It has been compiled with the same compiler (Intel Parallel Studio XE 2017) with the same options, and the Windows version is 3 times faster than the Linux one. The culprit is a call to…
InsideLoop
  • 6,063
  • 2
  • 28
  • 55
65
votes
6 answers

What is the difference between x64 and IA-64?

I was on Microsoft's website and noticed two different installers, one for x64 and one for IA-64. Reference:Installing the .NET Framework 4.5, 4.5.1 My understanding is that IA-64 is a subclass of x64, so I'm curious why it would have a separate…
James Oravec
  • 19,579
  • 27
  • 94
  • 160