1 /* The assembly function for memory compare. C-SKY ABIV2 version.
2 Copyright (C) 2018-2024 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, see
17 <https://www.gnu.org/licenses/>. */
22 /* Test if len less than 4 bytes. */
27 jbt .L_compare_by_byte
31 /* Test if s1 is not 4 bytes aligned. */
32 bnez r13, .L_s1_not_aligned
36 /* If dest is aligned, then copy. */
38 /* Test if len less than 16 bytes. */
39 bez r18, .L_compare_by_word
42 /* If aligned, load word each time. */
45 /* If s1[i] != s2[i], goto .L_byte_check. */
68 BNEZAD (r18, .L_compare_by_4word)
72 bez r18, .L_compare_by_byte
73 .L_compare_by_word_loop:
81 BNEZAD (r18, .L_compare_by_word_loop)
86 .L_compare_by_byte_loop:
94 BNEZAD (r18, .L_compare_by_byte_loop)
100 /* s1[i] != s2[i] in word, so we check byte 3. */
125 /* Compare when s1 is not aligned. */
129 .L_s1_not_aligned_loop:
137 BNEZAD (r13, .L_s1_not_aligned_loop)
140 weak_alias (memcmp, bcmp)
141 strong_alias (memcmp, __memcmpeq)
142 libc_hidden_def (memcmp)
143 libc_hidden_def (__memcmpeq)