Text file src/internal/bytealg/compare_s390x.s

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

View as plain text