]> git.sur5r.net Git - cc65/blob - test/ref/spill.c
Merge pull request #133 from pfusik/fix-char-cast
[cc65] / test / ref / spill.c
1 /*
2   !!DESCRIPTION!! register spilling
3   !!ORIGIN!!      LCC 4.1 Testsuite
4   !!LICENCE!!     own, freely distributeable for non-profit. read CPYRIGHT.LCC
5 */
6
7 #include <stdio.h>
8
9 int main(void)
10 {
11     printf("disassemble this program to check the generated code.\n");
12     return 0;
13 }
14
15 #ifdef NO_EMPTY_FUNC_ARGS
16         f(i){return i+i;}
17         f2(i){return f(i)+(i?f(i):1);}
18         f3(int i,int *p){
19         register r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,r10=0;
20                 *p++=i?f(i):0;
21         }
22 #else
23         f(i){i=f()+f();}
24         f2(i){i=f()+(i?f():1);}
25         f3(int i,int *p){
26         register r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,r10=0;
27                 *p++=i?f():0;
28         }
29 #endif
30
31 #ifdef NO_FLOATS
32         signed a[10],b[10];
33 #else
34         double a[10],b[10];
35 #endif
36
37 int i;
38
39 f4(){
40 register r6=0,r7=0,r8=0,r9=0,r10=0,r11=0;
41         i=a[i]+b[i] && i && a[i]-b[i];
42 }
43 /* f4 causes parent to spill child on vax when odd double regs are enabled */
44
45 int j, k, m, n;
46 #ifdef NO_FLOATS
47         signed *A, *B, x;
48 #else
49         double *A, *B, x;
50 #endif
51
52 f5(){
53         x=A[k*m]*A[j*m]+B[k*n]*B[j*n];
54         x=A[k*m]*B[j*n]-B[k*n]*A[j*m];
55 }