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

how to  use PLD  instructions

Note: This was originally posted on 28th November 2012 at http://forums.arm.com

NOW I am learning assemalbe function  "memset"  in android version;
follow is some :

0:
        PLD         (r3, #64)    ///Here is why 64  for what's mean?????
        PLD         (r1, #64)
        ldr         r0, [r3], #4
        ldr         lr, [r1, #4]!
        eors        r0, r0, ip
        ldreq       r0, [r3], #4
        ldreq       ip, [r1, #4]!
        eoreqs      r0, r0, lr
        ldreq       r0, [r3], #4
        ldreq       lr, [r1, #4]!
        eoreqs      r0, r0, ip
        ldreq       r0, [r3], #4
        ldreq       ip, [r1, #4]!
        eoreqs      r0, r0, lr
        ldreq       r0, [r3], #4
        ldreq       lr, [r1, #4]!
        eoreqs      r0, r0, ip
        ldreq       r0, [r3], #4
        ldreq       ip, [r1, #4]!
        eoreqs      r0, r0, lr
        ldreq       r0, [r3], #4
        ldreq       lr, [r1, #4]!
        eoreqs      r0, r0, ip
        ldreq       r0, [r3], #4
        ldreq       ip, [r1, #4]!
        eoreqs      r0, r0, lr
        bne         2f       
        subs        r2, r2, #16
        bhs         0b



I donot know how to  use this  instructions. can you tell me how to use and show a example , some explanation;  thanks !!!!!!!
  • Note: This was originally posted on 28th November 2012 at http://forums.arm.com


    I donot know how to  use this  instructions. can you tell me how to use and show a example , some explanation;  thanks !!!!!!!


    PLD just tell to the memory controler that you will try to access the a memory zone into a near future. With this information the memory controler can try to PRELOAD data into the cache.
    But:

    1 - you can't be sure that the memory controler will do something. With some architecture PLD has no effect.
    2 - you must specify an Offset (64 into your sample) because PRELOAD could not be effective immediately.

    If you offset is to small


    PLD  [r0, #0]
    LDR  r1, [r0], #4

    The memory controler wil not have enough time to PRELOAD the data into the cache before the LDR instruction is executed.

    The PLD instruction is usefull into a loop where you know that you will read at each iteration the next memory zone.
    In this case during iteration n you preload datas that will be used into iteration n+1 (or n+2 or n+3, ...)


    There is no ideal Offset value !
    64 is not bad value!
    Personaly, I used to set the offset value to 0xc0, but if the RAM speed of your device is very good, then a smaller value should be better !
  • Note: This was originally posted on 29th November 2012 at http://forums.arm.com

    thanks for reply .
    but how many bytes cache reads  at one time  ? thanks!
  • Note: This was originally posted on 29th November 2012 at http://forums.arm.com

    my Configuration is :

    devices :  huawei  C8650  moble,  
    CPU:  msm7627, 
    arch:  ARM1136jf-s