Bug 336 - Superfluous instructions generated from bit-field operations
Summary: Superfluous instructions generated from bit-field operations
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 2.95.2
: P3 enhancement
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
: 8013 (view as bug list)
Depends on:
Blocks: 19466
  Show dependency treegraph
 
Reported: 2000-06-20 00:06 UTC by thomasl
Modified: 2005-02-19 19:56 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-12-28 02:04:39


Attachments
bug.c (423 bytes, text/plain)
2003-05-21 15:17 UTC, thomasl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description thomasl 2000-06-20 00:06:00 UTC
When putting things into a bit-field struct, extra
useless instructions are generated.

Harmless, but not very optimal.

Release:
gcc version 2.95.2 19991024

Environment:
sparc-sun-solaris2.7

How-To-Repeat:
gcc -S -O2 bug.c
(or g++)
Comment 1 Richard Henderson 2002-04-01 22:28:43 UTC
State-Changed-From-To: open->suspended
State-Changed-Why: Known problem.  Unlikely to be fixed in the near future.
Comment 2 Andrew Pinski 2003-12-26 02:22:18 UTC
*** Bug 8013 has been marked as a duplicate of this bug. ***
Comment 3 Steven Bosscher 2004-06-29 18:37:37 UTC
This might be fixed by the patch proposed in: 
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg02483.html 
Comment 4 Jakub Jelinek 2004-06-29 18:59:05 UTC
My patch is unrelated to this.
Comment 5 roger 2005-02-19 19:56:04 UTC
This bug has now been fixed for gcc 4.0.  For the testcase attached to the PR,
mainline now generates the following code on sparc-sun-solaris2.8 with -O2:

fun:    ld      [%sp+64], %o5
        sll     %o0, 2, %g1
        mov     %o5, %o0
        or      %g1, 2, %g1
        jmp     %o7+12
        st     %g1, [%o5]

i.e. we've now eliminated the unnecessary "and" and "or" instructions, that
were present in 2.95.2 (and still present in 3.4.3).