1 /* { dg-options "(HAS_LXC1) -mhard-float -mno-lxc1-sxc1" } */
2 /* { dg-final { scan-assembler-not "\tldxc1\t" } } */
3 /* { dg-final { scan-assembler-not "\tsdxc1\t" } } */
4 
5 #ifndef __mips_no_lxc1_sxc1
6 #error missing definition of __mips_no_lxc1_sxc1
7 #endif
8 
9 double ldexp(double x, int exp);
10 
11 typedef struct
12 {
13   double** rows;
14 } d_mat_struct;
15 
16 typedef d_mat_struct d_mat_t[1];
17 
18 #define d_mat_entry(mat,i,j) (*((mat)->rows[i] + (j)))
19 
20 double __attribute__((noinline))
ldxc1_test(int kappa,int zeros,double ctt,int * expo,d_mat_t r,double * s)21 ldxc1_test (int kappa, int zeros, double ctt, int* expo, d_mat_t r, double* s)
22 {
23   int kappa2 = kappa;
24   double tmp = 0.0;
25 
26   do
27     {
28       kappa--;
29       if (kappa > zeros + 1)
30 	{
31 	  tmp = d_mat_entry(r, kappa - 1, kappa - 1) * ctt;
32 	  tmp = ldexp(tmp, (expo[kappa - 1] - expo[kappa2]));
33 	}
34     }
35   while ((kappa >= zeros + 2) && (s[kappa - 1] <= tmp));
36 
37   return tmp;
38 }
39 
40 #define SIZE 20
41 
main(void)42 int main(void)
43 {
44   int kappa = SIZE - 1;
45   int zeros = 1;
46   double ctt = 2;
47 
48   int expo[SIZE] = {0};
49   double s[SIZE] = {0};
50   double rows_data[SIZE][SIZE] = {0};
51   double* rows[SIZE];
52 
53   for (int i = 0; i < SIZE; i++)
54     rows[i] = rows_data[i];
55 
56   d_mat_t r = { rows };
57 
58   ldxc1_test(kappa, zeros, ctt, expo, r, s);
59   return 0;
60 }
61