ZUC: arm64, EIA uses VDUP to reduce VMOV

This commit is contained in:
Sun Yimin 2023-11-09 14:42:22 +08:00 committed by GitHub
parent 3d299a6480
commit b8cfff88b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 26 deletions

View File

@ -80,18 +80,15 @@ TEXT ·eia256RoundTag8(SB),NOSPLIT,$0
VLD1 (BX), [XTMP1.B16, XTMP2.B16]
VST1 [XTMP2.B16], (BX) // Copy last 16 bytes of KS to the front
// TODO: Any better solution???
VMOV XTMP1.S[1], KS_L.S[0]
VDUP XTMP1.S[1], KS_L.S4
VMOV XTMP1.S[0], KS_L.S[1]
VMOV XTMP1.S[2], KS_L.S[2]
VMOV XTMP1.S[1], KS_L.S[3] // KS bits [63:32 31:0 95:64 63:32]
VMOV XTMP1.S[3], KS_M1.S[0]
VMOV XTMP1.S[2], KS_L.S[2] // KS bits [63:32 31:0 95:64 63:32]
VDUP XTMP1.S[3], KS_M1.S4
VMOV XTMP1.S[2], KS_M1.S[1]
VMOV XTMP2.S[0], KS_M1.S[2]
VMOV XTMP1.S[3], KS_M1.S[3] // KS bits [127:96 95:64 159:128 127:96]
VMOV XTMP2.S[1], KS_M2.S[0]
VMOV XTMP2.S[0], KS_M1.S[2] // KS bits [127:96 95:64 159:128 127:96]
VDUP XTMP2.S[1], KS_M2.S4
VMOV XTMP2.S[0], KS_M2.S[1]
VMOV XTMP2.S[2], KS_M2.S[2]
VMOV XTMP2.S[1], KS_M2.S[3] // KS bits [191:160 159:128 223:192 191:160]
VMOV XTMP2.S[2], KS_M2.S[2] // KS bits [191:160 159:128 223:192 191:160]
// setup DATA
VTBL SHUF_MASK_DW0_DW1.B16, [XTMP3.B16], XTMP1.B16 // XTMP1 - Data bits [31:0 0s 63:32 0s]
@ -159,21 +156,17 @@ TEXT ·eia256RoundTag16(SB),NOSPLIT,$0
VLD1 (BX), [XTMP1.B16, XTMP2.B16]
VST1 [XTMP2.B16], (BX) // Copy last 16 bytes of KS to the front
// TODO: Any better solution??? We can use VTBL, but there are no performance imprvoement if we can't reuse MASK constant
VMOV XTMP1.S[1], KS_L.S[0]
VDUP XTMP1.S[1], KS_L.S4
VMOV XTMP1.S[0], KS_L.S[1]
VMOV XTMP1.S[2], KS_L.S[2]
VMOV XTMP1.S[1], KS_L.S[3] // KS bits [63:32 31:0 95:64 63:32]
VMOV XTMP1.S[3], KS_M1.S[0]
VMOV XTMP1.S[2], KS_L.S[2] // KS bits [63:32 31:0 95:64 63:32]
VDUP XTMP1.S[3], KS_M1.S4
VMOV XTMP1.S[2], KS_M1.S[1]
VMOV XTMP2.S[0], KS_M1.S[2]
VMOV XTMP1.S[3], KS_M1.S[3] // KS bits [127:96 95:64 159:128 127:96]
VMOV XTMP2.S[1], KS_M2.S[0]
VMOV XTMP2.S[0], KS_M1.S[2] // KS bits [127:96 95:64 159:128 127:96]
VDUP XTMP2.S[1], KS_M2.S4
VMOV XTMP2.S[0], KS_M2.S[1]
VMOV XTMP2.S[2], KS_M2.S[2]
VMOV XTMP2.S[1], KS_M2.S[3] // KS bits [191:160 159:128 223:192 191:160]
VMOV XTMP2.S[3], KS_H.S[0]
VMOV XTMP2.S[2], KS_M2.S[2] // KS bits [191:160 159:128 223:192 191:160]
VDUP XTMP2.S[3], KS_H.S4
VMOV XTMP2.S[2], KS_H.S[1]
VMOV XTMP2.S[3], KS_H.S[2]
VMOV XTMP2.S[2], KS_H.S[3] // KS bits [255:224 223:192 255:224 223:192]
// setup DATA

View File

@ -81,14 +81,12 @@ TEXT ·eia3Round16B(SB),NOSPLIT,$0
VLD1 (BX), [XTMP1.B16, XTMP2.B16]
VST1 [XTMP2.B16], (BX) // Copy last 16 bytes of KS to the front
// TODO: Any better solution???
VMOV XTMP1.S[1], KS_L.S[0]
VDUP XTMP1.S[1], KS_L.S4
VMOV XTMP1.S[0], KS_L.S[1]
VMOV XTMP1.S[2], KS_L.S[2]
VMOV XTMP1.S[1], KS_L.S[3] // KS bits [63:32 31:0 95:64 63:32]
VMOV XTMP1.S[3], KS_M1.S[0]
VMOV XTMP1.S[2], KS_L.S[2] // KS bits [63:32 31:0 95:64 63:32]
VDUP XTMP1.S[3], KS_M1.S4
VMOV XTMP1.S[2], KS_M1.S[1]
VMOV XTMP2.S[0], KS_M1.S[2]
VMOV XTMP1.S[3], KS_M1.S[3] // KS bits [127:96 95:64 159:128 127:96]
VMOV XTMP2.S[0], KS_M1.S[2] // KS bits [127:96 95:64 159:128 127:96]
// setup DATA
VTBL SHUF_MASK_DW0_DW1.B16, [XTMP3.B16], XTMP1.B16 // XTMP1 - Data bits [31:0 0s 63:32 0s]