Bug 137017 - Optimization regression with rotate instructions
Summary: Optimization regression with rotate instructions
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc   
(Show other bugs)
Version: rawhide
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-10-25 07:05 UTC by vvs
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-25 07:30:57 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 07:06 UTC, vvs
no flags Details

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

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


How reproducible:


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:

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.

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