Category : x86-64

If you compile with -O2 -march=skylake on clang x86-64 (I tested 12 and 13) and gcc you’ll see completely different implementations. I tested with znver2 and skylake https://godbolt.org/z/s8P871cc1 long long int_to_hex(unsigned long long val, char*buf) { const char lookup[] = {‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ..

Read more

I’m trying to understand how assert behaves in the case of false statement. It calls __assert_fail and it calls std::abort(), according to documentation. So, I want to know what is going in assembly code of __assert_fail: endbr64 pushq %r13 movl %edx, %r13d movl $0x5, %edx pushq %r12 movq %rsi, %r12 leaq 0x18467e(%rip), %rsi pushq %rbp ..

Read more

env : x86-64; linux-centos; 8-cpu-core For testing ‘false sharing performance’ I wrote c++ code like this: volatile int32_t a; volatile int32_t b; int64_t p1[7]; volatile int64_t c; int64_t p2[7]; volatile int64_t d; void thread1(int param) { auto start = chrono::high_resolution_clock::now(); for (size_t i = 0; i < 1000000000; ++i) { a = i % 512; ..

Read more

Assembly included. This weekend I tried to get my own small library running without any C libs and the thread local stuff is giving me problems. Below you can see I created a struct called Try1 (because it’s my first attempt!) If I set the thread local variable and use it, the code seems to ..

Read more