Skip to contentSkip to conversation

selftests: arm64: Factor out utility functions for assembly FP tests

PATCH In review Mark Brown 2 participants 2 messages Oct 19, 2021 – Oct 21, 2021

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 selftests: arm64: Factor out utility functions for assembly FP tests

The various floating point test programs written in assembly have a bunch of helper functions and macros which are cut'n'pasted between them. Factor them out into a separate source file which is linked into all of them.

We don't include memcmp() since it isn't as generic as it should be and directly branches to report an error in the programs.

---
 tools/testing/selftests/arm64/fp/Makefile     |   4 +-
 tools/testing/selftests/arm64/fp/asm-utils.S  | 172 ++++++++++++++++++
 tools/testing/selftests/arm64/fp/assembler.h  |  11 ++
 .../testing/selftests/arm64/fp/fpsimd-test.S  | 164 -----------------
 tools/testing/selftests/arm64/fp/sve-test.S   | 163 -----------------
 5 files changed, 185 insertions(+), 329 deletions(-)
 create mode 100644 tools/testing/selftests/arm64/fp/asm-utils.S
tools/testing/selftests/arm64/fp/Makefile +2 -2
index 4367125b7c27..ba1488c7c315 100644
@@ -9,12 +9,12 @@ TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress \
 
 all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED)
 
-fpsimd-test: fpsimd-test.o
+fpsimd-test: fpsimd-test.o asm-utils.o
 	$(CC) -nostdlib $^ -o $@
 rdvl-sve: rdvl-sve.o rdvl.o
 sve-ptrace: sve-ptrace.o
 sve-probe-vls: sve-probe-vls.o rdvl.o
-sve-test: sve-test.o
+sve-test: sve-test.o asm-utils.o
 	$(CC) -nostdlib $^ -o $@
 vec-syscfg: vec-syscfg.o rdvl.o
 vlset: vlset.o
tools/testing/selftests/arm64/fp/asm-utils.S new file +172 -0

172 lines not on this page · raw message

tools/testing/selftests/arm64/fp/assembler.h +11 -0
index 8944f2189206..90bd433d2665 100644
@@ -54,4 +54,15 @@ endfunction
 	.purgem \name\()_entry
 .endm
 
+// Utility macro to print a literal string
+// Clobbers x0-x4,x8
+.macro puts string
+	.pushsection .rodata.str1.1, "aMS", 1
+.L__puts_literal\@: .string "\string"
+	.popsection
+
+	ldr	x0, =.L__puts_literal\@
+	bl	puts
+.endm
+
 #endif /* ! ASSEMBLER_H */
tools/testing/selftests/arm64/fp/fpsimd-test.S +0 -164

182 lines not on this page · raw message

tools/testing/selftests/arm64/fp/sve-test.S +0 -163

181 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 8 lines · Mark Brown

The various floating point test programs written in assembly have a bunch of helper functions and macros which are cut'n'pasted between them. Factor them out into a separate source file which is linked into all of them.

We don't include memcmp() since it isn't as generic as it should be and directly branches to report an error in the programs.

[...]

Applied to arm64 (for-next/kselftest), thanks!

[1/1] selftests: arm64: Factor out utility functions for assembly FP tests

      https://git.kernel.org/arm64/c/260ea4ba94e8

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev