From: Stefan Liebler Date: Tue, 14 Jul 2026 08:56:49 +0000 (+0200) Subject: s390: Use 64bit branch relative on count instruction in strncpy-z900.S [BZ #34398] X-Git-Tag: glibc-2.44~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a3d4ff18c57eb962e18920a394d2b032e5e7b1aa;p=thirdparty%2Fglibc.git s390: Use 64bit branch relative on count instruction in strncpy-z900.S [BZ #34398] At the time the s390-32 strncpy implementation was adjusted for the s390-64 port, the brct (branch relative on count) instruction was not adjusted from 32bit to 64bit instruction. If n contains a value >32bit, the number of 8 byte chunks is computed with srlg (64bit shift right). The processing of 8 byte chunks is then processed by looping with brct (32bit branch relative on count) instruction. This patch just uses the brctg (64bit branch relative on count) instruciton. Note 1: There is a second loop copying the remaining seven bytes. The usage of 32bit brct for looping is fine here. Note 2: If glibc is build with architecture level set >=z13, the z900 variant of strncpy is not build at all. Note 3: If glibc is build for =z13 or if called via __GI_strncpy. --- diff --git a/sysdeps/s390/strncpy-z900.S b/sysdeps/s390/strncpy-z900.S index 6d954cf402..141cba2294 100644 --- a/sysdeps/s390/strncpy-z900.S +++ b/sysdeps/s390/strncpy-z900.S @@ -56,7 +56,7 @@ ENTRY(STRNCPY_Z900) jz .L10 stg %r0,0(%r2,%r3) # store all eight to dest. la %r3,8(%r3) - brct %r4,.L0 + brctg %r4,.L0 .L1: ltgr %r1,%r1 jz .Lexit .L2: icm %r0,1,0(%r3)