Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / float128-complex-2.c
blob2364e1288c265f0a0ebd5d954cba01adaee411b3
1 /* { dg-do compile { target { powerpc*-*-linux* } } } */
2 /* { dg-require-effective-target powerpc_float128_hw_ok } */
3 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
4 /* { dg-options "-O2 -mpower9-vector -mfloat128-hardware" } */
6 #ifndef NO_FLOAT
7 typedef _Complex float float_complex;
8 extern float_complex cfloat1 (void);
9 extern float_complex cfloat2 (void);
11 #define FLOAT_ARG(NAME, OP) ARG_OP(float, float_complex, NAME, OP)
12 #define FLOAT_PTR(NAME, OP) PTR_OP(float, float_complex, NAME, OP)
13 #define FLOAT_CALL() CALL_OP(float, float_complex, cfloat1, cfloat2)
15 #else
16 #define FLOAT_ARG(NAME, OP)
17 #define FLOAT_PTR(NAME, OP)
18 #define FLOAT_CALL()
19 #endif
21 #ifndef NO_DOUBLE
22 typedef _Complex double double_complex;
23 extern double_complex cdouble1 (void);
24 extern double_complex cdouble2 (void);
26 #define DOUBLE_ARG(NAME, OP) ARG_OP(double, double_complex, NAME, OP)
27 #define DOUBLE_PTR(NAME, OP) PTR_OP(double, double_complex, NAME, OP)
28 #define DOUBLE_CALL() CALL_OP(double, double_complex, cdouble1, cdouble2)
30 #else
31 #define DOUBLE_ARG(NAME, OP)
32 #define DOUBLE_PTR(NAME, OP)
33 #define DOUBLE_CALL()
34 #endif
36 #ifndef NO_FLOAT128
37 #ifdef __VSX__
38 typedef _Complex float __attribute__((mode(KC))) float128_complex;
39 #else
40 typedef _Complex float __attribute__((mode(TC))) float128_complex;
41 #endif
43 extern float128_complex cfloat128_1 (void);
44 extern float128_complex cfloat128_2 (void);
46 #define FLOAT128_ARG(NAME, OP) ARG_OP(float128, float128_complex, NAME, OP)
47 #define FLOAT128_PTR(NAME, OP) PTR_OP(float128, float128_complex, NAME, OP)
48 #define FLOAT128_CALL() CALL_OP(float128, float128_complex, cfloat128_1, cfloat128_2)
50 #else
51 #define FLOAT128_ARG(NAME, OP)
52 #define FLOAT128_PTR(NAME, OP)
53 #define FLOAT128_CALL()
54 #endif
56 #ifndef NO_LDOUBLE
57 typedef _Complex long double ldouble_complex;
58 extern ldouble_complex cldouble1 (void);
59 extern ldouble_complex cldouble2 (void);
61 #define LDOUBLE_ARG(NAME, OP) ARG_OP(ldouble, ldouble_complex, NAME, OP)
62 #define LDOUBLE_PTR(NAME, OP) PTR_OP(ldouble, ldouble_complex, NAME, OP)
63 #define LDOUBLE_CALL() CALL_OP(ldouble, ldouble_complex, cldouble1, cldouble2)
65 #else
66 #define LDOUBLE_ARG(NAME, OP)
67 #define LDOUBLE_PTR(NAME, OP)
68 #define LDOUBLE_CALL()
69 #endif
72 #define ARG_OP(SUFFIX, TYPE, NAME, OP) \
73 TYPE arg_ ## NAME ## _ ## SUFFIX (TYPE a, TYPE b) \
74 { \
75 return a OP b; \
78 #define PTR_OP(SUFFIX, TYPE, NAME, OP) \
79 void ptr_ ## NAME ## _ ## SUFFIX (TYPE *p, TYPE *a, TYPE *b) \
80 { \
81 *p = *a OP *b; \
84 #define CALL_OP(SUFFIX, TYPE, FUNC1, FUNC2) \
85 TYPE call_ ## SUFFIX (void) \
86 { \
87 TYPE value1 = FUNC1 (); \
88 TYPE value2 = FUNC2 (); \
89 return value1 + value2; \
92 #ifndef NO_ARG
93 #ifndef NO_ADD
94 FLOAT_ARG (add, +)
95 DOUBLE_ARG (add, +)
96 FLOAT128_ARG (add, +)
97 LDOUBLE_ARG (add, +)
98 #endif
100 #ifndef NO_SUB
101 FLOAT_ARG (sub, -)
102 DOUBLE_ARG (sub, -)
103 FLOAT128_ARG (sub, -)
104 LDOUBLE_ARG (sub, -)
105 #endif
107 #ifndef NO_MUL
108 FLOAT_ARG (mul, *)
109 DOUBLE_ARG (mul, *)
110 FLOAT128_ARG (mul, *)
111 LDOUBLE_ARG (mul, *)
112 #endif
114 #ifndef NO_DIV
115 FLOAT_ARG (div, /)
116 DOUBLE_ARG (div, /)
117 FLOAT128_ARG (div, /)
118 LDOUBLE_ARG (div, /)
119 #endif
120 #endif
122 #ifndef NO_PTR
123 #ifndef NO_ADD
124 FLOAT_PTR (add, +)
125 DOUBLE_PTR (add, +)
126 FLOAT128_PTR (add, +)
127 LDOUBLE_PTR (add, +)
128 #endif
130 #ifndef NO_SUB
131 FLOAT_PTR (sub, -)
132 DOUBLE_PTR (sub, -)
133 FLOAT128_PTR (sub, -)
134 LDOUBLE_PTR (sub, -)
135 #endif
137 #ifndef NO_MUL
138 FLOAT_PTR (mul, *)
139 DOUBLE_PTR (mul, *)
140 FLOAT128_PTR (mul, *)
141 LDOUBLE_PTR (mul, *)
142 #endif
144 #ifndef NO_DIV
145 FLOAT_PTR (div, /)
146 DOUBLE_PTR (div, /)
147 FLOAT128_PTR (div, /)
148 LDOUBLE_PTR (div, /)
149 #endif
150 #endif
152 #ifndef NO_CALL
153 FLOAT_CALL ()
154 DOUBLE_CALL ()
155 FLOAT128_CALL ()
156 LDOUBLE_CALL ()
157 #endif
159 /* { dg-final { scan-assembler "xsaddqp" } } */
160 /* { dg-final { scan-assembler "xssubqp" } } */