public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Factor out division by squares and remove division around comparisons (1/2)
@ 2017-08-10 14:11 Jackson Woodruff
  2017-08-10 15:26 ` Jackson Woodruff
  2017-08-15 14:22 ` Richard Biener
  0 siblings, 2 replies; 22+ messages in thread
From: Jackson Woodruff @ 2017-08-10 14:11 UTC (permalink / raw)
  To: Wilco.dijkstra, richard.guenther, kyrylo.tkachov, joseph, gcc-patches

Hi all,

The patch implements the division opitmizations discussed in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026 .

The implemented change differs slightly from the
proposed one in that we re-associate:

     C / x comparison 0.0 -> x comparison' 0.0

Where C is any constant and comparison' is changed as
appropriate if C is negative.

The implementations also removes the division from:

     x / C comparison 0.0 -> x comparison' 0.0

Where again, comparison' is changed as appropriate if C is
negative.

We also change the association of

      x / (y * C) -> (x / C) / y

If C is a constant. All of the above require
-funsafe-math-optimizations.

We also change:

   x / (- y) -> (-x) / y

Which requires -fno-trapping-math.

Bootstrapped and regtested (with part 2 of this patch) on aarch64.

OK for trunk?

(Apologies if the recipients in the 'to' field received this twice,
I accidentally sent this from an email gcc-patches doesn't accept)

Jackson

gcc/

2017-08-03  Jackson Woodruff  <jackson.woodruff@arm.com>

	PR 71026/tree-optimization
	* match.pd: New patterns.


gcc/testsuite

2017-08-03  Jackson Woodruff  <jackson.woodruff@arm.com>

	PR 71026/tree-optimization
	* gcc.dg/associate_comparison_1.c: New.
	* gcc.dg/associate_division_2.c: New.

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-10-13 18:52 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 14:11 [PATCH] Factor out division by squares and remove division around comparisons (1/2) Jackson Woodruff
2017-08-10 15:26 ` Jackson Woodruff
2017-08-11  0:15   ` Joseph Myers
2017-08-15 14:22 ` Richard Biener
2017-08-15 14:43   ` Wilco Dijkstra
2017-08-17 10:20     ` Richard Biener
2017-08-17 10:29       ` Wilco Dijkstra
2017-08-17 10:39         ` Richard Biener
2017-08-17 12:46           ` Joseph Myers
2017-08-24 21:26         ` Jeff Law
2017-08-29 12:13           ` Jackson Woodruff
2017-08-29 13:31             ` Richard Biener
2017-08-30 10:45               ` Jackson Woodruff
2017-08-30 13:26                 ` Richard Biener
2017-09-06  9:55                   ` Jackson Woodruff
2017-09-13 18:37                     ` Jeff Law
2017-09-13 21:20                       ` Wilco Dijkstra
2017-09-15 12:07                         ` Richard Biener
2017-09-15 16:50                         ` Jeff Law
2017-09-16 21:39                           ` Bernhard Reutner-Fischer
2017-10-13 18:18                             ` Jeff Law
2017-10-13 18:53                               ` Wilco Dijkstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).