Barcelona optimization guide

By: EduardoS (, May 13, 2007 10:30 am
Room: Moderated Discussions
>So if your car can drive at most at 100 KM/h,
>then it is an ok driving speed considering
>T-ford getting a speed at most of 40 KM/h ??

Did you know how multiply is done into hardware?
It's very complex, too hard (and expensive) to do it in less time, 5 cycles@3GHz isn't ok, it's f***ing fast.

>If core2 can retire 4 uops per cycle and barcelona can retire 3 uops a cycle i
>understand, then core2 can blow that barcelona core completely away. That's 33% faster speed.

Barcelona and K-8 can retire 3 macro-Ops per cycle...
add eax, eax = 1 K-8's macro-Ops and 1 Conroe's uOP
add [eax+ebx*4+76], 34 = 1 K-8's macro-Ops and 2 Conroe's uOPs
With real code and a big mix of instructions there won't be a big diference.

>No need to have a history to predict next branch:
>for( i = 0 ; i < 4 ; i++ ) {
>for( j = 0 ; j < 4 ; j++ ) {
>If K8-barcelona can't perfectly predict that, then AMD has some work to do.
Not so simple...
1) There is no processor today that will understand this loop will be taken 4 times and not taken 1 before executing it.
2) The two "for" will generate extra instructions, with a loop that is limited by the number of instructions.

To make things easier... After the C compiler otimization (but withou loop unrolling) the code should look like this:

xor ecx, ecx
xor eax, eax
add eax, 1
cmp eax, 4
jng innerloop
add ecx, 1
cmp ecx, 4
jng outerloop

So there are 8 extra instructions that must be executed even if the loop can be predicted.
note: Depending on the compiler and the code inside it may unroll it completly or change the add/cmp/jng by sub/jnz.
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Barcelona optimization guidemas2007/05/10 07:43 AM
  Barcelona optimization guideLinus Torvalds2007/05/10 10:00 AM
    Barcelona optimization guideRob Thorpe2007/05/10 10:23 AM
      Barcelona optimization guideLinus Torvalds2007/05/10 10:42 AM
        Barcelona optimization guideRob Thorpe2007/05/11 09:22 AM
          Barcelona optimization guideDavid Kanter2007/05/11 05:17 PM
            Barcelona optimization guideLinus Torvalds2007/05/11 05:30 PM
            Barcelona optimization guideanonymous2007/05/11 11:29 PM
              Barcelona optimization guideanonymous2007/05/12 07:47 AM
              Barcelona optimization guidehobold2007/05/14 05:30 AM
        Barcelona optimization guideAndreas Kaiser2007/05/12 09:32 AM
  Barcelona optimization guideVincent Diepeveen2007/05/13 05:20 AM
    Barcelona optimization guideEduardoS2007/05/13 07:01 AM
      Barcelona optimization guideVincent Diepeveen2007/05/13 09:18 AM
        Barcelona optimization guideMichael S2007/05/13 10:03 AM
        Barcelona optimization guideEduardoS2007/05/13 10:30 AM
        Barcelona optimization guideDresdenboy2007/05/14 08:18 AM
          Barcelona optimization guideVincent Diepeveen2007/05/16 02:36 AM
            Barcelona optimization guideEduardoS2007/05/16 06:57 AM
              Barcelona optimization guideVincent Diepeveen2007/05/16 09:51 AM
        Barcelona optimization guideDavid Kanter2007/05/16 04:13 AM
          Barcelona vs Core2 Vincent Diepeveen2007/05/16 06:35 AM
            Barcelona vs Core2 David Kanter2007/05/16 12:06 PM
            Barcelona vs Core2 EduardoS2007/05/16 12:41 PM
              Barcelona vs Core2 David Kanter2007/05/16 12:53 PM
                Barcelona vs Core2 EduardoS2007/05/16 01:37 PM
                  Barcelona vs Core2 David Kanter2007/05/16 02:43 PM
                    Barcelona vs Core2 EduardoS2007/05/16 04:32 PM
                    Barcelona vs Core2 Gabriele Svelto2007/05/17 06:38 AM
          Barcelona optimization guideanonymous2007/05/16 08:13 PM
            Barcelona optimization guideMichael S2007/05/17 05:26 AM
              Barcelona optimization guideanonymous2007/05/17 06:23 PM
Reply to this Topic
Body: No Text
How do you spell avocado?