| 1 |
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ |
| 2 |
/* { dg-skip-if "" { powerpc*-*-darwin* } } */ |
| 3 |
/* { dg-options "-mdejagnu-cpu=power8 -mvsx -w -std=c++14" } */ |
| 4 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 5 |
|
| 6 |
/* target/69667, compiler got |
| 7 |
internal compiler error: Max. number of generated reload insns per insn is achieved (90) */ |
| 8 |
|
| 9 |
struct A { |
| 10 |
typedef int evaluation_error_type; |
| 11 |
}; |
| 12 |
template <class T, class> T get_epsilon(); |
| 13 |
template <class E> __attribute__((__noreturn__)) void throw_exception(E); |
| 14 |
template <class Formatter, class Group> char do_format(Formatter, Group &); |
| 15 |
int raise_error_e, non_central_beta_p_k; |
| 16 |
template <class, class T> void raise_error(T &p1) { |
| 17 |
char msg = do_format(msg, p1); |
| 18 |
throw_exception(raise_error_e); |
| 19 |
} |
| 20 |
char raise_evaluation_error_function; |
| 21 |
template <class T1, class T2, class Policy> |
| 22 |
T1 gamma_p_derivative(T1, T2, Policy); |
| 23 |
template <class T, class Policy> T ibeta_imp(Policy, bool, T *); |
| 24 |
template <class> struct B {}; |
| 25 |
template <class Dist, class RealType> B<Dist> complement(Dist, RealType); |
| 26 |
template <class, class> class C; |
| 27 |
template <class T, class Policy> struct D { |
| 28 |
D(C<T, Policy> p1, T, bool) : dist(p1) {} |
| 29 |
void operator()(T p1) { comp ? cdf(complement(dist, p1)) : T(); } |
| 30 |
C<T, Policy> dist; |
| 31 |
bool comp; |
| 32 |
}; |
| 33 |
template <class, class = A> class C { |
| 34 |
public: |
| 35 |
C(int, int, int); |
| 36 |
}; |
| 37 |
template <class RealType, class Policy> void quantile(Policy p1, RealType) { |
| 38 |
nc_beta_quantile(p1, false); |
| 39 |
} |
| 40 |
double quantile_sanity_check___trans_tmp_1, quantile_sanity_check___trans_tmp_3, |
| 41 |
quantile_sanity_check___trans_tmp_5, quantile_sanity_check___trans_tmp_7; |
| 42 |
void Trans_NS_detail_raise_evaluation_error(char *, char *, long double &p3, |
| 43 |
int) { |
| 44 |
raise_error<int>(p3); |
| 45 |
} |
| 46 |
template <class T, class Policy> |
| 47 |
void raise_evaluation_error(char *, T &p2, Policy) { |
| 48 |
Trans_NS_detail_raise_evaluation_error( |
| 49 |
&raise_evaluation_error_function, "", p2, |
| 50 |
typename Policy::evaluation_error_type()); |
| 51 |
} |
| 52 |
template <class T, class Policy> |
| 53 |
T non_central_beta_p(T p1, T p2, T p3, Policy p4, T p5 = 0) { |
| 54 |
T y, errtol = get_epsilon<T, Policy>(), l2, |
| 55 |
pois = gamma_p_derivative(T(), l2, p4), xterm, last_term = 0; |
| 56 |
if (pois) |
| 57 |
return p5; |
| 58 |
T beta = y ? ibeta_imp(p4, false, &xterm) : ibeta_imp(p4, true, &xterm); |
| 59 |
xterm = y - 1; |
| 60 |
T sum = p5; |
| 61 |
if (beta && xterm) |
| 62 |
return p5; |
| 63 |
for (; non_central_beta_p_k;) { |
| 64 |
sum += beta; |
| 65 |
if (errtol && last_term || beta) |
| 66 |
break; |
| 67 |
xterm *= |
| 68 |
p1 + non_central_beta_p_k - 1 / p3 * p1 + p2 + non_central_beta_p_k - 2; |
| 69 |
last_term = beta; |
| 70 |
} |
| 71 |
raise_evaluation_error("", sum, p4); |
| 72 |
} |
| 73 |
template <class RealType, class Policy> |
| 74 |
RealType non_central_beta_cdf(RealType, bool, Policy) { |
| 75 |
RealType b, a, x; |
| 76 |
non_central_beta_p(a, b, x, A()); |
| 77 |
} |
| 78 |
template <class F, class T, class Tol, class Policy> |
| 79 |
int bracket_and_solve_root_01(F p1, T, bool, Tol, unsigned, Policy) { |
| 80 |
T guess; |
| 81 |
p1(guess); |
| 82 |
} |
| 83 |
template <class RealType, class Policy> |
| 84 |
void nc_beta_quantile(C<RealType, Policy>, bool p2) { |
| 85 |
RealType p; |
| 86 |
typedef RealType value_type; |
| 87 |
D<value_type, Policy> f(C<value_type, Policy>(0, 0, 0), p, p2); |
| 88 |
void tol(); |
| 89 |
long max_iter = |
| 90 |
bracket_and_solve_root_01(f, value_type(), true, tol, max_iter, Policy()); |
| 91 |
} |
| 92 |
template <class RealType, class Policy> RealType cdf(B<C<RealType, Policy>>) { |
| 93 |
RealType l = non_central_beta_cdf(l, true, Policy()); |
| 94 |
} |
| 95 |
template <typename T> void quantile_sanity_check(T) { |
| 96 |
quantile(C<long double>(quantile_sanity_check___trans_tmp_1, |
| 97 |
quantile_sanity_check___trans_tmp_3, |
| 98 |
quantile_sanity_check___trans_tmp_5), |
| 99 |
quantile_sanity_check___trans_tmp_7); |
| 100 |
} |
| 101 |
void test_accuracy() { |
| 102 |
int ncbeta; |
| 103 |
quantile_sanity_check(ncbeta); |
| 104 |
} |