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

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).