mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
sm3: s390x copyResultsBy4
This commit is contained in:
parent
75d3974162
commit
a3fa174e71
@ -8,3 +8,6 @@ package sm3
|
||||
|
||||
//go:noescape
|
||||
func transposeMatrix(dig **[8]uint32)
|
||||
|
||||
//go:noescape
|
||||
func copyResultsBy4(dig *uint32, p *byte)
|
||||
|
@ -56,3 +56,16 @@ TEXT ·transposeMatrix(SB),NOSPLIT,$0
|
||||
VSTM V6, V7, (R2)
|
||||
|
||||
RET
|
||||
|
||||
// func copyResultsBy4(dig *uint32, dst *byte)
|
||||
TEXT ·copyResultsBy4(SB),NOSPLIT,$0
|
||||
#define digPtr R1
|
||||
#define dstPtr R2
|
||||
MOVD dig+0(FP), digPtr
|
||||
MOVD dst+8(FP), dstPtr
|
||||
|
||||
// load state
|
||||
VLM (digPtr), V0, V7
|
||||
VSTM V0, V7, (dstPtr)
|
||||
|
||||
RET
|
||||
|
@ -29,3 +29,26 @@ func TestTransposeMatrix(t *testing.T) {
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyResultsBy4(t *testing.T) {
|
||||
var m [4][8]uint32
|
||||
var k uint32 = 0
|
||||
for i := 0; i < 4; i++ {
|
||||
for j := 0; j < 8; j++ {
|
||||
m[i][j] = k << 24
|
||||
k++
|
||||
fmt.Printf("%04x ", m[i][j])
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
var p [32]byte
|
||||
copyResultsBy4(&m[0][0], &p[0])
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
for i := 0; i < 32; i++ {
|
||||
fmt.Printf("%04x ", p[i])
|
||||
if i%8 == 7 {
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user