public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "etienne_lorrain at yahoo dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/37248]  New: regression 4.3.1 -> 4.3.2-rc transformation bitfield to individual bytes
Date: Tue, 26 Aug 2008 22:47:00 -0000	[thread overview]
Message-ID: <bug-37248-1034@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2008-08-26 22:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 22:47 etienne_lorrain at yahoo dot fr [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-37248-1034@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).