35 /* BEGIN CSTYLED */
36
37 /*
38 * Disable amd64 assembly code profiling for now.
39 */
40 #if defined(__amd64)
41 #undef PROF
42 #endif
43
44 #include <sys/asm_linkage.h>
45
46 #define NAME(x) x
47 #define TEXT .section ".text"
48 #define DATA .section ".data"
49 #define RO_DATA .section ".rodata"
50 #define IDENT(x) .ident x
51
52 #if defined(__sparc)
53
54 #define LIBM_ANSI_PRAGMA_WEAK(sym,stype) \
55 .weak sym; \
56 .type sym,#stype; \
57 sym = __/**/sym
58
59 #ifndef SET_FILE
60 #define SET_FILE(x) \
61 .file x
62 #endif /* !defined(SET_FILE) */
63
64 #ifdef PIC
65 /*
66 * One should *never* pass o7 to PIC_SETUP.
67 */
68 #define PIC_SETUP(via) \
69 9: call 8f; \
70 sethi %hi(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
71 8: or %via,%lo(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
72 add %via,%o7,%via
73 /*
74 * Must save/restore %o7 in leaf routines; may *not* use jmpl!
75 */
76 #define PIC_LEAF_SETUP(via) \
77 or %g0,%o7,%g1; \
134 restore; \
135 .common .L_/**/x/**/1,8,8
136 #else /* PIC13 */
137 #define MCOUNT_SIZE (8*4) /* 8 instructions */
138 #define MCOUNT(x) \
139 save %sp,-SA(MINFRAME),%sp; \
140 1: call .+8; \
141 sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
142 add %o0,%lo(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
143 add %o0,%o7,%o0; \
144 call _mcount; \
145 ldx [%o0+%lo(.L_/**/x/**/1)],%o0; \
146 restore; \
147 .common .L_/**/x/**/1,8,8
148 #endif /* !defined(PIC) */
149 #endif /* defined(PROF) && defined(__sparcv9) */
150
151 #elif defined(__x86)
152
153 #define LIBM_ANSI_PRAGMA_WEAK(sym,stype) \
154 .weak sym; \
155 .type sym,@stype; \
156 sym = __/**/sym
157
158 #ifdef PIC
159 #if defined(__amd64)
160 #define PIC_SETUP(x)
161 #define PIC_WRAPUP
162 #define PIC_F(x) x@PLT
163 #define PIC_G(x) x@GOTPCREL(%rip)
164 #define PIC_L(x) x(%rip)
165 #define PIC_G_LOAD(insn,sym,dst) \
166 movq PIC_G(sym),%dst; \
167 insn (%dst),%dst
168 #else
169 #define PIC_SETUP(label) \
170 pushl %ebx; \
171 call .label; \
172 .label: popl %ebx; \
173 addl $_GLOBAL_OFFSET_TABLE_+[.-.label],%ebx
174 #define PIC_WRAPUP popl %ebx
175 #define PIC_F(x) x@PLT
176 #define PIC_G(x) x@GOT(%ebx)
179 mov PIC_G(sym),%dst; \
180 insn (%dst),%dst
181 #endif
182 #else /* defined(PIC) */
183 #define PIC_SETUP(x)
184 #define PIC_WRAPUP
185 #define PIC_F(x) x
186 #define PIC_G(x) x
187 #define PIC_L(x) x
188 #define PIC_G_LOAD(insn,sym,dst) insn sym,%dst
189 #endif /* defined(PIC) */
190
191 #else
192 #error Unknown architecture
193 #endif
194
195 /* END CSTYLED */
196 #else /* defined(_ASM) */
197
198 #include "libm_macros.h"
199 #include "libm_synonyms.h"
200 #include "libm_protos.h"
201 #include "libm_inlines.h"
202 #include <math.h>
203 #if defined(__SUNPRO_C)
204 #include <sunmath.h>
205 #endif
206
207 #endif /* defined(_ASM) */
208
209 #endif /* _LIBM_H */
|
35 /* BEGIN CSTYLED */
36
37 /*
38 * Disable amd64 assembly code profiling for now.
39 */
40 #if defined(__amd64)
41 #undef PROF
42 #endif
43
44 #include <sys/asm_linkage.h>
45
46 #define NAME(x) x
47 #define TEXT .section ".text"
48 #define DATA .section ".data"
49 #define RO_DATA .section ".rodata"
50 #define IDENT(x) .ident x
51
52 #if defined(__sparc)
53
54 #define LIBM_ANSI_PRAGMA_WEAK(sym,stype) \
55 .weak __/**/sym; \
56 .type __/**/sym,#stype; \
57 __/**/sym = sym
58
59 #ifndef SET_FILE
60 #define SET_FILE(x) \
61 .file x
62 #endif /* !defined(SET_FILE) */
63
64 #ifdef PIC
65 /*
66 * One should *never* pass o7 to PIC_SETUP.
67 */
68 #define PIC_SETUP(via) \
69 9: call 8f; \
70 sethi %hi(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
71 8: or %via,%lo(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
72 add %via,%o7,%via
73 /*
74 * Must save/restore %o7 in leaf routines; may *not* use jmpl!
75 */
76 #define PIC_LEAF_SETUP(via) \
77 or %g0,%o7,%g1; \
134 restore; \
135 .common .L_/**/x/**/1,8,8
136 #else /* PIC13 */
137 #define MCOUNT_SIZE (8*4) /* 8 instructions */
138 #define MCOUNT(x) \
139 save %sp,-SA(MINFRAME),%sp; \
140 1: call .+8; \
141 sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
142 add %o0,%lo(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
143 add %o0,%o7,%o0; \
144 call _mcount; \
145 ldx [%o0+%lo(.L_/**/x/**/1)],%o0; \
146 restore; \
147 .common .L_/**/x/**/1,8,8
148 #endif /* !defined(PIC) */
149 #endif /* defined(PROF) && defined(__sparcv9) */
150
151 #elif defined(__x86)
152
153 #define LIBM_ANSI_PRAGMA_WEAK(sym,stype) \
154 .weak __/**/sym; \
155 .type __/**/sym,@stype; \
156 __/**/sym = sym
157
158 #ifdef PIC
159 #if defined(__amd64)
160 #define PIC_SETUP(x)
161 #define PIC_WRAPUP
162 #define PIC_F(x) x@PLT
163 #define PIC_G(x) x@GOTPCREL(%rip)
164 #define PIC_L(x) x(%rip)
165 #define PIC_G_LOAD(insn,sym,dst) \
166 movq PIC_G(sym),%dst; \
167 insn (%dst),%dst
168 #else
169 #define PIC_SETUP(label) \
170 pushl %ebx; \
171 call .label; \
172 .label: popl %ebx; \
173 addl $_GLOBAL_OFFSET_TABLE_+[.-.label],%ebx
174 #define PIC_WRAPUP popl %ebx
175 #define PIC_F(x) x@PLT
176 #define PIC_G(x) x@GOT(%ebx)
179 mov PIC_G(sym),%dst; \
180 insn (%dst),%dst
181 #endif
182 #else /* defined(PIC) */
183 #define PIC_SETUP(x)
184 #define PIC_WRAPUP
185 #define PIC_F(x) x
186 #define PIC_G(x) x
187 #define PIC_L(x) x
188 #define PIC_G_LOAD(insn,sym,dst) insn sym,%dst
189 #endif /* defined(PIC) */
190
191 #else
192 #error Unknown architecture
193 #endif
194
195 /* END CSTYLED */
196 #else /* defined(_ASM) */
197
198 #include "libm_macros.h"
199 #include "libm_protos.h"
200 #include "libm_inlines.h"
201 #include <math.h>
202 #if defined(__SUNPRO_C)
203 #include <sunmath.h>
204 #endif
205
206 #endif /* defined(_ASM) */
207
208 #endif /* _LIBM_H */
|