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