This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Optimize manual byte swap implementations v3


Hi Richard,

as proposed by Mark I did some experiments with the ARM target. I think the byte swap optimizer is especially benefical for targets where a "bswap" instruction has been added with some later CPU level. For these targets it is especially ugly to enhance code with inline assemblies since it would require CPU level checks. For ARM the instruction has been added with ARMv6. Currently neither the Linux kernel nor newlib use the "rev" instruction to implement byte swaps.

In order to enable the ARM byte swap instruction at all I did a small patch adding the "rev" instruction to the arm back-end and a kernel patch removing the bswap special handling in the linux kernel.

With the byte swap optimizer pass enabled the vmlinux.o object file contained 178 "rev" instructions shrinking the .text section by several kB (I don't have the exact number on this machine). To me a bit surprising was the shrinkage of the debug information. The .debug* sections together became about 40kB smaller.

What is lacking is to have a look at the performance overhead. I would consider the kernel as some kind of worst case scenario and I will try to do some benchmarking on my x86_64 machine with it.

Bye,

-Andreas-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]