https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96895
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > (In reply to Michael Matz from comment #2) > > The psABI doesn't say anything about such types, no. Maybe it could in some > > additional info pages, but it's always a problem to codify behaviour > > retroactively > > in it, when conflicting implementations already exist. It is about > > extension types, though, so we might be fine. > > > > FWIW, even ignoring the obvious relation of v1Xf to Xf, GCC behaviour for > > float and clang behaviour for double is the most logical one: this extended > > type is most > > similar to a struct containing one float/double, and such are passed in XMM > > registers per psABI. As this is also consistent with how a single > > top-level float is passed, this choice is the most consistent one. This is > > also > > what the psABI _would_ say, if we had written it into it, so at least both > > compilers would need a change to implement it. > > So vector types with element type T and N, a power-of-two, not otherwise > specified are passes the same as > > struct S { T a[N] }; > > ? I guess there's mismatch then for AVX types with -mno-avx then at least > (AVX512 are probably too big to be passed in registers). Ugh. We pass struct S { double a[4]; } in %rdi _and_ on the stack?! And return by invisible reference _and_ in %eax? typedef struct S { double a[4]; } v4df; v4df foo (v4df x) { return x; } foo: .LFB0: .cfi_startproc movq %rdi, %rax movdqu 8(%rsp), %xmm0 movups %xmm0, (%rdi) movdqu 24(%rsp), %xmm1 movups %xmm1, 16(%rdi) ret but a two-element array is passed/returned in two %xmm regs