]> git.sur5r.net Git - cc65/blob - test/ref/spill.c
remote TABs in doc/ and test/
[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 "common.h"
8 #include <stdio.h>
9
10 int main(void)
11 {
12     printf("disassemble this program to check the generated code.\n");
13     return 0;
14 }
15
16 #ifdef NO_EMPTY_FUNC_ARGS
17         f(i){return i+i;}
18         f2(i){return f(i)+(i?f(i):1);}
19         f3(int i,int *p){
20         register r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,r10=0;
21                 *p++=i?f(i):0;
22         }
23 #else
24         f(i){i=f()+f();}
25         f2(i){i=f()+(i?f():1);}
26         f3(int i,int *p){
27         register r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,r10=0;
28                 *p++=i?f():0;
29         }
30 #endif
31
32 #ifdef NO_FLOATS
33         signed a[10],b[10];
34 #else
35         double a[10],b[10];
36 #endif
37
38 int i;
39
40 f4(){
41 register r6=0,r7=0,r8=0,r9=0,r10=0,r11=0;
42         i=a[i]+b[i] && i && a[i]-b[i];
43 }
44 /* f4 causes parent to spill child on vax when odd double regs are enabled */
45
46 int j, k, m, n;
47 #ifdef NO_FLOATS
48         signed *A, *B, x;
49 #else
50         double *A, *B, x;
51 #endif
52
53 f5(){
54         x=A[k*m]*A[j*m]+B[k*n]*B[j*n];
55         x=A[k*m]*B[j*n]-B[k*n]*A[j*m];
56 }