public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> @ 2005-11-30 16:51 ` pinskia at gcc dot gnu dot org 2006-04-12 18:10 ` rguenth at gcc dot gnu dot org ` (4 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-11-30 16:51 UTC (permalink / raw) To: gcc-bugs ------- Comment #6 from pinskia at gcc dot gnu dot org 2005-11-30 16:51 ------- Note fixing this will also fix PR 23666 after my patch for moving "- ~a = a+1" to negate_expr. But this needs to depend on the fix for PR 25125 since otherwise we expose a latent bug in convert.c which shows up in the testsuite. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- BugsThisDependsOn| |25125 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> 2005-11-30 16:51 ` [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a pinskia at gcc dot gnu dot org @ 2006-04-12 18:10 ` rguenth at gcc dot gnu dot org 2006-04-13 1:01 ` pinskia at gcc dot gnu dot org ` (3 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: rguenth at gcc dot gnu dot org @ 2006-04-12 18:10 UTC (permalink / raw) To: gcc-bugs ------- Comment #7 from rguenth at gcc dot gnu dot org 2006-04-12 18:10 ------- Didn't we have the canonicalization to put the constant in operand2 if possible? A lot of transformations rely on that. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> 2005-11-30 16:51 ` [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a pinskia at gcc dot gnu dot org 2006-04-12 18:10 ` rguenth at gcc dot gnu dot org @ 2006-04-13 1:01 ` pinskia at gcc dot gnu dot org 2006-10-22 14:45 ` rguenth at gcc dot gnu dot org ` (2 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-04-13 1:01 UTC (permalink / raw) To: gcc-bugs ------- Comment #8 from pinskia at gcc dot gnu dot org 2006-04-13 01:01 ------- (In reply to comment #7) > Didn't we have the canonicalization to put the constant in operand2 if > possible? A lot of transformations rely on that. Why should they in this case, they only rely on that for operations that are comunitive and minus is not. "(-5) - a" is simplier than -a - 5 in reality. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> ` (2 preceding siblings ...) 2006-04-13 1:01 ` pinskia at gcc dot gnu dot org @ 2006-10-22 14:45 ` rguenth at gcc dot gnu dot org 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 5 siblings, 0 replies; 11+ messages in thread From: rguenth at gcc dot gnu dot org @ 2006-10-22 14:45 UTC (permalink / raw) To: gcc-bugs ------- Comment #9 from rguenth at gcc dot gnu dot org 2006-10-22 14:45 ------- Mine. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2006-02-18 17:40:06 |2006-10-22 14:45:16 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> ` (3 preceding siblings ...) 2006-10-22 14:45 ` rguenth at gcc dot gnu dot org @ 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 5 siblings, 0 replies; 11+ messages in thread From: rguenth at gcc dot gnu dot org @ 2006-10-23 7:20 UTC (permalink / raw) To: gcc-bugs ------- Comment #10 from rguenth at gcc dot gnu dot org 2006-10-23 07:19 ------- Subject: Bug 23295 Author: rguenth Date: Mon Oct 23 07:19:34 2006 New Revision: 117969 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117969 Log: 2006-10-24 Richard Guenther <rguenther@suse.de> PR middle-end/27132 PR middle-end/23295 * builtins.c (fold_binary): Remove checks for flag_wrapv and flag_trapv where negate_expr_p covers these cases. * gcc.dg/pr27132.c: New testcase. * gcc.dg/pr23295.c: Likewise. * gcc.dg/tree-ssa/pr23294.c: Adjust patterns. * g++.dg/tree-ssa/pr19807.C: Likewise. 2006-10-23 Richard Guenther <rguenther@suse.de> PR middle-end/29548 * fold-const.c (fold_plusminus_mult_expr): Check exact power of two on the absolute value. (fold_binary): Fold x * -C to -x * C if x is easily negatable and negating -C does not overflow. Added: trunk/gcc/testsuite/gcc.dg/pr23295.c trunk/gcc/testsuite/gcc.dg/pr27132.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/tree-ssa/pr19807.C trunk/gcc/testsuite/gcc.dg/tree-ssa/pr23294.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> ` (4 preceding siblings ...) 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org @ 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 5 siblings, 0 replies; 11+ messages in thread From: rguenth at gcc dot gnu dot org @ 2006-10-23 7:20 UTC (permalink / raw) To: gcc-bugs ------- Comment #11 from rguenth at gcc dot gnu dot org 2006-10-23 07:20 ------- Fixed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] New: fold does not simplify -a - (5) to (-5) - a @ 2005-08-09 3:12 pinskia at gcc dot gnu dot org 2005-08-09 3:12 ` [Bug middle-end/23295] " pinskia at gcc dot gnu dot org ` (4 more replies) 0 siblings, 5 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-09 3:12 UTC (permalink / raw) To: gcc-bugs Take the following function: int f(int a, int c) { return -a - (5); } Fold should have converted that to: int f(int a, int c) { return (-5) - a; } So that we only have one constant (-5) and one decl (a) and one expression (MINUS_EXPR) instead of one constant (5), one decl (a) and two expressions (MINUS_EXPR and NEG_EXPR). -- Summary: fold does not simplify -a - (5) to (-5) - a Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: missed-optimization, TREE Severity: enhancement Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a 2005-08-09 3:12 [Bug middle-end/23295] New: " pinskia at gcc dot gnu dot org @ 2005-08-09 3:12 ` pinskia at gcc dot gnu dot org 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org ` (3 subsequent siblings) 4 siblings, 0 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-09 3:12 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-09 03:12 ------- This is done in simplify-rtx.c for the rtl level. -- What |Removed |Added ---------------------------------------------------------------------------- OtherBugsDependingO| |19986 nThis| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a 2005-08-09 3:12 [Bug middle-end/23295] New: " pinskia at gcc dot gnu dot org 2005-08-09 3:12 ` [Bug middle-end/23295] " pinskia at gcc dot gnu dot org @ 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 4 siblings, 0 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-09 3:31 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-09 03:31 ------- Oh, and we remove one gimplfier tempary variable too. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a 2005-08-09 3:12 [Bug middle-end/23295] New: " pinskia at gcc dot gnu dot org 2005-08-09 3:12 ` [Bug middle-end/23295] " pinskia at gcc dot gnu dot org 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org @ 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org 2005-08-09 4:26 ` phython at gcc dot gnu dot org 2005-08-09 4:44 ` pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-09 3:31 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-09 03:31 ------- And then we can get optimial rtl generation right away for PPC: (insn 20 17 26 0 (set (reg/i:SI 3 r3 [ <result> ]) (minus:SI (const_int -5 [0xfffffffffffffffb]) (reg:SI 3 r3 [ a ]))) 78 {*rs6000.md:1236} (nil) (nil)) If we expand it correctly instead of depending on combine :). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a 2005-08-09 3:12 [Bug middle-end/23295] New: " pinskia at gcc dot gnu dot org ` (2 preceding siblings ...) 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org @ 2005-08-09 4:26 ` phython at gcc dot gnu dot org 2005-08-09 4:44 ` pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 11+ messages in thread From: phython at gcc dot gnu dot org @ 2005-08-09 4:26 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From phython at gcc dot gnu dot org 2005-08-09 04:26 ------- This transformation is done with -fwrapv. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2005-08-09 04:26:46 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a 2005-08-09 3:12 [Bug middle-end/23295] New: " pinskia at gcc dot gnu dot org ` (3 preceding siblings ...) 2005-08-09 4:26 ` phython at gcc dot gnu dot org @ 2005-08-09 4:44 ` pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 11+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-09 4:44 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-09 04:44 ------- I am going to move this to minor as this could be considered a regression in a way. It was introduced by: (fold): Optimize "-A - B" as "-B - A" if overflow wraps around. But in a way since wrapv is false, that means overflow is undefined and can be either wraps or anything else. Maybe Roger can comment on this? -- What |Removed |Added ---------------------------------------------------------------------------- CC| |sayle at gcc dot gnu dot org Severity|enhancement |minor http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-10-23 7:20 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-23295-6528@http.gcc.gnu.org/bugzilla/> 2005-11-30 16:51 ` [Bug middle-end/23295] fold does not simplify -a - (5) to (-5) - a pinskia at gcc dot gnu dot org 2006-04-12 18:10 ` rguenth at gcc dot gnu dot org 2006-04-13 1:01 ` pinskia at gcc dot gnu dot org 2006-10-22 14:45 ` rguenth at gcc dot gnu dot org 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 2006-10-23 7:20 ` rguenth at gcc dot gnu dot org 2005-08-09 3:12 [Bug middle-end/23295] New: " pinskia at gcc dot gnu dot org 2005-08-09 3:12 ` [Bug middle-end/23295] " pinskia at gcc dot gnu dot org 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org 2005-08-09 3:31 ` pinskia at gcc dot gnu dot org 2005-08-09 4:26 ` phython at gcc dot gnu dot org 2005-08-09 4:44 ` pinskia at gcc dot gnu dot org
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).