Re: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Segher Boessenkool
Hi! On Fri, May 06, 2022 at 02:09:21PM +, Matthias Gehre via Gcc wrote: > We would like to add support for division/modulo on large arbitrary precision  > integers to libgcc/compiler-rt > as required by C23's _BitInt type [0]. > > >From what I know, gcc doesn't yet support C23 _BitInt, but we

Re: AW: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Jonathan Lennox
On Friday, May 6 2022, "Matthias Gehre" wrote to "lennox" saying: > Jakub Jelinek wrote: > > Rather than uint32_t, wouldn't using the word size (64-bit for lp64, 32-bit > for ilp32) be better? > Is there a portable way to specify this in C? (size_t, uintptr_t?) And is the > word size > clearly de

Re: AW: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Joseph Myers
On Fri, 6 May 2022, Matthias Gehre via Gcc wrote: > > This proposed interface doesn't say anything about what aliasing is or > > isn't permitted among the four arrays pointed to. > Good catch. I would lean into saying that none of the four arrays must alias > because allowing them to alias would r

AW: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Matthias Gehre via Gcc
> Note that each architecture also needs to specify its _BitInt ABI > (including such things as whether the values of padding bits inside the > size of the _BitInt type, or outside that size but within a register used > for argument passing or return, have specified values or are arbitrary). > HJ h

AW: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Matthias Gehre via Gcc
On Fri, May 06, 2022 at 02:09:21PM +, Matthias Gehre via Gcc wrote: > /// \param quo The quotient represented by n words. Must be non-null. > /// \param rem The remainder represented by n words. Must be non-null. > /// \param a The dividend represented by n + 1 words. Must be non-null. > /// \p

Re: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Joseph Myers
On Fri, 6 May 2022, Jakub Jelinek via Gcc wrote: > And I really don't like the N + 1 stuff you're proposing, at least for > _BigInts that would be represented as an array of those word etc. elements > from least to most significant (or vice versa? That really needs to be > specified too), if they

Re: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Jakub Jelinek via Gcc
On Fri, May 06, 2022 at 02:09:21PM +, Matthias Gehre via Gcc wrote: > /// \param quo The quotient represented by n words. Must be non-null. > /// \param rem The remainder represented by n words. Must be non-null. > /// \param a The dividend represented by n + 1 words. Must be non-null. > /// \p

Re: [RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Joseph Myers
On Fri, 6 May 2022, Matthias Gehre via Gcc wrote: > We would like to add support for division/modulo on large arbitrary > precision integers to libgcc/compiler-rt as required by C23's _BitInt > type [0]. Note that each architecture also needs to specify its _BitInt ABI (including such things a

[RFC] Adding division/modulo on arbitrary precision integers to libgcc

2022-05-06 Thread Matthias Gehre via Gcc
Hello! We would like to add support for division/modulo on large arbitrary precision  integers to libgcc/compiler-rt as required by C23's _BitInt type [0]. >From what I know, gcc doesn't yet support C23 _BitInt, but we would still like to ensure that libgcc and compiler-rt can stay compatible in