public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/37248]  New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
@ 2008-08-26 22:47 etienne_lorrain at yahoo dot fr
  2008-08-26 22:51 ` [Bug middle-end/37248] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: etienne_lorrain at yahoo dot fr @ 2008-08-26 22:47 UTC (permalink / raw)
  To: gcc-bugs

In short, when passing a bitfield as parameter, each bit is converted to bytes
before being tested instead of a simple mask and test.
 Is there a way to disable bit to bytes conversion by a compilation switch,
I have never seen that producing better code up to now?

$ cat tmp2.c
struct mouse_button_str {
        unsigned char left      : 1;
        unsigned char right     : 1;
        unsigned char middle    : 1;
        } button;

char fct (struct mouse_button_str newbutton)
{
        return (newbutton.left && newbutton.right && newbutton.middle);
}
$ ./toolchain/bin/gcc --version
gcc (GCC) 4.3.2 20080819 (prerelease)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ./toolchain/bin/gcc -Os tmp2.c -S -o tmp2.s
$ cat tmp2.s
        .file   "tmp2.c"
        .text
.globl fct
        .type   fct, @function
fct:
        pushl   %ebp
        movl    %esp, %ebp
        movb    8(%ebp), %al
        movb    %al, %cl
        movb    %al, %dl
        shrb    %cl
        shrb    $2, %dl
        andl    $1, %ecx
        andl    $1, %edx
        testb   $1, %al
        je      .L2
        testb   %cl, %cl
        je      .L2
        movl    %edx, %eax
        andl    $1, %eax
        jmp     .L3
.L2:
        xorl    %eax, %eax
.L3:
        popl    %ebp
        ret
        .size   fct, .-fct
        .comm   button,1,1
        .ident  "GCC: (GNU) 4.3.2 20080819 (prerelease)"
        .section        .note.GNU-stack,"",@progbits
$ ./toolchain-4.3.1/bin/gcc --version
gcc (GCC) 4.3.1
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ./toolchain-4.3.1/bin/gcc -Os tmp2.c -S -o tmp2.s
$ cat tmp2.s
        .file   "tmp2.c"
        .text
.globl fct
        .type   fct, @function
fct:
        pushl   %ebp
        movl    %esp, %ebp
        movb    8(%ebp), %al
        popl    %ebp
        andl    $7, %eax
        cmpb    $7, %al
        sete    %al
        ret
        .size   fct, .-fct
        .comm   button,1,1
        .ident  "GCC: (GNU) 4.3.1"
        .section        .note.GNU-stack,"",@progbits


-- 
           Summary: regression 4.3.1 -> 4.3.2-rc transformation bitfield to
                    individual bytes
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: etienne_lorrain at yahoo dot fr
 GCC build triplet: i386-linux-fedora
  GCC host triplet: i386-linux-fedora
GCC target triplet: i386-linux-fedora


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


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

* [Bug middle-end/37248] [4.3/4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
@ 2008-08-26 22:51 ` pinskia at gcc dot gnu dot org
  2008-08-27 22:13 ` jsm28 at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-26 22:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-08-26 22:50 -------
BIT_FIELD_REF was removed because it caused wrong code.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i386-linux-fedora           |
   GCC host triplet|i386-linux-fedora           |
 GCC target triplet|i386-linux-fedora           |
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2008-08-26 22:50:34
               date|                            |
            Summary|regression 4.3.1 -> 4.3.2-rc|[4.3/4.4 Regression]
                   |transformation bitfield to  |regression 4.3.1 -> 4.3.2-rc
                   |individual bytes            |transformation bitfield to
                   |                            |individual bytes
   Target Milestone|---                         |4.3.2


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


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

* [Bug middle-end/37248] [4.3/4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
  2008-08-26 22:51 ` [Bug middle-end/37248] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
@ 2008-08-27 22:13 ` jsm28 at gcc dot gnu dot org
  2008-08-28 16:30 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-08-27 22:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jsm28 at gcc dot gnu dot org  2008-08-27 22:05 -------
4.3.2 is released, changing milestones to 4.3.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.2                       |4.3.3


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


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

* [Bug middle-end/37248] [4.3/4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
  2008-08-26 22:51 ` [Bug middle-end/37248] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
  2008-08-27 22:13 ` jsm28 at gcc dot gnu dot org
@ 2008-08-28 16:30 ` jakub at gcc dot gnu dot org
  2008-09-01  7:18 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-08-28 16:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-08-28 16:29 -------
Well, on the 4.3 branch it has been removed just because it has been removed on
the trunk and happened to make one PR away.  See PR36449 for an alternative fix
that doesn't disable the optimization.


-- 


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


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

* [Bug middle-end/37248] [4.3/4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (2 preceding siblings ...)
  2008-08-28 16:30 ` jakub at gcc dot gnu dot org
@ 2008-09-01  7:18 ` jakub at gcc dot gnu dot org
  2008-09-01 11:20 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-01  7:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2008-09-01 07:17 -------
Created an attachment (id=16177)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16177&action=view)
gcc43-pr37248.patch

Patch I've bootstrapped/regtested on 4 linux arches on 4.3 branch.


-- 


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


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

