flat assembler
Message board for the users of flat assembler.
Index
> Main > Why is the behavior of the repXX prefixes undefined for Goto page 1, 2 Next |
Author |
|
Azu 25 Dec 2009, 11:23
everything except the string instructions?
Are there any other instructions it behaves with consistently across processors? Or is it totally random? |
|||
25 Dec 2009, 11:23 |
|
Azu 25 Dec 2009, 12:04
Thanks.
I'll try it with some SSE instructions and see if it works with any of them. |
|||
25 Dec 2009, 12:04 |
|
revolution 25 Dec 2009, 12:08
Look at the SSE instruction encodings. Do you see anything familiar in some if them?
|
|||
25 Dec 2009, 12:08 |
|
Azu 25 Dec 2009, 12:12
Aww it's not that it works on them, it's that it is them.
I was hoping for something cool like rep xchg [ecx],ecx lol |
|||
25 Dec 2009, 12:12 |
|
MazeGen 25 Dec 2009, 12:14
It is documented is undefined, but I believe all x86 processors executes it as a NOP (if it has not another meaning).
|
|||
25 Dec 2009, 12:14 |
|
revolution 25 Dec 2009, 12:18
MazeGen wrote: It is documented is undefined, but I believe all x86 processors executes it as a NOP (if it has not another meaning). |
|||
25 Dec 2009, 12:18 |
|
Azu 25 Dec 2009, 12:25
Why couldn't they make it work the same as on the string functions? What is the point of having another nop? Is it there purely to obfuscate code? :/
|
|||
25 Dec 2009, 12:25 |
|
revolution 25 Dec 2009, 12:40
We don't know. You could try asking Intel if you really want to know.
But, I would guess that since it doesn't make sense to use rep on anything but string handling then it is good to leave it open for future expansion. Like they did with pause and SSE. |
|||
25 Dec 2009, 12:40 |
|
DOS386 25 Dec 2009, 12:57
Azu wrote: Why is the behavior of the repXX prefixes undefined foreverything except the string instructions? I don't know Code: rep ret rep ud2 rep cmc rep pope cs rep nop Answers (?) : [1] http://board.flatassembler.net/topic.php?p=106599#106599 [2] http://board.flatassembler.net/topic.php?t=6264 |
|||
25 Dec 2009, 12:57 |
|
LocoDelAssembly 25 Dec 2009, 16:12
Well, AMD does document the use of "rep ret", doesn't it?
[edit]Oh yes, I've said that myself in DOS386's second reference [/edit] Last edited by LocoDelAssembly on 25 Dec 2009, 22:42; edited 1 time in total |
|||
25 Dec 2009, 16:12 |
|
Azu 25 Dec 2009, 19:51
revolution wrote: We don't know. You could try asking Intel if you really want to know. revolution wrote: But, I would guess that since it doesn't make sense to use rep on anything but string handling Why wouldn't it make sense? It is loopXX but for one instruction and taking only one byte.. revolution wrote: then it is good to leave it open for future expansion. Like they did with pause and SSE. |
|||
25 Dec 2009, 19:51 |
|
baldr 26 Dec 2009, 15:07
Azu,
Could you supply an example of useful prefixed instruction? |
|||
26 Dec 2009, 15:07 |
|
Azu 26 Dec 2009, 23:23
baldr wrote: Azu, For example; rep xor[address+ecx*4],imm/r |
|||
26 Dec 2009, 23:23 |
|
revolution 26 Dec 2009, 23:43
Azu wrote: rep xor[address+ecx*4],imm/r |
|||
26 Dec 2009, 23:43 |
|
Azu 26 Dec 2009, 23:47
revolution wrote:
The prefix would be useful with almost any instruction. revolution wrote: For the negligible benefit it provides would you be prepared to make other things like SSE implementation more complex? |
|||
26 Dec 2009, 23:47 |
|
revolution 26 Dec 2009, 23:56
The reason was given. It is of negligible benefit. The makers would have to add silicon and test vectors and whatnot to implement it. And they won't go to all that effort if the overall benefit is minor. Not many programs are in need of operations like that so they keep it open for other, more beneficial, uses in the future.
If rep was made universal at the start (the 8086) then current SSE would have been harder to implement. We are currently reaping the benefit of not being so liberal with rep. |
|||
26 Dec 2009, 23:56 |
|
Azu 26 Dec 2009, 23:58
But adding rep to an 8086 instruction doesn't turn it into an SSE instruction.. so I don't understand.. what would be the difficulty? And the silicon is already there for the string functions. Couldn't it be reused?
|
|||
26 Dec 2009, 23:58 |
|
revolution 27 Dec 2009, 00:12
If you enabled rep for everything then that means that SSE has to use some other encoding format because rep is already used.
And, no, silicon can't just be "reused" like that. CPUs don't work that way. Read some books about CPU design if you want to know how they do work. |
|||
27 Dec 2009, 00:12 |
|
Azu 27 Dec 2009, 00:17
revolution wrote: If you enabled rep for everything then that means that SSE has to use some other encoding format because rep is already used. Azu wrote: They could still use it for other instructions besides pause and SSE ones, though.. revolution wrote: And, no, silicon can't just be "reused" like that. CPUs don't work that way. Read some books about CPU design if you want to know how they do work. Does the 16bit prefix need extra silicon for each individual instruction too, then? |
|||
27 Dec 2009, 00:17 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.