LWN.net Logo

Hardly a useful optimization

Hardly a useful optimization

Posted Apr 24, 2003 2:32 UTC (Thu) by proski (subscriber, #104)
In reply to: Nice jab at Emacs ;) by coriordan
Parent article: Opteron launches

How come GCC doesn't have a "compile as lower bit-width" optimisation?
This would have to be done across the board. Not just cat, but also libc would have to be recompiled. It int is 16-bit for an application and 32-bit for libc, such application would be unable to call libc functions without some kind of conversion of all data passed to and from those functions.

Another problem is that such optimization would be quite inefective on some architectures, including i386. You can have either 32-bit code that uses 32-bit and 8-bit registers, or 16-bit code that uses 16-bit and 8-bit registers. Using a 16-bit register in 32-bit code or vice versa requires a special instruction prefix.

Finally, there are very few applications that would benefit from such optimization. cat spends most time in libc and kernel. Any large program needs to address more than 64k. Programs doing heavy calculations with little code would still benefit from 32-bit bus width, given that the modern processors have on-die cache sufficient to keep the whole program and make memory access speed a non-issue.

Now, going from 32-bit to 64-bit is different because:

  1. Processors don't have 4Gb cache yet
  2. There is a lot you can do in 32-bit applications
  3. You can have a good 32-bit operating system
My guess is that that the transition is going to be more painful than going from 16-bit to 32-bit, and that there will be a lot of "partially 64-bit" software, including operating systems.


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds