A
A
Alexander Gusev2015-01-03 01:21:21
Delphi
Alexander Gusev, 2015-01-03 01:21:21

How to pack 4 real values ​​into XMM register in Delphi?

Good day. Here I ran into a problem, the task is as follows:
Input data: an array of values ​​\u200b\u200band a minimum search option (with and without SSE)
Action: searches for the minimum element and its number using the selected method
Output: minimum element and its number
That's the problem with this SSE.
How do I pack 4 real numbers into an XMM register in Delphi?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zed, 2015-01-03
@Sanchogus

In pure Delphi, without assembler insertion, this, in my opinion, cannot be done. Well, how to do it in assembler, you can google for a couple of minutes: Moving a single float to a xmm register

"mov    $0x3f000000, %%eax\n"  // encoding of 0.5
"movd   %%eax,       %%xmm1\n" // move to xmm1
"shufps $0, %%xmm1,  %%xmm1\n" // splat across all lanes of xmm1

Here, the key instruction is shufps , as far as you can tell.
If the data is already packed in memory, you can immediately drive it into the xmm register (example from the link above):movaps xmm0,xmmword ptr [ecx]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question