command-line-arguments_encodeSIMD1_pc105:
VMOVDQU64 (DI), Z1
MOVL $264305664, DX
VMOVD DX, X2
VPBROADCASTD X2, Z2
MOVL $67108928, R9
VMOVD R9, X3
VPBROADCASTD X3, Z3
MOVL $4129776, R10
VMOVD R10, X4
VPBROADCASTD X4, Z4
MOVL $16777232, R11
VMOVD R11, X5
VPBROADCASTD X5, Z5
NOP
LEAQ command-line-arguments..autotmp_43(SP), R12
MOVUPS X15, (R12)
MOVUPS X15, 16(R12)
MOVUPS X15, 32(R12)
MOVUPS X15, 48(R12)
MOVB $1, command-line-arguments..autotmp_43(SP)
MOVW $258, command-line-arguments..autotmp_43+2(SP)
MOVL $67437316, command-line-arguments..autotmp_43+4(SP)
MOVQ $723682103795385863, R12
MOVQ R12, command-line-arguments..autotmp_43+8(SP)
MOVQ $1157723140823845901, R13
MOVQ R13, command-line-arguments..autotmp_43+16(SP)
MOVQ $1591764177852305939, R15
MOVQ R15, command-line-arguments..autotmp_43+24(SP)
MOVQ $2025805214880765977, R15
MOVQ R15, command-line-arguments..autotmp_43+32(SP)
MOVQ $2459846251909226015, R15
MOVQ R15, command-line-arguments..autotmp_43+40(SP)
MOVQ $2893887288937686053, R15
MOVQ R15, command-line-arguments..autotmp_43+48(SP)
MOVQ $3327928325966146091, R15
MOVQ R15, command-line-arguments..autotmp_43+56(SP)
VMOVDQU64 command-line-arguments..autotmp_43(SP), Z6
VPERMB Z1, Z6, Z1
VPANDD Z1, Z2, Z2
VPMULHUW Z3, Z2, Z2
VPANDD Z1, Z4, Z1
VPMULLW Z5, Z1, Z1
VPORD Z1, Z2, Z1
VPERMB Z0, Z1, Z1
NOP
NOP
NOP
NOP
NOP
VMOVDQU64 Z1, (AX)
ADDQ $-64, CX
MOVQ CX, command-line-arguments..autotmp_54+128(SP)
NEGQ CX
SARQ $63, CX
ANDL $64, CX
ADDQ CX, AX
ADDQ $-64, BX
ADDQ $-48, R8
ADDQ $48, DI
ADDQ $-48, SI
MOVQ command-line-arguments..autotmp_54+128(SP), CX
command-line-arguments_encodeSIMD1_pc432:
CMPQ SI, $64
JLT command-line-arguments_encodeSIMD1_pc460
NOP
CMPQ BX, $63
JHI command-line-arguments_encodeSIMD1_pc105
Go version
N/A
Output of
go envin your module/workspace:What did you do?
I wrote a simple base64 encoder: https://go.dev/play/p/SaXeuZMg6Xy
I used some relatively simple pure
archsimdfunctions inside my core encoding loop (e.g.LoadUint8x64ArrayandBroadcastUint32x16).What did you see happen?
For encodeSIMD1, I see a fairly messy disassembly for the inside of the loop:
Disassembly
For encodeSIMD2, I manually hoisted some of the magic constants out of the loop. This cleaned up the codegen a lot.
Disassembly
What did you expect to see?
I expected to see similar codegen for encodeSIMD1 and encodeSIMD2. The compiler should hoist these operations out of the loop, I've seen it do the same for other operations, it should be possible for these SIMD operations as well.