Skip to content

Commit e7455f5

Browse files
authored
[ZARCH] fix dsdot.c
1 parent 3eafcfa commit e7455f5

File tree

1 file changed

+56
-67
lines changed

1 file changed

+56
-67
lines changed

kernel/zarch/dsdot.c

Lines changed: 56 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -27,61 +27,34 @@ USE OF THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

2828
#include "common.h"
2929

30-
static double dsdot_kernel_32(BLASLONG n, FLOAT *x, FLOAT *y)
30+
static double dsdot_kernel_16(BLASLONG n, FLOAT *x, FLOAT *y)
3131
{
3232
double dot;
3333

3434
__asm__ volatile (
3535
"vzero %%v0 \n\t"
36-
"srlg %%r0,%1,5 \n\t"
36+
"srlg %%r0,%1,4 \n\t"
3737
"xgr %%r1,%%r1 \n\t"
3838
"0: \n\t"
3939
"pfd 1,1024(%%r1,%2) \n\t"
40-
"pfd 2,1024(%%r1,%3) \n\t"
41-
42-
"vl %%v16,0(%%r1,%2) \n\t"
43-
"vl %%v17,16(%%r1,%2) \n\t"
44-
"vl %%v18,32(%%r1,%2) \n\t"
45-
"vl %%v19,48(%%r1,%2) \n\t"
46-
"vl %%v20,64(%%r1,%2) \n\t"
47-
"vl %%v21,80(%%r1,%2) \n\t"
48-
"vl %%v22,96(%%r1,%2) \n\t"
49-
"vl %%v23,112(%%r1,%2) \n\t"
50-
51-
"vl %%v24,0(%%r1,%3) \n\t"
52-
"vfmsb %%v16,%%v16,%%v24 \n\t"
53-
"vl %%v25,16(%%r1,%3) \n\t"
54-
"vfmsb %%v17,%%v17,%%v25 \n\t"
55-
"vl %%v26,32(%%r1,%3) \n\t"
56-
"vfmsb %%v18,%%v18,%%v26 \n\t"
57-
"vl %%v27,48(%%r1,%3) \n\t"
58-
"vfmsb %%v19,%%v19,%%v27 \n\t"
59-
"vl %%v28,64(%%r1,%3) \n\t"
60-
"vfmsb %%v20,%%v20,%%v28 \n\t"
61-
"vl %%v29,80(%%r1,%3) \n\t"
62-
"vfmsb %%v21,%%v21,%%v29 \n\t"
63-
"vl %%v30,96(%%r1,%3) \n\t"
64-
"vfmsb %%v22,%%v22,%%v30 \n\t"
65-
"vl %%v31,112(%%r1,%3) \n\t"
66-
"vfmsb %%v23,%%v23,%%v31 \n\t"
67-
68-
"vflls %%v24,%%v16 \n\t"
69-
"vflls %%v25,%%v17 \n\t"
70-
"vflls %%v26,%%v18 \n\t"
71-
"vflls %%v27,%%v19 \n\t"
72-
"vflls %%v28,%%v20 \n\t"
73-
"vflls %%v29,%%v21 \n\t"
74-
"vflls %%v30,%%v22 \n\t"
75-
"vflls %%v31,%%v23 \n\t"
76-
77-
"veslg %%v16,%%v16,32 \n\t"
78-
"veslg %%v17,%%v17,32 \n\t"
79-
"veslg %%v18,%%v18,32 \n\t"
80-
"veslg %%v19,%%v19,32 \n\t"
81-
"veslg %%v20,%%v20,32 \n\t"
82-
"veslg %%v21,%%v21,32 \n\t"
83-
"veslg %%v22,%%v22,32 \n\t"
84-
"veslg %%v23,%%v23,32 \n\t"
40+
"pfd 1,1024(%%r1,%3) \n\t"
41+
42+
"vlef %%v16,0(%%r1,%2),0 \n\t"
43+
"vlef %%v16,4(%%r1,%2),2 \n\t"
44+
"vlef %%v17,8(%%r1,%2),0 \n\t"
45+
"vlef %%v17,12(%%r1,%2),2 \n\t"
46+
"vlef %%v18,16(%%r1,%2),0 \n\t"
47+
"vlef %%v18,20(%%r1,%2),2 \n\t"
48+
"vlef %%v19,24(%%r1,%2),0 \n\t"
49+
"vlef %%v19,28(%%r1,%2),2 \n\t"
50+
"vlef %%v20,32(%%r1,%2),0 \n\t"
51+
"vlef %%v20,36(%%r1,%2),2 \n\t"
52+
"vlef %%v21,40(%%r1,%2),0 \n\t"
53+
"vlef %%v21,44(%%r1,%2),2 \n\t"
54+
"vlef %%v22,48(%%r1,%2),0 \n\t"
55+
"vlef %%v22,52(%%r1,%2),2 \n\t"
56+
"vlef %%v23,56(%%r1,%2),0 \n\t"
57+
"vlef %%v23,60(%%r1,%2),2 \n\t"
8558

8659
"vflls %%v16,%%v16 \n\t"
8760
"vflls %%v17,%%v17 \n\t"
@@ -92,24 +65,40 @@ static double dsdot_kernel_32(BLASLONG n, FLOAT *x, FLOAT *y)
9265
"vflls %%v22,%%v22 \n\t"
9366
"vflls %%v23,%%v23 \n\t"
9467

95-
"vfadb %%v16,%%v16,%%v24 \n\t"
96-
"vfadb %%v17,%%v17,%%v25 \n\t"
97-
"vfadb %%v18,%%v18,%%v26 \n\t"
98-
"vfadb %%v19,%%v19,%%v27 \n\t"
99-
"vfadb %%v20,%%v20,%%v28 \n\t"
100-
"vfadb %%v21,%%v21,%%v29 \n\t"
101-
"vfadb %%v22,%%v22,%%v30 \n\t"
102-
"vfadb %%v23,%%v23,%%v31 \n\t"
103-
"vfadb %%v16,%%v16,%%v20 \n\t"
104-
"vfadb %%v17,%%v17,%%v21 \n\t"
105-
"vfadb %%v18,%%v18,%%v22 \n\t"
106-
"vfadb %%v19,%%v19,%%v23 \n\t"
107-
"vfadb %%v16,%%v16,%%v18 \n\t"
108-
"vfadb %%v17,%%v17,%%v19 \n\t"
109-
"vfadb %%v16,%%v16,%%v17 \n\t"
110-
"vfadb %%v0,%%v16,%%v0 \n\t"
111-
112-
"agfi %%r1,128 \n\t"
68+
"vlef %%v24,0(%%r1,%3),0 \n\t"
69+
"vlef %%v24,4(%%r1,%3),2 \n\t"
70+
"vflls %%v24,%%v24 \n\t"
71+
"vfmadb %%v0,%%v16,%%v24,%%v0 \n\t"
72+
"vlef %%v25,8(%%r1,%3),0 \n\t"
73+
"vlef %%v25,12(%%r1,%3),2 \n\t"
74+
"vflls %%v25,%%v25 \n\t"
75+
"vfmadb %%v0,%%v17,%%v25,%%v0 \n\t"
76+
"vlef %%v26,16(%%r1,%3),0 \n\t"
77+
"vlef %%v26,20(%%r1,%3),2 \n\t"
78+
"vflls %%v26,%%v26 \n\t"
79+
"vfmadb %%v0,%%v18,%%v26,%%v0 \n\t"
80+
"vlef %%v27,24(%%r1,%3),0 \n\t"
81+
"vlef %%v27,28(%%r1,%3),2 \n\t"
82+
"vflls %%v27,%%v27 \n\t"
83+
"vfmadb %%v0,%%v19,%%v27,%%v0 \n\t"
84+
"vlef %%v28,32(%%r1,%3),0 \n\t"
85+
"vlef %%v28,36(%%r1,%3),2 \n\t"
86+
"vflls %%v28,%%v28 \n\t"
87+
"vfmadb %%v0,%%v20,%%v28,%%v0 \n\t"
88+
"vlef %%v29,40(%%r1,%3),0 \n\t"
89+
"vlef %%v29,44(%%r1,%3),2 \n\t"
90+
"vflls %%v29,%%v29 \n\t"
91+
"vfmadb %%v0,%%v21,%%v29,%%v0 \n\t"
92+
"vlef %%v30,48(%%r1,%3),0 \n\t"
93+
"vlef %%v30,52(%%r1,%3),2 \n\t"
94+
"vflls %%v30,%%v30 \n\t"
95+
"vfmadb %%v0,%%v22,%%v30,%%v0 \n\t"
96+
"vlef %%v31,56(%%r1,%3),0 \n\t"
97+
"vlef %%v31,60(%%r1,%3),2 \n\t"
98+
"vflls %%v31,%%v31 \n\t"
99+
"vfmadb %%v0,%%v23,%%v31,%%v0 \n\t"
100+
101+
"agfi %%r1,64 \n\t"
113102
"brctg %%r0,0b \n\t"
114103
"vrepg %%v1,%%v0,1 \n\t"
115104
"adbr %%f0,%%f1 \n\t"
@@ -134,10 +123,10 @@ double CNAME(BLASLONG n,FLOAT *x,BLASLONG inc_x,FLOAT *y,BLASLONG inc_y)
134123
if ( (inc_x == 1) && (inc_y == 1) )
135124
{
136125

137-
BLASLONG n1 = n & -32;
126+
BLASLONG n1 = n & -16;
138127

139128
if ( n1 )
140-
dot = dsdot_kernel_32(n1,x,y);
129+
dot = dsdot_kernel_16(n1,x,y);
141130

142131
i = n1;
143132
while(i < n)

0 commit comments

Comments
 (0)