* [Bug middle-end/37248] [4.3/4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (3 preceding siblings ...)
  2008-09-01  7:18 ` jakub at gcc dot gnu dot org
@ 2008-09-01 11:20 ` rguenth at gcc dot gnu dot org
  2008-09-01 11:35 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-09-01 11:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-09-01 11:19 -------
FWIW the patch is ok for the 4.3 branch.


-- 


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


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

* [Bug middle-end/37248] [4.3/4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (4 preceding siblings ...)
  2008-09-01 11:20 ` rguenth at gcc dot gnu dot org
@ 2008-09-01 11:35 ` jakub at gcc dot gnu dot org
  2008-09-01 20:30 ` [Bug middle-end/37248] [4.4 " etienne_lorrain at yahoo dot fr
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-01 11:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2008-09-01 11:33 -------
Subject: Bug 37248

Author: jakub
Date: Mon Sep  1 11:32:18 2008
New Revision: 139858

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139858
Log:
        PR middle-end/37248
        PR middle-end/36449
        * fold-const.c (make_bit_field_ref): Change bitpos and bitsize
        arguments to HOST_WIDE_INT.
        (fold_truthop): Change first_bit and end_bit to HOST_WIDE_INT.

        * g++.dg/opt/pr36449.C: New test.

        Revert:
        2008-06-11  Richard Guenther  <rguenther@suse.de>
        PR middle-end/36449
        * fold-const.c (fold_truthop): Remove code generating
        BIT_FIELD_REFs of structure bases.
        (fold_binary): Likewise.
        (make_bit_field_ref): Remove.
        (optimize_bit_field_compare): Remove.
        (all_ones_mask_p): Remove.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/opt/pr36449.C
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/fold-const.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/37248] [4.4 Regression] regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (5 preceding siblings ...)
  2008-09-01 11:35 ` jakub at gcc dot gnu dot org
@ 2008-09-01 20:30 ` etienne_lorrain at yahoo dot fr
  2008-09-09 20:25 ` [Bug middle-end/37248] [4.4 Regression] regression " jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: etienne_lorrain at yahoo dot fr @ 2008-09-01 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from etienne_lorrain at yahoo dot fr  2008-09-01 20:29 -------
Patch works for me, thanks.


-- 


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


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

* [Bug middle-end/37248] [4.4 Regression] regression transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (6 preceding siblings ...)
  2008-09-01 20:30 ` [Bug middle-end/37248] [4.4 " etienne_lorrain at yahoo dot fr
@ 2008-09-09 20:25 ` jsm28 at gcc dot gnu dot org
  2008-12-05 17:02 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-09-09 20:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|4.3.3                       |4.4.0


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


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

* [Bug middle-end/37248] [4.4 Regression] regression transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (7 preceding siblings ...)
  2008-09-09 20:25 ` [Bug middle-end/37248] [4.4 Regression] regression " jsm28 at gcc dot gnu dot org
@ 2008-12-05 17:02 ` jakub at gcc dot gnu dot org
  2008-12-05 17:03 ` jakub at gcc dot gnu dot org
  2008-12-27  5:32 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-05 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2008-12-05 17:01 -------
Subject: Bug 37248

Author: jakub
Date: Fri Dec  5 16:59:34 2008
New Revision: 142484

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142484
Log:
        PR middle-end/37248
        * fold-const.c (make_bit_field_ref): Change bitpos and bitsize
        arguments to HOST_WIDE_INT.  If type has different signedness
        than unsignedp or different precision from bitsize, create
        the right type for BIT_FIELD_REF and cast to type.
        (fold_truthop): Change first_bit and end_bit to HOST_WIDE_INT.

        Revert:
        2008-03-05  Richard Guenther  <rguenther@suse.de>
        PR c++/35336
        * fold-const.c (fold_truthop): Remove code generating
        BIT_FIELD_REFs of structure bases.
        (fold_binary): Likewise.
        (make_bit_field_ref): Remove.
        (optimize_bit_field_compare): Remove.
        (all_ones_mask_p): Remove.

        * gcc.target/i386/pr37248-1.c: New test.
        * gcc.target/i386/pr37248-2.c: New test.
        * gcc.target/i386/pr37248-3.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr37248-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr37248-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr37248-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/37248] [4.4 Regression] regression transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (8 preceding siblings ...)
  2008-12-05 17:02 ` jakub at gcc dot gnu dot org
@ 2008-12-05 17:03 ` jakub at gcc dot gnu dot org
  2008-12-27  5:32 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-05 17:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2008-12-05 17:01 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/37248] [4.4 Regression] regression transformation bitfield to individual bytes
  2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
                   ` (9 preceding siblings ...)
  2008-12-05 17:03 ` jakub at gcc dot gnu dot org
@ 2008-12-27  5:32 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-27  5:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.3.3                       |4.2.0 4.3.3
   Target Milestone|4.4.0                       |4.3.3


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


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

end of thread, other threads:[~2008-12-27  5:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-26 22:47 [Bug middle-end/37248] New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes etienne_lorrain at yahoo dot fr
2008-08-26 22:51 ` [Bug middle-end/37248] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2008-08-27 22:13 ` jsm28 at gcc dot gnu dot org
2008-08-28 16:30 ` jakub at gcc dot gnu dot org
2008-09-01  7:18 ` jakub at gcc dot gnu dot org
2008-09-01 11:20 ` rguenth at gcc dot gnu dot org
2008-09-01 11:35 ` jakub at gcc dot gnu dot org
2008-09-01 20:30 ` [Bug middle-end/37248] [4.4 " etienne_lorrain at yahoo dot fr
2008-09-09 20:25 ` [Bug middle-end/37248] [4.4 Regression] regression " jsm28 at gcc dot gnu dot org
2008-12-05 17:02 ` jakub at gcc dot gnu dot org
2008-12-05 17:03 ` jakub at gcc dot gnu dot org
2008-12-27  5:32 ` pinskia 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).