Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- Date: Fri, 11 Mar 2011 11:40:23 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- References: <AANLkTim_-D9CFYC8TNp33ni85zB+QBA7jV=BpLN=4SbZ@example.com> <AANLkTimhSGxdPk45AMZHqX8eo2PS75K-qkuV+xMS7bdH@example.com> <AANLkTimSRkAiworM=O5VRfTVw-jBA4z=iD89OXY9sWxB@example.com> <4D765593.4090409@example.com> <4D76ECFF.30903@example.com> <AANLkTim=he_XLrHsFU2RMEUtq1f30AROO1mYQ7nLJvL3@example.com> <DED1953A-4193-4A6B-9ED4-BF0F676BA509@example.com> <AANLkTikTORsQbrnd0wAu_QwntBmjijBT83s24=5t_h2Z@example.com> <2E17A6AD-8F2B-4AEA-9555-4FB82ADA3B29@example.com> <20110309193326.4c0712da.jep200404@example.com> <4D781FA8.1040102@example.com> <20110309203709.575cbf84.jep200404@example.com> <AANLkTimo9yUpeOUAikpFPg75nEJ0QpHKcsm+VBt+sRKs@example.com> <20110310015425.4d9e751b.jep200404@example.com> <AANLkTinnnmu2qMhJ6EZfdMakURU-okO5r1LhUMRJ0QTZ@example.com> <4D78A467.4060707@example.com>
Lewske Wada writes: > How about > > mov bx, ax > shl bx, 3 > sub bx, ax > > to get 7 times ax? But that's a peephole optimization, and I really don't think you want to compete with the compiler on remembering such optimizations. Instead, you want to teach the compiler to do new ones as you invent them. The only real problem with this approach is ensuring they are correct, but peephole optimizations are usually easy to prove correct. Note that Small C had about a dozen such optimizations, most of which simply corrected for really dumb code generation, but some of which depended on seminumerical analysis like the above. But Small C was self-hosted; a cross-compiler on a modern workstation could surely afford to do thousands of such, maybe millions with appropriate structuring of the data on optimizations. I think it would be also very hard to beat a modern compiler on register usage, although I'm sure it's possible (the human assembler programmer will choose algorithms he knows how to optimize, while the C programmer isn't as likely to do so). Of course, this is all theory. If there's no open source compiler for your platform, then (unless you're going to write a lot of code for it) you probably can't build your own library of optimizations. If there's no compiler at all, writing one (or retargeting one) is rather expensive.
- References:
- [tlug] Alternatives to sed + awk
- From: Nguyen Vu Hung
- Re: [tlug] Alternatives to sed + awk
- From: Josh Glover
- Re: [tlug] Alternatives to sed + awk
- From: Nguyen Vu Hung
- Re: [tlug] Alternatives to sed + awk
- From: Raymond Wan
- Re: [tlug] Alternatives to sed + awk
- From: Lewske Wada
- Re: [tlug] Alternatives to sed + awk
- From: Josh Glover
- Re: [tlug] Alternatives to sed + awk
- From: Lewske Wada
- Re: [tlug] Alternatives to sed + awk
- From: Josh Glover
- Re: [tlug] Alternatives to sed + awk
- From: Lewske Wada
- [tlug] Assembly Language v C and Embedded Development (was Re: Alternatives to sed + awk)
- From: jep200404
- Re: [tlug] Assembly Language v C and Embedded Development (was Re: Alternatives to sed + awk)
- From: Lewske Wada
- Re: [tlug] Assembly Language v C and Embedded Development
- From: jep200404
- Re: [tlug] Assembly Language v C and Embedded Development
- From: Josh Glover
- Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- From: jep200404
- Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- From: Josh Glover
- Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- From: Lewske Wada
Home | Main Index | Thread Index
- Prev by Date: [tlug] Browser share in Japan?
- Next by Date: Re: [tlug] Alternatives to sed + awk
- Previous by thread: Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- Next by thread: Re: [tlug] Assembly Language v C and Embedded Development: !gcc for PIC16F84
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links