https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70742

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
We could implement __builtin_ variants with a different ABI, returning the
quotiend and remainder in a (GCC extension) _Complex int type.  The library
would then do

#define div(a, b) ({ div_t res; _Complex int r = __builtin_div(a,b); res.quot =
_Real r; res.rem = _Imag r; res; })

that's without an inline function.  It's also way nicer to GCC internally,
not requiring memory for the return value - we'd have to lower to this kind
of internal code anyways to make code-generation good.

Reply via email to