github.com/flyinox/gosm@v0.0.0-20171117061539-16768cb62077/src/crypto/sha512/sha512block_s390x.s (about) 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 // func featureCheck() bool 8 TEXT ·featureCheck(SB),NOSPLIT,$16-1 9 LA tmp-16(SP), R1 10 XOR R0, R0 // query function code is 0 11 WORD $0xB93E0006 // KIMD (R6 is ignored) 12 MOVBZ tmp-16(SP), R4 // get the first byte 13 AND $0x10, R4 // bit 3 (big endian) for SHA512 14 CMPBEQ R4, $0, nosha512 15 MOVB $1, ret+0(FP) 16 RET 17 nosha512: 18 MOVB $0, ret+0(FP) 19 RET 20 21 // func block(dig *digest, p []byte) 22 TEXT ·block(SB),NOSPLIT,$0-32 23 MOVBZ ·useAsm(SB), R4 24 LMG dig+0(FP), R1, R3 // R2 = &p[0], R3 = len(p) 25 CMPBNE R4, $1, generic 26 MOVBZ $3, R0 // SHA512 function code 27 loop: 28 WORD $0xB93E0002 // KIMD R2 29 BVS loop // continue if interrupted 30 done: 31 XOR R0, R0 // restore R0 32 RET 33 generic: 34 BR ·blockGeneric(SB)