[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGen / PowerPC / ibm128-cast.c
blobd744ba7a8fc8c557ee225705142557f747557d4e
1 // RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify \
2 // RUN: -target-feature +float128 -mabi=ieeelongdouble -fsyntax-only -Wno-unused %s
3 // RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify \
4 // RUN: -target-feature +float128 -fsyntax-only -Wno-unused %s
6 __float128 cast1(__ibm128 x) { return x; } // expected-error {{returning '__ibm128' from a function with incompatible result type '__float128'}}
8 __ibm128 cast2(__float128 x) { return x; } // expected-error {{returning '__float128' from a function with incompatible result type '__ibm128'}}
10 __ibm128 gf;
12 void narrow(double *d, float *f) {
13 __ibm128 v = gf;
14 gf = *d; // expected-no-error {{assigning to '__ibm128' from incompatible type 'double'}}
15 *f = v; // expected-no-error {{assigning to 'float' from incompatible type '__ibm128'}}
16 *d = gf + *f; // expected-no-error {{invalid operands to binary expression ('__ibm128' and 'float')}}
19 #ifdef __LONG_DOUBLE_IEEE128__
20 long double cast3(__ibm128 x) { return x; } // expected-error {{returning '__ibm128' from a function with incompatible result type 'long double'}}
22 __ibm128 cast4(long double x) { return x; } // expected-error {{returning 'long double' from a function with incompatible result type '__ibm128'}}
24 void imp_cast(__ibm128 w, __float128 q, long double l, _Bool b) {
25 w + q; // expected-error {{invalid operands to binary expression ('__ibm128' and '__float128')}}
26 l + w; // expected-error {{invalid operands to binary expression ('long double' and '__ibm128')}}
27 q - w; // expected-error {{invalid operands to binary expression ('__float128' and '__ibm128')}}
28 w - l; // expected-error {{invalid operands to binary expression ('__ibm128' and 'long double')}}
29 w *l; // expected-error {{invalid operands to binary expression ('__ibm128' and 'long double')}}
30 q *w; // expected-error {{invalid operands to binary expression ('__float128' and '__ibm128')}}
31 q / w; // expected-error {{invalid operands to binary expression ('__float128' and '__ibm128')}}
32 w / l; // expected-error {{invalid operands to binary expression ('__ibm128' and 'long double')}}
33 w = q; // expected-error {{assigning to '__ibm128' from incompatible type '__float128'}}
34 q = w; // expected-error {{assigning to '__float128' from incompatible type '__ibm128'}}
35 l = w; // expected-error {{assigning to 'long double' from incompatible type '__ibm128'}}
36 w = l; // expected-error {{assigning to '__ibm128' from incompatible type 'long double'}}
37 b ? q : w; // expected-error {{incompatible operand types ('__float128' and '__ibm128')}}
38 !b ? w : l; // expected-error {{incompatible operand types ('__ibm128' and 'long double')}}
40 #elif __LONG_DOUBLE_IBM128__
41 long double cast3(__ibm128 x) { return x; } // expected-no-error {{returning '__ibm128' from a function with incompatible result type 'long double'}}
43 __ibm128 cast4(long double x) { return x; } // expected-no-error {{returning 'long double' from a function with incompatible result type '__ibm128'}}
45 void imp_cast(__ibm128 w, __float128 q, long double l, _Bool b) {
46 w + q; // expected-error {{invalid operands to binary expression ('__ibm128' and '__float128')}}
47 l + w; // expected-no-error {{invalid operands to binary expression ('long double' and '__ibm128')}}
48 q - w; // expected-error {{invalid operands to binary expression ('__float128' and '__ibm128')}}
49 w - l; // expected-no-error {{invalid operands to binary expression ('__ibm128' and 'long double')}}
50 w *l; // expected-no-error {{invalid operands to binary expression ('__ibm128' and 'long double')}}
51 q *w; // expected-error {{invalid operands to binary expression ('__float128' and '__ibm128')}}
52 q / w; // expected-error {{invalid operands to binary expression ('__float128' and '__ibm128')}}
53 w / l; // expected-no-error {{invalid operands to binary expression ('__ibm128' and 'long double')}}
54 w = q; // expected-error {{assigning to '__ibm128' from incompatible type '__float128'}}
55 q = w; // expected-error {{assigning to '__float128' from incompatible type '__ibm128'}}
56 l = w; // expected-no-error {{assigning to 'long double' from incompatible type '__ibm128'}}
57 w = l; // expected-no-error {{assigning to '__ibm128' from incompatible type 'long double'}}
58 b ? q : w; // expected-error {{incompatible operand types ('__float128' and '__ibm128')}}
59 !b ? w : l; // expected-no-error {{incompatible operand types ('__ibm128' and 'long double')}}
61 #endif