1 /* Compare two memory blocks for differences in the first COUNT bytes.
2 Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #include "asm-syntax.h"
25 #define PARMS LINKAGE+4 /* Preserve EBX. */
27 #define BLK2 BLK1+PTR_SIZE
28 #define LEN BLK2+PTR_SIZE
29 #define ENTRANCE pushl %ebx; cfi_adjust_cfa_offset (4); \
30 cfi_rel_offset (ebx, 0); ENTER
31 #define RETURN popl %ebx; cfi_adjust_cfa_offset (-4); \
32 cfi_restore (ebx); LEAVE; ret
34 /* Load an entry in a jump table into EBX. TABLE is a jump table
35 with relative offsets. INDEX is a register contains the index
36 into the jump table. */
37 #define LOAD_JUMP_TABLE_ENTRY(TABLE, INDEX) \
38 /* We first load PC into EBX. */ \
39 call __i686.get_pc_thunk.bx; \
40 /* Get the address of the jump table. */ \
41 addl $(TABLE - .), %ebx; \
42 /* Get the entry and convert the relative offset to the \
43 absolute address. */ \
44 addl (%ebx,INDEX,4), %ebx
46 .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
47 .globl __i686.get_pc_thunk.bx
48 .hidden __i686.get_pc_thunk.bx
50 .type __i686.get_pc_thunk.bx,@function
51 __i686.get_pc_thunk.bx:
57 ENTRY (BP_SYM (memcmp))
66 movzbl (%eax), %ecx /* LEN == 1 */
73 cfi_adjust_cfa_offset (4)
74 cfi_rel_offset (ebx, 0)
80 cfi_adjust_cfa_offset (4)
81 cfi_rel_offset (ebx, 0)
83 jl L(bye) /* LEN == 0 */
86 cfi_adjust_cfa_offset (4)
88 cfi_rel_offset (esi, 0)
90 jge L(32bytesormore) /* LEN => 32 */
92 LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx)
135 cfi_adjust_cfa_offset (-4)
140 cfi_adjust_cfa_offset (8)
141 cfi_rel_offset (esi, 0)
142 cfi_rel_offset (ebx, 4)
179 movzbl -1(%esi), %eax
183 cfi_adjust_cfa_offset (-4)
188 cfi_adjust_cfa_offset (8)
189 cfi_rel_offset (esi, 0)
190 cfi_rel_offset (ebx, 4)
227 movzwl -2(%esi), %eax
228 movzwl -2(%edx), %ecx
234 cfi_adjust_cfa_offset (-4)
239 cfi_adjust_cfa_offset (8)
240 cfi_rel_offset (esi, 0)
241 cfi_rel_offset (ebx, 4)
278 movzwl -3(%esi), %eax
279 movzwl -3(%edx), %ecx
284 movzbl -1(%esi), %eax
288 cfi_adjust_cfa_offset (-4)
293 cfi_adjust_cfa_offset (8)
294 cfi_rel_offset (esi, 0)
295 cfi_rel_offset (ebx, 4)
338 LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx)
369 /* We get there only if we already know there is a
376 cfi_adjust_cfa_offset (-4)
379 END (BP_SYM (memcmp))
384 .long L(0bytes) - L(table_32bytes)
385 .long L(1bytes) - L(table_32bytes)
386 .long L(2bytes) - L(table_32bytes)
387 .long L(3bytes) - L(table_32bytes)
388 .long L(4bytes) - L(table_32bytes)
389 .long L(5bytes) - L(table_32bytes)
390 .long L(6bytes) - L(table_32bytes)
391 .long L(7bytes) - L(table_32bytes)
392 .long L(8bytes) - L(table_32bytes)
393 .long L(9bytes) - L(table_32bytes)
394 .long L(10bytes) - L(table_32bytes)
395 .long L(11bytes) - L(table_32bytes)
396 .long L(12bytes) - L(table_32bytes)
397 .long L(13bytes) - L(table_32bytes)
398 .long L(14bytes) - L(table_32bytes)
399 .long L(15bytes) - L(table_32bytes)
400 .long L(16bytes) - L(table_32bytes)
401 .long L(17bytes) - L(table_32bytes)
402 .long L(18bytes) - L(table_32bytes)
403 .long L(19bytes) - L(table_32bytes)
404 .long L(20bytes) - L(table_32bytes)
405 .long L(21bytes) - L(table_32bytes)
406 .long L(22bytes) - L(table_32bytes)
407 .long L(23bytes) - L(table_32bytes)
408 .long L(24bytes) - L(table_32bytes)
409 .long L(25bytes) - L(table_32bytes)
410 .long L(26bytes) - L(table_32bytes)
411 .long L(27bytes) - L(table_32bytes)
412 .long L(28bytes) - L(table_32bytes)
413 .long L(29bytes) - L(table_32bytes)
414 .long L(30bytes) - L(table_32bytes)
415 .long L(31bytes) - L(table_32bytes)
419 weak_alias (BP_SYM (memcmp), BP_SYM (bcmp))
420 libc_hidden_builtin_def (BP_SYM (memcmp))