]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libgcc/config/i386/i386-asm.h
1 /* Defines common perprocessor and assembly macros for use by various stubs.
2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
3 Contributed by Daniel Santos <daniel.santos@pobox.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
29 #include "auto-host.h"
31 #define PASTE2(a, b) PASTE2a(a, b)
32 #define PASTE2a(a, b) a ## b
34 /* These macros currently support GNU/Linux, Solaris and Darwin. */
37 # define FN_TYPE(fn) .type fn,@function
38 # define FN_SIZE(fn) .size fn,.-fn
39 # ifdef HAVE_GAS_HIDDEN
40 # define FN_HIDDEN(fn) .hidden fn
48 # define FN_HIDDEN(fn)
51 #ifdef __USER_LABEL_PREFIX__
52 # define ASMNAME(name) PASTE2(__USER_LABEL_PREFIX__, name)
54 # define ASMNAME(name) name
57 #define FUNC_BEGIN(fn) \
59 FN_TYPE (ASMNAME(fn)); \
62 #define HIDDEN_FUNC(fn) \
64 FN_TYPE(ASMNAME(fn)); \
65 FN_HIDDEN(ASMNAME(fn)); \
68 #define FUNC_END(fn) FN_SIZE(ASMNAME(fn))
70 #ifdef MS2SYSV_STUB_AVX
71 # define MS2SYSV_STUB_PREFIX __avx_
72 # define MOVAPS vmovaps
73 #elif defined(MS2SYSV_STUB_SSE)
74 # define MS2SYSV_STUB_PREFIX __sse_
75 # define MOVAPS movaps
78 #if defined (MS2SYSV_STUB_PREFIX) && defined (MOVAPS)
80 # define MS2SYSV_STUB_BEGIN(base_name) \
81 HIDDEN_FUNC(PASTE2(MS2SYSV_STUB_PREFIX, base_name))
83 # define MS2SYSV_STUB_END(base_name) \
84 FUNC_END(PASTE2(MS2SYSV_STUB_PREFIX, base_name))
86 /* Save SSE registers 6-15. off is the offset of rax to get to xmm6. */
88 MOVAPS %xmm15,-0x30(%rax); \
89 MOVAPS %xmm14,-0x20(%rax); \
90 MOVAPS %xmm13,-0x10(%rax); \
91 MOVAPS %xmm12, (%rax); \
92 MOVAPS %xmm11, 0x10(%rax); \
93 MOVAPS %xmm10, 0x20(%rax); \
94 MOVAPS %xmm9, 0x30(%rax); \
95 MOVAPS %xmm8, 0x40(%rax); \
96 MOVAPS %xmm7, 0x50(%rax); \
97 MOVAPS %xmm6, 0x60(%rax)
99 /* Restore SSE registers 6-15. off is the offset of rsi to get to xmm6. */
100 # define SSE_RESTORE \
101 MOVAPS -0x30(%rsi), %xmm15; \
102 MOVAPS -0x20(%rsi), %xmm14; \
103 MOVAPS -0x10(%rsi), %xmm13; \
104 MOVAPS (%rsi), %xmm12; \
105 MOVAPS 0x10(%rsi), %xmm11; \
106 MOVAPS 0x20(%rsi), %xmm10; \
107 MOVAPS 0x30(%rsi), %xmm9 ; \
108 MOVAPS 0x40(%rsi), %xmm8 ; \
109 MOVAPS 0x50(%rsi), %xmm7 ; \
110 MOVAPS 0x60(%rsi), %xmm6
112 #endif /* defined (MS2SYSV_STUB_ISA) && defined (MOVAPS) */
113 #endif /* I386_ASM_H */