[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / complex.c
blob6233529a18f8b8db3d5416d0b7a463baa1376e80
1 // RUN: %clang_cc1 -emit-llvm-only %s
3 int main(void)
5 double _Complex a = 5;
6 double _Complex b = 42;
8 return a * b != b * a;
11 _Complex double bar(int);
12 void test(_Complex double*);
13 void takecomplex(_Complex double);
15 void test2(int c) {
16 _Complex double X;
17 X = bar(1);
18 test(&X);
19 takecomplex(X);
22 _Complex double g1, g2;
23 _Complex float cf;
24 double D;
26 void test3(void) {
27 g1 = g1 + g2;
28 g1 = g1 - g2;
29 g1 = g1 * g2;
30 g1 = +-~g1;
32 double Gr = __real g1;
34 cf += D;
35 D += cf;
36 cf /= g1;
37 g1 = g1 + D;
38 g1 = D + g1;
41 __complex__ int ci1, ci2;
42 __complex__ short cs;
43 int i;
44 void test3int(void) {
45 ci1 = ci1 + ci2;
46 ci1 = ci1 - ci2;
47 ci1 = ci1 * ci2;
48 ci1 = +-~ci1;
50 i = __real ci1;
52 cs += i;
53 D += cf;
54 cs /= ci1;
55 ci1 = ci1 + i;
56 ci1 = i + ci1;
59 void t1(void) {
60 (__real__ cf) = 4.0;
63 void t2(void) {
64 (__imag__ cf) = 4.0;
67 // PR1960
68 void t3(void) {
69 __complex__ long long v = 2;
72 // PR3131
73 float _Complex t4(void);
75 void t5(void) {
76 float _Complex x = t4();
79 void t6(void) {
80 g1++;
81 g1--;
82 ++g1;
83 --g1;
84 ci1++;
85 ci1--;
86 ++ci1;
87 --ci1;
90 double t7(double _Complex c) {
91 return __builtin_fabs(__real__(c));
94 void t8(void) {
95 __complex__ int *x = &(__complex__ int){1};
98 const _Complex double test9const = 0;
99 _Complex double test9func(void) { return test9const; }
101 // D6217
102 void t91(void) {
103 // Check for proper type promotion of conditional expression
104 char c[(int)(sizeof(typeof((0 ? 2.0f : (_Complex double) 2.0f))) - sizeof(_Complex double))];
105 // Check for proper codegen
106 (0 ? 2.0f : (_Complex double) 2.0f);
109 void t92(void) {
110 // Check for proper type promotion of conditional expression
111 char c[(int)(sizeof(typeof((0 ? (_Complex double) 2.0f : 2.0f))) - sizeof(_Complex double))];
112 // Check for proper codegen
113 (0 ? (_Complex double) 2.0f : 2.0f);