Displaying 2 results from an estimated 2 matches for "cnorm2".
Did you mean:
norm2
2009 Feb 26
2
[LLVMdev] Impressive performance result for LLVM: complex arithmetic
...Debian:
gcc: 5.727s
llvm-gcc: 1.393s
There is still 20% room for improvement but LLVM is >4x faster than gcc here.
Sweet.
Here's the code:
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
int max_i = 65536;
double sqr(double x) { return x*x; }
double cnorm2(complex z) { return sqr(creal(z)) + sqr(cimag(z)); }
int loop(complex c) {
complex z=c;
int i=1;
while (cnorm2(z) <= 4.0 && i++ < max_i)
z = z*z + c;
return i;
}
int main() {
for (int j = -39; j < 39; ++j) {
for (int i = -39; i < 39; ++i)...
2009 Feb 27
0
[LLVMdev] Impressive performance result for LLVM: complex arithmetic
...20% room for improvement but LLVM is >4x faster than gcc here.
> Sweet.
>
> Here's the code:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <complex.h>
>
> int max_i = 65536;
>
> double sqr(double x) { return x*x; }
>
> double cnorm2(complex z) { return sqr(creal(z)) + sqr(cimag(z)); }
>
> int loop(complex c) {
> complex z=c;
> int i=1;
> while (cnorm2(z) <= 4.0 && i++ < max_i)
> z = z*z + c;
> return i;
> }
>
> int main() {
> for (int j = -39; j < 39; ++j)...