public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/29749]  New: Missing byte swap optimizations
@ 2006-11-07  7:06 ubizjak at gmail dot com
  2006-11-07 11:47 ` [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] " schwab at suse dot de
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: ubizjak at gmail dot com @ 2006-11-07  7:06 UTC (permalink / raw)
  To: gcc-bugs

There is a claim in linux asm-i386/byteswap.h that:

/* Do not define swab16.  Gcc is smart enough to recognize "C" version and
   convert it into rotation or exhange.  */

Not really. Consider these two testcases:

--cut here--
unsigned short bad(unsigned short a)
{
       return ((a & 0xff00) >> 8 | (a & 0x00ff) << 8);
}


unsigned short good(unsigned short a)
{
       return (a >> 8 | a << 8);
}
--cut here--


gcc -O2 -S -m32 -fomit-frame-pointer
bad:
       movzwl  4(%esp), %edx
       movl    %edx, %eax
       sall    $8, %eax
       shrl    $8, %edx
       orl     %edx, %eax
       movzwl  %ax, %eax
       ret


good:
       movzwl  4(%esp), %eax
       rolw    $8, %ax
       movzwl  %ax, %eax
       ret


IMO both forms should produce equal asm.

Unfortunatelly, first form is usually used:

drivers/net/sk98lin/skxmac2.c:
SWord = ((SWord & 0xff00) >> 8) | ((SWord & 0x00ff) << 8);

drivers/atm/iphase.c:
#define swap(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8))  

drivers/atm/iphase.c:
trailer->length = ((skb->len & 0xff) << 8) | ((skb->len & 0xff00) >> 8);


Ideally, this construct should be compiled using (not yet introduced...)
bswaphi2 pattern to generate "xchgb %ah,%al" instead of rolw insn. Accordint to
pentopt.pdf, xchg is faster, 1.5 vs 4 clks.

Maybe this transformation could also be used for 32bit and 64bit data, to
automatically convert open coded shift series into bswapsi2 and bswapdi2
patterns.


-- 
           Summary: Missing byte swap optimizations
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ubizjak at gmail dot com
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
@ 2006-11-07 11:47 ` schwab at suse dot de
  2007-02-03 17:29 ` jsm28 at gcc dot gnu dot org
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: schwab at suse dot de @ 2006-11-07 11:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at suse dot de  2006-11-07 11:47 -------
That appears to be broken as far back as gcc 3.0: all 3.x versions do not
recognize either of the two forms, since 4.0 only the second form is
recognized.  Both 2.95 and 2.7 can optimize both forms (tested on m68k).


-- 

schwab at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   GCC host triplet|i686-pc-linux-gnu           |
            Summary|Missing byte swap           |[4.0/4.1/4.2/4.3 regression]
                   |optimizations               |Missing byte swap
                   |                            |optimizations


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
  2006-11-07 11:47 ` [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] " schwab at suse dot de
@ 2007-02-03 17:29 ` jsm28 at gcc dot gnu dot org
  2007-02-05  5:24 ` mmitchel at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2007-02-03 17:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.2


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
  2006-11-07 11:47 ` [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] " schwab at suse dot de
  2007-02-03 17:29 ` jsm28 at gcc dot gnu dot org
@ 2007-02-05  5:24 ` mmitchel at gcc dot gnu dot org
  2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-05  5:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (2 preceding siblings ...)
  2007-02-05  5:24 ` mmitchel at gcc dot gnu dot org
@ 2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
  2007-07-04 21:30 ` pinskia at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (3 preceding siblings ...)
  2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
@ 2007-07-04 21:30 ` pinskia at gcc dot gnu dot org
  2007-07-10 22:18 ` dougkwan at google dot com
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-04 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-07-04 21:30 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-04 21:30:28
               date|                            |


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (4 preceding siblings ...)
  2007-07-04 21:30 ` pinskia at gcc dot gnu dot org
@ 2007-07-10 22:18 ` dougkwan at google dot com
  2007-07-11 23:15 ` dougkwan at google dot com
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dougkwan at google dot com @ 2007-07-10 22:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dougkwan at google dot com  2007-07-10 22:18 -------
I'm working on a patch.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (5 preceding siblings ...)
  2007-07-10 22:18 ` dougkwan at google dot com
@ 2007-07-11 23:15 ` dougkwan at google dot com
  2007-07-12  6:08 ` ubizjak at gmail dot com
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dougkwan at google dot com @ 2007-07-11 23:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dougkwan at google dot com  2007-07-11 23:15 -------
Created an attachment (id=13891)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13891&action=view)
Patch for fixing byte swap optimization.

I have tested this patch on i486-linux-gnu (C/C++ test suite only, full
bootstrap to be done). The problem was reported on m68k initially but I checked
that it also appeared on i486. The patched have been tested to work on
i486-linux-gnu and powerpc64-unknown-linux-gnu.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (6 preceding siblings ...)
  2007-07-11 23:15 ` dougkwan at google dot com
