This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/19703] New: Poor optimisation of loop test
- From: "andrewhutchinson at cox dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2005 02:59:07 -0000
- Subject: [Bug c/19703] New: Poor optimisation of loop test
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Missed optimization
gcc version 4.0.0 20041205 (experimental)
4.0.0/cc1.exe -quiet -v looprv.c -quiet -dumpbase
looprv.c -mmcu=atmega169 -auxbase looprv -Os -Wall -version -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -o looprv.s
Down counting loop, uses expensive compare EQ (-n) instead of compare >=0.
Testcase as follows:
volatile char value6;
extern void foo6(char);
void testloop6(void)
{
int i;
for (i=100;i>= 0;i-=10)
{
if (!value6)
{
foo6(i);
}
}
Loop test in RTL is compare NE -10. It should be compare GE 0 - which
is(generally) free. First dump of Expanded RTL show the compare.
--
Summary: Poor optimisation of loop test
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrewhutchinson at cox dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703