This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading T7

Hi

The code generated when I read the value of sfr T7 is as follows.

   178:                         start_time = T7 ;
00005C98 F2FE50F0  MOV      R14,DPP3:0x3050
   179:                         _nop_() ;

I would like it to be
MOV   R14,T7

What compiler options do I need to set to generate this ?

Cheers

Elliot

Parents
  • Hi Jon,

    You are absolutely right. I must admit, I made a mistake. I got confused at first because in the C166 instruction set there is the instruction MOV Rn,Rm: F0nm. But the 4-bit addressing mode can't be used for T7, so this instruction wouldn't work here.
    But I would like to point out a different inefficiency in C166. Try compiling this code:

    unsigned long l;
    unsigned int i;
    void main(void)
    {
        i = (unsigned int)(l >> 16) + 1;
    }
    the compiler generates:
    0000 F2F50200 R    MOV       R5,l+02H
    0004 F045          MOV       R4,R5   ; <- unnecessary
    0006 0841          ADD       R4,#01H
    0008 F6F40400 R    MOV       i,R4
    000C CB00          RET       
    Looks like the optimizer fails to eliminate unnecessary loading into temporary storage, which would seem a very basic type of optimization.

    - mike

Reply
  • Hi Jon,

    You are absolutely right. I must admit, I made a mistake. I got confused at first because in the C166 instruction set there is the instruction MOV Rn,Rm: F0nm. But the 4-bit addressing mode can't be used for T7, so this instruction wouldn't work here.
    But I would like to point out a different inefficiency in C166. Try compiling this code:

    unsigned long l;
    unsigned int i;
    void main(void)
    {
        i = (unsigned int)(l >> 16) + 1;
    }
    the compiler generates:
    0000 F2F50200 R    MOV       R5,l+02H
    0004 F045          MOV       R4,R5   ; <- unnecessary
    0006 0841          ADD       R4,#01H
    0008 F6F40400 R    MOV       i,R4
    000C CB00          RET       
    Looks like the optimizer fails to eliminate unnecessary loading into temporary storage, which would seem a very basic type of optimization.

    - mike

Children
No data