[llvm-bugs] [Bug 29092] New: psABI inconsistency when passing vector registers?
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 22 08:13:58 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=29092
Bug ID: 29092
Summary: psABI inconsistency when passing vector registers?
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: wenzel.jakob at epfl.ch
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Clang trunk does not pass vector types through registers when they are
contained in an aggregate data type. Consider the following simple program:
------------------------------
C code:
#include <immintrin.h>
typedef struct __attribute__((aligned(16))) {
__m128 x, y;
} Structure;
__m128 test1(__m128 x, __m128 y) { return y; }
__m128 test2(Structure t) { return t.y; }
------------------------------
Assembly:
$ clang++ test.cpp -msse4.2 -I include -std=c++14 -o - -S -fomit-frame-pointer
-O3
__Z5test1Dv4_fS_:
vmovaps %xmm1, %xmm0
retq
__Z5test29Structure:
vmovaps 24(%rsp), %xmm0 <------ copy from memory :(
retq
------------------------------
The psABI spec
(https://github.com/hjl-tools/x86-psABI/blob/master/low-level-sys-info.tex#L506)
has the following to say about this:
Each field of an object is classified *recursively* (emphasis added) so that
always two fields are considered. The resulting class is calculated according
to the classes of the fields in the eightbyte [...].
(a)-(e) [... cases which don't apply ...]
(f) Otherwise class SSE is used.
Intuitively (and according to the spec), I would have expected that "x" is
assigned to %xmm0 and "y" is assigned to %xmm1.
I'm wondering if I am misreading the ABI here, or if Clang is in violation?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160822/5c63c897/attachment.html>
More information about the llvm-bugs
mailing list