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<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-56
     9  	// R2 = a_base
    10  	// R3 = a_len
    11  	// R4 = a_cap (unused)
    12  	// R5 = b_base (want in R4)
    13  	// R6 = b_len (want in R5)
    14  	// R7 = b_cap (unused)
    15  	MOVD	R5, R4
    16  	MOVD	R6, R5
    17  	BR	cmpbody<>(SB)
    18  
    19  TEXT runtime·cmpstring<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-40
    20  	// R2 = a_base
    21  	// R3 = a_len
    22  	// R4 = b_base
    23  	// R5 = b_len
    24  
    25  	BR	cmpbody<>(SB)
    26  
    27  // input:
    28  //   R2 = a
    29  //   R3 = alen
    30  //   R4 = b
    31  //   R5 = blen
    32  //   For regabiargs output value( -1/0/1 ) stored in R2
    33  //   For !regabiargs address of output word( stores -1/0/1 ) stored in R6
    34  TEXT cmpbody<>(SB),NOSPLIT|NOFRAME,$0-0
    35  	CMPBEQ	R2, R4, cmplengths
    36  	MOVD	R3, R7
    37  	CMPBLE	R3, R5, amin
    38  	MOVD	R5, R7
    39  amin:
    40  	CMPBEQ	R7, $0, cmplengths
    41  	CMP	R7, $256
    42  	BLE	tail
    43  loop:
    44  	CLC	$256, 0(R2), 0(R4)
    45  	BGT	gt
    46  	BLT	lt
    47  	SUB	$256, R7
    48  	MOVD	$256(R2), R2
    49  	MOVD	$256(R4), R4
    50  	CMP	R7, $256
    51  	BGT	loop
    52  tail:
    53  	SUB	$1, R7
    54  	EXRL	$cmpbodyclc<>(SB), R7
    55  	BGT	gt
    56  	BLT	lt
    57  cmplengths:
    58  	CMP	R3, R5
    59  	BEQ	eq
    60  	BLT	lt
    61  gt:
    62  	MOVD	$1, R2
    63  	RET
    64  lt:
    65  	MOVD	$-1, R2
    66  	RET
    67  eq:
    68  	MOVD	$0, R2
    69  	RET
    70  
    71  TEXT cmpbodyclc<>(SB),NOSPLIT|NOFRAME,$0-0
    72  	CLC	$1, 0(R2), 0(R4)
    73  	RET
    74  

View as plain text