zuc: arm64, eia256 uses VMOVQ & VTBL

This commit is contained in:
Sun Yimin 2023-11-09 15:28:49 +08:00 committed by GitHub
parent 632edd80d5
commit e373ac7968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,11 +82,11 @@ TEXT ·eia256RoundTag8(SB),NOSPLIT,$0
// TODO: Any better solution???
VMOVQ $0x0302010007060504, $0x070605040b0a0908, XTMP4
VTBL XTMP4.B16, [XTMP1.B16], KS_L.B16 // KS bits [63:32 31:0 95:64 63:32]
VTBL XTMP4.B16, [XTMP2.B16], KS_M2.B16 // KS bits [63:32 31:0 95:64 63:32]
VTBL XTMP4.B16, [XTMP2.B16], KS_M2.B16 // KS bits [191:160 159:128 223:192 191:160]
VDUP XTMP1.S[3], KS_M1.S4
VMOV XTMP1.S[2], KS_M1.S[1]
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]
VTBL SHUF_MASK_DW2_DW3.B16, [XTMP3.B16], XTMP2.B16 // XTMP2 - Data bits [95:64 0s 127:96 0s]
@ -153,19 +153,15 @@ 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
VDUP XTMP1.S[1], KS_L.S4
VMOV XTMP1.S[0], KS_L.S[1]
VMOV XTMP1.S[2], KS_L.S[2] // KS bits [63:32 31:0 95:64 63:32]
VMOVQ $0x0302010007060504, $0x070605040b0a0908, XTMP4
VTBL XTMP4.B16, [XTMP1.B16], KS_L.B16 // KS bits [63:32 31:0 95:64 63:32]
VTBL XTMP4.B16, [XTMP2.B16], KS_M2.B16 // KS bits [191:160 159:128 223:192 191:160]
VMOVQ $0x0b0a09080f0e0d0c, $0x0b0a09080f0e0d0c, XTMP4
VTBL XTMP4.B16, [XTMP2.B16], KS_H.B16 // KS bits [255:224 223:192 255:224 223:192]
VDUP XTMP1.S[3], KS_M1.S4
VMOV XTMP1.S[2], KS_M1.S[1]
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] // 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[2], KS_H.S[3] // KS bits [255:224 223:192 255:224 223:192]
// setup DATA
VTBL SHUF_MASK_DW0_DW1.B16, [XTMP3.B16], XTMP1.B16 // XTMP1 - Data bits [31:0 0s 63:32 0s]
VTBL SHUF_MASK_DW2_DW3.B16, [XTMP3.B16], XTMP2.B16 // XTMP2 - Data bits [95:64 0s 127:96 0s]