<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Seems fair.</p>
<p>The main thing that I'm wary of is memory alignment. SSE works
best with structures that are aligned to a 16-byte boundary -
attempting to call MOVAPS with a structure that isn't aligned will
trigger an access violation, while MOVUPS is considerably slower
on older processors. This is why I suggested something like the
following some time ago, instead of depending on slightly messy
pre-processor directives:</p>
<p><tt><b>type </b>TVector4 = <b>record</b></tt><tt><br>
</tt><tt> X, Y, Z, W: Single</tt><tt><br>
</tt><tt><b>end </b><b>align </b>16;</tt></p>
<p>Gareth aka. Kit<br>
</p>
<div class="moz-cite-prefix">On 18/01/2020 19:39, Sven Barth via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:dc11051d-13e9-3e4e-84ad-fe6dda18b3c2@googlemail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Am 18.01.2020 um 18:52 schrieb J.
Gareth Moreton:<br>
</div>
<blockquote type="cite"
cite="mid:1ffc576a-752d-99fc-19d6-648e94f90ad1@moreton-family.com">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<p>I think more than anything I would like to see a degree of
"ease of use" for the SIMD intrinsics, since modifying __m128
data in C/C++ is not that straightforward. Just as a
straightforward example, what might be the best way to ensure
these following record types are compatible with the __m128
data types?</p>
<p><tt><b>type </b>TVector4 = <b>record</b></tt><tt><br>
</tt><tt> X, Y, Z, W: Single;</tt><tt><br>
</tt><tt><b>end</b>; // compatible with __m128f</tt></p>
<p><tt><b>type </b>TComplex = <b>record</b></tt><tt><br>
</tt><tt> Re, Im: Double;</tt><tt><br>
</tt><tt><b>end</b>; // compatible with __m128d</tt></p>
<p>Programmers on their own projects, whether it be a game or a
mathematical program, would much rather work with those
constructs if it can be helped... or at least I would.</p>
</blockquote>
The compiler currently considers corresponding arrays as
compatible, like "array[0..3] of Single" or "array[0..1] of
Double". In theory nothing would stop us from implementing similar
compatibility with the records you mentioned.<br>
<br>
Though to be really useable it would need to be flexible enough to
handle for the following for example as well:<br>
<br>
=== code begin ===<br>
<br>
type<br>
TVector3 = record<br>
X, Y, Z: Single;<br>
end;<br>
<br>
TVector4 = record<br>
P: TVector3;<br>
W: Single;<br>
end;<br>
<br>
=== code end ===<br>
<br>
Regards,<br>
Sven<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
</body>
</html>