Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 28 Dec 2021 09:42:30 +0100
From: Markus Wichmann <>
Subject: Re: ASM-to-C conversion for i386

On Mon, Dec 27, 2021 at 01:41:38PM -0500, Rich Felker wrote:
> Yes, I think the insns that can emit other precisions probably would
> need 3 versions, but there are very few of these -- just fabs and
> fmod?
> Rich

x87 does not have an fmod instruction. There are fprem and fprem1, and
the difference escapes me at the moment. Anyway, frndint is also used in
this way. But for now, I have decided to just leave all of them as they
are. The fabs functions could not be any simpler, and it is unlikely the
remainder functions would benefit from this treatment, either, because
of the use of the status word. In the end I would create functions that
are used precisely once, and don't even clean up the function where they
are used all that much.

This means only the remquo functions suffer the penalty of superfluous
rounding. But in that case, I think the benefit of having only one place
with the implementation of the status word bit shuffle is actually worth
it. So the only thing I would even consider right now is to go back into
the remainder functions and replace the "0x400" with a symbolic
constant, now that there is one (X87_SW_C2).

Beyond that, I cannot think of what to change about the maths code any
more. String code needs more love, however.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.