AnsweredAssumed Answered

Optimizing Memory access

Question asked by k.moazzemi on Feb 23, 2013
Latest reply on Mar 25, 2013 by CraigG

Hello All,

I'm trying to do some performance estimation on Blackfin processors. I'm using crossCompilers for finding the suitable code to run on the program but I noticed in assembly code, everytime a simple operation wants to be executed there are two loads for variables and one store for the result.

    R1 = 1 (X);
    R0 = 2 (X);
    R1 = 3 (X);
    [FP+-8] = R1;
    R2 = [FP+-8];
    R1 = R0 + R2;
    R0 = R1 + R0;
    [FP+-8] = R0;
    R2 = [FP+-8];
    R0 = R2 + R1;
    R0 = R1 + R1;
    R2 = [FP+-8];
    R0 = R2 + R2;
    R2 = [FP+-8];
    R0 = R2 + R2;
    R2 = [FP+-8];
    R0 = R2 + R2;
    R2 = [FP+-8];
    R0 = R2 + R2;

 

I'm trying to get rid of these memory access. I have tried using Register in defining my variables in C code to give the compiler the hint to store these variables in registers but it didn't work. Is there anyway to optimize the speed of these operation by eliminating the memory access?

Thanks.

Outcomes