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

    <tr>
        <th>Summary</th>
        <td>
            "ext_vector_type" does not respect "aligned" attribute
        </td>
    </tr>

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

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

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

<pre>
    At least on the X86 target, this test case does not emit unaligned loads/stores:

```c++
#if defined(__clang__)
typedef float float4 __attribute__((ext_vector_type(4), aligned(4)));
#elif defined(__GNUC__)
typedef float float4 __attribute__((vector_size(16), aligned(4)));
#endif

void fma4(float4 &out, float4 const &a, float4 const &b, float4 const &c)
{
 out = a * b + c;
}
```

You can see this in action on godbolt: https://gcc.godbolt.org/z/GTod8vMTr

Using GCC and their vector extension implementation with `aligned(4)` emits this:
```
fma4(float __vector(4) const&, float __vector(4) const&, float __vector(4) const&):
 movups  xmm1, XMMWORD PTR [rsi]
        movups  xmm0, XMMWORD PTR [rdi]
        mulps   xmm0, xmm1
        movups  xmm1, XMMWORD PTR [rdx]
        addps   xmm0, xmm1
        ret
```

While Clang does this, regardless of `aligned(4)` (reproduced on Clang 17, but it seems to happen with any Clang version that supports `ext_vector_type`:
```
fma4(float __vector(4) const&, float __vector(4) const&, float __vector(4) const&):                   # @fma4(float __vector(4) const&, float __vector(4) const&, float __vector(4) const&)
 movaps  xmm0, xmmword ptr [rsi]
        mulps   xmm0, xmmword ptr [rdi]
        addps   xmm0, xmmword ptr [rdx]
 ret
```

Shouldn't that be emitting unaligned loads/stores?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVcFu4zYQ_Rr6MtiAomRZPuiQ2HBOaYttFrs9GRQ5tlhQokCOHGe_vqCk2o7jbIsWKGoIMjDim_c08zQjQzD7FrFk8wc2X89kT7XzJb2q2s0qp1_LewK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