Skip to content

Commit 73f8866

Browse files
authored
make NAN handling depend on DUMMY2 parameter
1 parent dfbc234 commit 73f8866

File tree

2 files changed

+71
-7
lines changed

2 files changed

+71
-7
lines changed

kernel/power/dscal.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ static void dscal_kernel_8_zero (BLASLONG n, FLOAT *x)
7373

7474
for( i=0; i<n; i+=8 )
7575
{
76+
x[0] = alpha;
77+
x[1] = alpha;
78+
x[2] = alpha;
79+
x[3] = alpha;
80+
x[4] = alpha;
81+
x[5] = alpha;
82+
x[6] = alpha;
83+
x[7] = alpha;
84+
#if 0
7685
if(isfinite(x[0]))
7786
x[0] = alpha;
7887
else
@@ -106,7 +115,8 @@ static void dscal_kernel_8_zero (BLASLONG n, FLOAT *x)
106115
else
107116
x[7] = NAN;
108117
x+=8;
109-
}
118+
#endif
119+
}
110120

111121
}
112122

@@ -130,6 +140,11 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
130140
if ( n >= 16 )
131141
{
132142
BLASLONG align = ((32 - ((uintptr_t)x & (uintptr_t)0x1F)) >> 3) & 0x3;
143+
if (dummy2 == 0)
144+
for (j = 0; j < align; j++) {
145+
x [j] = 0.0;
146+
}
147+
else
133148
for (j = 0; j < align; j++) {
134149
if (isfinite(x[j]))
135150
x[j] = 0.0;
@@ -151,7 +166,13 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
151166
j=n1;
152167
}
153168
#endif
154-
169+
if (dummy2 == 0)
170+
while(j < n)
171+
{
172+
x[j]=0.0;
173+
j++;
174+
}
175+
else
155176
while(j < n)
156177
{
157178
if (!isfinite(x[j]))
@@ -202,7 +223,14 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
202223

203224
if ( da == 0.0 )
204225
{
205-
226+
if (dummy2 == 0)
227+
while(j < n)
228+
{
229+
x[i]=0.0;
230+
i += inc_x;
231+
j++;
232+
}
233+
else
206234
while(j < n)
207235
{
208236
if (!isfinite(x[i]))

kernel/power/sscal.c

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,24 @@ static void sscal_kernel_16_zero( BLASLONG n, FLOAT *x )
7474

7575
for( i=0; i<n; i+=8 )
7676
{
77-
if (isfinite(x[0]))
77+
x[0] = alpha;
78+
x[1] = alpha;
79+
x[2] = alpha;
80+
x[3] = alpha;
81+
x[4] = alpha;
82+
x[5] = alpha;
83+
x[6] = alpha;
84+
x[7] = alpha;
85+
x[8] = alpha;
86+
x[9] = alpha;
87+
x[10] = alpha;
88+
x[11] = alpha;
89+
x[12] = alpha;
90+
x[13] = alpha;
91+
x[14] = alpha;
92+
x[15] = alpha;
93+
#if 0
94+
if (isfinite(x[0]))
7895
x[0] = alpha;
7996
else
8097
x[0] = NAN;
@@ -107,7 +124,8 @@ static void sscal_kernel_16_zero( BLASLONG n, FLOAT *x )
107124
else
108125
x[7] = NAN;
109126
x+=8;
110-
}
127+
#endif
128+
}
111129

112130
}
113131

@@ -132,6 +150,11 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
132150
if ( n >= 32 )
133151
{
134152
BLASLONG align = ((32 - ((uintptr_t)x & (uintptr_t)0x1F)) >> 2) & 0x7;
153+
if (dummy2 == 0)
154+
for (j = 0; j < align; j++){
155+
x[j] = 0.0;
156+
}
157+
else
135158
for (j = 0; j < align; j++) {
136159
if (isfinite(x[j]))
137160
x[j] = 0.0;
@@ -153,9 +176,15 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
153176
j=n1;
154177
}
155178
#endif
156-
179+
if (dummy2 == 0)
157180
while(j < n)
158181
{
182+
x[j] = 0.0;
183+
j++;
184+
}
185+
else
186+
while(j < n)
187+
{
159188
if (isfinite(x[j]))
160189
x[j]=0.0;
161190
else
@@ -204,7 +233,14 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
204233

205234
if ( da == 0.0 )
206235
{
207-
236+
if (dummy2 == 0)
237+
while(j < n)
238+
{
239+
x[i]=0.0;
240+
i += inc_x;
241+
j++;
242+
}
243+
else
208244
while(j < n)
209245
{
210246
if (isfinite(x[i]))

0 commit comments

Comments
 (0)