<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68560>68560</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Difference between attributed typedef vs using
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
uncleasm
</td>
</tr>
</table>
<pre>
In x86 backend at least there's a difference between the generated code in
```
auto load(uint8_t const *p) {
typedef uint8_t Vec __attribute__((vector_size(16),aligned(1)));
return *(reinterpret_cast<Vec const *>(p));
}
movups xmm0, xmmword ptr [rdi]
ret
auto load2(uint8_t const *p) {
using Vec = uint8_t __attribute__((vector_size(16),aligned(1)));
return *(reinterpret_cast<Vec const *>(p));
}
movaps xmm0, xmmword ptr [rdi]
ret
```
The intention of course is to initialise the vector with unaligned load.
At least according to https://stackoverflow.com/questions/10747810/what-is-the-difference-between-typedef-and-using
there should be no difference between these statements (btw GCC seems to agree with this).
It's of course possible that there's a better (cross-platform) way to initialise extended vectors, which I'm unfortunately not aware of (https://stackoverflow.com/questions/77256820/what-is-the-proper-method-to-initialise-load-gcc-vector-extensions)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlE-PszYQxj_N5DIiApPw58Bh36Sp9l71Ghl7CO4LNrWHsNtPX5mwu-9uVantqREKSmw_88zPMyNDMDdL1MDxGxzPOzlz73wzWzWQDOOudfq1ebb4UhXYSvWdrEbJGBcZuSdPIMqAErXpOvJkFWFLvBDZuIw3suQlk0blNKGxkJ4hfYIi3Z71p5zZ4eCkBlHNxnJ1ZVTOBkYQTxOIGqH89tiK_DqRpg7f9v1KCq9XyexNOzNdryAqENWdFDt_DeYPAlFlBYgaxEkOMdsYJlv_WJ_8TdoTz97GmCAqT8Yy-ckTX5UMDPkphnq3BflPIKrpiwaU501s-4zuPk8B8WUcUxCn-F6c1zixRzh-89rA8csRT7yJfYYj_gGdORh7W5lAfn5n9P_mI_8zn89V9Pj-pY9lxmTZOIuuQ-VmHwhNQHZorGEjBxNoLc8HBVwM9zjbLfsV9h5_FH16K3mplPM6MmaHPfMUIH8CcQFxCSzVd3cn3w1u2Ss3grj8PlOIPgKIS5aWh7LKUhCXpZecmJBwT8lH4yRb4yRbiSfS6mS90IeJtd0w9G4eNLaE1v1N1wXCwJJpJMsBQVQtL_jz6YSBaFwxyJsneqTNvQkg6v2P6T7z2tUf8CYXgmmHCE1-7vuWmMnHIMq7EJJpkNw5P8ayXOTrF-b0wmQ16Q18iDe-9Eb1-AyiHHG2nfM8W8k0vKJ1jHKRnqITENW_412W4lhU4ivvybuJfDIS904n7JIPe0m8-OSmVPKwl6x2w0Ov3ukm13Veyx01WVEXVV6KvN71jejKutakMpm2uigOXXYsOtJCVnlGUh52phGpyLM0rdPykOb1Pi8PhahEfjzk1HaZhENKozTDfhju4975286EMFNTVMci3Q2ypSGsE1oISwuuiyBEHNi-iWeSdr4FOKSDCRw-VNjwQM35r0XyPg70-zy9h8fw2M1-aD6Tvhnu53ZDHMW3V2T5GykGcVktReqr5T8DAAD__6qSBR8">