From 4529c8fba65bf2c80e3bd4dac0851451a101c936 Mon Sep 17 00:00:00 2001 From: Srinivas Pokala Date: Tue, 11 Nov 2025 05:22:32 +0100 Subject: [PATCH] runtime: port memmove, memclr to register ABI on s390x This allows memmove and memclr to be invoked using the new register ABI on s390x. Update #40724 Change-Id: I2e799aac693ddd693266c156c525d6303060796f Reviewed-on: https://go-review.googlesource.com/c/go/+/719424 Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI Reviewed-by: Vishwanatha HD Reviewed-by: Keith Randall --- src/runtime/memclr_s390x.s | 8 ++++++-- src/runtime/memmove_s390x.s | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/runtime/memclr_s390x.s b/src/runtime/memclr_s390x.s index 392057565e..919423edf7 100644 --- a/src/runtime/memclr_s390x.s +++ b/src/runtime/memclr_s390x.s @@ -7,10 +7,14 @@ // See memclrNoHeapPointers Go doc for important implementation constraints. // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) -TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT|NOFRAME,$0-16 +TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT|NOFRAME,$0-16 +#ifndef GOEXPERIMENT_regabiargs MOVD ptr+0(FP), R4 MOVD n+8(FP), R5 - +#else + MOVD R2, R4 + MOVD R3, R5 +#endif CMPBGE R5, $32, clearge32 start: diff --git a/src/runtime/memmove_s390x.s b/src/runtime/memmove_s390x.s index f4c2b87d92..28c6a5dab2 100644 --- a/src/runtime/memmove_s390x.s +++ b/src/runtime/memmove_s390x.s @@ -7,10 +7,16 @@ // See memmove Go doc for important implementation constraints. // func memmove(to, from unsafe.Pointer, n uintptr) -TEXT runtime·memmove(SB),NOSPLIT|NOFRAME,$0-24 +TEXT runtime·memmove(SB),NOSPLIT|NOFRAME,$0-24 +#ifndef GOEXPERIMENT_regabiargs MOVD to+0(FP), R6 MOVD from+8(FP), R4 MOVD n+16(FP), R5 +#else + MOVD R4, R5 + MOVD R3, R4 + MOVD R2, R6 +#endif CMPBEQ R6, R4, done -- 2.52.0