From e7299cda751f7742091a67c932ea6057397a8533 Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Thu, 5 Sep 2024 14:54:46 +0800 Subject: [PATCH] debug ppc64le byte order --- sm3/sm3blocks_ppc64x.s | 12 +++++++++++- sm3/sm3blocks_ppc64x_test.go | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sm3/sm3blocks_ppc64x.s b/sm3/sm3blocks_ppc64x.s index 8eb7db9..53eb11d 100644 --- a/sm3/sm3blocks_ppc64x.s +++ b/sm3/sm3blocks_ppc64x.s @@ -70,7 +70,7 @@ TEXT ·transposeMatrix(SB),NOSPLIT,$0 #else MOVD $·mask+0x10(SB), R4 #endif - +/* LVX (R0)(R4), V8 LVX (R6)(R4), V9 LVX (R8)(R4), V10 @@ -105,5 +105,15 @@ TEXT ·transposeMatrix(SB),NOSPLIT,$0 MOVD (R7)(R3), R4 P8_STXVB16X(V3, R4, R0) P8_STXVB16X(V7, R4, R6) +*/ + MOVD (R0)(R3), R4 + LXVD2X (R0)(R4), V0 + VSPLTW $1, V0, V2 + STXVD2X V2, (R0)(R4) + + LXVD2X (R6)(R4), V1 + VPERM V1, V1, ESPERM, V1 + VSPLTW $1, V1, V2 + STXVD2X V2, (R6)(R4) RET diff --git a/sm3/sm3blocks_ppc64x_test.go b/sm3/sm3blocks_ppc64x_test.go index 7f708cd..e3246fb 100644 --- a/sm3/sm3blocks_ppc64x_test.go +++ b/sm3/sm3blocks_ppc64x_test.go @@ -18,7 +18,7 @@ func TestTransposeMatrix(t *testing.T) { for j := 0; j < 8; j++ { m[i][j] = k k++ - fmt.Printf("%04x ", m[i][j]) + fmt.Printf("%08x ", m[i][j]) } fmt.Println() } @@ -28,7 +28,7 @@ func TestTransposeMatrix(t *testing.T) { fmt.Println() for i := 0; i < 4; i++ { for j := 0; j < 8; j++ { - fmt.Printf("%04x ", m[i][j]) + fmt.Printf("%08x ", m[i][j]) } fmt.Println() }