1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
aarch64 SVE emulation breaks strnlen and strrchr
arm optimized-routines have sve string functions with test code.
the test worked up until recently: with qemu-5.2.0 i see
$ qemu-aarch64 build/bin/test/strnlen
PASS strnlen
PASS __strnlen_aarch64
__strnlen_aarch64_sve (0x490fa0, 32) len 32 returned 64, expected 32
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80"
__strnlen_aarch64_sve (0x490fa0, 32) len 33 returned 64, expected 32
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80a"
__strnlen_aarch64_sve (0x490fa0, 33) len 33 returned 64, expected 33
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80a"
__strnlen_aarch64_sve (0x490fa0, 32) len 34 returned 64, expected 32
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80ab"
__strnlen_aarch64_sve (0x490fa0, 33) len 34 returned 64, expected 33
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80ab"
__strnlen_aarch64_sve (0x490fa0, 34) len 34 returned 64, expected 34
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80ab"
__strnlen_aarch64_sve (0x490fa0, 32) len 35 returned 64, expected 32
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80a\x00c"
__strnlen_aarch64_sve (0x490fa0, 33) len 35 returned 64, expected 33
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80ab\x00"
__strnlen_aarch64_sve (0x490fa0, 34) len 35 returned 64, expected 34
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80abc"
__strnlen_aarch64_sve (0x490fa0, 35) len 35 returned 64, expected 35
input: "abcdefghijklmnopqrstuvwxyz\{|}~\x7f\x80abc"
FAIL __strnlen_aarch64_sve
however the test passes with
qemu-aarch64 -cpu max,sve-max-vq=2
there should be nothing vector length specific in the code.
i haven't debugged it further, to reproduce the issue clone
https://github.com/ARM-software/optimized-routines
and run 'make build/bin/test/strnlen' with a config.mk like
SUBS = string
ARCH = aarch64
CROSS_COMPILE = aarch64-none-linux-gnu-
CC = $(CROSS_COMPILE)gcc
CFLAGS = -std=c99 -pipe -O3
CFLAGS += -march=armv8.2-a+sve
EMULATOR = qemu-aarch64
(native compilation works too, and you can run 'make check' to
run all string tests) this will build a static linked executable
into build/bin/test. if you want a smaller test case edit
string/test/strnlen.c
|