 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3320
|
Posted: Mon Jan 27, 2025 3:30 pm Post subject: ASM - Extend float in XMM to 128 bits |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25778 Location: The netherlands
|
Posted: Mon Jan 27, 2025 3:47 pm Post subject: |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4695
|
Posted: Mon Jan 27, 2025 4:06 pm Post subject: |
|
|
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 |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3320
|
Posted: Tue Jan 28, 2025 4:36 am Post subject: |
|
|
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 |
|
 |
|
|
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
|
|