1 /* wcslen optimized with SSE2.
2 Copyright (C) 2017-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/>. */
19 #include <isa-level.h>
21 #if ISA_SHOULD_BUILD (1)
26 # define WCSLEN __wcslen_sse2
100 pcmpeqd (%rax), %xmm3
106 pcmpeqd (%rax), %xmm0
112 pcmpeqd (%rax), %xmm1
118 pcmpeqd (%rax), %xmm2
124 pcmpeqd (%rax), %xmm3
135 movaps 16(%rax), %xmm1
136 movaps 32(%rax), %xmm2
137 movaps 48(%rax), %xmm6
146 jz L(aligned_64_loop)
148 pcmpeqd -64(%rax), %xmm3
160 pcmpeqd -32(%rax), %xmm3
170 jz L(aligned_64_loop)
183 /* No align here. Naturally aligned % 16 == 1. */
185 andl $(15 << 8), %edx