[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / mandel.c
blobbb62885eaaca98659976a19bca7710ba56e7819d
1 // RUN: %clang_cc1 -emit-llvm %s -o %t
3 /* Sparc is not C99-compliant */
4 #if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
6 int main(void) { return 0; }
8 #else /* sparc */
10 #define ESCAPE 2
11 #define IMAGE_WIDTH 150
12 #define IMAGE_HEIGHT 50
13 #if 1
14 #define IMAGE_SIZE 60
15 #else
16 #define IMAGE_SIZE 5000
17 #endif
18 #define START_X -2.1
19 #define END_X 1.0
20 #define START_Y -1.25
21 #define MAX_ITER 100
23 #define step_X ((END_X - START_X)/IMAGE_WIDTH)
24 #define step_Y ((-START_Y - START_Y)/IMAGE_HEIGHT)
26 #define I 1.0iF
28 int putchar(char c);
29 double hypot(double, double);
31 volatile double __complex__ accum;
33 void mandel(void) {
34 int x, y, n;
35 for (y = 0; y < IMAGE_HEIGHT; ++y) {
36 for (x = 0; x < IMAGE_WIDTH; ++x) {
37 double __complex__ c = (START_X+x*step_X) + (START_Y+y*step_Y) * I;
38 double __complex__ z = 0.0;
40 for (n = 0; n < MAX_ITER; ++n) {
41 z = z * z + c;
42 if (hypot(__real__ z, __imag__ z) >= ESCAPE)
43 break;
46 if (n == MAX_ITER)
47 putchar(' ');
48 else if (n > 6)
49 putchar('.');
50 else if (n > 3)
51 putchar('+');
52 else if (n > 2)
53 putchar('x');
54 else
55 putchar('*');
57 putchar('\n');
61 int main(void) {
62 mandel();
63 return 0;
66 #endif /* sparc */