2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
7 * Copyright (c) 2002 Advanced Micro Devices, Inc.
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the
13 * following conditions are met:
15 * + Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the
17 * following disclaimer.
19 * + Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the
21 * following disclaimer in the documentation and/or other
22 * materials provided with the distribution.
24 * + Neither the name of Advanced Micro Devices, Inc. nor the
25 * names of its contributors may be used to endorse or
26 * promote products derived from this software without
27 * specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
30 * CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
31 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES,
34 * INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
41 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGE.
44 * It is licensee's responsibility to comply with any export
45 * regulations applicable in licensee's jurisdiction.
50 #include <sys/asm_linkage.h>
52 ANSI_PRAGMA_WEAK
(memcmp
,function
)
57 #define LABEL(s) .memcmp##s
59 ENTRY
(memcmp
) /* (const void *, const void*, size_t) */
65 LABEL
(1): /* 1-byte */
95 LABEL
(8): /* 8-byte */
130 LABEL
(32): /* 32-byte */
171 prefetchnta _sref_
(.amd64cache1half) /* 3DNow: use prefetch */
174 mov
%esi
, %r8d
/* align by source */
177 jz LABEL
(srcafter
) /* not unaligned */
179 LABEL
(src
): /* align */
180 lea
-8 (%r8, %rdx
), %rdx
202 mov _sref_
(.amd64cache1half), %rcx
206 LABEL
(64): /* 64-byte */
266 LABEL
(pre
): /* 64-byte prefetching */
267 mov _sref_
(.amd64cache2half), %rcx
274 prefetchnta
512 (%rsi
) /* 3DNow: use prefetch */
275 prefetchnta
512 (%rdi
) /* 3DNow: use prefetch */
314 prefetchnta
512 (%rsi
) /* 3DNow: use prefetch */
315 prefetchnta
512 (%rdi
) /* 3DNow: use prefetch */
369 LABEL
(128): /* 128-byte */
377 prefetchnta
512 (%rsi
) /* 3DNow: use prefetch */
378 prefetchnta
512 (%rdi
) /* 3DNow: use prefetch */
409 prefetchnta
576 (%rsi
) /* 3DNow: use prefetch */
410 prefetchnta
576 (%rdi
) /* 3DNow: use prefetch */