@ 2007-07-12  6:08 ` ubizjak at gmail dot com
  2007-07-12  6:17 ` dougkwan at google dot com
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ubizjak at gmail dot com @ 2007-07-12  6:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ubizjak at gmail dot com  2007-07-12 06:08 -------
(In reply to comment #4)

> bootstrap to be done). The problem was reported on m68k initially but I checked

FWIW, the problem was reported on i686-pc-linux-gnu, but it is generic RTL
missed-optimization problem.

BTW: It would be nice if a testcase (or two) were added to the patch. The added
functionality of the patch is complex enough that we should check it...


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (7 preceding siblings ...)
  2007-07-12  6:08 ` ubizjak at gmail dot com
@ 2007-07-12  6:17 ` dougkwan at google dot com
  2007-07-13 22:46 ` dougkwan at google dot com
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dougkwan at google dot com @ 2007-07-12  6:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dougkwan at google dot com  2007-07-12 06:17 -------
Subject: Re:  [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations

I misread one of the earlier comments when I typed the reply.  So I
thought it was reported on the m68k first. I agree that adding test
cases is a good idea, I will update & re-submit a new patch, this
week.

-Doug

12 Jul 2007 06:08:50 -0000, ubizjak at gmail dot com
<gcc-bugzilla@gcc.gnu.org>:
>
>
> ------- Comment #5 from ubizjak at gmail dot com  2007-07-12 06:08 -------
> (In reply to comment #4)
>
> > bootstrap to be done). The problem was reported on m68k initially but I checked
>
> FWIW, the problem was reported on i686-pc-linux-gnu, but it is generic RTL
> missed-optimization problem.
>
> BTW: It would be nice if a testcase (or two) were added to the patch. The added
> functionality of the patch is complex enough that we should check it...
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29749
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (8 preceding siblings ...)
  2007-07-12  6:17 ` dougkwan at google dot com
@ 2007-07-13 22:46 ` dougkwan at google dot com
  2007-08-23 14:29 ` ubizjak at gmail dot com
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dougkwan at google dot com @ 2007-07-13 22:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dougkwan at google dot com  2007-07-13 22:46 -------
Created an attachment (id=13911)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13911&action=view)
Updated patch with test case a bug fix.

I've added a test case of the changes. It did find a bug in the patch and I've
fixed that. I did a full bootstap and C/C++/ObjC dejagnu with top of 4.2-branch
as of 20070713 and had no problem.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (9 preceding siblings ...)
  2007-07-13 22:46 ` dougkwan at google dot com
@ 2007-08-23 14:29 ` ubizjak at gmail dot com
  2007-08-23 16:32 ` dougkwan at google dot com
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ubizjak at gmail dot com @ 2007-08-23 14:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ubizjak at gmail dot com  2007-08-23 14:28 -------
(In reply to comment #7)
> Created an attachment (id=13911)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13911&action=view) [edit]
> Updated patch with test case a bug fix.
> 
> I've added a test case of the changes. It did find a bug in the patch and I've
> fixed that. I did a full bootstap and C/C++/ObjC dejagnu with top of 4.2-branch
> as of 20070713 and had no problem.

Any news with this patch?


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (10 preceding siblings ...)
  2007-08-23 14:29 ` ubizjak at gmail dot com
@ 2007-08-23 16:32 ` dougkwan at google dot com
  2007-11-20 19:38 ` jakub at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dougkwan at google dot com @ 2007-08-23 16:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from dougkwan at google dot com  2007-08-23 16:32 -------
