public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug other/17107] New: Opportunity to improve code generated for complex logical expression @ 2004-08-19 14:59 gcc-bugzilla at gcc dot gnu dot org 2004-08-19 15:29 ` [Bug rtl-optimization/17107] " pinskia at gcc dot gnu dot org ` (7 more replies) 0 siblings, 8 replies; 9+ messages in thread From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-19 14:59 UTC (permalink / raw) To: gcc-bugs Description: A non-optimal code sequence is illustraded. Duplicate using gcc 3.5 and command line: gcc -O3 -m64 -c test.c Testcase: int i; void foo(int a, int b, int c) { i = (a > b && a < c); } Assembly: Currently gcc 3.5 generates the following code which always results in the execution of the compare/branch for the right side of the expression (i.e. a < c): .foo: cmpw 7,4,3 cmpw 6,3,5 ld 11,.LC0@toc(2) li 9,1 blt- 7,.L2 li 9,0 .L2: li 0,1 blt- 6,.L3 li 0,0 .L3: and 0,9,0 stw 0,0(11) blr Execution of the second compare/branch may be avoided by restructuring the code. This also eliminates the need for the 'and': .foo: cmpw 7,4,3 ld 11,.LC0@toc(2) li 9,0 bng- 7,.L2 cmpw 6,3,5 bnl- 6,.L2 li 9,1 .L2: stw 9,0(11) blr -- Summary: Opportunity to improve code generated for complex logical expression Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: enhancement Priority: P1 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: steinmtz at us dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm dot com GCC build triplet: powerpc64-linux GCC host triplet: powerpc64-linux GCC target triplet: powerpc64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org @ 2004-08-19 15:29 ` pinskia at gcc dot gnu dot org 2004-10-12 10:38 ` nathan at gcc dot gnu dot org ` (6 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-08-19 15:29 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-19 15:29 ------- Confirmed. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|other |rtl-optimization Ever Confirmed| |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2004-08-19 15:29:16 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org 2004-08-19 15:29 ` [Bug rtl-optimization/17107] " pinskia at gcc dot gnu dot org @ 2004-10-12 10:38 ` nathan at gcc dot gnu dot org 2004-11-12 14:48 ` nathan at gcc dot gnu dot org ` (5 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: nathan at gcc dot gnu dot org @ 2004-10-12 10:38 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From nathan at gcc dot gnu dot org 2004-10-12 10:38 ------- It occurs to me that converting && to & (when safe) is a lose on targets that do not have setcond instructions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org 2004-08-19 15:29 ` [Bug rtl-optimization/17107] " pinskia at gcc dot gnu dot org 2004-10-12 10:38 ` nathan at gcc dot gnu dot org @ 2004-11-12 14:48 ` nathan at gcc dot gnu dot org 2004-11-15 2:39 ` pinskia at gcc dot gnu dot org ` (4 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: nathan at gcc dot gnu dot org @ 2004-11-12 14:48 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |nathan at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org ` (2 preceding siblings ...) 2004-11-12 14:48 ` nathan at gcc dot gnu dot org @ 2004-11-15 2:39 ` pinskia at gcc dot gnu dot org 2004-11-18 12:11 ` cvs-commit at gcc dot gnu dot org ` (3 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-11-15 2:39 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-15 02:39 ------- The reason why we convert TRUTH_ANDIF_EXPR to be TRUTH_AND_EXPR is because the BRANCH_COST is 2 on PPC. (this is done in fold-const.c). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org ` (3 preceding siblings ...) 2004-11-15 2:39 ` pinskia at gcc dot gnu dot org @ 2004-11-18 12:11 ` cvs-commit at gcc dot gnu dot org 2004-11-18 12:14 ` nathan at gcc dot gnu dot org ` (2 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2004-11-18 12:11 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-18 12:10 ------- Subject: Bug 17107 CVSROOT: /cvs/gcc Module name: gcc Changes by: nathan@gcc.gnu.org 2004-11-18 12:09:45 Modified files: gcc : ChangeLog fold-const.c gcc/config/rs6000: rs6000.h Log message: PR target/17107 * fold-const.c (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ... (LOGICAL_OP_NON_SHORT_CIRCUIT): ... here. (fold_range_test): Adjust. (fold_truthop): Use it. * config/rs6000/rs6000.h (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ... (LOGICAL_OP_NON_SHORT_CIRCUIT): ... here. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6393&r2=2.6394 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.474&r2=1.475 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&r1=1.346&r2=1.347 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org ` (4 preceding siblings ...) 2004-11-18 12:11 ` cvs-commit at gcc dot gnu dot org @ 2004-11-18 12:14 ` nathan at gcc dot gnu dot org 2004-11-18 12:16 ` pinskia at gcc dot gnu dot org 2004-12-01 17:19 ` cvs-commit at gcc dot gnu dot org 7 siblings, 0 replies; 9+ messages in thread From: nathan at gcc dot gnu dot org @ 2004-11-18 12:14 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-18 12:14 ------- 2004-11-18 Nathan Sidwell <nathan@codesourcery.com> PR target/17107 * fold-const.c (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ... (LOGICAL_OP_NON_SHORT_CIRCUIT): ... here. (fold_range_test): Adjust. (fold_truthop): Use it. * config/rs6000/rs6000.h (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ... (LOGICAL_OP_NON_SHORT_CIRCUIT): ... here. -- What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org ` (5 preceding siblings ...) 2004-11-18 12:14 ` nathan at gcc dot gnu dot org @ 2004-11-18 12:16 ` pinskia at gcc dot gnu dot org 2004-12-01 17:19 ` cvs-commit at gcc dot gnu dot org 7 siblings, 0 replies; 9+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-11-18 12:16 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/17107] Opportunity to improve code generated for complex logical expression 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org ` (6 preceding siblings ...) 2004-11-18 12:16 ` pinskia at gcc dot gnu dot org @ 2004-12-01 17:19 ` cvs-commit at gcc dot gnu dot org 7 siblings, 0 replies; 9+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2004-12-01 17:19 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-12-01 17:19 ------- Subject: Bug 17107 CVSROOT: /cvs/gcc Module name: gcc Changes by: dje@gcc.gnu.org 2004-12-01 17:18:43 Modified files: gcc : ChangeLog gcc/config/rs6000: rs6000.md Log message: 2004-12-01 David Edelsohn <edelsohn@gnu.org> Nathan Sidwell <nathan@codesourcery.com> PR target/17107 * config/rs6000/rs6000.md (sge): Enable for non-TARGET_POWER. (sgt): Same. (sle): Same. (slt): Same. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6659&r2=2.6660 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&r1=1.335&r2=1.336 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17107 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-12-01 17:19 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-08-19 14:59 [Bug other/17107] New: Opportunity to improve code generated for complex logical expression gcc-bugzilla at gcc dot gnu dot org 2004-08-19 15:29 ` [Bug rtl-optimization/17107] " pinskia at gcc dot gnu dot org 2004-10-12 10:38 ` nathan at gcc dot gnu dot org 2004-11-12 14:48 ` nathan at gcc dot gnu dot org 2004-11-15 2:39 ` pinskia at gcc dot gnu dot org 2004-11-18 12:11 ` cvs-commit at gcc dot gnu dot org 2004-11-18 12:14 ` nathan at gcc dot gnu dot org 2004-11-18 12:16 ` pinskia at gcc dot gnu dot org 2004-12-01 17:19 ` cvs-commit 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).