Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ASM - Extend float in XMM to 128 bits

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3320

PostPosted: Mon Jan 27, 2025 3:30 pm    Post subject: ASM - Extend float in XMM to 128 bits Reply with quote

Hi all,
this is what CE shows in the XMM register as float:
Code:
XMM0:0.00  _  0.00  _  0.02  _  0.02

XMM0 contains 4 floats, as it were a 4D vector.
I would like to multiply each float with the same float value while not using movups to load 4 floats; I want to load just one float and extend it.

To move a float into XMM, we use movss.
E.g.
Code:
movss xmm1,[fMyVal]

Is there an instruction to copy the float from the first 32 bits of XMM1 to the other 3 dwords of the XMM register so it would look like this:
Code:
XMM1:0.50  _  0.50  _  0.50  _  0.50

Or, use something else instead of movss to get the same result, loading the same float into all 4 dwords at once?

In the end, I would like to use mulps xmm0,xmm1 to do the multiplication.

Thank you!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25778
Location: The netherlands

PostPosted: Mon Jan 27, 2025 3:47 pm    Post subject: Reply with quote

i'm not 100% on this, but try
Code:

shufps xmm1, xmm1, 0x00

to replicate the 0.50 to the other 3 spots

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Mon Jan 27, 2025 4:06 pm    Post subject: Reply with quote

If AVX is available, there's `vbroadcastss`

But if the game isn't using AVX (no `v` prefix on SSE instructions), stick with `movss` / `shufps` as DB said

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3320

PostPosted: Tue Jan 28, 2025 4:36 am    Post subject: Reply with quote

Dark Byte wrote:
i'm not 100% on this, but try
Code:

shufps xmm1, xmm1, 0x00

to replicate the 0.50 to the other 3 spots

Tested, this is 100% correct, thank you!

ParkourPenguin wrote:
If AVX is available, there's `vbroadcastss`

But if the game isn't using AVX (no `v` prefix on SSE instructions), stick with `movss` / `shufps` as DB said

No, there's no AVX, it's an older title.
Thank you though, I will take a mental note on this one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites