[glibc] s390: Use 64bit branch relative on count instruction in strncpy-z900.S [BZ #34398]
Stefan Liebler via Glibc-cvs <[email protected]> Tue, 14 Jul 2026 12:39:47 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a3d4ff18c57eb962e18920a394d2b032e5e7b1aa commit a3d4ff18c57eb962e18920a394d2b032e5e7b1aa Author: Stefan Liebler <[email protected]> Date: Tue Jul 14 10:56:49 2026 +0200 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, the z900 ifunc variant is only chosen if not run on >=z13 or if called via __GI_strncpy. Diff: --- sysdeps/s390/strncpy-z900.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)