Richard Henderson - Re: [PATCH]: Expand finite() as inline i386 asm (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
- From: Richard Henderson
- To: Geert Bosch
- Cc: Uros Bizjak , GCC Patches
- Date: Thu, 1 Feb 2007 12:25:23 -0800
- Subject: Re: [PATCH]: Expand finite() as inline i386 asm
- References: 5787cf470701250731rb6cba27l360293b491b972a1@mail.gmail.com <20070201005832.GA8302@redhat.com> <8E65FCAD-672D-4FA5-AA20-1A05B2DFF87B@adacore.com>
On Thu, Feb 01, 2007 at 10:11:26AM -0500, Geert Bosch wrote:
isfinite(d) => islessequal(fabs(d), DBL_MAX)
The 'Valid attribute in Ada (see s-fatgen.adb, function Valid) does essentially the same in a target-independent way. Also, by keeping the entire operation in the integer domain, it avoids trapping on some architectures (e.g. MIPS).
islessequal is by definition non-trapping, in contrast to the <= operator. MIPS does in fact implement this operation via c.ule.[sd] instructions. Which, presumably, couldn't be emitted from Ada once upon a time.
The significant advantage of implementing these operations in the fpu (when possible), is that the value is usually already in the fpu, and so we avoid a costly transfer of the value into the general registers. Your x86 example is more or less the exception, because of passing parameters on the stack by default.
r~
- References:
- Re: [PATCH]: Expand finite() as inline i386 asm
* From: Richard Henderson - Re: [PATCH]: Expand finite() as inline i386 asm
* From: Geert Bosch
- Re: [PATCH]: Expand finite() as inline i386 asm
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |