Bug 137017

Summary: Optimization regression with rotate instructions
Product: [Fedora] Fedora Reporter: vvs <vvs009>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: barryn
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-25 07:30:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test case none

Description vvs 2004-10-25 07:05:56 UTC
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 07:06:30 UTC
Created attachment 105715 [details]
test case

Comment 2 Jakub Jelinek 2004-10-25 07:30:57 UTC
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 07:51:56 UTC
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 08:15:33 UTC
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.