tg at gmplib.org
Sun Jul 4 12:56:10 UTC 2021
Perhaps we should write a little low-level, m4-based asm compiler?
We could define ad-hoc primitives, like some equivalent to the inline
asm umul_ppmm, add/subtract with carry, loads, stores, branches, etc.
The set of primitives should be separted in must-define and optional.
Writing a definition file for a CPU is not much work.
If we stay within the must-define primitives, source code would be
legible and simple to write. As soon as we use ifdefs on optional
primitives things could become hairy of course.
I neat trick would be to have this structure,
where default.m4 could define all thereto undefined optional primitives
to generate an error. That would allow us to write function variants
using optional instructions without messing with ifdef. Instead,
compilation would fail for machine where mdep.m4 has not defined all
used primitives. That is an OK failure mode.
Then we could define things such as your division methods using these
macros, and at least use it as a quick way of generating asm code, or
perhaps even use it as real GMP sources as an intermediate between C and
Please encrypt, key id 0xC8601622
More information about the gmp-devel