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

LSL and LSR instructions

Hi all ,

I need some explanations for the code highlighted below.I got this code from the disassembled window.
Here temp is declared as unsigned short and onech is declared as unsigned Char.
I would like to know why the compiler is doing the LSL and LSR operations here in this part of the code ,though there is only one LSL I have specified in the code .(ie. (temp^onech) << 8.)

Looking for help.
T.Sendhilraj

74: unsigned short ans=((temp^onech) << 8);
MOV R0,R1
MOV R1,R0,LSL #16
MOV R1,R1,LSR #16

MOV R0,R2
MOV R0,R0,LSL #24
MOV R0,R0,LSR #24

EOR R1,R1,R0
MOV R1,R1,LSL #8
MOV R1,R1,LSL #16
MOV R1,R1,LSR #16

Parents
  • Thanks for your reply .

    better optimization....

    Well throughout my simulation these higlighted code does nothing except shifiting left and right.Do I need these codes really ?.If not,Is it ok if i remove these codes while working for an optimized code?If I am correct these highlighted code occupies 24 bytes.

    recommend that you are changing to the
    RealView Compiler....

    I dont have a RealView Compiler with me.

Reply
  • Thanks for your reply .

    better optimization....

    Well throughout my simulation these higlighted code does nothing except shifiting left and right.Do I need these codes really ?.If not,Is it ok if i remove these codes while working for an optimized code?If I am correct these highlighted code occupies 24 bytes.

    recommend that you are changing to the
    RealView Compiler....

    I dont have a RealView Compiler with me.

Children