search for: saddo_n

Displaying 1 result from an estimated 1 matches for "saddo_n".

Did you mean: addon
2018 Nov 20
2
A pattern for portable __builtin_add_overflow()
...addo_native xor eax, eax add edi, esi setb al mov dword ptr [rdx], edi ret uaddo_portable: # @uaddo_portable xor eax, eax add edi, esi setb al mov dword ptr [rdx], edi ret But with signed types it is not so easy. I tried 2 versions, but the result is quite far away from the optimal assembly. int saddo_native(int a, int b, int* s) { return __builtin_add_overflow(a, b, s); } int saddo_portable(int a, int b, int* s) { *s = (unsigned)a + (unsigned)b; return (a > 0) ? *s <= b : *s > b; } int saddo_portable2(int a, int b, int* s) { *s = (unsigned)a + (unsigned)b; int cond = a > 0; int chec...