Skip to content
Snippets Groups Projects
Commit 9f0a7f9d authored by Roger Sayle's avatar Roger Sayle Committed by Roger Sayle
Browse files

builtins.c (fold_builtin): Optimize cos(-x) as cos(x).

	* builtins.c (fold_builtin): Optimize cos(-x) as cos(x).
	* fold-const.c (fold <NEGATE_EXPR>): Convert -f(x) into f(-x)
	when x is easily negated and f is sin, tan or atan.
	(fold <MULT_EXPR>): Optimize tan(x)*cos(x) and cos(x)*tan(x) as
	sin(x) with flag_unsafe_math_optimizations.
	(fold <RDIV_EXPR>): With flag_unsafe_math_optimizations fold
	sin(x)/cos(x) as tan(x) and cos(x)/sin(x) as 1.0/tan(x).

	* gcc.dg/builtins-20.c: New test case.

From-SVN: r67701
parent 8936c82f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment