public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield
@ 2004-10-16  3:04 kazu at cs dot umass dot edu
  2004-10-16  3:11 ` [Bug middle-end/18030] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-10-16  3:04 UTC (permalink / raw)
  To: gcc-bugs

Consider:

struct B {
  unsigned bit : 2;
};

void
plus (struct B *b)
{
  b->bit |= 1;
}

./cc1 -O2 -fomit-frame-pointer -mregparm=3 generates

plus:
	movb	(%eax), %cl
	andl	$3, %ecx
	orl	$1, %ecx
	andl	$3, %ecx
	movl	(%eax), %edx
	andl	$-4, %edx
	orl	%ecx, %edx
	movl	%edx, (%eax)
	ret

Note that we could just do "orl $1, (%eax)"

-- 
           Summary: OR is inefficient in 2-bit bitfield
           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=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/18030] OR is inefficient in 2-bit bitfield
  2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
@ 2004-10-16  3:11 ` pinskia at gcc dot gnu dot org
  2004-10-16 15:49 ` kazu at cs dot umass dot edu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-16  3:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-16 03:11 -------
For PPC:
struct B {
  unsigned :30;
  unsigned bit : 2;
};

Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-16 03:11:16
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/18030] OR is inefficient in 2-bit bitfield
  2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
  2004-10-16  3:11 ` [Bug middle-end/18030] " 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)
  5 siblings, 0 replies; 7+ 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=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/18030] OR is inefficient in 2-bit bitfield
  2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
  2004-10-16  3:11 ` [Bug middle-end/18030] " 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:58 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ 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=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/18030] OR is inefficient in 2-bit bitfield
  2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-10-17 11:26 ` giovannibajo at libero dot it
@ 2005-01-13 18:58 ` pinskia at gcc dot gnu dot org
  2005-03-02 16:05 ` cvs-commit at gcc dot gnu dot org
  2005-03-02 16:08 ` kazu at cs dot umass dot edu
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-13 18:58 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/18030] OR is inefficient in 2-bit bitfield
  2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
                   ` (3 preceding siblings ...)
  2005-01-13 18:58 ` pinskia at gcc dot gnu dot org
@ 2005-03-02 16:05 ` cvs-commit at gcc dot gnu dot org
  2005-03-02 16:08 ` kazu at cs dot umass dot edu
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-02 16:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-02 16:05 -------
Subject: Bug 18030

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=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/18030] OR is inefficient in 2-bit bitfield
  2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
                   ` (4 preceding siblings ...)
  2005-03-02 16:05 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-02 16:08 ` kazu at cs dot umass dot edu
  5 siblings, 0 replies; 7+ 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:08 -------
Just checked in a patch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18030


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-02 16:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-16  3:04 [Bug middle-end/18030] New: OR is inefficient in 2-bit bitfield kazu at cs dot umass dot edu
2004-10-16  3:11 ` [Bug middle-end/18030] " 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:58 ` pinskia at gcc dot gnu dot org
2005-03-02 16:05 ` 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).