[llvm-commits] [test-suite] r65636 - /test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c
Chris Lattner
sabre at nondot.org
Fri Feb 27 09:00:25 PST 2009
Author: lattner
Date: Fri Feb 27 11:00:25 2009
New Revision: 65636
URL: http://llvm.org/viewvc/llvm-project?rev=65636&view=rev
Log:
add Jon Harrop's text-mandelbrot.
Added:
test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c
Added: test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c?rev=65636&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c (added)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c Fri Feb 27 11:00:25 2009
@@ -0,0 +1,28 @@
+#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() {
+ int i, j;
+ for (j = -39; j < 39; ++j) {
+ for (i = -39; i < 39; ++i)
+ printf(loop(j/40.0-0.5 + i/40.0*I) > max_i ? "*" : " ");
+ printf("\n");
+ }
+ return 0;
+}
+
More information about the llvm-commits
mailing list