Skip to contentSkip to conversation

kselftest/arm64: Use preferred form for predicate load/stores

PATCH In review Mark Brown 3 participants 4 messages Nov 17, 2022 – Nov 18, 2022

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 kselftest/arm64: Use preferred form for predicate load/stores

The preferred form of the str/ldr for predicate registers with an immediate of zero is to omit the zero, and the clang built in assembler rejects the zero immediate. Drop the immediate.

---
 tools/testing/selftests/arm64/abi/syscall-abi-asm.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/arm64/abi/syscall-abi-asm.S +2 -2
index b523c21c2278..acd5e9f3bc0b 100644
@@ -153,7 +153,7 @@ do_syscall:
 	// Only set a non-zero FFR, test patterns must be zero since the
 	// syscall should clear it - this lets us handle FA64.
 	ldr	x2, =ffr_in
-	ldr	p0, [x2, #0]
+	ldr	p0, [x2]
 	ldr	x2, [x2, #0]
 	cbz	x2, 2f
 	wrffr	p0.b
@@ -298,7 +298,7 @@ do_syscall:
 	cbz	x2, 1f
 	ldr	x2, =ffr_out
 	rdffr	p0.b
-	str	p0, [x2, #0]
+	str	p0, [x2]
 1:
 
 	// Restore callee saved registers x19-x30

base-commit: 30a0b95b1335e12efef89dd78518ed3e4a71a763

Signature · 1 line
2.30.2
reviewer
#1 lore raw
Quoted 3 lines · Mark Brown

The preferred form of the str/ldr for predicate registers with an immediate of zero is to omit the zero, and the clang built in assembler rejects the zero immediate. Drop the immediate.

Rejecting that outright seems like a bug in clang, given there are legitimate reasons to write code that way (e.g. using asm-offsets style definitions); has that been reported so that it can be fixed?

Regardless, the patch itself looks fine, and I don't mean to block this as-is!

Thanks,
Mark.

Quoted 38 lines
---
 tools/testing/selftests/arm64/abi/syscall-abi-asm.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/arm64/abi/syscall-abi-asm.S +2 -2
index b523c21c2278..acd5e9f3bc0b 100644
@@ -153,7 +153,7 @@ do_syscall:
 	// Only set a non-zero FFR, test patterns must be zero since the
 	// syscall should clear it - this lets us handle FA64.
 	ldr	x2, =ffr_in
-	ldr	p0, [x2, #0]
+	ldr	p0, [x2]
 	ldr	x2, [x2, #0]
 	cbz	x2, 2f
 	wrffr	p0.b
@@ -298,7 +298,7 @@ do_syscall:
 	cbz	x2, 1f
 	ldr	x2, =ffr_out
 	rdffr	p0.b
-	str	p0, [x2, #0]
+	str	p0, [x2]
 1:
 
 	// Restore callee saved registers x19-x30

base-commit: 30a0b95b1335e12efef89dd78518ed3e4a71a763

Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#2 lore raw
Quoted 9 lines · Mark Rutland
Quoted 3 lines · Mark Brown

The preferred form of the str/ldr for predicate registers with an immediate of zero is to omit the zero, and the clang built in assembler rejects the zero immediate. Drop the immediate.

Rejecting that outright seems like a bug in clang, given there are legitimate reasons to write code that way (e.g. using asm-offsets style definitions); has that been reported so that it can be fixed?

I believe it's been reported, yes.

maintainer
#3 lore raw
In reply to Mark Brown
Quoted 5 lines · Mark Brown

The preferred form of the str/ldr for predicate registers with an immediate of zero is to omit the zero, and the clang built in assembler rejects the zero immediate. Drop the immediate.

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

[1/1] kselftest/arm64: Use preferred form for predicate load/stores

      https://git.kernel.org/arm64/c/284d2b44a8cc

Cheers,

Signature · 5 lines
Will

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