Subject: Re:  [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations

No, FALSE, `(), nil, #f, 0.... :)

-Doug

23 Aug 2007 14:28:51 -0000, ubizjak at gmail dot com
<gcc-bugzilla@gcc.gnu.org>:
>
>
> ------- Comment #8 from ubizjak at gmail dot com  2007-08-23 14:28 -------
> (In reply to comment #7)
> > Created an attachment (id=13911)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13911&action=view)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13911&action=view) [edit]
> > Updated patch with test case a bug fix.
> >
> > I've added a test case of the changes. It did find a bug in the patch and I've
> > fixed that. I did a full bootstap and C/C++/ObjC dejagnu with top of 4.2-branch
> > as of 20070713 and had no problem.
>
> Any news with this patch?
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29749
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (11 preceding siblings ...)
  2007-08-23 16:32 ` dougkwan at google dot com
@ 2007-11-20 19:38 ` jakub at gcc dot gnu dot org
  2007-11-20 20:05 ` rask at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-20 19:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jakub at gcc dot gnu dot org  2007-11-20 19:38 -------
Guess you should ping that on gcc-patches, or better resend after such a long
while.  If you are going to do the latter, I think you should move the
testcase into gcc.dg/, add
/* { dg-do run { target { int32plus } } } */
/* { dg-options "-O2" } */
to make embedded folks happy and fix up comment formatting in the patch.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (12 preceding siblings ...)
  2007-11-20 19:38 ` jakub at gcc dot gnu dot org
@ 2007-11-20 20:05 ` rask at gcc dot gnu dot org
  2007-11-21 14:51 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: rask at gcc dot gnu dot org @ 2007-11-20 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rask at gcc dot gnu dot org  2007-11-20 20:04 -------
>  /* { dg-do run { target { int32plus } } } */

Or even better, use types such as uint_least32_t from stdint.h, then use this
dg directive:
/* { dg-do run { target { stdint_types } } } */


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (13 preceding siblings ...)
  2007-11-20 20:05 ` rask at gcc dot gnu dot org
@ 2007-11-21 14:51 ` jakub at gcc dot gnu dot org
  2007-11-21 16:26 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-21 14:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jakub at gcc dot gnu dot org  2007-11-21 14:50 -------
I disagree with that, it is preferrable to avoid including any headers in
testcases if possible.

Anyway, I'm testing a fold-const.c optimization which solves this already at
the tree level.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-07-04 21:30:28         |2007-11-21 14:50:43
               date|                            |


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (14 preceding siblings ...)
  2007-11-21 14:51 ` jakub at gcc dot gnu dot org
@ 2007-11-21 16:26 ` jakub at gcc dot gnu dot org
  2007-11-21 19:11 ` rask at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-21 16:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from jakub at gcc dot gnu dot org  2007-11-21 16:26 -------
Created an attachment (id=14593)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14593&action=view)
gcc43-pr29749.patch

Patch I'm about to test.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (15 preceding siblings ...)
  2007-11-21 16:26 ` jakub at gcc dot gnu dot org
@ 2007-11-21 19:11 ` rask at gcc dot gnu dot org
  2007-12-03 22:39 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: rask at gcc dot gnu dot org @ 2007-11-21 19:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from rask at gcc dot gnu dot org  2007-11-21 19:11 -------
> it is preferrable to avoid including any headers in
> testcases if possible.

Yes, but IMHO not at the cost of disabling the test on targets where it is
supposed to run and pass. Targets without stdint.h are rare and this sort of
optimization really does need to be tested on the 8-bit and 16-bit targets too.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (16 preceding siblings ...)
  2007-11-21 19:11 ` rask at gcc dot gnu dot org
@ 2007-12-03 22:39 ` jakub at gcc dot gnu dot org
  2007-12-03 22:45 ` [Bug middle-end/29749] [4.0/4.1/4.2 " jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-03 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from jakub at gcc dot gnu dot org  2007-12-03 22:38 -------
Subject: Bug 29749

Author: jakub
Date: Mon Dec  3 22:38:28 2007
New Revision: 130589

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130589
Log:
        PR middle-end/29749
        * fold-const.c (fold_binary) <case BIT_AND_EXPR>: Optimize
        (X << C1) & C2 into (X << C1) & (C2 | ((1 << C1) - 1))
        and (X >> C1) & C2 into (X >> C1) & (C2 | ~((type) -1 >> C1)).
        (fold_binary) <case LSHIFT_EXPR, case RSHIFT_EXPR>: Optimize
        (X & C2) << C1 into (X << C1) & (C2 << C1) and
        (X & C2) >> C1 into (X >> C1) & (C2 >> C1) if that allows further
        optimizations.

        * gcc.dg/fold-rotate-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/fold-rotate-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (17 preceding siblings ...)
  2007-12-03 22:39 ` jakub at gcc dot gnu dot org
@ 2007-12-03 22:45 ` jakub at gcc dot gnu dot org
  2007-12-17  9:24 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-03 22:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jakub at gcc dot gnu dot org  2007-12-03 22:45 -------
Fixed on the trunk.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2/4.3 regression]|[4.0/4.1/4.2 regression]
                   |Missing byte swap           |Missing byte swap
                   |optimizations               |optimizations


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (18 preceding siblings ...)
  2007-12-03 22:45 ` [Bug middle-end/29749] [4.0/4.1/4.2 " jakub at gcc dot gnu dot org
@ 2007-12-17  9:24 ` ubizjak at gmail dot com
  2007-12-17  9:29 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ubizjak at gmail dot com @ 2007-12-17  9:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from ubizjak at gmail dot com  2007-12-17 09:24 -------
Jakub, is there any chance of backporting your patch(es) to 4.2?


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (19 preceding siblings ...)
  2007-12-17  9:24 ` ubizjak at gmail dot com
@ 2007-12-17  9:29 ` jakub at gcc dot gnu dot org
  2007-12-17  9:33 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-17  9:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jakub at gcc dot gnu dot org  2007-12-17 09:28 -------
Given that this patch introduced a regression (which has since been fixed), I'd
try to be very careful.  As it is just a missed-optimization, I think I'd feel
safer to only fix this on the trunk.


-- 


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


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

* [Bug middle-end/29749] [4.0/4.1/4.2 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (20 preceding siblings ...)
  2007-12-17  9:29 ` jakub at gcc dot gnu dot org
@ 2007-12-17  9:33 ` jakub at gcc dot gnu dot org
  2008-07-04 21:45 ` [Bug middle-end/29749] [4.2 " jsm28 at gcc dot gnu dot org
  2008-09-06 16:30 ` ubizjak at gmail dot com
  23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-17  9:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from jakub at gcc dot gnu dot org  2007-12-17 09:33 -------
If the question was more general, not just about this particular PR (yeah, I
know I have over 35 PRs still open for 4.2 and/or 4.1 that have been fixed
already on the turnk), yes, there is some chance, but ATM I'm swamped with 4.3
work which is a priority for me, so I doubt I'd have time for backporting and
testing the patches till end of January.  Sorry.


-- 


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


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

* [Bug middle-end/29749] [4.2 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (21 preceding siblings ...)
  2007-12-17  9:33 ` jakub at gcc dot gnu dot org
@ 2008-07-04 21:45 ` jsm28 at gcc dot gnu dot org
  2008-09-06 16:30 ` ubizjak at gmail dot com
  23 siblings, 0 replies; 25+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from jsm28 at gcc dot gnu dot org  2008-07-04 21:44 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 regression] Missing|[4.2 regression] Missing
                   |byte swap optimizations     |byte swap optimizations
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug middle-end/29749] [4.2 regression] Missing byte swap optimizations
  2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
                   ` (22 preceding siblings ...)
  2008-07-04 21:45 ` [Bug middle-end/29749] [4.2 " jsm28 at gcc dot gnu dot org
@ 2008-09-06 16:30 ` ubizjak at gmail dot com
  23 siblings, 0 replies; 25+ messages in thread
From: ubizjak at gmail dot com @ 2008-09-06 16:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from ubizjak at gmail dot com  2008-09-06 16:29 -------
IMO, this enhancement request can be closed now that 4.3 is released.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2008-09-06 16:30 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-07  7:06 [Bug middle-end/29749] New: Missing byte swap optimizations ubizjak at gmail dot com
2006-11-07 11:47 ` [Bug middle-end/29749] [4.0/4.1/4.2/4.3 regression] " schwab at suse dot de
2007-02-03 17:29 ` jsm28 at gcc dot gnu dot org
2007-02-05  5:24 ` mmitchel at gcc dot gnu dot org
2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
2007-07-04 21:30 ` pinskia at gcc dot gnu dot org
2007-07-10 22:18 ` dougkwan at google dot com
2007-07-11 23:15 ` dougkwan at google dot com
2007-07-12  6:08 ` ubizjak at gmail dot com
2007-07-12  6:17 ` dougkwan at google dot com
2007-07-13 22:46 ` dougkwan at google dot com
2007-08-23 14:29 ` ubizjak at gmail dot com
2007-08-23 16:32 ` dougkwan at google dot com
2007-11-20 19:38 ` jakub at gcc dot gnu dot org
2007-11-20 20:05 ` rask at gcc dot gnu dot org
2007-11-21 14:51 ` jakub at gcc dot gnu dot org
2007-11-21 16:26 ` jakub at gcc dot gnu dot org
2007-11-21 19:11 ` rask at gcc dot gnu dot org
2007-12-03 22:39 ` jakub at gcc dot gnu dot org
2007-12-03 22:45 ` [Bug middle-end/29749] [4.0/4.1/4.2 " jakub at gcc dot gnu dot org
2007-12-17  9:24 ` ubizjak at gmail dot com
2007-12-17  9:29 ` jakub at gcc dot gnu dot org
2007-12-17  9:33 ` jakub at gcc dot gnu dot org
2008-07-04 21:45 ` [Bug middle-end/29749] [4.2 " jsm28 at gcc dot gnu dot org
2008-09-06 16:30 ` ubizjak at gmail dot com

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