[Flang] remove whole-archive option for AIX linker (#76039)
[llvm-project.git] / clang / test / CodeGenCXX / float128-declarations.cpp
blob84b8f7f33036b594e311db280e2b104e5c5a49af
1 // RUN: %clang_cc1 -emit-llvm -triple powerpc64-unknown-unknown \
2 // RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown \
4 // RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s
5 // RUN: %clang_cc1 -emit-llvm -triple i386-unknown-linux-gnu -std=c++11 \
6 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
7 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-linux-gnu -std=c++11 \
8 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
9 // RUN: %clang_cc1 -emit-llvm -triple i386-unknown-freebsd -std=c++11 \
10 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
11 // RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-freebsd -std=c++11 \
12 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
13 // RUN: %clang_cc1 -emit-llvm -triple i386-unknown-netbsd -std=c++11 \
14 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
15 // RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-netbsd -std=c++11 \
16 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
17 // RUN: %clang_cc1 -emit-llvm -triple i386-unknown-openbsd -std=c++11 \
18 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
19 // RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-openbsd -std=c++11 \
20 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
21 // RUN: %clang_cc1 -emit-llvm -triple i386-pc-solaris2.11 -std=c++11 \
22 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
23 // RUN: %clang_cc1 -emit-llvm -triple x86_64-pc-solaris2.11 -std=c++11 \
24 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
25 // RUN: %clang_cc1 -emit-llvm -triple i586-pc-haiku -std=c++11 \
26 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
27 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-haiku -std=c++11 \
28 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86
30 /* Various contexts where type __float128 can appear. The different check
31 prefixes are due to different mangling on X86. */
33 /* Namespace */
34 namespace {
35 __float128 f1n;
36 __float128 f2n = 33.q;
37 __float128 arr1n[10];
38 __float128 arr2n[] = { 1.2q, 3.0q, 3.e11q };
39 const volatile __float128 func1n(const __float128 &arg) {
40 return arg + f2n + arr1n[4] - arr2n[1];
44 /* File */
45 __float128 f1f;
46 __float128 f2f = 32.4q;
47 static __float128 f3f = f2f;
48 __float128 arr1f[10];
49 __float128 arr2f[] = { -1.2q, -3.0q, -3.e11q };
50 __float128 func1f(__float128 arg);
52 /* Class */
53 class C1 {
54 __float128 f1c;
55 static const __float128 f2c;
56 volatile __float128 f3c;
57 public:
58 C1(__float128 arg) : f1c(arg), f3c(arg) { }
59 __float128 func1c(__float128 arg ) {
60 return f1c + arg;
62 static __float128 func2c(__float128 arg) {
63 return arg * C1::f2c;
67 /* Template */
68 template <class C> C func1t(C arg) { return arg * 2.q; }
69 template <class C> struct S1 {
70 C mem1;
72 template <> struct S1<__float128> {
73 __float128 mem2;
76 /* Local */
77 int main(void) {
78 __float128 f1l = 123e220q;
79 __float128 f2l = -0.q;
80 __float128 f3l = 1.189731495357231765085759326628007e4932q;
81 C1 c1(f1l);
82 S1<__float128> s1 = { 132.q };
83 __float128 f4l = func1n(f1l) + func1f(f2l) + c1.func1c(f3l) + c1.func2c(f1l) +
84 func1t(f1l) + s1.mem2 - f1n + f2n;
85 #if (__cplusplus >= 201103L)
86 auto f5l = -1.q, *f6l = &f2l, f7l = func1t(f3l);
87 #endif
88 __float128 f8l = f4l++;
89 __float128 arr1l[] = { -1.q, -0.q, -11.q };
91 // CHECK-DAG: @_ZN12_GLOBAL__N_13f1nE = internal global fp128 0xL00000000000000000000000000000000
92 // CHECK-DAG: @_ZN12_GLOBAL__N_13f2nE = internal global fp128 0xL00000000000000004004080000000000
93 // CHECK-DAG: @_ZN12_GLOBAL__N_15arr1nE = internal global [10 x fp128]
94 // CHECK-DAG: @_ZN12_GLOBAL__N_15arr2nE = internal global [3 x fp128] [fp128 0xL33333333333333333FFF333333333333, fp128 0xL00000000000000004000800000000000, fp128 0xL00000000000000004025176592E00000]
95 // CHECK-DAG: define internal noundef fp128 @_ZN12_GLOBAL__N_16func1nERKu9__ieee128(ptr
96 // CHECK-DAG: @f1f ={{.*}} global fp128 0xL00000000000000000000000000000000
97 // CHECK-DAG: @f2f ={{.*}} global fp128 0xL33333333333333334004033333333333
98 // CHECK-DAG: @arr1f ={{.*}} global [10 x fp128]
99 // CHECK-DAG: @arr2f ={{.*}} global [3 x fp128] [fp128 0xL3333333333333333BFFF333333333333, fp128 0xL0000000000000000C000800000000000, fp128 0xL0000000000000000C025176592E00000]
100 // CHECK-DAG: declare noundef fp128 @_Z6func1fu9__ieee128(fp128 noundef)
101 // CHECK-DAG: define linkonce_odr void @_ZN2C1C2Eu9__ieee128(ptr {{[^,]*}} %this, fp128 noundef %arg)
102 // CHECK-DAG: define linkonce_odr noundef fp128 @_ZN2C16func2cEu9__ieee128(fp128 noundef %arg)
103 // CHECK-DAG: define linkonce_odr noundef fp128 @_Z6func1tIu9__ieee128ET_S0_(fp128 noundef %arg)
104 // CHECK-DAG: @__const.main.s1 = private unnamed_addr constant %struct.S1 { fp128 0xL00000000000000004006080000000000 }
105 // CHECK-DAG: store fp128 0xLF0AFD0EBFF292DCE42E0B38CDD83F26F, ptr %f1l, align 16
106 // CHECK-DAG: store fp128 0xL00000000000000008000000000000000, ptr %f2l, align 16
107 // CHECK-DAG: store fp128 0xLFFFFFFFFFFFFFFFF7FFEFFFFFFFFFFFF, ptr %f3l, align 16
108 // CHECK-DAG: store fp128 0xL0000000000000000BFFF000000000000, ptr %f5l, align 16
109 // CHECK-DAG: [[F4L:%[a-z0-9]+]] = load fp128, ptr %f4l
110 // CHECK-DAG: [[INC:%[a-z0-9]+]] = fadd fp128 [[F4L]], 0xL00000000000000003FFF000000000000
111 // CHECK-DAG: store fp128 [[INC]], ptr %f4l
113 // CHECK-X86-DAG: @_ZN12_GLOBAL__N_13f1nE = internal global fp128 0xL00000000000000000000000000000000
114 // CHECK-X86-DAG: @_ZN12_GLOBAL__N_13f2nE = internal global fp128 0xL00000000000000004004080000000000
115 // CHECK-X86-DAG: @_ZN12_GLOBAL__N_15arr1nE = internal global [10 x fp128]
116 // CHECK-X86-DAG: @_ZN12_GLOBAL__N_15arr2nE = internal global [3 x fp128] [fp128 0xL33333333333333333FFF333333333333, fp128 0xL00000000000000004000800000000000, fp128 0xL00000000000000004025176592E00000]
117 // CHECK-X86-DAG: define internal noundef fp128 @_ZN12_GLOBAL__N_16func1nERKg(ptr
118 // CHECK-X86-DAG: @f1f ={{.*}} global fp128 0xL00000000000000000000000000000000
119 // CHECK-X86-DAG: @f2f ={{.*}} global fp128 0xL33333333333333334004033333333333
120 // CHECK-X86-DAG: @arr1f ={{.*}} global [10 x fp128]
121 // CHECK-X86-DAG: @arr2f ={{.*}} global [3 x fp128] [fp128 0xL3333333333333333BFFF333333333333, fp128 0xL0000000000000000C000800000000000, fp128 0xL0000000000000000C025176592E00000]
122 // CHECK-X86-DAG: declare noundef fp128 @_Z6func1fg(fp128 noundef)
123 // CHECK-X86-DAG: define linkonce_odr void @_ZN2C1C2Eg(ptr {{[^,]*}} %this, fp128 noundef %arg)
124 // CHECK-X86-DAG: define linkonce_odr noundef fp128 @_ZN2C16func2cEg(fp128 noundef %arg)
125 // CHECK-X86-DAG: define linkonce_odr noundef fp128 @_Z6func1tIgET_S0_(fp128 noundef %arg)
126 // CHECK-X86-DAG: @__const.main.s1 = private unnamed_addr constant %struct.S1 { fp128 0xL00000000000000004006080000000000 }
127 // CHECK-X86-DAG: store fp128 0xLF0AFD0EBFF292DCE42E0B38CDD83F26F, ptr %f1l, align 16
128 // CHECK-X86-DAG: store fp128 0xL00000000000000008000000000000000, ptr %f2l, align 16
129 // CHECK-X86-DAG: store fp128 0xLFFFFFFFFFFFFFFFF7FFEFFFFFFFFFFFF, ptr %f3l, align 16
130 // CHECK-X86-DAG: store fp128 0xL0000000000000000BFFF000000000000, ptr %f5l, align 16
131 // CHECK-X86-DAG: [[F4L:%[a-z0-9]+]] = load fp128, ptr %f4l
132 // CHECK-X86-DAG: [[INC:%[a-z0-9]+]] = fadd fp128 [[F4L]], 0xL00000000000000003FFF000000000000
133 // CHECK-X86-DAG: store fp128 [[INC]], ptr %f4l