On Dec 7, 2007 2:24 PM, Chris Lattner <[EMAIL PROTECTED]> wrote:
>
> I know you're kidding, but have you benchmarked this on the G5?  In
> this specific case, "foo" is probably MUCH faster because the loop is
> one dispatch group instead of two (I think).  :)
>
It made this program slower:

$ cat t.c
#include <stdio.h>

#define SIZE 100000
int arr[SIZE];

__attribute__((noinline)) void foo(int *arr, unsigned size) {
  unsigned i = 0;

  do {
    arr[i++] = 0;
  } while (i < size);
}

int main() {
  int i;
  for (i = 0; i < SIZE; ++i)
    foo(arr, SIZE);
  return 0;
}
$ time ./t.old

real    0m15.107s
user    0m15.095s
sys     0m0.012s
$ time ./t.new

real    0m20.088s
user    0m20.075s
sys     0m0.013s

But when I set the alignment of the loop in main to 8, it got slightly faster:

$ time ./t.new

real    0m15.090s
user    0m15.079s
sys     0m0.010s

So there's some type of alignment thing that's getting in the way, but
it's encouraging for an initial pass that moved 3 instructions total.
:-)

-bw
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to