Chris Lattner | 9b2dc28 | 2008-04-04 16:54:41 +0000 | [diff] [blame] | 1 | // RUN: clang -emit-llvm < %s |
Gabor Greif | bacfa02 | 2007-07-13 22:15:44 +0000 | [diff] [blame] | 2 | |
Gabor Greif | b02d4b4 | 2007-07-13 23:40:27 +0000 | [diff] [blame] | 3 | int main(void) |
Gabor Greif | bacfa02 | 2007-07-13 22:15:44 +0000 | [diff] [blame] | 4 | { |
5 | double _Complex a = 5; | ||||
6 | double _Complex b = 42; | ||||
7 | |||||
Gabor Greif | b02d4b4 | 2007-07-13 23:40:27 +0000 | [diff] [blame] | 8 | return a * b != b * a; |
Gabor Greif | bacfa02 | 2007-07-13 22:15:44 +0000 | [diff] [blame] | 9 | } |
Chris Lattner | 12b2be2 | 2007-08-10 17:02:59 +0000 | [diff] [blame] | 10 | |
11 | _Complex double bar(int); | ||||
12 | void test(_Complex double*); | ||||
Chris Lattner | fd90ac0 | 2007-08-23 23:49:47 +0000 | [diff] [blame] | 13 | void takecomplex(_Complex double); |
Chris Lattner | 12b2be2 | 2007-08-10 17:02:59 +0000 | [diff] [blame] | 14 | |
15 | void test2(int c) { | ||||
16 | _Complex double X; | ||||
17 | X = bar(1); | ||||
18 | test(&X); | ||||
Chris Lattner | fd90ac0 | 2007-08-23 23:49:47 +0000 | [diff] [blame] | 19 | takecomplex(X); |
Chris Lattner | 12b2be2 | 2007-08-10 17:02:59 +0000 | [diff] [blame] | 20 | } |
21 | |||||
Chris Lattner | fd90ac0 | 2007-08-23 23:49:47 +0000 | [diff] [blame] | 22 | _Complex double g1, g2; |
Chris Lattner | 8ae3a9f | 2007-08-26 22:41:57 +0000 | [diff] [blame] | 23 | _Complex float cf; |
24 | double D; | ||||
Chris Lattner | fd90ac0 | 2007-08-23 23:49:47 +0000 | [diff] [blame] | 25 | |
26 | void test3() { | ||||
27 | g1 = g1 + g2; | ||||
28 | g1 = g1 - g2; | ||||
29 | g1 = g1 * g2; | ||||
30 | g1 = +-~g1; | ||||
Chris Lattner | 46f93d0 | 2007-08-24 21:20:17 +0000 | [diff] [blame] | 31 | |
32 | double Gr = __real g1; | ||||
Chris Lattner | 8ae3a9f | 2007-08-26 22:41:57 +0000 | [diff] [blame] | 33 | |
Chris Lattner | 9cff1a9 | 2007-08-27 16:37:44 +0000 | [diff] [blame] | 34 | cf += D; |
Chris Lattner | 8ae3a9f | 2007-08-26 22:41:57 +0000 | [diff] [blame] | 35 | D += cf; |
36 | cf /= g1; | ||||
Chris Lattner | 9cff1a9 | 2007-08-27 16:37:44 +0000 | [diff] [blame] | 37 | g1 = g1 + D; |
38 | g1 = D + g1; | ||||
Chris Lattner | fd90ac0 | 2007-08-23 23:49:47 +0000 | [diff] [blame] | 39 | } |
Chris Lattner | 7da36f6 | 2007-10-30 22:53:42 +0000 | [diff] [blame] | 40 | |
41 | void t1() { | ||||
42 | (__real__ cf) = 4.0; | ||||
43 | } | ||||
44 | |||||
45 | void t2() { | ||||
46 | (__imag__ cf) = 4.0; | ||||
47 | } | ||||
48 | |||||
Chris Lattner | 9b2dc28 | 2008-04-04 16:54:41 +0000 | [diff] [blame] | 49 | // PR1960 |
50 | void t3() { | ||||
51 | __complex__ long long v = 2; | ||||
52 | } | ||||
53 | |||||
Anders Carlsson | ad3d691 | 2008-11-25 22:21:48 +0000 | [diff] [blame] | 54 | // PR3131 |
55 | float _Complex t4(); | ||||
56 | |||||
57 | void t5() { | ||||
58 | float _Complex x = t4(); | ||||
59 | } | ||||
60 |