Bug 137017 - Optimization regression with rotate instructions
Optimization regression with rotate instructions
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
rawhide
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-25 03:05 EDT by vvs
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-25 03:30:57 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test case (125 bytes, text/plain)
2004-10-25 03:06 EDT, vvs
no flags Details

  None (edit)
Description vvs 2004-10-25 03:05:56 EDT
Description of problem:

gcc does not combine several shift instructions into one rotate when
this is appropriate. This represent a regression against previous gcc
versions.

Version-Release number of selected component (if applicable):

gcc-3.4.2-6

How reproducible:

Always

Steps to Reproduce:
1. compile the attached test case with gcc -O3 -S test.c
2. examine output test.s
  
Actual results:

There are two shifts and one or instruction

Expected results:

There should be one rotate instruction

Additional info:

If you change the type of variable to unsigned int and shift counter
from 7 to 31 then it will work as expected, i.e. optimization is not
broken for integers.
Comment 1 vvs 2004-10-25 03:06:30 EDT
Created attachment 105715 [details]
test case
Comment 2 Jakub Jelinek 2004-10-25 03:30:57 EDT
I certainly don't get rolb with GCC 3.2.3, 3.3.4 nor 3.4.2
(but get one with 2.96-RH and current CVS HEAD).
Given that it is not a recent regression, works with HEAD GCC,
all I'm going to do is:
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02041.html
Comment 3 Barry K. Nathan 2004-10-25 03:51:56 EDT
FWIW, I get rolb with gcc4-4.0.0-0.8. This isn't surprising because it
works on HEAD, of course, but I'm mentioning this because it means the
reporter of this bug can try running "gcc4" instead of "gcc".
Comment 4 vvs 2004-10-25 04:15:33 EDT
Sure, gcc4 can do it, but it isn't as solid as mainline gcc,
especially with regard to optimization. In particular it is known to
generate broken code with some projects out there.

Note You need to log in before you can comment on or make changes to this bug.