<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154125>154125</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISC-V] zero extension should be preferred over bit field extraction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
christian-herber-nxp
</td>
</tr>
</table>
<pre>
I have seen code size expansion in two workloads of embench-iot 1.0 (edn and picojpeg), when using the t-head bitfield extension.
I could not isolate a trivial code snippet. For anything simple, zext.h is used.
This is one where you can see and instruction in the style of th.extu rd, rs, 15, 0 being used in favor of zext.h:
https://godbolt.org/z/beb4r4Kzq
This is suboptimal, as zext.h can possibly be compressed. Might not be the case, here, but it happens elsewhere and hurts code density.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcUk1v8zYM_jXyhYhhK1aTHHx418JAMeyyDbtLFhOpUyRNpPP16we56Yq9F9KwQD4ffDSRP0XEUahfhHpr9MIulXF2xRN7HTcOi8GyibfcmGTv4zs4fUEgxAhzsgjkHwh4yzqSTxF8BL4muKbyd0jaEqQj4NlgnN3GJ4a-7UDIPdoIOlrIfk4fGU9CHoR8havDCAv5eAJ2CLxxqC0Yz0ePwQLeGFeYVnQ_RPfjHea0BAsxMXhKQTOCBi7-4nV40os-Z-QWplRAxzu7upz8OQesiA-8cevAEyyE9rn3T-ep_koRK6WCcE8LzDpW3StvH4nLMvOXZIdAfA9Y5bJr8cYLFFsBCtXaq1o7MFjhK1QdO-pLKnXkk4XYVnDHnKl-yknI6ZSsSYHbVE5CTg8hJ4NmKMOvj3_-z5UWkzL7sw4VSdOXsso6JyJvwh0MwpzOuSBVsfCbPzle3TO4apg1ra5UzbWbhcEzOJ0zRgIMhJ9-VA_cUpg-Xbb1LHxvGztu7WF70A2O_U4pJXcvXd-40Sozd6ofzIve9XJQA6oXfeg6JfFoLe4aP8pOqm7f7_thu5V9e9zN8tBvD3bbG9wbJYYOz9qHNoTLudrReKIFx14NvVRN0AYDrTGWMuIV1lchZU11GevQxiwnEkMXPDF9r2HPYc3_7-9_vG7-EuoNHljSd9iA3Joyg5ALHrEUtJAuWGow4b9kFr3GoVlKGH-6oWe3mHZOZyGnivtsm1zSB84s5LSyJSGnp5zLKP8NAAD__7cqNfg">