<HTML>
<div><style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>Indeed, most of the instructions for bit extracting appeared later for SSE and AVX.  I did find one instruction that works with general-purpose registers, named BEXTR, but it only extracts contiguous bits and requires BMI1.<br>
</div><div><br>
</div><div>Gareth aka. Kit<br>
</div><br>
 <br>
<br>
<span style="font-weight: bold;">On Sat 23/02/19 10:27 , Jonas Maebe jonas@freepascal.org sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">On 23/02/2019 01:30, J. Gareth Moreton wrote:
<br>

<span style="color: rgb(102, 102, 102);">> Given that the reference is an offset from %rbp, the compiler will know 
</span><br>

<span style="color: rgb(102, 102, 102);">> for sure that the variable is local, so there won't be any problems with 
</span><br>

<span style="color: rgb(102, 102, 102);">> multi-threading that prevents a lot of temporary register storage for 
</span><br>

<span style="color: rgb(102, 102, 102);">> safety reasons.
</span><br>


<br>

Unpacking records could be done if their address is not taken anywhere. 
<br>

The compiler already supports keeping records in registers under the 
<br>

same conditions, but only up to a certain size (two native registers) 
<br>

and only using the same layout as they would have in memory (so no 
<br>

explicit splitting out fields into separate registers).
<br>


<br>

On x86, it does this less often than on other architectures, because 
<br>

that architecture does not have efficient instructions to extract/insert 
<br>

bits from/into registers. However, one improvement that could be made 
<br>

there in the compiler is to ignore this fact if every field of the 
<br>

record already corresponds to exactly one register.
<br>


<br>


<br>

Jonas
<br>

_______________________________________________
<br>

fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>

<a target="_blank" href="<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>"><span style="color: red;">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</span></a>
<br>

<br>

<br>

</blockquote></HTML>