| Issue |
74169
|
| Summary |
"ext_vector_type" does not respect "aligned" attribute
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
tycho
|
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?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs