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

    <tr>
        <th>Summary</th>
        <td>
            -mcpu=cortex-m33 does not set -munaligned-access
        </td>
    </tr>

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

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

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

<pre>
    Cortex-M33 is ARMv8-M Mainline, which supports unaligned access unless explicitly disabled. It appears to be correct in ARM.td, but as you can see below the output depends on the flag being explictly passed.

Test case:
```
int ttt(short a[2], short b[2]) {
  return (int)a[0] * (int)b[0] + (int)a[1] * (int)b[1];
}
```

Output with `clang --target=arm-none-eabi -mcpu=cortex-m33 -O3 -S -o- testcase.c`:
```
        ldrsh.w r2, [r0]
        ldrsh.w r0, [r0, #2]
        ldrsh.w r3, [r1, #2]
        ldrsh.w r1, [r1]
        muls    r0, r3, r0
        smlabb  r0, r1, r2, r0
        bx      lr
```

Output with `clang --target=arm-none-eabi -mcpu=cortex-m33 -munaligned-access -O3 -S -o- testcase.c`:
```
        ldr     r0, [r0]
        ldr     r1, [r1]
        movs    r2, #0
        smlad   r0, r1, r0, r2
        bx      lr
```

Version: Homebrew clang version 15.0.6
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lEFv4zYQhX8NdRlIoKhIsQ46xGsY7SFYoC16J6lZiwVFCpxRnPz7gpY33iy8bVFgAYO0Hh_5Rt-A0kTuFBAH0e5Feyj0ylNMA-uk_Wth4vg2fIqJ8bV8bhpwBE-_Pb_symd41i54F1CoT3CenJ2A1mWJiQnWoH0-dARtLVIWfJ7wdfHOOvZvMDrSxuNYwa8MellQJwKOYBBsTAktgws5q-IxJ5iVQRO8xRWsDkCIYNDHM_CEEFdeVoYRFwwjQQwX9YvXJzDowukanHMXTYRjJeRByKdt_AOJwWpC0VwV0cnr7_LoAgMzC7WjKSYGLdq9Eu0h17Up5l3pQTzut20ACXlNAYTaucBC9XmjFO0BhHq6qeam7j9667verIrmGiIeD3dr3sbPG5iz4wlEJ63X4QRlyTqdkEVz0GkuQwxYojYOytkuq2gOduv33DRQfm6g_B3KWAIjcaZU2RzyA1RC9n5MNFVnIfukMiHR7lN-vXsGeTPkP6pRPzA2X431vxjrm_Ebw7x6es_bDku3imn22pjb-uWMrfhvXOY1J6WfSnt-vznl9eb8vwZ8x_Yjqn_AFF_o1jfVfEQ0fk9IXjn9d0J_YiIXg2ie4Jc4o0l4hg3Ty7YCdVvJqivGoRn7ptcFDnX3WCu1k3VXTIPtet3ph7ZtcffF1hp77FCNoxmNkthh4QYllapV3SklZd1V2O_Qdjs00vRmhw_iQeKsna-8f5mrmE6FI1pxaPu2k4XXBj19_RamIZtKs55IPEjviOm2jR17HO50cYxIECIDId9pabEmP0zMC-UeqqNQx5PjaTWVjbNQxxxwncolxb_QslDHS5Ek1PFS598BAAD__7Rdpew">