1 Index: callback/vacall_r/vacall-sparc64.S
2 ===================================================================
3 RCS file: /sources/libffcall/ffcall/callback/vacall_r/vacall-sparc64.S,v
4 retrieving revision 1.3
5 diff -u -r1.3 vacall-sparc64.S
6 --- callback/vacall_r/vacall-sparc64.S 23 May 2005 10:15:06 -0000 1.3
7 +++ callback/vacall_r/vacall-sparc64.S 11 Mar 2008 21:52:48 -0000
9 .type __vacall_r,$function
12 + .register %g2, $scratch
13 + .register %g3, $scratch
17 Index: vacall/vacall-sparc64.S
18 ===================================================================
19 RCS file: /sources/libffcall/ffcall/vacall/vacall-sparc64.S,v
20 retrieving revision 1.4
21 diff -u -r1.4 vacall-sparc64.S
22 --- vacall/vacall-sparc64.S 23 May 2005 10:15:06 -0000 1.4
23 +++ vacall/vacall-sparc64.S 11 Mar 2008 21:52:50 -0000
25 .type __vacall,$function
28 + .register %g2, $scratch
29 + .register %g3, $scratch
33 Index: avcall/avcall.h.in
34 ===================================================================
35 RCS file: /sources/libffcall/ffcall/avcall/avcall.h.in,v
36 retrieving revision 1.25
37 diff -u -r1.25 avcall.h.in
38 --- avcall/avcall.h.in 2 Nov 2007 15:24:53 -0000 1.25
39 +++ avcall/avcall.h.in 11 Mar 2008 21:52:44 -0000
41 #if defined(__sparc64__)
42 /* store the floating-point arguments in an extra array */
43 int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
44 - unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */
45 - unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */
46 + unsigned int darg_mask; /* bitmask of those entries in args[] which have a float or double value */
48 #if defined(__ia64__) || defined(__x86_64__)
49 /* store the floating-point arguments in an extra array */
51 #if defined(__sparc64__)
52 #define __av_start1(LIST) \
54 - (LIST).farg_mask = 0, \
55 (LIST).darg_mask = 0, \
56 (LIST).aptr = &(LIST).args[0], \
57 (LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
60 #define av_float(LIST,VAL) \
61 ((LIST).aptr >= __av_eptr(LIST) \
62 - ? -1 : (((LIST).anum < 16 && ((LIST).farg_mask |= (1 << (LIST).anum))), \
63 - (*(float*)(LIST).aptr = (float)(VAL)), \
64 + ? -1 : (((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), \
65 + (((float*)(LIST).aptr)[1] = (float)(VAL)), \
69 @@ -1300,10 +1298,8 @@
70 ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
71 (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
73 - && ((LIST).farg_mask |= (-1 << (LIST).anum), \
74 - (LIST).darg_mask |= (-1 << (LIST).anum))), \
75 + && ((LIST).darg_mask |= (-1 << (LIST).anum))), \
76 (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(long)sizeof(__avword))/sizeof(__avword),\
77 - (LIST).farg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, \
78 (LIST).darg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, \
81 Index: avcall/avcall-sparc64.c
82 ===================================================================
83 RCS file: /sources/libffcall/ffcall/avcall/avcall-sparc64.c,v
84 retrieving revision 1.3
85 diff -u -r1.3 avcall-sparc64.c
86 --- avcall/avcall-sparc64.c 23 May 2005 10:17:21 -0000 1.3
87 +++ avcall/avcall-sparc64.c 11 Mar 2008 21:52:42 -0000
89 #define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL))
90 #define OFFSETOF(struct,member) ((int)&(((struct*)0)->member))
92 -register void* callee __asm__("%g2"); /* any global or local register */
93 register __avword o0 __asm__("%o0");
94 register __avword o1 __asm__("%o1");
95 register __avword o2 __asm__("%o2");
97 register double dret __asm__("%f0"); /* %f0,%f1 */
99 __avword trampoline[6]; /* room for a trampoline */
100 - __avword space[__AV_ALIST_WORDS]; /* space for callee's stack frame */
101 - __avword *argframe = sp + 17; /* stack offset for argument list */
102 int arglen = l->aptr - l->args;
105 - if (l->farg_mask) {
106 - /* push leading float args */
107 - if (l->farg_mask & (1<<0))
108 - __asm__("ld %1(%0),%%f1" : : "p" (l), "i" OFFSETOF(av_alist,args[0]));
109 - if (l->farg_mask & (1<<1))
110 - __asm__("ld %1(%0),%%f3" : : "p" (l), "i" OFFSETOF(av_alist,args[1]));
111 - if (l->farg_mask & (1<<2))
112 - __asm__("ld %1(%0),%%f5" : : "p" (l), "i" OFFSETOF(av_alist,args[2]));
113 - if (l->farg_mask & (1<<3))
114 - __asm__("ld %1(%0),%%f7" : : "p" (l), "i" OFFSETOF(av_alist,args[3]));
115 - if (l->farg_mask & (1<<4))
116 - __asm__("ld %1(%0),%%f9" : : "p" (l), "i" OFFSETOF(av_alist,args[4]));
117 - if (l->farg_mask & (1<<5))
118 - __asm__("ld %1(%0),%%f11" : : "p" (l), "i" OFFSETOF(av_alist,args[5]));
119 - if (l->farg_mask & (1<<6))
120 - __asm__("ld %1(%0),%%f13" : : "p" (l), "i" OFFSETOF(av_alist,args[6]));
121 - if (l->farg_mask & (1<<7))
122 - __asm__("ld %1(%0),%%f15" : : "p" (l), "i" OFFSETOF(av_alist,args[7]));
123 - if (l->farg_mask & (1<<8))
124 - __asm__("ld %1(%0),%%f17" : : "p" (l), "i" OFFSETOF(av_alist,args[8]));
125 - if (l->farg_mask & (1<<9))
126 - __asm__("ld %1(%0),%%f19" : : "p" (l), "i" OFFSETOF(av_alist,args[9]));
127 - if (l->farg_mask & (1<<10))
128 - __asm__("ld %1(%0),%%f21" : : "p" (l), "i" OFFSETOF(av_alist,args[10]));
129 - if (l->farg_mask & (1<<11))
130 - __asm__("ld %1(%0),%%f23" : : "p" (l), "i" OFFSETOF(av_alist,args[11]));
131 - if (l->farg_mask & (1<<12))
132 - __asm__("ld %1(%0),%%f25" : : "p" (l), "i" OFFSETOF(av_alist,args[12]));
133 - if (l->farg_mask & (1<<13))
134 - __asm__("ld %1(%0),%%f27" : : "p" (l), "i" OFFSETOF(av_alist,args[13]));
135 - if (l->farg_mask & (1<<14))
136 - __asm__("ld %1(%0),%%f29" : : "p" (l), "i" OFFSETOF(av_alist,args[14]));
137 - if (l->farg_mask & (1<<15))
138 - __asm__("ld %1(%0),%%f31" : : "p" (l), "i" OFFSETOF(av_alist,args[15]));
141 - /* push leading double args */
142 + /* push leading float/double args */
143 if (l->darg_mask & (1<<0))
144 - __asm__("ldd %1(%0),%%f0" : : "p" (l), "i" OFFSETOF(av_alist,args[0]));
145 + __asm__("ldd [%0+%1],%%f0" : : "p" (l), "i" OFFSETOF(av_alist,args[0]));
146 if (l->darg_mask & (1<<1))
147 - __asm__("ldd %1(%0),%%f2" : : "p" (l), "i" OFFSETOF(av_alist,args[1]));
148 + __asm__("ldd [%0+%1],%%f2" : : "p" (l), "i" OFFSETOF(av_alist,args[1]));
149 if (l->darg_mask & (1<<2))
150 - __asm__("ldd %1(%0),%%f4" : : "p" (l), "i" OFFSETOF(av_alist,args[2]));
151 + __asm__("ldd [%0+%1],%%f4" : : "p" (l), "i" OFFSETOF(av_alist,args[2]));
152 if (l->darg_mask & (1<<3))
153 - __asm__("ldd %1(%0),%%f6" : : "p" (l), "i" OFFSETOF(av_alist,args[3]));
154 + __asm__("ldd [%0+%1],%%f6" : : "p" (l), "i" OFFSETOF(av_alist,args[3]));
155 if (l->darg_mask & (1<<4))
156 - __asm__("ldd %1(%0),%%f8" : : "p" (l), "i" OFFSETOF(av_alist,args[4]));
157 + __asm__("ldd [%0+%1],%%f8" : : "p" (l), "i" OFFSETOF(av_alist,args[4]));
158 if (l->darg_mask & (1<<5))
159 - __asm__("ldd %1(%0),%%f10" : : "p" (l), "i" OFFSETOF(av_alist,args[5]));
160 + __asm__("ldd [%0+%1],%%f10" : : "p" (l), "i" OFFSETOF(av_alist,args[5]));
161 if (l->darg_mask & (1<<6))
162 - __asm__("ldd %1(%0),%%f12" : : "p" (l), "i" OFFSETOF(av_alist,args[6]));
163 + __asm__("ldd [%0+%1],%%f12" : : "p" (l), "i" OFFSETOF(av_alist,args[6]));
164 if (l->darg_mask & (1<<7))
165 - __asm__("ldd %1(%0),%%f14" : : "p" (l), "i" OFFSETOF(av_alist,args[7]));
166 + __asm__("ldd [%0+%1],%%f14" : : "p" (l), "i" OFFSETOF(av_alist,args[7]));
167 if (l->darg_mask & (1<<8))
168 - __asm__("ldd %1(%0),%%f16" : : "p" (l), "i" OFFSETOF(av_alist,args[8]));
169 + __asm__("ldd [%0+%1],%%f16" : : "p" (l), "i" OFFSETOF(av_alist,args[8]));
170 if (l->darg_mask & (1<<9))
171 - __asm__("ldd %1(%0),%%f18" : : "p" (l), "i" OFFSETOF(av_alist,args[9]));
172 + __asm__("ldd [%0+%1],%%f18" : : "p" (l), "i" OFFSETOF(av_alist,args[9]));
173 if (l->darg_mask & (1<<10))
174 - __asm__("ldd %1(%0),%%f20" : : "p" (l), "i" OFFSETOF(av_alist,args[10]));
175 + __asm__("ldd [%0+%1],%%f20" : : "p" (l), "i" OFFSETOF(av_alist,args[10]));
176 if (l->darg_mask & (1<<11))
177 - __asm__("ldd %1(%0),%%f22" : : "p" (l), "i" OFFSETOF(av_alist,args[11]));
178 + __asm__("ldd [%0+%1],%%f22" : : "p" (l), "i" OFFSETOF(av_alist,args[11]));
179 if (l->darg_mask & (1<<12))
180 - __asm__("ldd %1(%0),%%f24" : : "p" (l), "i" OFFSETOF(av_alist,args[12]));
181 + __asm__("ldd [%0+%1],%%f24" : : "p" (l), "i" OFFSETOF(av_alist,args[12]));
182 if (l->darg_mask & (1<<13))
183 - __asm__("ldd %1(%0),%%f26" : : "p" (l), "i" OFFSETOF(av_alist,args[13]));
184 + __asm__("ldd [%0+%1],%%f26" : : "p" (l), "i" OFFSETOF(av_alist,args[13]));
185 if (l->darg_mask & (1<<14))
186 - __asm__("ldd %1(%0),%%f28" : : "p" (l), "i" OFFSETOF(av_alist,args[14]));
187 + __asm__("ldd [%0+%1],%%f28" : : "p" (l), "i" OFFSETOF(av_alist,args[14]));
188 if (l->darg_mask & (1<<15))
189 - __asm__("ldd %1(%0),%%f30" : : "p" (l), "i" OFFSETOF(av_alist,args[15]));
190 + __asm__("ldd [%0+%1],%%f30" : : "p" (l), "i" OFFSETOF(av_alist,args[15]));
195 + /* alloca space is separated from the extra outgoing args area by
196 + * the area for compiler temps (addressable with postive offsets from sp)
197 + * but they shouldn't be needed for this function, so, effectively,
198 + * space returned by alloca is safe to use as the area for extra args.
200 + void *extra_args_area = __builtin_alloca(sizeof(__avword) * (arglen - 6));
201 + __avword *argframe = (__avword *)extra_args_area - 6;
203 + /* "by construction" */
204 + assert(argframe == (void *)((unsigned long)(sp + 16)+2047));
208 for (i = 6; i < arglen; i++) /* push excess function args */
209 argframe[i] = l->args[i];
211 i = ({ register __avword iret __asm__ ("%o0");
212 iret = (*l->func)(l->args[0], l->args[1], l->args[2],
213 l->args[3], l->args[4], l->args[5]);
214 - asm ("nop"); /* struct returning functions skip this instruction */
215 + asm __volatile__("nop"); /* struct returning functions skip this instruction */
219 --- avcall/avcall-sparc64.S.orig 2005-05-23 12:17:21.000000000 +0200
220 +++ avcall/avcall-sparc64.S 2008-10-09 22:10:17.000000000 +0200
222 #include "asmsparc.h"
223 .file "avcall-sparc64.c"
229 .global __builtin_avcall
230 DECLARE_FUNCTION(__builtin_avcall)
231 - .type __builtin_avcall,$function
235 - save %sp, -2288, %sp
294 + .register %g2, $scratch
295 + .register %g3, $scratch
296 + save %sp, -192, %sp
305 + bne,pt %xcc, .LL161
307 + bne,pt %xcc, .LL162
310 + bne,pt %xcc, .LL163
313 + bne,pt %xcc, .LL164
316 + bne,pt %xcc, .LL165
319 + bne,pt %xcc, .LL166
322 + bne,pt %xcc, .LL167
323 + andcc %g3, 128, %g0
325 + bne,pt %xcc, .LL168
326 + andcc %g3, 256, %g0
328 + bne,pt %xcc, .LL169
329 + andcc %g3, 512, %g0
331 + bne,pt %xcc, .LL170
332 + andcc %g3, 1024, %g0
334 + bne,pt %xcc, .LL171
335 + andcc %g3, 2048, %g0
337 + bne,pt %xcc, .LL172
338 + sethi %hi(4096), %g1
340 + andcc %g3, %g1, %g0
341 + bne,pt %icc, .LL173
342 + sethi %hi(8192), %g1
344 + andcc %g3, %g1, %g0
345 + bne,pt %icc, .LL174
346 + sethi %hi(16384), %g1
348 + andcc %g3, %g1, %g0
349 + bne,pt %icc, .LL175
350 + sethi %hi(32768), %g1
352 + andcc %g3, %g1, %g0
353 + bne,pt %icc, .LL176
375 + be,a,pt %icc, .LL214
411 + andcc %g1, 512, %g0
424 + bneg,pn %icc, .LL38
449 + ble,a,pt %icc, .LL212
480 - be,a,pn %icc, .LL170
494 - sethi %hi(4096), %g3
496 - sethi %hi(4096), %g3
498 + andcc %g3, 256, %g0
500 + andcc %g3, 512, %g0
505 + andcc %g3, 128, %g0
507 + andcc %g3, 256, %g0
514 + andcc %g3, 128, %g0
553 - andcc %o7, %g3, %g0
555 - sethi %hi(8192), %g3
557 - sethi %hi(8192), %g3
559 - andcc %o7, %g3, %g0
561 - sethi %hi(16384), %g3
563 - sethi %hi(16384), %g3
565 + sethi %hi(4096), %g1
566 + andcc %g3, %g1, %g0
568 + sethi %hi(8192), %g1
573 + andcc %g3, 2048, %g0
575 + sethi %hi(4096), %g1
580 + andcc %g3, 1024, %g0
582 + andcc %g3, 2048, %g0
587 + andcc %g3, 512, %g0
589 + andcc %g3, 1024, %g0
593 - andcc %o7, %g3, %g0
595 - sethi %hi(32768), %g3
597 - sethi %hi(32768), %g3
599 + sethi %hi(16384), %g1
600 + andcc %g3, %g1, %g0
602 + sethi %hi(32768), %g1
607 + sethi %hi(8192), %g1
608 + andcc %g3, %g1, %g0
610 + sethi %hi(16384), %g1
614 - andcc %o7, %g3, %g0
615 - be,a,pn %icc, .LL176
637 + sethi %hi(32768), %g1
638 + andcc %g3, %g1, %g0
903 - sethi %hi(4096), %g3
905 - sethi %hi(4096), %g3
907 - andcc %o7, %g3, %g0
909 - sethi %hi(8192), %g3
911 - sethi %hi(8192), %g3
913 - andcc %o7, %g3, %g0
915 - sethi %hi(16384), %g3
917 - sethi %hi(16384), %g3
919 - andcc %o7, %g3, %g0
921 - sethi %hi(32768), %g3
923 - sethi %hi(32768), %g3
925 - andcc %o7, %g3, %g0
933 - bge,a,pt %icc, .LL193
992 - be,a,pn %icc, .LL194
1000 - bne,pt %icc, .LL68
1006 - bne,pt %icc, .LL70
1012 - bne,pt %icc, .LL72
1285 - bne,pt %icc, .LL43
1294 - bne,pt %xcc, .LL76
1301 - bne,pt %xcc, .LL78
1308 - bne,pt %xcc, .LL80
1315 - bne,pt %xcc, .LL82
1330 - ldx [%g1+%l0], %g3
1332 - stx %g3, [%o7+%l0]
1334 - bge,pt %icc, .LL86
1345 - bgu,pn %xcc, .LL43
1347 - bne,pt %xcc, .LL91
1354 - bne,pt %xcc, .LL93
1364 - bne,pt %xcc, .LL95
1377 - bne,pt %xcc, .LL97
1393 - bne,pt %xcc, .LL99
1412 - bne,pt %xcc, .LL101
1434 - bne,pt %xcc, .LL103
1460 - bgu,pn %xcc, .LL43
1488 - bne,pt %xcc, .LL108
1495 - bne,pt %xcc, .LL110
1505 - bne,pt %xcc, .LL112
1518 - bne,pt %xcc, .LL114
1534 - bne,pt %xcc, .LL116
1553 - bne,pt %xcc, .LL118
1575 - bne,pt %xcc, .LL120
1601 - bgu,pn %xcc, .LL43
1629 - bne,pt %xcc, .LL125
1636 - bne,pt %xcc, .LL127
1646 - bne,pt %xcc, .LL129
1659 - bne,pt %xcc, .LL131
1675 - bne,pt %xcc, .LL133
1694 - bne,pt %xcc, .LL135
1716 - bne,pt %xcc, .LL137
1742 - bgu,pn %xcc, .LL43
1770 - bne,pt %xcc, .LL142
1777 - bne,pt %xcc, .LL144
1787 - bne,pt %xcc, .LL146
1800 - bne,pt %xcc, .LL148
1816 - bne,pt %xcc, .LL150
1835 - bne,pt %xcc, .LL152
1857 - bne,pt %xcc, .LL154
1882 - bne,pt %xcc, .LL43
2030 - restore %g0, 0, %o0
2032 - .size __builtin_avcall,.LLfe1-__builtin_avcall
2033 - .ident "GCC: (GNU) 2.95.2 19991024 (release)"
2045 + .size __builtin_avcall, .-__builtin_avcall
2046 + .ident "GCC: (GNU) 4.1.3 20070620 prerelease (NetBSD nb1 20070620)"