Tell me if I am right, the ghosts you can answer too.
mov [hWndSysInput+rip],rcx
mov rdx,[hInstance+rip]
xor rax,rax
mov [rsp + 64],rcx
mov [rsp + 80],rdx
mov [rsp + 88],rax
mov [rsp + 72],rax
mov [rsp + 56],rax
mov [rsp + 48],rax
mov [rsp + 40],rax
mov [rsp + 32],rax
mov r9,WS_CHILD or LVS_NOSORTHEADER or LVS_SORTASCENDING or LVS_REPORT
mov r8,OFFSET szNullString
mov rdx,OFFSET WC_LISTVIEW
xor rcx,rcx
call CreateWindowExA
If I have well understood Agner Fog and others this must execute like this:
ov [hWndSysInput+rip],rcx mov rdx,[hInstance+rip] NO PENALTY
xor rax,rax mov [rsp + 64],rcx PENALTY because XOR is quicker than MOV
mov [rsp + 80],rdx mov [rsp + 88],rax NO PENALTY
mov [rsp + 72],rax mov [rsp + 56],rax NO PENALTY
mov [rsp + 48],rax mov [rsp + 40],rax NO PENALTY
mov [rsp + 32],rax mov r9,WS_CHILD or LVS_NOSORTHEADER PENALTY cause of 1st instruction
mov r8,OFFSET szNullString mov rdx,OFFSET WC_LISTVIEW NO PENALTY
xor rcx,rcx PENALTY because the CALL cannot be excuted in the same cycle as the XOR
call CreateWindowExA PENALTY
this could be improved:
mov [hWndSysInput+rip],rcx mov rdx,[hInstance+rip]
mov [rsp + 64],rcx mov [rsp + 80],rdx
xor rax,rax xor rcx,rcx
mov r8,OFFSET szNullString mov rdx,OFFSET WC_LISTVIEW
mov [rsp + 88],rax mov [rsp + 72],rax
mov [rsp + 56],rax mov [rsp + 48],rax
mov [rsp + 40],rax mov [rsp + 32],rax
mov r9,WS_CHILD or LVS_NO.. xchg rax,rax (NOP)
call CreateWindowExA
And the final code is:
mov [hWndSysInput+rip],rcx
mov rdx,[hInstance+rip]
mov [rsp + 64],rcx
mov [rsp + 80],rdx
xor rax,rax
xor rcx,rcx
mov r8,OFFSET szNullString
mov rdx,OFFSET WC_LISTVIEW
mov [rsp + 88],rax
mov [rsp + 72],rax
mov [rsp + 56],rax
mov [rsp + 48],rax
mov [rsp + 40],rax
mov [rsp + 32],rax
mov r9,WS_CHILD or LVS_NOSORTHEADER or LVS_SORTASCENDING or LVS_REPORT
xchg rax,rax (NOP)
call CreateWindowExA
Give me advice about this kind of parallel code.
Thanks
Jokaste / Grincheux