1/* Wrapper implementations of vector math functions.
2 Copyright (C) 2014-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* SSE2 ISA version as wrapper to scalar. */
20.macro WRAPPER_IMPL_SSE2 callee
21 subq $24, %rsp
22 cfi_adjust_cfa_offset (24)
23 movaps %xmm0, (%rsp)
24 call JUMPTARGET(\callee)
25 movsd %xmm0, (%rsp)
26 movsd 8(%rsp), %xmm0
27 call JUMPTARGET(\callee)
28 movsd (%rsp), %xmm1
29 unpcklpd %xmm0, %xmm1
30 movaps %xmm1, %xmm0
31 addq $24, %rsp
32 cfi_adjust_cfa_offset (-24)
33 ret
34.endm
35
36
37/* 2 argument SSE2 ISA version as wrapper to scalar. */
38.macro WRAPPER_IMPL_SSE2_ff callee
39 subq $40, %rsp
40 cfi_adjust_cfa_offset (40)
41 movaps %xmm0, (%rsp)
42 movaps %xmm1, 16(%rsp)
43 call JUMPTARGET(\callee)
44 movsd %xmm0, (%rsp)
45 movsd 8(%rsp), %xmm0
46 movsd 24(%rsp), %xmm1
47 call JUMPTARGET(\callee)
48 movsd (%rsp), %xmm1
49 unpcklpd %xmm0, %xmm1
50 movaps %xmm1, %xmm0
51 addq $40, %rsp
52 cfi_adjust_cfa_offset (-40)
53 ret
54.endm
55
56/* 3 argument SSE2 ISA version as wrapper to scalar. */
57.macro WRAPPER_IMPL_SSE2_fFF callee
58 pushq %rbp
59 cfi_adjust_cfa_offset (8)
60 cfi_rel_offset (%rbp, 0)
61 pushq %rbx
62 cfi_adjust_cfa_offset (8)
63 cfi_rel_offset (%rbx, 0)
64 subq $24, %rsp
65 cfi_adjust_cfa_offset (24)
66 movaps %xmm0, (%rsp)
67 movq %rdi, %rbp
68 movq %rsi, %rbx
69 call JUMPTARGET(\callee)
70 movsd 8(%rsp), %xmm0
71 leaq 8(%rbp), %rdi
72 leaq 8(%rbx), %rsi
73 call JUMPTARGET(\callee)
74 addq $24, %rsp
75 cfi_adjust_cfa_offset (-24)
76 popq %rbx
77 cfi_adjust_cfa_offset (-8)
78 cfi_restore (%rbx)
79 popq %rbp
80 cfi_adjust_cfa_offset (-8)
81 cfi_restore (%rbp)
82 ret
83.endm
84
85#include "svml_sd_wrapper_impl.h"
86

source code of glibc/sysdeps/x86_64/fpu/svml_d_wrapper_impl.h