This is the mail archive of the gcc@gcc.gnu.org mailing 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]

Re: [RFC PATCH] implement asin() and acos() as built-in function


On Mon, 19 Apr 2004, Uros Bizjak wrote:
> Attached to this message is RFC patch, which implements asin() and
> acos() as built-in function. Patch is tested, and produces code as
> expected, however, I would like someone to review this patch _before_ I
> implement long and float versions (they are trivial, once this RFC patch
> is OK'd). I will prepare full patch with ChangeLog tomorrow...

I think this proto-patch is fine except for the i386.md parts.  I think
that instead of introducing a new *sqrttruncxfdf2 pattern, the asindf2
and acosdf2 patterns should use sqrtxf2 and atan2xf3_1 instructions
followed by a final truncxfdf2_noop.  So the entire calculation is
performed in XFmode, with the final result "conceptually" truncated
back down to a double.

Indeed, one reason this implementation is more suitable for x87 than
for strict IEEE platforms is that "sqrt(1-x*x)" is calculated using
more precision than is available to a regular double.

One possible implementation strategy is for the asindf2 and asinsf2
patterns to extend their operands, generate asinxf2, and then truncate
the result.  Similarly for acosdf2 and acossf2 reusing acosxf2 expander.

I hope this helps.  I'm looking forward to seeing your patch.

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]