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

* [Bug tree-optimization/45144] SRA optimization issue of bit-field
  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 ` jakub at gcc dot gnu dot org
  2010-07-31  9:25 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-30 17:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-07-30 17:09 -------
The solution IMNSHO is to detect adjacent bitfield operations that can be
handled together and lower bitfield ops still at the tree level, though soon
before expansion, rather than disabling SRA for bitfields.


-- 


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


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

* [Bug tree-optimization/45144] SRA optimization issue of bit-field
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-31  9:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-07-31 09:25 -------
I agree.  SRA might be even the place to do this lowering in.  For ease of
use re-surrecting BIT_FIELD_EXPR from the mem-ref branch might turn out
useful for this.


-- 


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


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

* [Bug tree-optimization/45144] SRA optimization issue of bit-field
  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
  4 siblings, 0 replies; 7+ messages in thread
From: jiez at gcc dot gnu dot org @ 2010-08-02  4:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jiez at gcc dot gnu dot org  2010-08-02 04:34 -------
Aggregates Copy Propagation should be able to fix this, too.


-- 


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


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

* [Bug tree-optimization/45144] SRA optimization issue of bit-field
  2010-07-30 15:12 [Bug tree-optimization/45144] New: SRA optimization issue of bit-field jiez at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 7+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-08-02  7:54 UTC (permalink / raw)
  To: gcc-bugs



-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-02 07:54:22
               date|                            |


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


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

* [Bug tree-optimization/45144] SRA optimization issue of bit-field
  2010-07-30 15:12 [Bug tree-optimization/45144] New: SRA optimization issue of bit-field jiez at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-08-02  7:54 ` ramana at gcc dot gnu dot org
@ 2010-08-05  3:06 ` jiez at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: jiez at gcc dot gnu dot org @ 2010-08-05  3:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jiez at gcc dot gnu dot org  2010-08-05 03:06 -------
Subject: Bug 45144

Author: jiez
Date: Thu Aug  5 03:05:35 2010
New Revision: 162897

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162897
Log:
        PR tree-optimization/45144
        * tree-sra.c (type_consists_of_records_p): Return false
        if the record contains bit-field.

        testsuite/
        PR tree-optimization/45144
        * gcc.dg/tree-ssa/pr45144.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr45144.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-sra.c


-- 


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


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

* [Bug tree-optimization/45144] SRA optimization issue of bit-field
       [not found] <bug-45144-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-06 13:40 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-06 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-06 13:33:58 UTC ---
Fixed with my current lowering patch which gets rid of the struct A and
union TMP vars completely.


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

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