1 dnl AMD64 SSE mpn_sec_tabselect.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright
2011-2013 Free Software Foundation
, Inc.
7 dnl
This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
10 dnl it under the terms of
either:
12 dnl
* the GNU Lesser General
Public License as published by the Free
13 dnl Software Foundation
; either version 3 of the License, or (at your
14 dnl option
) any later version.
18 dnl
* the GNU General
Public License as published by the Free Software
19 dnl Foundation
; either version 2 of the License, or (at your option) any
22 dnl
or both
in parallel
, as here.
24 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
25 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
26 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
29 dnl You should have received copies of the GNU General
Public License
and the
30 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
31 dnl see
https://www.gnu.
org/licenses
/.
33 include(`..
/config.m4
')
36 C cycles/limb cycles/limb cycles/limb
37 C ali,evn n unal,evn n other cases
38 C AMD K8,K9 1.65 1.65 1.8
39 C AMD K10 0.78 0.78 0.85
40 C AMD bd1 0.80 0.91 1.25
41 C AMD bobcat 2.15 2.15 2.37
42 C Intel P4 2.5 2.5 2.95
43 C Intel core2 1.17 1.25 1.25
44 C Intel NHM 0.87 0.90 0.90
45 C Intel SBR 0.63 0.79 0.77
46 C Intel atom 4.3 4.3 4.3 slower than plain code
47 C VIA nano 1.4 5.1 3.14 too alignment dependent
50 C * We only honour the least significant 32 bits of the `which' and `nents
'
51 C arguments to allow efficient code using just SSE2. We would need to
52 C either use the SSE4_1 pcmpeqq, or find some other SSE2 sequence.
53 C * We use movd for copying between xmm and plain registers, since old gas
54 C rejects movq. But gas assembles movd as movq when given a 64-bit greg.
59 define(`nents', `
%rcx
')
60 define(`which', `
%r8
')
65 C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
66 C nents n rp tab which j i temp * * * *
74 PROLOGUE(mpn_sec_tabselect)
76 IFDOS(` mov 56(%rsp), %r8d ')
79 pshufd
$0, %xmm8
, %xmm8 C
4 `which
' copies
82 pshufd $0, %xmm9, %xmm9 C 4 copies of 1
97 L(top): movdqa %xmm8, %xmm0
135 L(tp4): movdqa %xmm8, %xmm0
136 pcmpeqd %xmm13, %xmm0
152 L(b0xx):test $2, R8(n)
159 L(tp2): movdqa %xmm8, %xmm0
160 pcmpeqd %xmm13, %xmm0
172 L(b00x):test $1, R8(n)
179 L(tp1): movdqa %xmm8, %xmm0
180 pcmpeqd %xmm13, %xmm0