2010-01-03 08:20:48 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm-only %s
|
2007-07-14 06:15:44 +08:00
|
|
|
|
2007-07-14 07:40:27 +08:00
|
|
|
int main(void)
|
2007-07-14 06:15:44 +08:00
|
|
|
{
|
|
|
|
double _Complex a = 5;
|
|
|
|
double _Complex b = 42;
|
|
|
|
|
2007-07-14 07:40:27 +08:00
|
|
|
return a * b != b * a;
|
2007-07-14 06:15:44 +08:00
|
|
|
}
|
2007-08-11 01:02:59 +08:00
|
|
|
|
|
|
|
_Complex double bar(int);
|
|
|
|
void test(_Complex double*);
|
2007-08-24 07:49:47 +08:00
|
|
|
void takecomplex(_Complex double);
|
2007-08-11 01:02:59 +08:00
|
|
|
|
|
|
|
void test2(int c) {
|
|
|
|
_Complex double X;
|
|
|
|
X = bar(1);
|
|
|
|
test(&X);
|
2007-08-24 07:49:47 +08:00
|
|
|
takecomplex(X);
|
2007-08-11 01:02:59 +08:00
|
|
|
}
|
|
|
|
|
2007-08-24 07:49:47 +08:00
|
|
|
_Complex double g1, g2;
|
2007-08-27 06:41:57 +08:00
|
|
|
_Complex float cf;
|
|
|
|
double D;
|
2007-08-24 07:49:47 +08:00
|
|
|
|
|
|
|
void test3() {
|
|
|
|
g1 = g1 + g2;
|
|
|
|
g1 = g1 - g2;
|
|
|
|
g1 = g1 * g2;
|
|
|
|
g1 = +-~g1;
|
2007-08-25 05:20:17 +08:00
|
|
|
|
|
|
|
double Gr = __real g1;
|
2007-08-27 06:41:57 +08:00
|
|
|
|
2007-08-28 00:37:44 +08:00
|
|
|
cf += D;
|
2013-06-12 09:40:06 +08:00
|
|
|
D += cf;
|
2007-08-27 06:41:57 +08:00
|
|
|
cf /= g1;
|
2007-08-28 00:37:44 +08:00
|
|
|
g1 = g1 + D;
|
|
|
|
g1 = D + g1;
|
2007-08-24 07:49:47 +08:00
|
|
|
}
|
2007-10-31 06:53:42 +08:00
|
|
|
|
2010-01-03 08:20:48 +08:00
|
|
|
__complex__ int ci1, ci2;
|
|
|
|
__complex__ short cs;
|
|
|
|
int i;
|
|
|
|
void test3int() {
|
|
|
|
ci1 = ci1 + ci2;
|
|
|
|
ci1 = ci1 - ci2;
|
|
|
|
ci1 = ci1 * ci2;
|
|
|
|
ci1 = +-~ci1;
|
|
|
|
|
|
|
|
i = __real ci1;
|
|
|
|
|
|
|
|
cs += i;
|
2013-06-12 09:40:06 +08:00
|
|
|
D += cf;
|
2010-01-03 08:20:48 +08:00
|
|
|
cs /= ci1;
|
|
|
|
ci1 = ci1 + i;
|
|
|
|
ci1 = i + ci1;
|
|
|
|
}
|
|
|
|
|
2007-10-31 06:53:42 +08:00
|
|
|
void t1() {
|
|
|
|
(__real__ cf) = 4.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void t2() {
|
|
|
|
(__imag__ cf) = 4.0;
|
|
|
|
}
|
|
|
|
|
2008-04-05 00:54:41 +08:00
|
|
|
// PR1960
|
|
|
|
void t3() {
|
|
|
|
__complex__ long long v = 2;
|
|
|
|
}
|
|
|
|
|
2008-11-26 06:21:48 +08:00
|
|
|
// PR3131
|
|
|
|
float _Complex t4();
|
|
|
|
|
|
|
|
void t5() {
|
|
|
|
float _Complex x = t4();
|
|
|
|
}
|
|
|
|
|
2010-01-03 08:20:48 +08:00
|
|
|
void t6() {
|
|
|
|
g1++;
|
|
|
|
g1--;
|
|
|
|
++g1;
|
|
|
|
--g1;
|
|
|
|
ci1++;
|
|
|
|
ci1--;
|
|
|
|
++ci1;
|
|
|
|
--ci1;
|
|
|
|
}
|
|
|
|
|
2010-05-08 06:08:54 +08:00
|
|
|
// <rdar://problem/7958272>
|
|
|
|
double t7(double _Complex c) {
|
|
|
|
return __builtin_fabs(__real__(c));
|
|
|
|
}
|
2011-06-16 04:17:07 +08:00
|
|
|
|
|
|
|
void t8() {
|
|
|
|
__complex__ int *x = &(__complex__ int){1};
|
|
|
|
}
|
2013-07-17 04:19:04 +08:00
|
|
|
|
|
|
|
const _Complex double test9const = 0;
|
|
|
|
_Complex double test9func() { return test9const; }
|