public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/18029] New: a twiddleing of a @ 2004-10-16 2:57 kazu at cs dot umass dot edu 2004-10-16 2:57 ` [Bug middle-end/18029] an xor of a single bit bitfield is inefficient kazu at cs dot umass dot edu ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: kazu at cs dot umass dot edu @ 2004-10-16 2:57 UTC (permalink / raw) To: gcc-bugs Consider: struct B { unsigned bit : 1; }; void plus (struct B *b) { b->bit = b->bit + 1; } void xor (struct B *b) { b->bit = b->bit ^ 1; } ./cc1 -O2 -fomit-frame-pointer -mregparm=3 generates plus: xorb $1, (%eax) ret xor: movb (%eax), %cl andl $1, %ecx xorl $1, %ecx movzbl %cl, %ecx movl (%eax), %edx andl $-2, %edx orl %ecx, %edx movl %edx, (%eax) ret Note that the two functions do the same thing. Obviously, we should optimize xor just like plus. -- Summary: a twiddleing of a Product: gcc Version: unknown Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at cs dot umass dot edu CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu @ 2004-10-16 2:57 ` kazu at cs dot umass dot edu 2004-10-16 3:05 ` pinskia at gcc dot gnu dot org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: kazu at cs dot umass dot edu @ 2004-10-16 2:57 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Summary|a twiddleing of a |an xor of a single bit | |bitfield is inefficient http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu 2004-10-16 2:57 ` [Bug middle-end/18029] an xor of a single bit bitfield is inefficient kazu at cs dot umass dot edu @ 2004-10-16 3:05 ` pinskia at gcc dot gnu dot org 2004-10-16 15:49 ` kazu at cs dot umass dot edu ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-10-16 3:05 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-16 03:05 ------- Confirmed on PPC also. (note for PPC to get about the same code we have to use the following definition for the struct: struct B { unsigned unused: 31; unsigned bit : 1; }; ). -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2004-10-16 03:05:12 date| | Version|unknown |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu 2004-10-16 2:57 ` [Bug middle-end/18029] an xor of a single bit bitfield is inefficient kazu at cs dot umass dot edu 2004-10-16 3:05 ` pinskia at gcc dot gnu dot org @ 2004-10-16 15:49 ` kazu at cs dot umass dot edu 2004-10-17 11:26 ` giovannibajo at libero dot it ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: kazu at cs dot umass dot edu @ 2004-10-16 15:49 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From kazu at cs dot umass dot edu 2004-10-16 15:49 ------- A patch here: http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01333.html -- What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu ` (2 preceding siblings ...) 2004-10-16 15:49 ` kazu at cs dot umass dot edu @ 2004-10-17 11:26 ` giovannibajo at libero dot it 2005-01-13 18:57 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: giovannibajo at libero dot it @ 2004-10-17 11:26 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From giovannibajo at libero dot it 2004-10-17 11:26 ------- Approved for 4.1. -- What |Removed |Added ---------------------------------------------------------------------------- OtherBugsDependingO| |17652 nThis| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu ` (3 preceding siblings ...) 2004-10-17 11:26 ` giovannibajo at libero dot it @ 2005-01-13 18:57 ` pinskia at gcc dot gnu dot org 2005-03-02 16:06 ` cvs-commit at gcc dot gnu dot org 2005-03-02 16:08 ` kazu at cs dot umass dot edu 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-01-13 18:57 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.1.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu ` (4 preceding siblings ...) 2005-01-13 18:57 ` pinskia at gcc dot gnu dot org @ 2005-03-02 16:06 ` cvs-commit at gcc dot gnu dot org 2005-03-02 16:08 ` kazu at cs dot umass dot edu 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-03-02 16:06 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-03-02 16:05 ------- Subject: Bug 18029 CVSROOT: /cvs/gcc Module name: gcc Changes by: kazu@gcc.gnu.org 2005-03-02 16:05:00 Modified files: gcc : ChangeLog expr.c Log message: PR middle-end/18029 and PR middle-end/18030 * expr.c (optimize_bitfield_assignment_op): Add a special case to handle BIT_IOR_EXPR and BIT_XOR_EXPR. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7632&r2=2.7633 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.778&r2=1.779 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/18029] an xor of a single bit bitfield is inefficient 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu ` (5 preceding siblings ...) 2005-03-02 16:06 ` cvs-commit at gcc dot gnu dot org @ 2005-03-02 16:08 ` kazu at cs dot umass dot edu 6 siblings, 0 replies; 8+ messages in thread From: kazu at cs dot umass dot edu @ 2005-03-02 16:08 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From kazu at cs dot umass dot edu 2005-03-02 16:07 ------- Just checked in a patch. -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18029 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-03-02 16:08 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-10-16 2:57 [Bug middle-end/18029] New: a twiddleing of a kazu at cs dot umass dot edu 2004-10-16 2:57 ` [Bug middle-end/18029] an xor of a single bit bitfield is inefficient kazu at cs dot umass dot edu 2004-10-16 3:05 ` pinskia at gcc dot gnu dot org 2004-10-16 15:49 ` kazu at cs dot umass dot edu 2004-10-17 11:26 ` giovannibajo at libero dot it 2005-01-13 18:57 ` pinskia at gcc dot gnu dot org 2005-03-02 16:06 ` cvs-commit at gcc dot gnu dot org 2005-03-02 16:08 ` kazu at cs dot umass dot edu
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).