version 1.1.1.1, 2000/09/09 14:12:42 |
version 1.1.1.2, 2003/08/25 16:06:28 |
|
|
dnl AMD K6-2 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n, |
dnl AMD K6-2 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n, |
dnl mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations. |
dnl mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations. |
dnl |
|
dnl alignment dst/src1/src2, A=0mod8, N=4mod8 |
|
dnl A/A/A A/A/N A/N/A A/N/N N/A/A N/A/N N/N/A N/N/N |
|
dnl |
|
dnl K6-2 1.2 1.5 1.5 1.2 1.2 1.5 1.5 1.2 and,andn,ior,xor |
|
dnl K6-2 1.5 1.75 2.0 1.75 1.75 2.0 1.75 1.5 iorn,xnor |
|
dnl K6-2 1.75 2.0 2.0 2.0 2.0 2.0 2.0 1.75 nand,nior |
|
dnl |
|
dnl K6 1.5 1.68 1.75 1.2 1.75 1.75 1.68 1.5 and,andn,ior,xor |
|
dnl K6 2.0 2.0 2.25 2.25 2.25 2.25 2.0 2.0 iorn,xnor |
|
dnl K6 2.0 2.25 2.25 2.25 2.25 2.25 2.25 2.0 nand,nior |
|
|
|
|
dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
dnl Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
|
dnl |
dnl |
dnl This file is part of the GNU MP Library. |
dnl This file is part of the GNU MP Library. |
dnl |
dnl |
Line 32 dnl License along with the GNU MP Library; see the fi |
|
Line 20 dnl License along with the GNU MP Library; see the fi |
|
dnl not, write to the Free Software Foundation, Inc., 59 Temple Place - |
dnl not, write to the Free Software Foundation, Inc., 59 Temple Place - |
dnl Suite 330, Boston, MA 02111-1307, USA. |
dnl Suite 330, Boston, MA 02111-1307, USA. |
|
|
|
|
include(`../config.m4') |
include(`../config.m4') |
|
|
|
NAILS_SUPPORT(0-31) |
|
|
|
|
|
C alignment dst/src1/src2, A=0mod8, N=4mod8 |
|
C A/A/A A/A/N A/N/A A/N/N N/A/A N/A/N N/N/A N/N/N |
|
C |
|
C K6-2 1.2 1.5 1.5 1.2 1.2 1.5 1.5 1.2 and,andn,ior,xor |
|
C K6-2 1.5 1.75 2.0 1.75 1.75 2.0 1.75 1.5 iorn,xnor |
|
C K6-2 1.75 2.0 2.0 2.0 2.0 2.0 2.0 1.75 nand,nior |
|
C |
|
C K6 1.5 1.68 1.75 1.2 1.75 1.75 1.68 1.5 and,andn,ior,xor |
|
C K6 2.0 2.0 2.25 2.25 2.25 2.25 2.0 2.0 iorn,xnor |
|
C K6 2.0 2.25 2.25 2.25 2.25 2.25 2.25 2.0 nand,nior |
|
|
|
|
dnl M4_p and M4_i are the MMX and integer instructions |
dnl M4_p and M4_i are the MMX and integer instructions |
dnl M4_*_neg_dst means whether to negate the final result before writing |
dnl M4_*_neg_dst means whether to negate the final result before writing |
dnl M4_*_neg_src2 means whether to negate the src2 values before using them |
dnl M4_*_neg_src2 means whether to negate the src2 values before using them |
Line 55 define(`M4_i_neg_src2',`$7') |
|
Line 56 define(`M4_i_neg_src2',`$7') |
|
|
|
dnl xnor is done in "iorn" style because it's a touch faster than "nior" |
dnl xnor is done in "iorn" style because it's a touch faster than "nior" |
dnl style (the two are equivalent for xor). |
dnl style (the two are equivalent for xor). |
|
dnl |
|
dnl pandn can't be used with nails. |
|
|
M4_choose_op( and_n, pand,0,0, andl,0,0) |
M4_choose_op( and_n, pand,0,0, andl,0,0) |
M4_choose_op( andn_n, pandn,0,0, andl,0,1) |
ifelse(GMP_NAIL_BITS,0, |
|
`M4_choose_op(andn_n, pandn,0,0, andl,0,1)', |
|
`M4_choose_op(andn_n, pand,0,1, andl,0,1)') |
M4_choose_op( nand_n, pand,1,0, andl,1,0) |
M4_choose_op( nand_n, pand,1,0, andl,1,0) |
M4_choose_op( ior_n, por,0,0, orl,0,0) |
M4_choose_op( ior_n, por,0,0, orl,0,0) |
M4_choose_op( iorn_n, por,0,1, orl,0,1) |
M4_choose_op( iorn_n, por,0,1, orl,0,1) |
Line 105 defframe(PARAM_SRC1,8) |
|
Line 110 defframe(PARAM_SRC1,8) |
|
defframe(PARAM_DST, 4) |
defframe(PARAM_DST, 4) |
deflit(`FRAME',0) |
deflit(`FRAME',0) |
|
|
.text |
TEXT |
ALIGN(32) |
ALIGN(32) |
PROLOGUE(M4_function) |
PROLOGUE(M4_function) |
movl PARAM_SIZE, %ecx |
movl PARAM_SIZE, %ecx |
pushl %ebx |
pushl %ebx FRAME_pushl() |
FRAME_pushl() |
|
movl PARAM_SRC1, %eax |
movl PARAM_SRC1, %eax |
|
|
movl PARAM_SRC2, %ebx |
movl PARAM_SRC2, %ebx |
cmpl $1, %ecx |
cmpl $1, %ecx |
|
|
movl PARAM_DST, %edx |
movl PARAM_DST, %edx |
ja L(two_or_more) |
ja L(two_or_more) |
|
|
|
|
movl (%ebx), %ecx |
movl (%ebx), %ecx |
popl %ebx |
popl %ebx |
ifelse(M4_i_neg_src2,1,`notl %ecx') |
ifelse(M4_i_neg_src2,1,`notl_or_xorl_GMP_NUMB_MASK( %ecx)') |
M4_i (%eax), %ecx |
M4_i (%eax), %ecx |
ifelse(M4_i_neg_dst,1,` notl %ecx') |
ifelse(M4_i_neg_dst,1,` notl_or_xorl_GMP_NUMB_MASK( %ecx)') |
movl %ecx, (%edx) |
movl %ecx, (%edx) |
|
|
ret |
ret |
|
|
C esi |
C esi |
C edi |
C edi |
C ebp |
C ebp |
C |
|
C carry bit is low of size |
|
|
|
pushl %esi |
pushl %esi FRAME_pushl() |
FRAME_pushl() |
|
testl $4, %eax |
testl $4, %eax |
jz L(alignment_ok) |
jz L(alignment_ok) |
|
|
movl (%ebx), %esi |
movl (%ebx), %esi |
addl $4, %ebx |
addl $4, %ebx |
ifelse(M4_i_neg_src2,1,`notl %esi') |
ifelse(M4_i_neg_src2,1,`notl_or_xorl_GMP_NUMB_MASK( %esi)') |
M4_i (%eax), %esi |
M4_i (%eax), %esi |
addl $4, %eax |
addl $4, %eax |
ifelse(M4_i_neg_dst,1,` notl %esi') |
ifelse(M4_i_neg_dst,1,` notl_or_xorl_GMP_NUMB_MASK( %esi)') |
movl %esi, (%edx) |
movl %esi, (%edx) |
addl $4, %edx |
addl $4, %edx |
decl %ecx |
decl %ecx |
Line 161 L(alignment_ok): |
|
Line 165 L(alignment_ok): |
|
|
|
movl (%ebx), %ecx |
movl (%ebx), %ecx |
popl %esi |
popl %esi |
ifelse(M4_i_neg_src2,1,`notl %ecx') |
ifelse(M4_i_neg_src2,1,`notl_or_xorl_GMP_NUMB_MASK( %ecx)') |
M4_i (%eax), %ecx |
M4_i (%eax), %ecx |
ifelse(M4_i_neg_dst,1,` notl %ecx') |
ifelse(M4_i_neg_dst,1,` notl_or_xorl_GMP_NUMB_MASK( %ecx)') |
popl %ebx |
popl %ebx |
movl %ecx, (%edx) |
movl %ecx, (%edx) |
ret |
ret |
Line 171 ifelse(M4_i_neg_dst,1,` notl %ecx') |
|
Line 175 ifelse(M4_i_neg_dst,1,` notl %ecx') |
|
|
|
L(still_two_or_more): |
L(still_two_or_more): |
ifelse(eval(M4_p_neg_src2 || M4_p_neg_dst),1,` |
ifelse(eval(M4_p_neg_src2 || M4_p_neg_dst),1,` |
pcmpeqd %mm7, %mm7 C all ones |
pcmpeqd %mm7, %mm7 C all ones |
|
ifelse(GMP_NAIL_BITS,0,,`psrld $GMP_NAIL_BITS, %mm7') C clear nails |
') |
') |
|
|
ALIGN(16) |
ALIGN(16) |
Line 198 ifelse(M4_p_neg_dst,1,` pxor %mm7, %mm0') |
|
Line 203 ifelse(M4_p_neg_dst,1,` pxor %mm7, %mm0') |
|
jnc L(no_extra) |
jnc L(no_extra) |
|
|
movl -4(%ebx,%esi,4), %ebx |
movl -4(%ebx,%esi,4), %ebx |
ifelse(M4_i_neg_src2,1,`notl %ebx') |
ifelse(M4_i_neg_src2,1,`notl_or_xorl_GMP_NUMB_MASK( %ebx)') |
M4_i -4(%eax,%esi,4), %ebx |
M4_i -4(%eax,%esi,4), %ebx |
ifelse(M4_i_neg_dst,1,` notl %ebx') |
ifelse(M4_i_neg_dst,1,` notl_or_xorl_GMP_NUMB_MASK( %ebx)') |
movl %ebx, -4(%edx,%esi,4) |
movl %ebx, -4(%edx,%esi,4) |
L(no_extra): |
L(no_extra): |
|
|