public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/20517] New: bit shift/mask optimization potential @ 2005-03-17 13:17 Thomas dot Koenig at online dot de 2005-03-17 13:34 ` [Bug middle-end/20517] " Thomas dot Koenig at online dot de ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Thomas dot Koenig at online dot de @ 2005-03-17 13:17 UTC (permalink / raw) To: gcc-bugs $ cat shift.c #include <stdio.h> #define OFFSET 4 #define MASK 0xf0 int main() { unsigned int f,g; scanf("%u",&f); if ((f & MASK) >> OFFSET == 1) { printf("success\n"); } return 0; } $ gcc -S -O2 -fdump-tree-optimized shift.c $ tail -20 shift.c.t66.optimized unsigned int g; unsigned int f; int D.1807; unsigned int D.1806; unsigned int D.1805; unsigned int f.10; <bb 0>: scanf (&"%u"[0], &f); if ((f & 240) >> 4 == 1) goto <L0>; else goto <L1>; <L0>:; printf (&"success\n"[0]); <L1>:; return 0; } $ gcc -v Using built-in specs. Target: ia64-unknown-linux-gnu Configured with: ../gcc-4.1-20050306/configure --prefix=/home/zfkts --enable-languages=c,f95 --disable-optimization Thread model: posix gcc version 4.1.0 20050306 (experimental) The expression (f & 0xf0) >> 4 == 1 could be optimized to f & 0xf == 1 << 4. Code like that occurs in the libgfortan library. -- Summary: bit shift/mask optimization potential Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Thomas dot Koenig at online dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20517 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/20517] bit shift/mask optimization potential 2005-03-17 13:17 [Bug middle-end/20517] New: bit shift/mask optimization potential Thomas dot Koenig at online dot de @ 2005-03-17 13:34 ` Thomas dot Koenig at online dot de 2005-03-17 17:21 ` [Bug tree-optimization/20517] " pinskia at gcc dot gnu dot org 2005-07-23 21:07 ` phython at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: Thomas dot Koenig at online dot de @ 2005-03-17 13:34 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20517 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/20517] bit shift/mask optimization potential 2005-03-17 13:17 [Bug middle-end/20517] New: bit shift/mask optimization potential Thomas dot Koenig at online dot de 2005-03-17 13:34 ` [Bug middle-end/20517] " Thomas dot Koenig at online dot de @ 2005-03-17 17:21 ` pinskia at gcc dot gnu dot org 2005-07-23 21:07 ` phython at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-03-17 17:21 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-17 17:21 ------- Confirmed, but this is already done on the RTL level. So the assembler looks same for what you recomend and what is produced already. -- What |Removed |Added ---------------------------------------------------------------------------- OtherBugsDependingO| |19986 nThis| | Severity|normal |enhancement Status|UNCONFIRMED |NEW Component|middle-end |tree-optimization Ever Confirmed| |1 Keywords| |TREE Last reconfirmed|0000-00-00 00:00:00 |2005-03-17 17:21:20 date| | Version|unknown |4.1.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20517 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/20517] bit shift/mask optimization potential 2005-03-17 13:17 [Bug middle-end/20517] New: bit shift/mask optimization potential Thomas dot Koenig at online dot de 2005-03-17 13:34 ` [Bug middle-end/20517] " Thomas dot Koenig at online dot de 2005-03-17 17:21 ` [Bug tree-optimization/20517] " pinskia at gcc dot gnu dot org @ 2005-07-23 21:07 ` phython at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: phython at gcc dot gnu dot org @ 2005-07-23 21:07 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From phython at gcc dot gnu dot org 2005-07-23 21:05 ------- The condition around fold-const:9302 can be generalized to deal with this case. -- What |Removed |Added ---------------------------------------------------------------------------- CC| |phython at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20517 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-07-23 21:05 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-03-17 13:17 [Bug middle-end/20517] New: bit shift/mask optimization potential Thomas dot Koenig at online dot de 2005-03-17 13:34 ` [Bug middle-end/20517] " Thomas dot Koenig at online dot de 2005-03-17 17:21 ` [Bug tree-optimization/20517] " pinskia at gcc dot gnu dot org 2005-07-23 21:07 ` phython 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).