flat assembler
Message board for the users of flat assembler.

Index > Main > SSE3 max value for signed bytes

Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 01 Jul 2022, 02:58
Hi
I need to compare bytes in 248 bytes massive for greater value. Can someone show me examples how to do that?
As I see it needs to compare 256 by half then by half again and again until one left.
If I use PCMPGTB for that it sets up all bits to 1 or 0 as result. How can I manage with it then? PAND to first source, then PANDN to second, then POR between?..
Post 01 Jul 2022, 02:58
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 01 Jul 2022, 03:21
Or I can PADDB 128 for each byte, then PMAXUB, then PSUBB 128...
Even better sub 128 from last byte at the end...
Post 01 Jul 2022, 03:21
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 01 Jul 2022, 03:30
Code:
PCMPGTB dest, src
PAND dest, result
PANDN src, result
POR dest, src    
dest, src - compared values; result - the result of PCMPGTB.
Post 01 Jul 2022, 03:30
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 01 Jul 2022, 03:43
That is exactly as I said in my first thinks. But second one is more than twice faster. After first check it needs only one instruction to run -- PMAXUB. Just checked Agners tables, the result should be super fast.
Post 01 Jul 2022, 03:43
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 01 Jul 2022, 05:15
Overclick wrote:
PAND to first source, then PANDN to second

first = src. second = dest - this is the reverse order. Besides, there was a question at the end. I specified how to do it correctly.
Post 01 Jul 2022, 05:15
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 01 Jul 2022, 05:55
Post 01 Jul 2022, 05:55
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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 GitHub, YouTube, Twitter.

Website powered by rwasa.