https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100301
Bug ID: 100301 Summary: sum of __int128 - regression since 8.2 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dushistov at mail dot ru Target Milestone: --- For such simple function: __int128 add1(__int128 a, __int128 b) { return a + b; } gcc 8.2 generates for a + b: mov r9, rdi mov r10, rsi add r9, rdx adc r10, rcx mov rax, r9 mov rdx, r10 ret and for b + a: add1(__int128, __int128): mov rax, rdx mov rdx, rcx add rax, rdi adc rdx, rsi ret but gcc 11.1 generates for both cases: add1(__int128, __int128): mov r9, rdi mov rax, rdx mov r8, rsi mov rdx, rcx add rax, r9 adc rdx, r8 ret 4 moves instead of 2. Recent versions of clang and icc generates the same number and type of instruction of both cases, and only 2 moves and 2 additions: icc: add1(__int128, __int128): add rdi, rdx mov rax, rdi adc rsi, rcx mov rdx, rsi ret add1(__int128, __int128): add rdx, rdi mov rax, rdx adc rcx, rsi mov rdx, rcx ret clang: add1(__int128, __int128): mov rax, rdi add rax, rdx adc rsi, rcx mov rdx, rsi ret add1(__int128, __int128): mov rax, rdi add rax, rdx adc rsi, rcx mov rdx, rsi ret Not sure is this target specific issue, I get this example from this article: https://habr.com/ru/post/554760/ , where risc-v gcc 8.2.0 has similar problem that "a + b" and "b + a" uses different number of instructions.