« Return to Thread: : hitech compiler - deliberately generating poor code in free version?

Re: : hitech compiler - deliberately generating poor code in free version?

by Terry Harris :: Rate this Message:

Reply to Author | View in Thread

On Fri, 03 Jul 2009 20:14:13 -0300, you wrote:

>OK, explain this under this theory:
>
>Look how they do 'Var = 0;' :
>
>bcf    STATUS,C
>*movlw*   0
>btfsc   STATUS,C
>*movlw*   1
>movwf   Var

Evaluate the right hand expression and put the result in something just big
enough (in this case the carry flag). Copy the result to the lvalue.


>'Var = 1;'
>
>clrf   Var
>bsf   STATUS,C
>rlf   Var,f

Same again although I don't know why it chose a different method to copy.


>'Var = 2;'
>
>clrw
>iorlw   2
>movwf   Temp
>movf   Temp,w
>movwf   Var

Same again but the expression needs a file to hold the result.

It seems the compiler is being smart recognising constant expressions of 0
and 1 will fit in a bit and treating them differently. The generated code
looks dumb but I presume provides more scope of optimisation by the bit of
the compiler you didn't buy.

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

 « Return to Thread: : hitech compiler - deliberately generating poor code in free version?