flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Support MOVBE

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Can you give a code snippet, revolution? I'm having trouble imagining how that would be optimal. I did find this recently - many awesome case studies.
Post 07 Jul 2009, 20:35
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17349
Location: In your JS exploiting you and your system
revolution
Text is basically a big-endian storage format. The first character is the most significant for sorting purposes.
Code:
string_a: db 'Hello',0
string_b: db 'world',0

movbe eax,dword[string_a]
movbe ebx,dword[string_b]
cmp eax,ebx
ja swapStrings
jb alreadyInOrder
je goToNextDword    
Post 08 Jul 2009, 01:13
View user's profile Send private message Visit poster's website Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
Code:
movbe eax,dword[string_a]
movbe ebx,dword[string_b] 
    

Is more compact, but is it faster than...
Code:
mov eax,dword[string_a]
mov ebx,dword[string_b]
bswap eax
bswap ebx 
    


In any case the string compare is a good example of usage for the MOVBE REG,MEM (although it wouldn't be useful for unicode).

Can anyone think of a similar snippet/example/algo for MOVBE MEM,REG? The equivalent MOV / BSWAP / MOV would seem to benefit from this new opcode but I can't think of a situation where it would be done in iteration and where SIMD wouldn't be better served for the task.

Does Intel have a rationalization for MOVBE? Maybe it was purely for the sake of completeness or did they find a bottle neck in a large algorithm that the Intel Compiler couldn't handle well.

At this point in the x86 instruction set it's funny that BSWAP is getting a "service pack" Smile
Post 08 Jul 2009, 20:49
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.