<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112890>112890</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
On 32-bit x86, `half` return ABI is incorrect when SSE is enabled but SSE2 is disabled
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
beetrees
</td>
</tr>
</table>
<pre>
Consider the following IR ([compiler explorer](https://godbolt.org/z/nMrcsed1a)):
```llvm
target triple = "i586-unknown-linux-gnu"
define half @only_sse(half) #0 {
ret half %0
}
attributes #0 = { "target-features"="+sse,-sse2" }
define half @sse_and_sse2(half) #1 {
ret half %0
}
attributes #1 = { "target-features"="+sse,+sse2" }
```
The 32-bit x86 ABI for returning `half` is specified as using the `xmm0` register. As both `only_sse` and `sse_and_sse2` have SSE registers available, they should both be able to use the specified ABI. However, LLVM currently only compiles `sse_and_sse2` correctly, with `only_sse` incorrectly returning the `half` in `eax` instead.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlN-PozYQx_8a8zJKZIZAwgMPyaVRV7pTpV7V15XBQ3Dr2JHH5Ef_-sqQ202397ISAjwef_2ZH7ZiNkdH1IhyJ8p9psY4-NC0RDEQcdZ6fW--eMdGU4A4EPTeWn817ggvv4PAjSh3nT-djaUAdDtbHyiIci9wM8R4ZlFsBR4EHo5et97GpQ9HgYd_BB7ct9Ax6VwJrNNTbIXcC_njXcn5sfZymk1RhSNFiMGcLYEo9iAQTbmpFqP72_mrW1jjxtvi6EaB-CymqTeOYFC2B7GS3tn7KzMlSGV7gTUILCSI9W72h0Dx4Y2lfCit98-SKsZg2jESP9YmnPUuIc2ci55UHANxYin26Y27adMvC2ZCgQgfND9gMtOrcvp19n5GzZ9QAT5Nm3-Kdv75wPujOs-b_DEQFLhoTYTbpoLt7gV6HxLdGFzqGFHJKYhKgmHgM3WmN6RBMYycHFKDiUreTqekDYGOhiOFJWwZWh-HNPlWvEqCcjqZ_pOoSsKgLgTfv__yJsCgLspY1doUUNrmDjz40epZtiVIcxA9jEwTxjvddveyhF_9lS4U0uqvX__8Bt0YArlo75B44HEE-Gc0nQ-BumjvafHV_D8K495cnpL1yMVbwlwakbrNA46k9DLTTaHrolYZNfkaayyxropsaKq63uhKV12dExUbXK27Usm862vK-1L2mWlQ4iqX-SZPP8VylbcblVeoO1r1ZVWLlaSTMnaZzl86tZlhHqnJc9zUMrOqJcvTtYHo6ArTbGqbcp-FJi1atOORxUpaw5HfZaKJlprf3FOrpMQ8hTrnYOofw-_ZgetAbiqrYSCXCqahHWMyYbJpw5MxG4NtPtw-Jg5ju-z8SeBhulHmz-Ic_F_URYGHKQAWeHhEeGnw3wAAAP__oGaQ9A">