public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45144]  New: SRA optimization issue of bit-field
@ 2010-07-30 15:12 jiez at gcc dot gnu dot org
  2010-07-30 17:10 ` [Bug tree-optimization/45144] " jakub at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: jiez at gcc dot gnu dot org @ 2010-07-30 15:12 UTC (permalink / raw)
  To: gcc-bugs

For the following code:

void baz (unsigned);

extern unsigned buf[];

struct A
{
  unsigned a1:10;
  unsigned a2:3;
  unsigned:19;
};

union TMP
{
  struct A a;
  unsigned int b;
};

static unsigned
foo (struct A *p)
{
  union TMP t;
  struct A x;

  x = *p;
  t.a = x;
  return t.b;
}

void
bar (unsigned orig, unsigned *new)
{
  struct A a;
  union TMP s;

  s.b = orig;
  a = s.a;
  if (a.a1)
    baz (a.a2);
  *new = foo (&a);
}

"arm-none-eabi-gcc -O2" generates:

bar:
        @ Function supports interworking.
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        stmfd   sp!, {r3, r4, r5, r6, r7, lr}
        mov     r4, r0, asl #22
        mov     r5, r0, lsr #10
        movs    r4, r4, lsr #22
        mov     r6, r1
        and     r5, r5, #7
        mov     r7, r0, lsr #13
        movne   r0, r5
        blne    baz
.L2:
        orr     r4, r4, r5, asl #10
        orr     r7, r4, r7, asl #13
        str     r7, [r6, #0]
        ldmfd   sp!, {r3, r4, r5, r6, r7, lr}
        bx      lr

while "arm-none-eabi-gcc -O2 -fno-tree-sra" generates:

bar:
        @ Function supports interworking.
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        stmfd   sp!, {r3, r4, r5, lr}
        movs    r3, r0, asl #22
        mov     r4, r0
        mov     r5, r1
        movne   r0, r0, lsr #10
        andne   r0, r0, #7
        blne    baz
.L2:
        str     r4, [r5, #0]
        ldmfd   sp!, {r3, r4, r5, lr}
        bx      lr


-- 
           Summary: SRA optimization issue of bit-field
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jiez at gcc dot gnu dot org
GCC target triplet: arm-none-eabi


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


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <bug-45144-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-05-06 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30 15:12 [Bug tree-optimization/45144] New: SRA optimization issue of bit-field jiez at gcc dot gnu dot org
2010-07-30 17:10 ` [Bug tree-optimization/45144] " jakub at gcc dot gnu dot org
2010-07-31  9:25 ` rguenth at gcc dot gnu dot org
2010-08-02  4:34 ` jiez at gcc dot gnu dot org
2010-08-02  7:54 ` ramana at gcc dot gnu dot org
2010-08-05  3:06 ` jiez at gcc dot gnu dot org
     [not found] <bug-45144-4@http.gcc.gnu.org/bugzilla/>
2011-05-06 13:40 ` rguenth at gcc dot gnu.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).