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