summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/complex.c
blob: 6a0d3d628c549e9ca34a623b15ce2360195e4d8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// RUN: clang-cc -emit-llvm < %s

int main(void)
{
  double _Complex a = 5;
  double _Complex b = 42;

  return a * b != b * a;
}

_Complex double bar(int);
void test(_Complex double*);
void takecomplex(_Complex double);

void test2(int c) {
  _Complex double X;
  X = bar(1);
  test(&X);
  takecomplex(X);
}

_Complex double g1, g2;
_Complex float cf;
double D;

void test3() {
  g1 = g1 + g2;
  g1 = g1 - g2;
  g1 = g1 * g2;
  g1 = +-~g1;

  double Gr = __real g1;

  cf += D;
  // FIXME: Currently unsupported!
  //D += cf;
  cf /= g1;
  g1 = g1 + D;
  g1 = D + g1;
}

void t1() {
  (__real__ cf) = 4.0;
}

void t2() {
  (__imag__ cf) = 4.0;
}

// PR1960
void t3() {
  __complex__ long long v = 2;
}

// PR3131
float _Complex t4();

void t5() {
  float _Complex x = t4();
}

OpenPOWER on IntegriCloud