Barcelona optimization guide

By: EduardoS (no.delete@this.spam.com), May 13, 2007 9: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
but
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
outerloop:
xor eax, eax
innerloop:
;...
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 06:43 AM
  Barcelona optimization guideLinus Torvalds2007/05/10 09:00 AM
    Barcelona optimization guideRob Thorpe2007/05/10 09:23 AM
      Barcelona optimization guideLinus Torvalds2007/05/10 09:42 AM
        Barcelona optimization guideRob Thorpe2007/05/11 08:22 AM
          Barcelona optimization guideDavid Kanter2007/05/11 04:17 PM
            Barcelona optimization guideLinus Torvalds2007/05/11 04:30 PM
            Barcelona optimization guideanonymous2007/05/11 10:29 PM
              Barcelona optimization guideanonymous2007/05/12 06:47 AM
              Barcelona optimization guidehobold2007/05/14 04:30 AM
        Barcelona optimization guideAndreas Kaiser2007/05/12 08:32 AM
  Barcelona optimization guideVincent Diepeveen2007/05/13 04:20 AM
    Barcelona optimization guideEduardoS2007/05/13 06:01 AM
      Barcelona optimization guideVincent Diepeveen2007/05/13 08:18 AM
        Barcelona optimization guideMichael S2007/05/13 09:03 AM
        Barcelona optimization guideEduardoS2007/05/13 09:30 AM
        Barcelona optimization guideDresdenboy2007/05/14 07:18 AM
          Barcelona optimization guideVincent Diepeveen2007/05/16 01:36 AM
            Barcelona optimization guideEduardoS2007/05/16 05:57 AM
              Barcelona optimization guideVincent Diepeveen2007/05/16 08:51 AM
        Barcelona optimization guideDavid Kanter2007/05/16 03:13 AM
          Barcelona vs Core2 Vincent Diepeveen2007/05/16 05:35 AM
            Barcelona vs Core2 David Kanter2007/05/16 11:06 AM
            Barcelona vs Core2 EduardoS2007/05/16 11:41 AM
              Barcelona vs Core2 David Kanter2007/05/16 11:53 AM
                Barcelona vs Core2 EduardoS2007/05/16 12:37 PM
                  Barcelona vs Core2 David Kanter2007/05/16 01:43 PM
                    Barcelona vs Core2 EduardoS2007/05/16 03:32 PM
                    Barcelona vs Core2 Gabriele Svelto2007/05/17 05:38 AM
          Barcelona optimization guideanonymous2007/05/16 07:13 PM
            Barcelona optimization guideMichael S2007/05/17 04:26 AM
              Barcelona optimization guideanonymous2007/05/17 05:23 PM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell avocado?