Skip to content

Commit

Permalink
zuc: arm64, eia256 uses VMOVQ & VTBL
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Nov 9, 2023
1 parent 632edd8 commit e373ac7
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions zuc/eia256_asm_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit e373ac7

Please sign in to comment.