mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-28 15:58:57 -04:00

According to the x86-64 ABI, structures with both floating point and integer members are split between floating-point and general purpose registers, and consecutive 32-bit floats can be packed into a single floating point register. In the case of variadic functions these are stored to memory and the position recorded in the va_list. This was already correctly implemented in llvm.va_start. The problem is that the code in clang for implementing va_arg was reading floating point registers from the wrong location. Patch by Thomas Jablin. Fixes PR20018. llvm-svn: 211626
16 lines
470 B
C
16 lines
470 B
C
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
|
|
|
|
struct Bar {
|
|
float f1;
|
|
float f2;
|
|
unsigned u;
|
|
};
|
|
|
|
struct Bar foo(__builtin_va_list ap) {
|
|
return __builtin_va_arg(ap, struct Bar);
|
|
// CHECK: [[FPOP:%.*]] = getelementptr inbounds %struct.__va_list_tag* {{.*}}, i32 0, i32 1
|
|
// CHECK: [[FPO:%.*]] = load i32* [[FPOP]]
|
|
// CHECK: [[FPVEC:%.*]] = getelementptr i8* {{.*}}, i32 [[FPO]]
|
|
// CHECK: bitcast i8* [[FPVEC]] to <2 x float>*
|
|
}
|