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

    <tr>
        <th>Summary</th>
        <td>
            Incorrect codegen for unaligned load/store (ARM NEON)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    https://clang.godbolt.org/z/nEfsT961d

```c
#include <arm_neon.h>
#include <stdint.h>

void double32(uint8_t* data) {
    uint8x16x2_t x = vld1q_u8_x2(data);
    uint8x16_t y0 = vaddq_u8(x.val[0], x.val[0]);
    uint8x16_t y1 = vaddq_u8(x.val[1], x.val[1]);
    uint8x16x2_t y = {y0, y1};
    vst1q_u8_x2(data, y);
}
```

```asm
double32:
        vld1.8  {d16, d17, d18, d19}, [r0:256] ; <- should be [r0]
        vshl.i8 q11, q9, #1
        vshl.i8 q10, q8, #1
        vst1.8  {d20, d21, d22, d23}, [r0:256] ; <- should be [r0]
        bx      lr
```

https://developer.arm.com/documentation/den0018/a/NEON-Instruction-Set-Architecture/Alignment

It seems that there is no way to generate unaligned load/store instructions.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE1zmzAQ_TXiojGDpIDhwMGJk5kcms60vXsEWgMdWYol4dr99V2B08RpnEsZ0CLpvbdfgsaqU92H8OyJWBH-gHerpenSzqrG6pBa1-Hab3zM_db_qAqmSLYm2eo8Ftl8t-c5F4Np9aiAEnEn3W5jwJq0J-L-I4APajDh7fY0HuygqLJjo0FwwssRQeUmEL6iSgZJeEXJ8nbGUrym_SMrjnwT6BGF1_SgFdtvxnJzjAJnFhEfkJByymaOVCpykHBMD1KT_DYj-ZrwO3o5vy7Ergmxd0LsE6EpjdOkhGmessg7MbJcX6APPvyTIeLeikbKZZs-7J30u3nlb8nF6tXP5AurmZY0hqNYEf0otpxNOZsq-sI3TM1lyOd5gRliDrexzwvqeztqRRs4I_L1Ow--1-lQ0j1jUWZfTWJcsGuwqSr78hos_I2XT0jF2Wz4bMR_xtscZ6vdJxW-_LAUHEDbZ3Apfhdpa3dxzbbjDkyQYbBmwpgsizV9wG4-PN1_fVo8Gh_c2EbA4juExcq1_RCgDaMDxKz00Jko8dbxY6AeYOdp6GXAARzQwVNj6S95osHSDgw4GYCORkYBUFRbqVDPBxvBr059mkDNiqIsRbmsikTVQlWikkkYgob60bTWOQyHtlYB6tKtdddk8aCuvn2hMS88p8no9LufTzeEfmzOxdH68GIWz87-RCc4HbwfweNLXmUlS_q62DK5lJCXy1JwBTcNSMaqPK9yuNmqcplo2YD2NTYS25gMNc84ZwjJCoQVqSiWhRKyUpkCLraM3GSwk4NOo-P4A0xcPcXQjJ3HTT344F83pfcxU3jRl2Poraufxm4wkEzR1lOofwAfbYc1">