This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/14] [x86_64] Vector math functions (vector cos)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 15 May 2015 16:32:34 +0000
- Subject: Re: [PATCH 1/14] [x86_64] Vector math functions (vector cos)
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3t+v7zYEmvWQxV9aRmJB6Ag2hQgQ56cZJTDy=siRBszDw at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1504301541120 dot 23221 at digraph dot polyomino dot org dot uk> <CAMXFM3sVJ6vkEF7RqrrHczJSdF_-gr9Xog-zFcG3rjhOqgqjDw at mail dot gmail dot com>
On Fri, 15 May 2015, Andrew Senkevich wrote:
> diff --git a/include/libc-symbols.h b/include/libc-symbols.h
> index ca3fe00..8992e9e 100644
> --- a/include/libc-symbols.h
> +++ b/include/libc-symbols.h
> @@ -526,7 +526,7 @@ for linking")
> # define rtld_hidden_data_ver(local, name)
> #endif
>
> -#if IS_IN (libm)
> +#if IS_IN (libm) || IS_IN(libmvec)
> # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
> # define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
> # define libm_hidden_def(name) hidden_def (name)
I think it would be better to have a completely separate set of
libmvec_hidden_* definitions (sorry for misleading you in my previous
comments by referring to libm_hidden_*). Also remember the space before
'(' in the IS_IN call, and in other macro calls such as ENTRY, END and
libmvec_hidden_def.
> + jne .LBL_1_3
> +
> +.LBL_1_2:
> + movq %rbp, %rsp
> + cfi_def_cfa_register (%rsp)
> + popq %rbp
> + cfi_adjust_cfa_offset (-8)
> + cfi_restore (%rbp)
> + ret
> +
> +.LBL_1_3:
> + movups %xmm3, 192(%rsp)
This won't yield correct CFI at .LBL_1_3 and afterwards. At .LBL_1_3, the
correct CFI is the same as that at .LBL_1_2 - *not* the same as that at
the ret instruction. So you should do cfi_remember_state before the CFI
changes here, and cfi_restore_state after ret, for the CFI to be correct
for the rest of the function.
> + movups %xmm0, 256(%rsp)
> + je .LBL_1_2
> +
> + xorb %dl, %dl
> + xorl %eax, %eax
> + movups %xmm8, 112(%rsp)
> + movups %xmm9, 96(%rsp)
> + movups %xmm10, 80(%rsp)
> + movups %xmm11, 64(%rsp)
> + movups %xmm12, 48(%rsp)
> + movups %xmm13, 32(%rsp)
> + movups %xmm14, 16(%rsp)
> + movups %xmm15, (%rsp)
> + movq %rsi, 136(%rsp)
> + movq %rdi, 128(%rsp)
> + movq %r12, 168(%rsp)
> + movb %dl, %r12b
> + movq %r13, 160(%rsp)
> + movl %ecx, %r13d
> + movq %r14, 152(%rsp)
> + movl %eax, %r14d
> + movq %r15, 144(%rsp)
The ABI says that r12-r15 are callee-saved registers. That means you need
CFI describing when they are saved and restored (and again need
cfi_remember_state and cfi_restore_state to deal with how some code that's
physically after the restoration is logically before it, and so needs the
CFI describing how those registers are saved on the stack).
Similar issues apply with the CFI in other function implementations here.
--
Joseph S. Myers
joseph@codesourcery.com