Hacker News new | ask | show | jobs
by senfiaj 260 days ago
This what was generated with clang / gcc x64 with O2/O3 flag on godbolt.org

  abs_branchless(int):
        mov     eax, edi
        neg     eax
        cmovs   eax, edi
        ret

  abs_branch(int):
        mov     eax, edi
        neg     eax
        cmovs   eax, edi
        ret