]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / x86_64 / abi / ms-sysv / do-test.S
1 /* Assembly proxy functions for ms_abi tests.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 Contributed by Daniel Santos <daniel.santos@pobox.com>
4
5 This file is part of GCC.
6
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)
10 any later version.
11
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.
16
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.
20
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/>. */
25
26 #if defined(__x86_64__) && defined(__SSE2__)
27
28 /* These macros currently support GNU/Linux, Solaris and Darwin. */
29
30 #ifdef __ELF__
31 # define FN_TYPE(fn) .type fn,@function
32 # define FN_SIZE(fn) .size fn,.-fn
33 #else
34 # define FN_TYPE(fn)
35 # define FN_SIZE(fn)
36 #endif
37
38 #ifdef __USER_LABEL_PREFIX__
39 # define ASMNAME2(prefix, name) prefix ## name
40 # define ASMNAME1(prefix, name) ASMNAME2(prefix, name)
41 # define ASMNAME(name) ASMNAME1(__USER_LABEL_PREFIX__, name)
42 #else
43 # define ASMNAME(name) name
44 #endif
45
46 #define FUNC_BEGIN(fn) \
47 .globl ASMNAME(fn); \
48 FN_TYPE (ASMNAME(fn)); \
49 ASMNAME(fn):
50
51 #define FUNC_END(fn) FN_SIZE(ASMNAME(fn))
52
53 #ifdef __AVX__
54 # define MOVAPS vmovaps
55 #else
56 # define MOVAPS movaps
57 #endif
58
59 .text
60
61 FUNC_BEGIN(regs_to_mem)
62 MOVAPS %xmm6, (%r10)
63 MOVAPS %xmm7, 0x10(%r10)
64 MOVAPS %xmm8, 0x20(%r10)
65 MOVAPS %xmm9, 0x30(%r10)
66 MOVAPS %xmm10, 0x40(%r10)
67 MOVAPS %xmm11, 0x50(%r10)
68 MOVAPS %xmm12, 0x60(%r10)
69 MOVAPS %xmm13, 0x70(%r10)
70 MOVAPS %xmm14, 0x80(%r10)
71 MOVAPS %xmm15, 0x90(%r10)
72 mov %rsi, 0xa0(%r10)
73 mov %rdi, 0xa8(%r10)
74 mov %rbx, 0xb0(%r10)
75 mov %rbp, 0xb8(%r10)
76 mov %r12, 0xc0(%r10)
77 mov %r13, 0xc8(%r10)
78 mov %r14, 0xd0(%r10)
79 mov %r15, 0xd8(%r10)
80 retq
81 FUNC_END(regs_to_mem)
82
83 FUNC_BEGIN(mem_to_regs)
84 MOVAPS (%r10), %xmm6
85 MOVAPS 0x10(%r10),%xmm7
86 MOVAPS 0x20(%r10),%xmm8
87 MOVAPS 0x30(%r10),%xmm9
88 MOVAPS 0x40(%r10),%xmm10
89 MOVAPS 0x50(%r10),%xmm11
90 MOVAPS 0x60(%r10),%xmm12
91 MOVAPS 0x70(%r10),%xmm13
92 MOVAPS 0x80(%r10),%xmm14
93 MOVAPS 0x90(%r10),%xmm15
94 mov 0xa0(%r10),%rsi
95 mov 0xa8(%r10),%rdi
96 mov 0xb0(%r10),%rbx
97 mov 0xb8(%r10),%rbp
98 mov 0xc0(%r10),%r12
99 mov 0xc8(%r10),%r13
100 mov 0xd0(%r10),%r14
101 mov 0xd8(%r10),%r15
102 retq
103 FUNC_END(mem_to_regs)
104
105 # NOTE: Not MT safe
106 FUNC_BEGIN(do_test_unaligned)
107 # The below alignment checks are to verify correctness of the test
108 # its self.
109
110 # Verify that incoming stack is aligned + 8
111 test $0xf, %rsp
112 je ASMNAME(do_test_body)
113 int $3 # Stack not unaligned
114 FUNC_END(do_test_unaligned)
115
116 FUNC_BEGIN(do_test_aligned)
117 # Verify that incoming stack is aligned
118 test $0x8, %rsp
119 jne ASMNAME(do_test_body)
120 int $3 # Stack not aligned
121 FUNC_END(do_test_aligned)
122
123 #endif /* __x86_64__ */