<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/66837>66837</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            avx register spill generates 14 instructions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          fbarchard
      </td>
    </tr>
</table>

<pre>
    Changing instruction order from:

```
const __m128i va0 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a0));
const __m256i vxa0 = _mm256_cvtepi8_epi16(va0);
a0 += 8;
const __m128i va1 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a1));
const __m256i vxa1 = _mm256_cvtepi8_epi16(va1);
a1 += 8;
const __m128i va2 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a2));
const __m256i vxa2 = _mm256_cvtepi8_epi16(va2);
a2 += 8;
```

to this:

```
const __m128i va0 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a0));
const __m128i va1 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a1));
const __m128i va2 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a2));
const __m256i vxa0 = _mm256_cvtepi8_epi16(va0);
a0 += 8;
const __m256i vxa1 = _mm256_cvtepi8_epi16(va1);
a1 += 8;
const __m256i vxa2 = _mm256_cvtepi8_epi16(va2);
a2 += 8;
[xnn_qd8_f32_qc8w_gemm_minmax_ukernel_3x8c8__avx2.txt](https://github.com/llvm/llvm-project/files/12667142/xnn_qd8_f32_qc8w_gemm_minmax_ukernel_3x8c8__avx2.txt)
```

Causes a microkernel to go from 46 instructions to 60 instructions, due to register spill (of 1 vector)
The generated code generates quite a few vmovdqa to shuffle register order

Attached is preprocessed source


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlc1u4ywUhq8Gb9AXmYNN8cKLplGu4NtbBI5tZrBJALuZux_Z_UnTSq1mFFUjISz-3vOY8wIqRtuNiDUpt6TcZWpKvQ91e1BB9yqY7ODNr_qhV2Nnx47aMaYw6WT9SH0wGGgb_ED4Pcl3JH-pRf5c1qb2Y0y0aQYG0tJZ5ZTwHW2GoTkEr4xWMZ0aPFpREJBLt_PKuNceAvJKgcA9gYqqnEC1FL59FwZKYel8vsSBUjR6Tni0clFlgoCcn9a_LF4mw3aZLz8KPnOz23Czr7jZ59zsipt9zQ234YavuOFzbrjiho_c72zzVCdPU2_jv-WwbzLEN-fvZufl5ka-mcPK7Xkcm5ORTcuhOWn52HQ4DM1gx0Gdm-knhhFdw89Sy6ZR8xk26ZxIuSMg-5SOqw9hT2Df2dRPh432A4G9c_PL579j8D9QJwL71jqMBPYMhLhjBRDY_1V0qD45Hw9qihipooPVwT8p0ORp59ebmRbi7Z0dlyGRX3UReKBmwmUkYGdjwkDj0TpHCUjfUkZn1MmHV47_e6QdjhhUQkO1N5dmpKfJJqSKtvhI58HP5qQW5dhPbevwEmF9PN7-yH1KSvdoqI30GPAYvMYY0dDop6Dx7dTM1NxUvFIZ1kxUJROFAMj6upVtgZyrUoHioJk5MBB3ZSWUEkIWbWZryIHnFauA57yAjeRtZSrOSgOF4rkkRY6Dsm6z5HLjQ5fZGCeshZD8LnPqgC6uTyXAiI90HSQAy8sZ6jX_h6mLpMidjSleVJJNDms1n9_v8WXnWHGVlmwKrv5jz61Ai-lW4N8BAAD__8jAYd8">