github.com/primecitizens/pcz/std@v0.2.1/core/cmp/bs_s390x.s (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2018 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build pcz && s390x 9 10 #include "textflag.h" 11 12 TEXT ·Bytes(SB),NOSPLIT|NOFRAME,$0-56 13 MOVD a_base+0(FP), R3 14 MOVD a_len+8(FP), R4 15 MOVD b_base+24(FP), R5 16 MOVD b_len+32(FP), R6 17 LA ret+48(FP), R7 18 BR cmpbody<>(SB) 19 20 TEXT ·String(SB),NOSPLIT|NOFRAME,$0-40 21 MOVD a_base+0(FP), R3 22 MOVD a_len+8(FP), R4 23 MOVD b_base+16(FP), R5 24 MOVD b_len+24(FP), R6 25 LA ret+32(FP), R7 26 BR cmpbody<>(SB) 27 28 // input: 29 // R3 = a 30 // R4 = alen 31 // R5 = b 32 // R6 = blen 33 // R7 = address of output word (stores -1/0/1 here) 34 TEXT cmpbody<>(SB),NOSPLIT|NOFRAME,$0-0 35 CMPBEQ R3, R5, cmplengths 36 MOVD R4, R8 37 CMPBLE R4, R6, amin 38 MOVD R6, R8 39 amin: 40 CMPBEQ R8, $0, cmplengths 41 CMP R8, $256 42 BLE tail 43 loop: 44 CLC $256, 0(R3), 0(R5) 45 BGT gt 46 BLT lt 47 SUB $256, R8 48 MOVD $256(R3), R3 49 MOVD $256(R5), R5 50 CMP R8, $256 51 BGT loop 52 tail: 53 SUB $1, R8 54 EXRL $cmpbodyclc<>(SB), R8 55 BGT gt 56 BLT lt 57 cmplengths: 58 CMP R4, R6 59 BEQ eq 60 BLT lt 61 gt: 62 MOVD $1, 0(R7) 63 RET 64 lt: 65 MOVD $-1, 0(R7) 66 RET 67 eq: 68 MOVD $0, 0(R7) 69 RET 70 71 TEXT cmpbodyclc<>(SB),NOSPLIT|NOFRAME,$0-0 72 CLC $1, 0(R3), 0(R5) 73 RET