<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/135346>135346</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SystemZ][TTI]Wrong costs for insertelement with even/odd indices
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alexey-bataev
</td>
</tr>
</table>
<pre>
Looks like there is bug in SystemZTargetTransformInfo.cpp, SystemZTTIImpl::getVectorInstrCost:
```
if (Val->isIntOrIntVectorTy(BitWidth: 64))
return ((Index % 2 == 0) ? 1 : 0);
```
It returns cost 1 for insertion into lane 0 and cost 0 for insertion into lane 1, though looks like SystemZTTIImpl::getScalarizationOverhead implements different logic
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0kkFr6zgQxz_N-DIk2JKd2AcfkmYNhoUeGlrYm2yNbW1lKUjjtNlPvzgNr48HFQNC0vxnND_-KkYzOqIaiiMUp0QtPPlQK0ufdNt0ihVdk87rW_239-8RrXkn5IkCoYnYLSMahy-3yDT_c1ZhJD4H5eLgw9y6wW_7ywXE06-Mc9vOFwvyAPIwEr9Szz60LnJ48pHX-_Qeu_QR6cEMCKJ8VXYD8i8TW8fPoXUP6fkGojwafjOaJ5AH3OUgqjXSA2IgXoJb5SDK1mn6RBAFCgR5AnnCFESFIBvMcNWuR5DHP_pDemj5USpi7yNjhoMPaFykwMY7NI49WuUIU1ROfyWlPyZlKxGe_DJOaL-p_sDopVdWBfOfWqs8XylMpDSa-WJpJscRtRkGCuQYrR9Nn-ha6kpWKqE62-e53KdpuUumWldDR50cRF9psZN6L6peyrLMs7KvdNElphapKNI8W1ee77aauq7v9qUo9qLIM4I8pVkZu7X2Om99GBMT40J1JguZ7xKrOrLx7iQhHH3g_RWEWI0V6lW06ZYxQp5aEzl-l2HD9m7BBwMoTlAcz-cWitNb8G68I42_EaWv6fHD8IR0JQei8Vqjcdr0FJMl2HpivsSVo2hANKPhaem2vZ9BNGvnx7a5BP8v9Qyiuf83gmgeA11r8X8AAAD__-mWATA">