i am trying to reach the single threaded FP peak performance for my nehalem cpu to detect the performance anomalies of my application, but i can't seem to reach it. The clock speed is 3.2 GHz, and i want to achieve the peak FP performance of the cpu without using SSE instructions and multi-threading.
As i understand it single precision FP addition and multiplication can be done in parallel each clock cycle, yielding a maximum performance of 2 * 3.20 = 6.4 GFLOPS/sec.
However i am not able to reach this performance with a simple piece of code:
int iterations = 1000000;
int flops_per_iteration = 2;
int num_flops = iterations * flops_per_iterations;
for(int i=0; i<iterations; i++)
{
    a[i] = i; 
    b[i] = i*2;
    c[i] = i*3;
}
tick(&start_time);
for(int i = 0; i < iterations; i++){
    a[i] *= b[i];
    c[i] += b[i];
}
time = tock(&start_time);
printf("Performance: %0.4f GFLOPS \n", flops/(time*pow(10,-3)*pow(10,9)));
This piece of code gives me a performance of: ~1.5 GFLOPS instead of 6.4 GFLOPS.
Anybody has any other example that can approach the peak performance without using MT and SSE, or has any idea my code doesn't?
Thanks in advance
* Update: Added Assembly Code of the hot loop: *
Address Assembly
Block 17:
0x4013a5    movssl  (%rdi,%rax,4), %xmm2
0x4013aa    movssl  (%r8,%rax,4), %xmm0
0x4013b0    movssl  (%rsi,%rax,4), %xmm1
0x4013b5    mulss %xmm2, %xmm0
0x4013b9    addss %xmm1, %xmm2
0x4013bd    movssl  %xmm0, (%r8,%rax,4)
0x4013c3    movssl  %xmm2, (%rsi,%rax,4)
0x4013c8    inc %rax
0x4013cb    cmp %rcx, %rax
0x4013ce    jb 0x4013a5 <Block 17>
 
     
     
    