flat assembler
Message board for the users of flat assembler.
Index
> Main > 64 bit why not do call dword [ebx-4] ? |
Author |
|
bitRAKE 20 Dec 2020, 18:32
Direct quote from AMD manual:
Quote: No prefix is available to encode a 32-bit operand size in 64-bit mode. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
20 Dec 2020, 18:32 |
|
revolution 20 Dec 2020, 22:37
Roman: You don't need the "sub rdx,rdx" instruction there. All writes to edx (and all 32-bit registers) will zero the upper 32-bits automatically.
Also we discussed push previously. In 64-bit mode you can't push 32-bit values. It simply can't be done. |
|||
20 Dec 2020, 22:37 |
|
Furs 21 Dec 2020, 14:06
Code: mov edx,[rbx-4] |
|||
21 Dec 2020, 14:06 |
|
Roman 21 Dec 2020, 16:56
revolution wrote: Roman: You don't need the "sub rdx,rdx" instruction there. All writes to edx (and all 32-bit registers) will zero the upper 32-bits automatically. O ! I dont know this ! I test and look in IDA Pro mov rax,-1 mov eax,0xff00ff00 ;this reset to null high parts rax Why this need do ? About reset high part rax. Very handfull store in high part some values. And exist MOVSXD |
|||
21 Dec 2020, 16:56 |
|
revolution 22 Dec 2020, 09:23
Roman wrote: Why this need do ? About reset high part rax. |
|||
22 Dec 2020, 09:23 |
|
Roman 22 Dec 2020, 09:38
Quote: Ask AMD. They decided it. Where was Intel ? Smoking in the bathroom ? |
|||
22 Dec 2020, 09:38 |
|
revolution 22 Dec 2020, 09:40
Roman wrote: Where was Intel ? |
|||
22 Dec 2020, 09:40 |
|
Roman 22 Dec 2020, 09:47
Intel was in Italy and created itanium.
|
|||
22 Dec 2020, 09:47 |
|
Furs 22 Dec 2020, 14:31
Roman wrote: Why this need do ? Code: mov rax, -1 ; do some stuff mov eax, 1234 ; eax is now a different physical register, all computations on it are done in parallel to above But now it implicitly knows they are 0, so it can use a totally different register to do the calculations at the same time without waiting for it. |
|||
22 Dec 2020, 14:31 |
|
Roman 22 Dec 2020, 14:56
Quote:
And how to use it on practically ? Show simple example. |
|||
22 Dec 2020, 14:56 |
|
Furs 23 Dec 2020, 14:55
Roman wrote: And how to use it on practically ? Here's an example with a loop: Code: @@: mov rax, [some_var + rcx*8] ; do something with rax mov eax, [some_other_var + rcx*4] xor eax, edx ; do some other stuff mov [some_output + rax*4], esi loop @b Keep in mind this isn't just two things running in parallel. Each iteration of the loop runs in parallel since it's independent of another one (except for ecx, which is dirt cheap to compute, just a decrement on each iteration). Depends how much the CPU can execute in parallel at this point, which varies by CPU design. You don't concern yourself with that, what you simply do is allow it to run it in parallel, nothing more. It could execute 2 things in parallel at same time, or 100. That's why some CPUs are wildly faster than others, even with similar clock speeds. They execute more stuff in parallel. But obviously to do this, they need to be allowed to execute them in parallel. Register renaming is a big deal for this. Now it can do both memory reads per loop at the same time, instead of having to wait for first memory read and other computations done. Keep in mind that the CPU OoO execution doesn't "stop" at a jump or loop. Branch prediction is a huge thing. For loops it will correctly predict them a lot of the time. So as far as the CPU sees, it sees a lot more of these parallel instructions than just 2: it sees the next loop iteration at the same time, then the next as well and how many it can fit in its pipeline. It executes all of them at the same time. |
|||
23 Dec 2020, 14:55 |
|
Roman 23 Dec 2020, 15:07
[quote="Furs"]
Roman wrote: mov rax, [some_var + rcx*8] ;i think here any regs do parallel , not only rax. You said CPU do this parallel. Rax on one CPU register and eax another CPU register Physically in CPU this is two registers. It right? Code: mov ecx,300 @@: mov rax, [some_var + rcx*8] ; do something with rax mov eax, [some_other_var + rcx*4] xor eax, edx ; do some other stuff mov [some_output + rax*4], esi dec ecx test ecx,ecx jnz @b You said in this case CPU do two parallel loops. It right ? |
|||
23 Dec 2020, 15:07 |
|
Furs 24 Dec 2020, 13:47
Roman wrote: You said CPU do this parallel. The registers you access in code do not map directly to physical registers, the CPU abstracts that and uses a lot more internally due to register renaming. Roman wrote: You said in this case CPU do two parallel loops. As long as it has idle execution units available, it will try to fill them up to do work at the same time, with things that don't depend on previous results. |
|||
24 Dec 2020, 13:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.