Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/09/08 15:58
Read: times


 
#160797 - Is that relevant to this environment?
Responding to: ???'s previous message
Per Westermark said:
Assembler allows a developer to place any compbination of instructions after each other - or even "in" each other if one byte of one instruction is allowed to be a target for a jump...

Most 8-bit processors are quite easy to program in assembler because of a limited number of instructions and access modes etc. People still constantly fail to produce decent assembler code.

Just to keep us all grounded, I'd point out that this is 8052.COM and not a site devoted to large processors.

A processor that consumes different number of clock cycles for different instructions is harder to program than a processor with a fixed number of cycles/instruction.

If moving to a processor with DRAM memory, you may continue to get tight code. But to get fast code, you must think about alignment in relation to rows and columns of the memory. And for a 16 or 32-bit processor, the alignment in relation to data size also affects the speed (if unaligned access is supported at all).

When the processor gets a cache, then the cache line sizes will introduce yet more differences in memory bandwidth depending on loop sizes and alignments.

Is that what concerns us on 8052.com?

And with multi-issue processors (multiple instructions started on every clock cycle) you have to spend a significant amount of time trying to permutate all instructions to fill the multiple evaluation units of the processor.

Just the little change where Intel allowed a zero-clock swap of two registers in the floating-point stack of the original Pentium was enough to make it almost impossible to beat a good compiler when writing floating-point-intensive x86 code. The human brain don't like to try to keep track of what values are stored at what positions when one swap may be performed for each other fp instruction without extra cost (than a bit of consumption of cache memory). Who wants to spend 5 hours to gain 0.1% extra speed in a math function, and know that the next generation of the compiler may take back that gain. Or the optimization for the next generation processor would result in way larger speed differences and requires new optimizations.

So, in the low-end uC world, the assembler programmer may feel like a king. But the number of people who can compete with the best compilers decreases a lot for each improved processor generation/architecture that gets released. We are good at seeing patterns, but not as good at scanning through large number of permuations with a very low probability of introducing errors.


All this doesn't change the fact that, if you want to write code that's both small and fast, ASM is the only way to ensure that you do that. You can take the compiler's output and "fix" it, but with small (<<200K-lines) programs, it's not necessary. Helpful, maybe, easier to maintain, probably, but ... Better???

RE

List of 50 messages in thread
TopicAuthorDate
Which programming language is the best?            01/01/70 00:00      
   depends on compiler            01/01/70 00:00      
   Who is "we"            01/01/70 00:00      
   Creativity            01/01/70 00:00      
      Responding to Andy Neil "Who is we?"            01/01/70 00:00      
         apples and oranges            01/01/70 00:00      
            Re: apples and oranges            01/01/70 00:00      
               Correct            01/01/70 00:00      
               Calling conv more depending on target than language            01/01/70 00:00      
                  Re: Calling conv...            01/01/70 00:00      
         not the rule            01/01/70 00:00      
   Do you think Spanish is better than Mandarin?            01/01/70 00:00      
      Concise?            01/01/70 00:00      
         fair question            01/01/70 00:00      
            Maybe            01/01/70 00:00      
               There is no question about it!            01/01/70 00:00      
                  Does it work ?            01/01/70 00:00      
                     Unless it impacts cost ...            01/01/70 00:00      
                  Bottom line            01/01/70 00:00      
                     ... and that is the problem with many products ...            01/01/70 00:00      
                        Not true            01/01/70 00:00      
                           low-volume/high-volume tradeoffs            01/01/70 00:00      
                        Bottom line price is more than just consumed kB code space            01/01/70 00:00      
            Oh no, not that old chestnut            01/01/70 00:00      
               Assembler and processor size            01/01/70 00:00      
                  Is that relevant to this environment?            01/01/70 00:00      
                     Human brain            01/01/70 00:00      
               You will have trouble convincing me ...            01/01/70 00:00      
                  I agree with you there!            01/01/70 00:00      
      Re: Spanish better than...            01/01/70 00:00      
         That's the point!            01/01/70 00:00      
         not so            01/01/70 00:00      
   In a war which is the best weapon ?            01/01/70 00:00      
      the language in which programmer feels comfortable            01/01/70 00:00      
         Comfort is not the issue!            01/01/70 00:00      
            true, but            01/01/70 00:00      
         It's about the right tool(s) for the job            01/01/70 00:00      
   My two cents            01/01/70 00:00      
      If it fits ...            01/01/70 00:00      
         that is (ir)relevant            01/01/70 00:00      
            What is small?            01/01/70 00:00      
               Would that be appropriate on 805x?            01/01/70 00:00      
                  more on big/small series            01/01/70 00:00      
                     Does this approach fit 805x and other small MCU?            01/01/70 00:00      
                        Already have full Linux solutions too            01/01/70 00:00      
   Yes..C and asm is the best            01/01/70 00:00      
   I prefer KEIL U2V , C programming language.            01/01/70 00:00      
      Magic with Kel C?            01/01/70 00:00      
      Makes no sense!            01/01/70 00:00      
   Pascal is not dead            01/01/70 00:00      

Back to Subject List