Text file src/runtime/memclr_s390x.s

     1  // Copyright 2016 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 "textflag.h"
     6  
     7  // See memclrNoHeapPointers Go doc for important implementation constraints.
     8  
     9  // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
    10  TEXT runtime¬∑memclrNoHeapPointers(SB),NOSPLIT|NOFRAME,$0-16
    11  	MOVD	ptr+0(FP), R4
    12  	MOVD	n+8(FP), R5
    13  
    14  start:
    15  	CMPBLE	R5, $3, clear0to3
    16  	CMPBLE	R5, $7, clear4to7
    17  	CMPBLE	R5, $11, clear8to11
    18  	CMPBLE	R5, $15, clear12to15
    19  	CMP	R5, $32
    20  	BGE	clearmt32
    21  	MOVD	$0, 0(R4)
    22  	MOVD	$0, 8(R4)
    23  	ADD	$16, R4
    24  	SUB	$16, R5
    25  	BR	start
    26  
    27  clear0to3:
    28  	CMPBEQ	R5, $0, done
    29  	CMPBNE	R5, $1, clear2
    30  	MOVB	$0, 0(R4)
    31  	RET
    32  clear2:
    33  	CMPBNE	R5, $2, clear3
    34  	MOVH	$0, 0(R4)
    35  	RET
    36  clear3:
    37  	MOVH	$0, 0(R4)
    38  	MOVB	$0, 2(R4)
    39  	RET
    40  
    41  clear4to7:
    42  	CMPBNE	R5, $4, clear5
    43  	MOVW	$0, 0(R4)
    44  	RET
    45  clear5:
    46  	CMPBNE	R5, $5, clear6
    47  	MOVW	$0, 0(R4)
    48  	MOVB	$0, 4(R4)
    49  	RET
    50  clear6:
    51  	CMPBNE	R5, $6, clear7
    52  	MOVW	$0, 0(R4)
    53  	MOVH	$0, 4(R4)
    54  	RET
    55  clear7:
    56  	MOVW	$0, 0(R4)
    57  	MOVH	$0, 4(R4)
    58  	MOVB	$0, 6(R4)
    59  	RET
    60  
    61  clear8to11:
    62  	CMPBNE	R5, $8, clear9
    63  	MOVD	$0, 0(R4)
    64  	RET
    65  clear9:
    66  	CMPBNE	R5, $9, clear10
    67  	MOVD	$0, 0(R4)
    68  	MOVB	$0, 8(R4)
    69  	RET
    70  clear10:
    71  	CMPBNE	R5, $10, clear11
    72  	MOVD	$0, 0(R4)
    73  	MOVH	$0, 8(R4)
    74  	RET
    75  clear11:
    76  	MOVD	$0, 0(R4)
    77  	MOVH	$0, 8(R4)
    78  	MOVB	$0, 10(R4)
    79  	RET
    80  
    81  clear12to15:
    82  	CMPBNE	R5, $12, clear13
    83  	MOVD	$0, 0(R4)
    84  	MOVW	$0, 8(R4)
    85  	RET
    86  clear13:
    87  	CMPBNE	R5, $13, clear14
    88  	MOVD	$0, 0(R4)
    89  	MOVW	$0, 8(R4)
    90  	MOVB	$0, 12(R4)
    91  	RET
    92  clear14:
    93  	CMPBNE	R5, $14, clear15
    94  	MOVD	$0, 0(R4)
    95  	MOVW	$0, 8(R4)
    96  	MOVH	$0, 12(R4)
    97  	RET
    98  clear15:
    99  	MOVD	$0, 0(R4)
   100  	MOVW	$0, 8(R4)
   101  	MOVH	$0, 12(R4)
   102  	MOVB	$0, 14(R4)
   103  	RET
   104  
   105  clearmt32:
   106  	CMP	R5, $256
   107  	BLT	clearlt256
   108  	XC	$256, 0(R4), 0(R4)
   109  	ADD	$256, R4
   110  	ADD	$-256, R5
   111  	BR	clearmt32
   112  clearlt256:
   113  	CMPBEQ	R5, $0, done
   114  	ADD	$-1, R5
   115  	EXRL	$memclr_exrl_xc<>(SB), R5
   116  done:
   117  	RET
   118  
   119  // DO NOT CALL - target for exrl (execute relative long) instruction.
   120  TEXT memclr_exrl_xc<>(SB),NOSPLIT|NOFRAME,$0-0
   121  	XC	$1, 0(R4), 0(R4)
   122  	MOVD	$0, 0(R0)
   123  	RET
   124  
   125  

View as plain text