This is the mail archive of the gcc-patches@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: [PATCH] Some more trigonometric optimizations


Hello Paolo!

>    if (untyped_math_builtin_code (fcode0) == BUILT_IN_SIN)
>       cosfn = typed_math_builtin_decl (BUILT_IN_COS, fcode0);

Thanks for pointing this to me!

Attached patch implements your suggestion the way it is implemented in
other trigonometric transformations (the code changes amazingly fast
:).

BTW: In this patch, a bit of code is also moved around, so we don't
have to calculate fcode three times for
flag_unsafe_math_optimizations.

Regtesting on 686-pc-linux-gnu is in progress (and c part of the
testsuite already passed).

2005-10-28  Roger Sayle  <roger@eyesopen.com>
	    Uros Bizjak  <uros@kss-loka.si>

	* fold-const.c (fold binary) [RDIV_EXPR]: Optimize
	sin(x)/tan(x) as cos(x) and tan(x)/sin(x) as 1.0/cos(x)
	when flag_unsafe_math_optimizations is set and
	we don't care about NaNs or Infinities.
	Move x/expN(y) and x/pow(y,z) transformation into common
	flag_unsafe_math_optimizations section.

testsuite/

	* gcc.dg/builtins-20.c: Add checks for sin(x)/tan(x) and
	tan(x)/sin(x) transformations.

OK for 4.2?
Uros.

Attachment: trig.diff
Description: Binary data


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