[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    missed optimization, would be very helpful
From:       Zack Weinberg <zack () rabi ! columbia ! edu>
Date:       1998-12-31 20:32:06
[Download RAW message or body]


In a loop of the form

while (condition) (*int_ptr)++;

gcc generates a read-mod-write cycle to the memory location *int_ptr at each
iteration of the loop.  Modern chips really don't like that; I got a ~30%
speedup on one piece of code by rewriting it to bump a register and write
the memory location at the end.  The pointer isn't volatile, so I believe
there is nothing stopping gcc from doing this optimization.

This is egcs-1.1.1; it might've been fixed more recently but I can't test
that since the Dec 24 CVS is unreliable on my system.

(If anyone wants an example, look at cpplib.c:adjust_position.)

zw

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic