@@ -5,8 +5,9 @@ typedef double *__restrict__ pRF64;
float maxv_f32 (pRF32 a)
{
int i;
- float s = a[0];
- for (i=1;i<8;i++)
+ float s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<8;i++)
s = (s > a[i] ? s : a[i]);
return s;
@@ -15,8 +16,9 @@ float maxv_f32 (pRF32 a)
float minv_f32 (pRF32 a)
{
int i;
- float s = a[0];
- for (i=1;i<16;i++)
+ float s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<16;i++)
s = (s < a[i] ? s : a[i]);
return s;
@@ -25,8 +27,9 @@ float minv_f32 (pRF32 a)
double maxv_f64 (pRF64 a)
{
int i;
- double s = a[0];
- for (i=1;i<8;i++)
+ double s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<8;i++)
s = (s > a[i] ? s : a[i]);
return s;
@@ -35,8 +38,9 @@ double maxv_f64 (pRF64 a)
double minv_f64 (pRF64 a)
{
int i;
- double s = a[0];
- for (i=1;i<16;i++)
+ double s;
+ asm ("" : "=w" (s) : "0" (a[0]));
+ for (i=0;i<16;i++)
s = (s < a[i] ? s : a[i]);
return s;
@@ -57,8 +57,8 @@ test_vaddv##SUFFIX##_##TYPE##x##LANES##_t (void) \
/* Calculate linearly. */ \
for (i = 0; i < moves; i++) \
{ \
- out_l[i] = input_##TYPE[i]; \
- for (j = 1; j < LANES; j++) \
+ asm ("" : "=r" (out_l[i]) : "0" (0)); \
+ for (j = 0; j < LANES; j++) \
out_l[i] += input_##TYPE[i + j]; \
} \
\
@@ -36,7 +36,7 @@ test_v##MAXMIN##v##SUFFIX##_##TYPE##x##LANES##_t (void) \
/* Calculate linearly. */ \
for (i = 0; i < moves; i++) \
{ \
- out_l[i] = input_##TYPE[i]; \
+ asm ("" : "=r" (out_l[i]) : "0" (input_##TYPE[i])); \
for (j = 0; j < LANES; j++) \
out_l[i] = input_##TYPE[i + j] CMP_OP out_l[i] ? \
input_##TYPE[i + j] : out_l[i]; \