public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matt at 3am-software dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug regression/21198] New: Packed bitfield structure copies are very inefficient
Date: Sun, 24 Apr 2005 23:14:00 -0000	[thread overview]
Message-ID: <20050424231443.21198.matt@3am-software.com> (raw)

In a digression from 2.95, gcc 4.1 copies a packed bitfield structure member by member instead of 
doing as an aggregate.

Given the program:

struct __attribute__((packed)) A { unsigned short i : 1, l : 1, j : 3, k : 11; };
struct A sA;
struct A retmeA (struct A x) { return x; }

GCC 4.1 -O3 compiles that as:

        .align 1
.globl retmeA
        .type   retmeA, @function
retmeA:
        .word 0x0
        subl2 $4,%sp
        movl %r1,%r0
        movw 4(%ap),%r2
        rotl $30,%r2,%r3
        bicl2 $-8,%r3
        rotl $31,%r2,%r4
        bicl2 $-2,%r4
        rotl $27,%r2,%r1
        bicl2 $-2048,%r1
        insv %r1,$5,$11,(%r0)
        insv %r3,$2,$3,(%r0)
        insv %r4,$1,$1,(%r0)
        insv %r2,$0,$1,(%r0)
        ret
        .size   retmeA, .-retmeA

Whereas GCC 2.95.3 compiled it to:

.globl retmeA
        .type    retmeA,@function
retmeA:
        .word 0x0
        movw 4(%ap),(%r1)
        ret

-- 
           Summary: Packed bitfield structure copies are very inefficient
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matt at 3am-software dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64--netbsd
  GCC host triplet: x86_64--netbsd
GCC target triplet: vax--netbsdelf


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


             reply	other threads:[~2005-04-24 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-24 23:14 matt at 3am-software dot com [this message]
2005-04-25  1:09 ` [Bug regression/21198] " 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=20050424231443.21198.matt@3am-software.com \
    --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).