[PATCH] powerpc: Take 5, merge page.h

Arnd Bergmann arnd at arndb.de
Sat Nov 12 04:53:06 EST 2005


On Freedag 11 November 2005 18:17, Milton Miller wrote:
> Can the compiler optimize the first one to the second?  Can
> we always use the first version?
> 

I tried this out and found that gcc-2.95, 3.2, 3.3 and 3.4
can not, but 4.0 can.

They can all generate the same object code if you do it like

void copy_page(void *to, void *from)
{
       unsigned int i;
       if (PAGE_SHIFT == 12)
               copy_4K_page(to, from);
       else for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) {
               copy_4K_page(to, from);
               to += 4096;
               from += 4096;
       }
}

	Arnd <><



More information about the Linuxppc64-dev mailing list