-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
I am working on flang, and we have to deal with struct passing ABI in the context of C/Fortran interoperability.
I noticed that struct {__float128} are passed on the stack (byval) by clang on X86-64. Reading at the ABI, I would expect them to be passed in SSE register.
typedef struct {
__float128 x;
} S;
void bar(__float128 x);
void test(S x) {
bar(x.x);
}
LLVM IR for X86-64:
define dso_local void @test(ptr noundef byval(%struct.S) align 16 %0) {
%2 = getelementptr inbounds %struct.S, ptr %0, i32 0, i32 0
%3 = load fp128, ptr %2, align 16
call void @bar(fp128 noundef %3)
ret void
}
declare void @bar(fp128 noundef)
clang -O3 Assembly:
test: # @test
movaps xmm0, xmmword ptr [rsp + 8]
jmp bar@PLT
For info, gcc -O3 / icc -O3 assembly looks like:
test:
jmp bar