summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/long-double-x86.c4
-rw-r--r--clang/test/CodeGen/ppc64-align-long-double.c16
-rw-r--r--clang/test/CodeGen/ppc64-long-double.cpp19
-rw-r--r--clang/test/CodeGen/x86-long-double.cpp43
4 files changed, 62 insertions, 20 deletions
diff --git a/clang/test/CodeGen/long-double-x86.c b/clang/test/CodeGen/long-double-x86.c
deleted file mode 100644
index f040207e73a..00000000000
--- a/clang/test/CodeGen/long-double-x86.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | grep x86_fp80
-
-long double x = 0;
-int checksize[sizeof(x) == 16 ? 1 : -1];
diff --git a/clang/test/CodeGen/ppc64-align-long-double.c b/clang/test/CodeGen/ppc64-align-long-double.c
deleted file mode 100644
index 2214e246205..00000000000
--- a/clang/test/CodeGen/ppc64-align-long-double.c
+++ /dev/null
@@ -1,16 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
-
-struct S {
- double a;
- long double b;
-};
-
-// CHECK: %struct.{{[a-zA-Z0-9]+}} = type { double, ppc_fp128 }
-
-long double test (struct S x)
-{
- return x.b;
-}
-
-// CHECK: %{{[0-9]}} = load ppc_fp128, ppc_fp128* %{{[a-zA-Z0-9]+}}, align 16
diff --git a/clang/test/CodeGen/ppc64-long-double.cpp b/clang/test/CodeGen/ppc64-long-double.cpp
new file mode 100644
index 00000000000..56cb24a3d12
--- /dev/null
+++ b/clang/test/CodeGen/ppc64-long-double.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple powerpc64-linux-musl -emit-llvm -o - %s | \
+// RUN: FileCheck --check-prefix=FP64 %s
+// RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm -o - %s -mlong-double-64 | \
+// RUN: FileCheck --check-prefix=FP64 %s
+// RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm -o - %s | \
+// RUN: FileCheck --check-prefix=IBM128 %s
+
+long double x = 0;
+int size = sizeof(x);
+
+// FP64: @x = global double {{.*}}, align 8
+// FP64: @size = global i32 8
+// IBM128: @x = global ppc_fp128 {{.*}}, align 16
+// IBM128: @size = global i32 16
+
+long double foo(long double d) { return d; }
+
+// FP64: double @_Z3fooe(double %d)
+// IBM128: ppc_fp128 @_Z3foog(ppc_fp128 %d)
diff --git a/clang/test/CodeGen/x86-long-double.cpp b/clang/test/CodeGen/x86-long-double.cpp
new file mode 100644
index 00000000000..a05470aeab6
--- /dev/null
+++ b/clang/test/CodeGen/x86-long-double.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 | \
+// RUN: FileCheck --check-prefixes=FP80,FP80-ELF32 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin | \
+// RUN: FileCheck --check-prefixes=FP80,FP80-DARWIN %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 | \
+// RUN: FileCheck --check-prefixes=FP80,FP80-ELF64 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin | \
+// RUN: FileCheck --check-prefixes=FP80,FP80-DARWIN %s
+
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 -mlong-double-64 | \
+// RUN: FileCheck --check-prefixes=FP64,FP64-X32 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin -mlong-double-64 | \
+// RUN: FileCheck --check-prefixes=FP64,FP64-X32 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 -mlong-double-64 | \
+// RUN: FileCheck --check-prefixes=FP64,FP64-X64 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin -mlong-double-64 | \
+// RUN: FileCheck --check-prefixes=FP64,FP64-X64 %s
+
+// Check -malign-double increases the alignment from 4 to 8 on x86-32.
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686 -mlong-double-64 \
+// RUN: -malign-double | FileCheck --check-prefixes=FP64,FP64-X64 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64 -mlong-double-64 \
+// RUN: -malign-double | FileCheck --check-prefixes=FP64,FP64-X64 %s
+
+long double x = 0;
+int size = sizeof(x);
+
+// FP80-ELF32: @x = global x86_fp80 {{.*}}, align 4
+// FP80-ELF32: @size = global i32 12
+// FP80-ELF64: @x = global x86_fp80 {{.*}}, align 16
+// FP80-ELF64: @size = global i32 16
+// FP80-DARWIN: @x = global x86_fp80 {{.*}}, align 16
+// FP80-DARWIN: @size = global i32 16
+
+// FP64-X32: @x = global double {{.*}}, align 4
+// FP64-X32: @size = global i32 8
+// FP64-X64: @x = global double {{.*}}, align 8
+// FP64-X64: @size = global i32 8
+
+long double foo(long double d) { return d; }
+
+// FP64: double @_Z3fooe(double %d)
+// FP80: x86_fp80 @_Z3fooe(x86_fp80 %d)
OpenPOWER on IntegriCloud