| 1 |
// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s \ |
| 2 |
// RUN: | FileCheck %s --check-prefix=GNU32 |
| 3 |
// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s -fms-layout-compatibility=microsoft \ |
| 4 |
// RUN: | FileCheck %s --check-prefix=GNU32 |
| 5 |
// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -o - %s \ |
| 6 |
// RUN: | FileCheck %s --check-prefix=GNU64 |
| 7 |
// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s \ |
| 8 |
// RUN: | FileCheck %s --check-prefix=MSC64 |
| 9 |
|
| 10 |
struct { |
| 11 |
char c; |
| 12 |
long double ldb; |
| 13 |
} agggregate_LD = {}; |
| 14 |
// GNU32: @agggregate_LD = dso_local global { i8, [3 x i8], x86_fp80 } zeroinitializer, align 4 |
| 15 |
// GNU64: @agggregate_LD = dso_local global { i8, [15 x i8], x86_fp80 } zeroinitializer, align 16 |
| 16 |
// MSC64: @agggregate_LD = dso_local global { i8, [7 x i8], double } zeroinitializer, align 8 |
| 17 |
|
| 18 |
long double dataLD = 1.0L; |
| 19 |
// GNU32: @dataLD = dso_local global x86_fp80 0xK3FFF8000000000000000, align 4 |
| 20 |
// GNU64: @dataLD = dso_local global x86_fp80 0xK3FFF8000000000000000, align 16 |
| 21 |
// MSC64: @dataLD = dso_local global double 1.000000e+00, align 8 |
| 22 |
|
| 23 |
long double _Complex dataLDC = {1.0L, 1.0L}; |
| 24 |
// GNU32: @dataLDC = dso_local global { x86_fp80, x86_fp80 } { x86_fp80 0xK3FFF8000000000000000, x86_fp80 0xK3FFF8000000000000000 }, align 4 |
| 25 |
// GNU64: @dataLDC = dso_local global { x86_fp80, x86_fp80 } { x86_fp80 0xK3FFF8000000000000000, x86_fp80 0xK3FFF8000000000000000 }, align 16 |
| 26 |
// MSC64: @dataLDC = dso_local global { double, double } { double 1.000000e+00, double 1.000000e+00 }, align 8 |
| 27 |
|
| 28 |
long double TestLD(long double x) { |
| 29 |
return x * x; |
| 30 |
} |
| 31 |
// GNU32: define dso_local x86_fp80 @TestLD(x86_fp80 noundef %x) |
| 32 |
// GNU64: define dso_local void @TestLD(ptr dead_on_unwind noalias writable sret(x86_fp80) align 16 %agg.result, ptr dead_on_return noundef %0) |
| 33 |
// MSC64: define dso_local double @TestLD(double noundef %x) |
| 34 |
|
| 35 |
long double _Complex TestLDC(long double _Complex x) { |
| 36 |
return x * x; |
| 37 |
} |
| 38 |
// GNU32: define dso_local void @TestLDC(ptr dead_on_unwind noalias writable sret({ x86_fp80, x86_fp80 }) align 4 %agg.result, ptr noundef byval({ x86_fp80, x86_fp80 }) align 4 %x) |
| 39 |
// GNU64: define dso_local void @TestLDC(ptr dead_on_unwind noalias writable sret({ x86_fp80, x86_fp80 }) align 16 %agg.result, ptr dead_on_return noundef %x) |
| 40 |
// MSC64: define dso_local void @TestLDC(ptr dead_on_unwind noalias writable sret({ double, double }) align 8 %agg.result, ptr dead_on_return noundef %x) |
| 41 |
|
| 42 |
// GNU32: declare dso_local void @__mulxc3 |
| 43 |
// GNU64: declare dso_local void @__mulxc3 |
| 44 |
// MSC64: declare dso_local void @__muldc3 |
| 45 |
|
| 46 |
void VarArgLD(int a, ...) { |
| 47 |
// GNU32-LABEL: define{{.*}} void @VarArgLD |
| 48 |
// GNU64-LABEL: define{{.*}} void @VarArgLD |
| 49 |
// MSC64-LABEL: define{{.*}} void @VarArgLD |
| 50 |
__builtin_va_list ap; |
| 51 |
__builtin_va_start(ap, a); |
| 52 |
long double LD = __builtin_va_arg(ap, long double); |
| 53 |
// GNU32: load x86_fp80, ptr %argp.cur |
| 54 |
// GNU64: [[P:%.*]] = load ptr, ptr %argp.cur |
| 55 |
// GNU64: load x86_fp80, ptr [[P]] |
| 56 |
// MSC64: load double, ptr %argp.cur |
| 57 |
__builtin_va_end(ap); |
| 58 |
} |