diff options
| author | Reid Kleckner <rnk@google.com> | 2015-10-28 22:29:52 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2015-10-28 22:29:52 +0000 |
| commit | 11a17198e0396ac11d8034cf9d88e3c4c5c4e1f6 (patch) | |
| tree | 0673d7bd4ecc3c59bfeff15d8fecaf9dfa692f3a /clang/test/CodeGen | |
| parent | 34d4149452225e61e14ba346dde223183f617658 (diff) | |
| download | bcm5719-llvm-11a17198e0396ac11d8034cf9d88e3c4c5c4e1f6.tar.gz bcm5719-llvm-11a17198e0396ac11d8034cf9d88e3c4c5c4e1f6.zip | |
Fix the calling convention of Mingw64 long double values
GCC uses the x87DoubleExtended model for long doubles, and passes them
indirectly by address through function calls.
Also replace the existing mingw-long-double assembly emitting test with
an IR-level test.
llvm-svn: 251567
Diffstat (limited to 'clang/test/CodeGen')
| -rw-r--r-- | clang/test/CodeGen/mingw-long-double.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/clang/test/CodeGen/mingw-long-double.c b/clang/test/CodeGen/mingw-long-double.c index a29662c8e7d..1c7c31f88be 100644 --- a/clang/test/CodeGen/mingw-long-double.c +++ b/clang/test/CodeGen/mingw-long-double.c @@ -1,12 +1,41 @@ -// REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple i686-pc-windows-gnu -S %s -o - | FileCheck %s -check-prefix=CHECK_I686 -// CHECK_I686: _lda,12 -// CHECK_I686: _lds,16 -// RUN: %clang_cc1 -triple x86_64-pc-windows-gnu -S %s -o - | FileCheck %s -check-prefix=CHECK_X86_64 -// CHECK_X86_64: lda,16 -// CHECK_X86_64: lds,32 -long double lda; +// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s \ +// RUN: | FileCheck %s --check-prefix=GNU32 +// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -o - %s \ +// RUN: | FileCheck %s --check-prefix=GNU64 +// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s \ +// RUN: | FileCheck %s --check-prefix=MSC64 + struct { char c; long double ldb; -} lds; +} agggregate_LD = {}; +// GNU32: %struct.anon = type { i8, x86_fp80 } +// GNU32: @agggregate_LD = global %struct.anon zeroinitializer, align 4 +// GNU64: %struct.anon = type { i8, x86_fp80 } +// GNU64: @agggregate_LD = global %struct.anon zeroinitializer, align 16 +// MSC64: %struct.anon = type { i8, double } +// MSC64: @agggregate_LD = global %struct.anon zeroinitializer, align 8 + +long double dataLD = 1.0L; +// GNU32: @dataLD = global x86_fp80 0xK3FFF8000000000000000, align 4 +// GNU64: @dataLD = global x86_fp80 0xK3FFF8000000000000000, align 16 +// MSC64: @dataLD = global double 1.000000e+00, align 8 + +long double _Complex dataLDC = {1.0L, 1.0L}; +// GNU32: @dataLDC = global { x86_fp80, x86_fp80 } { x86_fp80 0xK3FFF8000000000000000, x86_fp80 0xK3FFF8000000000000000 }, align 4 +// GNU64: @dataLDC = global { x86_fp80, x86_fp80 } { x86_fp80 0xK3FFF8000000000000000, x86_fp80 0xK3FFF8000000000000000 }, align 16 +// MSC64: @dataLDC = global { double, double } { double 1.000000e+00, double 1.000000e+00 }, align 8 + +long double TestLD(long double x) { + return x * x; +} +// GNU32: define x86_fp80 @TestLD(x86_fp80 %x) +// GNU64: define void @TestLD(x86_fp80* noalias sret %agg.result, x86_fp80*) +// MSC64: define double @TestLD(double %x) + +long double _Complex TestLDC(long double _Complex x) { + return x * x; +} +// GNU32: define void @TestLDC({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* byval align 4 %x) +// GNU64: define void @TestLDC({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* %x) +// MSC64: define void @TestLDC({ double, double }* noalias sret %agg.result, { double, double }* %x) |

