asm/f64: Updated axpy test code to use value sigils in guards.
MODIFY
asm/f64/axpy_test.go
asm/f64/axpy_test.go
@@ -6,533 +6,262 @@ package f64
import (
"fmt"
- "math/rand"
"testing"
)
-var daxpyTests = []struct {
- alpha float64
- xData []float64
- yData []float64
+const (
+ msgVal = "%v: unexpected value at %v Got: %v Expected: %v"
+ msgGuard = "%v: Guard violated in %s vector %v %v"
+)
+var axpyTests = []struct {
+ alpha float64
+ x []float64
+ y []float64
want []float64
wantRev []float64 // Result when x is traversed in reverse direction.
}{
{
alpha: 0,
- xData: []float64{2},
- yData: []float64{-3},
+ x: []float64{2},
+ y: []float64{-3},
want: []float64{-3},
wantRev: []float64{-3},
},
{
alpha: 1,
- xData: []float64{2},
- yData: []float64{-3},
+ x: []float64{2},
+ y: []float64{-3},
want: []float64{-1},
wantRev: []float64{-1},
},
{
alpha: 3,
- xData: []float64{2},
- yData: []float64{-3},
+ x: []float64{2},
+ y: []float64{-3},
want: []float64{3},
wantRev: []float64{3},
},
{
alpha: -3,
- xData: []float64{2},
- yData: []float64{-3},
+ x: []float64{2},
+ y: []float64{-3},
want: []float64{-9},
wantRev: []float64{-9},
},
+ {
+ alpha: 1,
+ x: []float64{1, 5},
+ y: []float64{2, -3},
+ want: []float64{3, 2},
+ wantRev: []float64{7, -2},
+ },
+ {
+ alpha: 1,
+ x: []float64{2, 3, 4},
+ y: []float64{-3, -2, -1},
+ want: []float64{-1, 1, 3},
+ wantRev: []float64{1, 1, 1},
+ },
{
alpha: 0,
- xData: []float64{0, 0, 1, 1, 2, -3, -4},
- yData: []float64{0, 1, 0, 3, -4, 5, -6},
+ x: []float64{0, 0, 1, 1, 2, -3, -4},
+ y: []float64{0, 1, 0, 3, -4, 5, -6},
want: []float64{0, 1, 0, 3, -4, 5, -6},
wantRev: []float64{0, 1, 0, 3, -4, 5, -6},
},
{
alpha: 1,
- xData: []float64{0, 0, 1, 1, 2, -3, -4},
- yData: []float64{0, 1, 0, 3, -4, 5, -6},
+ x: []float64{0, 0, 1, 1, 2, -3, -4},
+ y: []float64{0, 1, 0, 3, -4, 5, -6},
want: []float64{0, 1, 1, 4, -2, 2, -10},
wantRev: []float64{-4, -2, 2, 4, -3, 5, -6},
},
{
alpha: 3,
- xData: []float64{0, 0, 1, 1, 2, -3, -4},
- yData: []float64{0, 1, 0, 3, -4, 5, -6},
+ x: []float64{0, 0, 1, 1, 2, -3, -4},
+ y: []float64{0, 1, 0, 3, -4, 5, -6},
want: []float64{0, 1, 3, 6, 2, -4, -18},
wantRev: []float64{-12, -8, 6, 6, -1, 5, -6},
},
{
alpha: -3,
- xData: []float64{0, 0, 1, 1, 2, -3, -4},
- yData: []float64{0, 1, 0, 3, -4, 5, -6},
- want: []float64{0, 1, -3, 0, -10, 14, 6},
- wantRev: []float64{12, 10, -6, 0, -7, 5, -6},
+ x: []float64{0, 0, 1, 1, 2, -3, -4, 0, 0, 1, 1, 2, -3, -4},
+ y: []float64{0, 1, 0, 3, -4, 5, -6, 0, 1, 0, 3, -4, 5, -6},
+ want: []float64{0, 1, -3, 0, -10, 14, 6, 0, 1, -3, 0, -10, 14, 6},
+ wantRev: []float64{12, 10, -6, 0, -7, 5, -6, 12, 10, -6, 0, -7, 5, -6},
},
{
alpha: -5,
- xData: []float64{0, 0, 1, 1, 2, -3, -4, 5},
- yData: []float64{0, 1, 0, 3, -4, 5, -6, 7},
- want: []float64{0, 1, -5, -2, -14, 20, 14, -18},
- wantRev: []float64{-25, 21, 15, -7, -9, 0, -6, 7},
+ x: []float64{0, 0, 1, 1, 2, -3, -4, 5, 1, 2, -3, -4, 5},
+ y: []float64{0, 1, 0, 3, -4, 5, -6, 7, 3, -4, 5, -6, 7},
+ want: []float64{0, 1, -5, -2, -14, 20, 14, -18, -2, -14, 20, 14, -18},
+ wantRev: []float64{-25, 21, 15, -7, -9, -20, 14, 22, -7, -9, 0, -6, 7},
},
}
-func TestDaxpyUnitary(t *testing.T) {
- for i, test := range daxpyTests {
- const msgGuard = "%v: out-of-bounds write to %v argument\nfront guard: %v\nback guard: %v"
-
- prefix := fmt.Sprintf("test %v (y+=a*x)", i)
- x, xFront, xBack := newGuardedVector(test.xData, 1)
- y, yFront, yBack := newGuardedVector(test.yData, 1)
- AxpyUnitary(test.alpha, x, y)
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
- }
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
- }
- if !equalStrided(test.xData, x, 1) {
- t.Errorf("%v: modified read-only x argument", prefix)
- }
-
- if !equalStrided(test.want, y, 1) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, test.want, y)
+func TestAxpyUnitary(t *testing.T) {
+ var xGdVal, yGdVal float64 = -1, 0.5
+ for i, tt := range axpyTests {
+ for _, align := range align2 {
+ prefix := fmt.Sprintf("Test %v (x:%v y:%v)", i, align.x, align.y)
+ xgLn, ygLn := 4+align.x, 4+align.y
+ xg, yg := guardVector(tt.x, xGdVal, xgLn), guardVector(tt.y, yGdVal, ygLn)
+ x, y := xg[xgLn:len(xg)-xgLn], yg[ygLn:len(yg)-ygLn]
+ AxpyUnitary(tt.alpha, x, y)
+ for i := range tt.want {
+ if !same(y[i], tt.want[i]) {
+ t.Errorf(msgVal, prefix, i, y[i], tt.want[i])
}
}
+ if !isValidGuard(xg, xGdVal, xgLn) {
+ t.Errorf(msgGuard, prefix, "x", xg[:xgLn], xg[len(xg)-xgLn:])
}
-
-func TestDaxpyUnitaryTo(t *testing.T) {
- for i, test := range daxpyTests {
- const msgGuard = "%v: out-of-bounds write to %v argument\nfront guard: %v\nback guard: %v"
-
- // Test dst = alpha * x + y.
- prefix := fmt.Sprintf("test %v (dst=a*x+y)", i)
- x, xFront, xBack := newGuardedVector(test.xData, 1)
- y, yFront, yBack := newGuardedVector(test.yData, 1)
- dst, dstFront, dstBack := newGuardedVector(test.xData, 1)
- AxpyUnitaryTo(dst, test.alpha, x, y)
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
+ if !isValidGuard(yg, yGdVal, ygLn) {
+ t.Errorf(msgGuard, prefix, "y", yg[:ygLn], yg[len(yg)-ygLn:])
}
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
+ if !equalStrided(tt.x, x, 1) {
+ t.Errorf("%v: modified read-only x argument", prefix)
}
- if !allNaN(dstFront) || !allNaN(dstBack) {
- t.Errorf(msgGuard, prefix, "dst", dstFront, dstBack)
}
- if !equalStrided(test.xData, x, 1) {
- t.Errorf("%v: modified read-only x argument", prefix)
}
- if !equalStrided(test.yData, y, 1) {
- t.Errorf("%v: modified read-only y argument", prefix)
}
- if !equalStrided(test.want, dst, 1) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, test.want, dst)
- }
+func TestAxpyUnitaryTo(t *testing.T) {
+ var dstGdVal, xGdVal, yGdVal float64 = 1, -1, 0.5
+ for i, tt := range axpyTests {
+ for _, align := range align3 {
+ prefix := fmt.Sprintf("Test %v (x:%v y:%v dst:%v)", i, align.x, align.y, align.z)
- // Test y = alpha * x + y.
- prefix = fmt.Sprintf("test %v (y=a*x+y)", i)
- x, xFront, xBack = newGuardedVector(test.xData, 1)
- y, yFront, yBack = newGuardedVector(test.yData, 1)
- AxpyUnitaryTo(y, test.alpha, x, y)
+ dgLn, xgLn, ygLn := 4+align.z, 4+align.x, 4+align.y
+ dstOrig := make([]float64, len(tt.x))
+ xg, yg := guardVector(tt.x, xGdVal, xgLn), guardVector(tt.y, yGdVal, ygLn)
+ dstg := guardVector(dstOrig, dstGdVal, dgLn)
+ x, y := xg[xgLn:len(xg)-xgLn], yg[ygLn:len(yg)-ygLn]
+ dst := dstg[dgLn : len(dstg)-dgLn]
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
+ AxpyUnitaryTo(dst, tt.alpha, x, y)
+ for i := range tt.want {
+ if !same(dst[i], tt.want[i]) {
+ t.Errorf(msgVal, prefix, i, dst[i], tt.want[i])
}
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
}
- if !equalStrided(test.xData, x, 1) {
- t.Errorf("%v: modified read-only x argument", prefix)
+ if !isValidGuard(xg, xGdVal, xgLn) {
+ t.Errorf(msgGuard, prefix, "x", xg[:xgLn], xg[len(xg)-xgLn:])
}
-
- if !equalStrided(test.want, y, 1) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, test.want, y)
+ if !isValidGuard(yg, yGdVal, ygLn) {
+ t.Errorf(msgGuard, prefix, "y", yg[:ygLn], yg[len(yg)-ygLn:])
}
-
- // Test x = alpha * x + y.
- prefix = fmt.Sprintf("test %v (x=a*x+y)", i)
- x, xFront, xBack = newGuardedVector(test.xData, 1)
- y, yFront, yBack = newGuardedVector(test.yData, 1)
-
- AxpyUnitaryTo(x, test.alpha, x, y)
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
+ if !isValidGuard(dstg, dstGdVal, dgLn) {
+ t.Errorf(msgGuard, prefix, "dst", dstg[:dgLn], dstg[len(dstg)-dgLn:])
}
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
+ if !equalStrided(tt.x, x, 1) {
+ t.Errorf("%v: modified read-only x argument", prefix)
}
- if !equalStrided(test.yData, y, 1) {
+ if !equalStrided(tt.y, y, 1) {
t.Errorf("%v: modified read-only y argument", prefix)
}
-
- if !equalStrided(test.want, x, 1) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, test.want, x)
}
}
}
-func TestDaxpyInc(t *testing.T) {
- for i, test := range daxpyTests {
- const msgGuard = "%v: out-of-bounds write to %v argument\nfront guard: %v\nback guard: %v"
- n := len(test.xData)
-
- for _, incX := range []int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7} {
- for _, incY := range []int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7} {
+func TestAxpyInc(t *testing.T) {
+ var xGdVal, yGdVal float64 = -1, 0.5
+ gdLn := 4
+ for i, test := range axpyTests {
+ n := len(test.x)
+ for _, inc := range genInc([]int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7}) {
var ix, iy int
- if incX < 0 {
- ix = (-n + 1) * incX
+ if inc.x < 0 {
+ ix = (-n + 1) * inc.x
}
- if incY < 0 {
- iy = (-n + 1) * incY
+ if inc.y < 0 {
+ iy = (-n + 1) * inc.y
}
+ prefix := fmt.Sprintf("test %v, inc.x = %v, inc.y = %v", i, inc.x, inc.y)
+ xg := guardIncVector(test.x, xGdVal, inc.x, gdLn)
+ yg := guardIncVector(test.y, yGdVal, inc.y, gdLn)
+ x, y := xg[gdLn:len(xg)-gdLn], yg[gdLn:len(yg)-gdLn]
- prefix := fmt.Sprintf("test %v, incX = %v, incY = %v", i, incX, incY)
- x, xFront, xBack := newGuardedVector(test.xData, incX)
- y, yFront, yBack := newGuardedVector(test.yData, incY)
- AxpyInc(test.alpha, x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
- }
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
- }
- if nonStridedWrite(x, incX) || !equalStrided(test.xData, x, incX) {
- t.Errorf("%v: modified read-only x argument", prefix)
- }
- if nonStridedWrite(y, incY) {
- t.Errorf("%v: modified y argument at non-stride position", prefix)
- }
+ AxpyInc(test.alpha, x, y, uintptr(n),
+ uintptr(inc.x), uintptr(inc.y), uintptr(ix), uintptr(iy))
want := test.want
- if incX*incY < 0 {
+ if inc.x*inc.y < 0 {
want = test.wantRev
}
- if !equalStrided(want, y, incY) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, want, y)
+ if inc.y < 0 {
+ inc.y = -inc.y
}
+ for i := range want {
+ if !same(y[i*inc.y], want[i]) {
+ t.Errorf(msgVal, prefix, i, y[iy+i*inc.y], want[i])
}
}
+ if !equalStrided(test.x, x, inc.x) {
+ t.Errorf("%v: modified read-only x argument", prefix)
}
+ checkValidIncGuard(t, xg, xGdVal, inc.x, gdLn)
+ checkValidIncGuard(t, yg, yGdVal, inc.y, gdLn)
}
-
-func TestDaxpyIncTo(t *testing.T) {
- for i, test := range daxpyTests {
- const msgGuard = "%v: out-of-bounds write to %v argument\nfront guard: %v\nback guard: %v"
- n := len(test.xData)
- want := make([]float64, n)
-
- for _, incX := range []int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7} {
- for _, incY := range []int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7} {
- var ix, iy int
- if incX < 0 {
- ix = (-n + 1) * incX
}
- if incY < 0 {
- iy = (-n + 1) * incY
}
- // Test y = alpha * x + y.
- prefix := fmt.Sprintf("test %v (y=a*x+y), incX = %v, incY = %v", i, incX, incY)
- x, xFront, xBack := newGuardedVector(test.xData, incX)
- y, yFront, yBack := newGuardedVector(test.yData, incY)
- AxpyIncTo(y, uintptr(incY), uintptr(iy),
- test.alpha, x, y,
- uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
- }
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
+func TestAxpyIncTo(t *testing.T) {
+ var dstGdVal, xGdVal, yGdVal float64 = 1, -1, 0.5
+ var want []float64
+ gdLn := 4
+ for i, tt := range axpyTests {
+ n := len(tt.x)
+ for _, inc := range genIncTo([]int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7}) {
+ var ix, iy, idst uintptr
+ if inc.x < 0 {
+ ix = uintptr((-n + 1) * inc.x)
}
- if !equalStrided(test.xData, x, incX) {
- t.Errorf("%v: modified read-only x argument", prefix)
- }
-
- if incX*incY < 0 {
- copy(want, test.wantRev)
- } else {
- copy(want, test.want)
+ if inc.y < 0 {
+ iy = uintptr((-n + 1) * inc.y)
}
- if !equalStrided(want, y, incY) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, want, y)
+ if inc.dst < 0 {
+ idst = uintptr((-n + 1) * inc.dst)
}
- // Test x = alpha * x + y.
- prefix = fmt.Sprintf("test %v (x=a*x+y), incX = %v, incY = %v", i, incX, incY)
- x, xFront, xBack = newGuardedVector(test.xData, incX)
- y, yFront, yBack = newGuardedVector(test.yData, incY)
+ prefix := fmt.Sprintf("Test %v: (x: %v, y: %v, dst:%v)", i, inc.x, inc.y, inc.dst)
+ dstOrig := make([]float64, len(tt.want))
+ xg := guardIncVector(tt.x, xGdVal, inc.x, gdLn)
+ yg := guardIncVector(tt.y, yGdVal, inc.y, gdLn)
+ dstg := guardIncVector(dstOrig, dstGdVal, inc.dst, gdLn)
+ x, y := xg[gdLn:len(xg)-gdLn], yg[gdLn:len(yg)-gdLn]
+ dst := dstg[gdLn : len(dstg)-gdLn]
- AxpyIncTo(x, uintptr(incX), uintptr(ix),
- test.alpha, x, y,
- uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
- }
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
- }
- if !equalStrided(test.yData, y, incY) {
- t.Errorf("%v: modified read-only y argument", prefix)
+ AxpyIncTo(dst, uintptr(inc.dst), idst,
+ tt.alpha, x, y, uintptr(n),
+ uintptr(inc.x), uintptr(inc.y), ix, iy)
+ want = tt.want
+ if inc.x*inc.y < 0 {
+ want = tt.wantRev
}
-
- if incX*incY < 0 {
- copy(want, test.wantRev)
- for i := 0; i < n/2; i++ {
- want[i], want[n-i-1] = want[n-i-1], want[i]
+ var iW, incW int = 0, 1
+ if inc.y*inc.dst < 0 {
+ iW, incW = len(want)-1, -1
}
- } else {
- copy(want, test.want)
+ if inc.dst < 0 {
+ inc.dst = -inc.dst
}
- if !equalStrided(want, x, incX) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, want, x)
+ for i := range want {
+ if !same(dst[i*inc.dst], want[iW+i*incW]) {
+ t.Errorf(msgVal, prefix, i, dst[i*inc.dst], want[iW+i*incW])
}
-
- for _, incDst := range []int{-7, -4, -3, -2, -1, 1, 2, 3, 4, 7} {
- var idst int
- if incDst < 0 {
- idst = (-n + 1) * incDst
}
- // Test dst = alpha * x + y.
- prefix = fmt.Sprintf("test %v (dst=a*x+y), incX = %v, incY = %v, incDst =%v", i, incX, incY, incDst)
- x, xFront, xBack = newGuardedVector(test.xData, incX)
- y, yFront, yBack = newGuardedVector(test.yData, incY)
- dst, dstFront, dstBack := newGuardedVector(test.xData, incDst)
- AxpyIncTo(dst, uintptr(incDst), uintptr(idst),
- test.alpha, x, y,
- uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
-
- if !allNaN(xFront) || !allNaN(xBack) {
- t.Errorf(msgGuard, prefix, "x", xFront, xBack)
- }
- if !allNaN(yFront) || !allNaN(yBack) {
- t.Errorf(msgGuard, prefix, "y", yFront, yBack)
- }
- if !allNaN(dstFront) || !allNaN(dstBack) {
- t.Errorf(msgGuard, prefix, "dst", dstFront, dstBack)
- }
- if nonStridedWrite(x, incX) || !equalStrided(test.xData, x, incX) {
+ checkValidIncGuard(t, xg, xGdVal, inc.x, gdLn)
+ checkValidIncGuard(t, yg, yGdVal, inc.y, gdLn)
+ checkValidIncGuard(t, dstg, dstGdVal, inc.dst, gdLn)
+ if !equalStrided(tt.x, x, inc.x) {
t.Errorf("%v: modified read-only x argument", prefix)
}
- if nonStridedWrite(y, incY) || !equalStrided(test.yData, y, incY) {
+ if !equalStrided(tt.y, y, inc.y) {
t.Errorf("%v: modified read-only y argument", prefix)
}
- if nonStridedWrite(dst, incDst) {
- t.Errorf("%v: modified dst argument at non-stride position", prefix)
- }
-
- if incX*incY < 0 {
- copy(want, test.wantRev)
- } else {
- copy(want, test.want)
- }
- if incY*incDst < 0 {
- for i := 0; i < n/2; i++ {
- want[i], want[n-i-1] = want[n-i-1], want[i]
- }
- }
- if !equalStrided(want, dst, incDst) {
- t.Errorf("%v: unexpected result:\nwant: %v\ngot: %v", prefix, want, dst)
- }
- }
- }
- }
- }
-}
-
-var gs []float64
-
-func BenchmarkDaxpyUnitaryN1(b *testing.B) { daxpyUnitaryBenchmark(b, 1) }
-func BenchmarkDaxpyUnitaryN2(b *testing.B) { daxpyUnitaryBenchmark(b, 2) }
-func BenchmarkDaxpyUnitaryN3(b *testing.B) { daxpyUnitaryBenchmark(b, 3) }
-func BenchmarkDaxpyUnitaryN4(b *testing.B) { daxpyUnitaryBenchmark(b, 4) }
-func BenchmarkDaxpyUnitaryN10(b *testing.B) { daxpyUnitaryBenchmark(b, 10) }
-func BenchmarkDaxpyUnitaryN100(b *testing.B) { daxpyUnitaryBenchmark(b, 100) }
-func BenchmarkDaxpyUnitaryN1000(b *testing.B) { daxpyUnitaryBenchmark(b, 1000) }
-func BenchmarkDaxpyUnitaryN10000(b *testing.B) { daxpyUnitaryBenchmark(b, 10000) }
-func BenchmarkDaxpyUnitaryN100000(b *testing.B) { daxpyUnitaryBenchmark(b, 100000) }
-
-func daxpyUnitaryBenchmark(b *testing.B, n int) {
- x := randomSlice(n, 1)
- y := randomSlice(n, 1)
- a := rand.Float64()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- AxpyUnitary(a, x, y)
- }
- gs = y
-}
-
-func BenchmarkDaxpyUnitaryToYN1(b *testing.B) { daxpyUnitaryToYBenchmark(b, 1) }
-func BenchmarkDaxpyUnitaryToYN2(b *testing.B) { daxpyUnitaryToYBenchmark(b, 2) }
-func BenchmarkDaxpyUnitaryToYN3(b *testing.B) { daxpyUnitaryToYBenchmark(b, 3) }
-func BenchmarkDaxpyUnitaryToYN4(b *testing.B) { daxpyUnitaryToYBenchmark(b, 4) }
-func BenchmarkDaxpyUnitaryToYN10(b *testing.B) { daxpyUnitaryToYBenchmark(b, 10) }
-func BenchmarkDaxpyUnitaryToYN100(b *testing.B) { daxpyUnitaryToYBenchmark(b, 100) }
-func BenchmarkDaxpyUnitaryToYN1000(b *testing.B) { daxpyUnitaryToYBenchmark(b, 1000) }
-func BenchmarkDaxpyUnitaryToYN10000(b *testing.B) { daxpyUnitaryToYBenchmark(b, 10000) }
-func BenchmarkDaxpyUnitaryToYN100000(b *testing.B) { daxpyUnitaryToYBenchmark(b, 100000) }
-
-func daxpyUnitaryToYBenchmark(b *testing.B, n int) {
- x := randomSlice(n, 1)
- y := randomSlice(n, 1)
- a := rand.Float64()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- AxpyUnitaryTo(y, a, x, y)
- }
- gs = y
-}
-
-func BenchmarkDaxpyUnitaryToN1(b *testing.B) { daxpyUnitaryToBenchmark(b, 1) }
-func BenchmarkDaxpyUnitaryToN2(b *testing.B) { daxpyUnitaryToBenchmark(b, 2) }
-func BenchmarkDaxpyUnitaryToN3(b *testing.B) { daxpyUnitaryToBenchmark(b, 3) }
-func BenchmarkDaxpyUnitaryToN4(b *testing.B) { daxpyUnitaryToBenchmark(b, 4) }
-func BenchmarkDaxpyUnitaryToN10(b *testing.B) { daxpyUnitaryToBenchmark(b, 10) }
-func BenchmarkDaxpyUnitaryToN100(b *testing.B) { daxpyUnitaryToBenchmark(b, 100) }
-func BenchmarkDaxpyUnitaryToN1000(b *testing.B) { daxpyUnitaryToBenchmark(b, 1000) }
-func BenchmarkDaxpyUnitaryToN10000(b *testing.B) { daxpyUnitaryToBenchmark(b, 10000) }
-func BenchmarkDaxpyUnitaryToN100000(b *testing.B) { daxpyUnitaryToBenchmark(b, 100000) }
-
-func daxpyUnitaryToBenchmark(b *testing.B, n int) {
- x := randomSlice(n, 1)
- y := randomSlice(n, 1)
- dst := randomSlice(n, 1)
- a := rand.Float64()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- AxpyUnitaryTo(dst, a, x, y)
- }
- gs = dst
-}
-
-func BenchmarkDaxpyIncN1Inc1(b *testing.B) { daxpyIncBenchmark(b, 1, 1) }
-
-func BenchmarkDaxpyIncN2Inc1(b *testing.B) { daxpyIncBenchmark(b, 2, 1) }
-func BenchmarkDaxpyIncN2Inc2(b *testing.B) { daxpyIncBenchmark(b, 2, 2) }
-func BenchmarkDaxpyIncN2Inc4(b *testing.B) { daxpyIncBenchmark(b, 2, 4) }
-func BenchmarkDaxpyIncN2Inc10(b *testing.B) { daxpyIncBenchmark(b, 2, 10) }
-
-func BenchmarkDaxpyIncN3Inc1(b *testing.B) { daxpyIncBenchmark(b, 3, 1) }
-func BenchmarkDaxpyIncN3Inc2(b *testing.B) { daxpyIncBenchmark(b, 3, 2) }
-func BenchmarkDaxpyIncN3Inc4(b *testing.B) { daxpyIncBenchmark(b, 3, 4) }
-func BenchmarkDaxpyIncN3Inc10(b *testing.B) { daxpyIncBenchmark(b, 3, 10) }
-
-func BenchmarkDaxpyIncN4Inc1(b *testing.B) { daxpyIncBenchmark(b, 4, 1) }
-func BenchmarkDaxpyIncN4Inc2(b *testing.B) { daxpyIncBenchmark(b, 4, 2) }
-func BenchmarkDaxpyIncN4Inc4(b *testing.B) { daxpyIncBenchmark(b, 4, 4) }
-func BenchmarkDaxpyIncN4Inc10(b *testing.B) { daxpyIncBenchmark(b, 4, 10) }
-
-func BenchmarkDaxpyIncN10Inc1(b *testing.B) { daxpyIncBenchmark(b, 10, 1) }
-func BenchmarkDaxpyIncN10Inc2(b *testing.B) { daxpyIncBenchmark(b, 10, 2) }
-func BenchmarkDaxpyIncN10Inc4(b *testing.B) { daxpyIncBenchmark(b, 10, 4) }
-func BenchmarkDaxpyIncN10Inc10(b *testing.B) { daxpyIncBenchmark(b, 10, 10) }
-
-func BenchmarkDaxpyIncN1000Inc1(b *testing.B) { daxpyIncBenchmark(b, 1000, 1) }
-func BenchmarkDaxpyIncN1000Inc2(b *testing.B) { daxpyIncBenchmark(b, 1000, 2) }
-func BenchmarkDaxpyIncN1000Inc4(b *testing.B) { daxpyIncBenchmark(b, 1000, 4) }
-func BenchmarkDaxpyIncN1000Inc10(b *testing.B) { daxpyIncBenchmark(b, 1000, 10) }
-
-func BenchmarkDaxpyIncN100000Inc1(b *testing.B) { daxpyIncBenchmark(b, 100000, 1) }
-func BenchmarkDaxpyIncN100000Inc2(b *testing.B) { daxpyIncBenchmark(b, 100000, 2) }
-func BenchmarkDaxpyIncN100000Inc4(b *testing.B) { daxpyIncBenchmark(b, 100000, 4) }
-func BenchmarkDaxpyIncN100000Inc10(b *testing.B) { daxpyIncBenchmark(b, 100000, 10) }
-
-func BenchmarkDaxpyIncN100000IncM1(b *testing.B) { daxpyIncBenchmark(b, 100000, -1) }
-func BenchmarkDaxpyIncN100000IncM2(b *testing.B) { daxpyIncBenchmark(b, 100000, -2) }
-func BenchmarkDaxpyIncN100000IncM4(b *testing.B) { daxpyIncBenchmark(b, 100000, -4) }
-func BenchmarkDaxpyIncN100000IncM10(b *testing.B) { daxpyIncBenchmark(b, 100000, -10) }
-
-func daxpyIncBenchmark(b *testing.B, n, inc int) {
- x := randomSlice(n, inc)
- y := randomSlice(n, inc)
- var ini int
- if inc < 0 {
- ini = (-n + 1) * inc
- }
- a := rand.Float64()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- AxpyInc(a, x, y, uintptr(n), uintptr(inc), uintptr(inc), uintptr(ini), uintptr(ini))
- }
- gs = y
-}
-
-func BenchmarkDaxpyIncToN1Inc1(b *testing.B) { daxpyIncToBenchmark(b, 1, 1) }
-
-func BenchmarkDaxpyIncToN2Inc1(b *testing.B) { daxpyIncToBenchmark(b, 2, 1) }
-func BenchmarkDaxpyIncToN2Inc2(b *testing.B) { daxpyIncToBenchmark(b, 2, 2) }
-func BenchmarkDaxpyIncToN2Inc4(b *testing.B) { daxpyIncToBenchmark(b, 2, 4) }
-func BenchmarkDaxpyIncToN2Inc10(b *testing.B) { daxpyIncToBenchmark(b, 2, 10) }
-
-func BenchmarkDaxpyIncToN3Inc1(b *testing.B) { daxpyIncToBenchmark(b, 3, 1) }
-func BenchmarkDaxpyIncToN3Inc2(b *testing.B) { daxpyIncToBenchmark(b, 3, 2) }
-func BenchmarkDaxpyIncToN3Inc4(b *testing.B) { daxpyIncToBenchmark(b, 3, 4) }
-func BenchmarkDaxpyIncToN3Inc10(b *testing.B) { daxpyIncToBenchmark(b, 3, 10) }
-
-func BenchmarkDaxpyIncToN4Inc1(b *testing.B) { daxpyIncToBenchmark(b, 4, 1) }
-func BenchmarkDaxpyIncToN4Inc2(b *testing.B) { daxpyIncToBenchmark(b, 4, 2) }
-func BenchmarkDaxpyIncToN4Inc4(b *testing.B) { daxpyIncToBenchmark(b, 4, 4) }
-func BenchmarkDaxpyIncToN4Inc10(b *testing.B) { daxpyIncToBenchmark(b, 4, 10) }
-
-func BenchmarkDaxpyIncToN10Inc1(b *testing.B) { daxpyIncToBenchmark(b, 10, 1) }
-func BenchmarkDaxpyIncToN10Inc2(b *testing.B) { daxpyIncToBenchmark(b, 10, 2) }
-func BenchmarkDaxpyIncToN10Inc4(b *testing.B) { daxpyIncToBenchmark(b, 10, 4) }
-func BenchmarkDaxpyIncToN10Inc10(b *testing.B) { daxpyIncToBenchmark(b, 10, 10) }
-
-func BenchmarkDaxpyIncToN1000Inc1(b *testing.B) { daxpyIncToBenchmark(b, 1000, 1) }
-func BenchmarkDaxpyIncToN1000Inc2(b *testing.B) { daxpyIncToBenchmark(b, 1000, 2) }
-func BenchmarkDaxpyIncToN1000Inc4(b *testing.B) { daxpyIncToBenchmark(b, 1000, 4) }
-func BenchmarkDaxpyIncToN1000Inc10(b *testing.B) { daxpyIncToBenchmark(b, 1000, 10) }
-
-func BenchmarkDaxpyIncToN100000Inc1(b *testing.B) { daxpyIncToBenchmark(b, 100000, 1) }
-func BenchmarkDaxpyIncToN100000Inc2(b *testing.B) { daxpyIncToBenchmark(b, 100000, 2) }
-func BenchmarkDaxpyIncToN100000Inc4(b *testing.B) { daxpyIncToBenchmark(b, 100000, 4) }
-func BenchmarkDaxpyIncToN100000Inc10(b *testing.B) { daxpyIncToBenchmark(b, 100000, 10) }
-
-func BenchmarkDaxpyIncToN100000IncM1(b *testing.B) { daxpyIncToBenchmark(b, 100000, -1) }
-func BenchmarkDaxpyIncToN100000IncM2(b *testing.B) { daxpyIncToBenchmark(b, 100000, -2) }
-func BenchmarkDaxpyIncToN100000IncM4(b *testing.B) { daxpyIncToBenchmark(b, 100000, -4) }
-func BenchmarkDaxpyIncToN100000IncM10(b *testing.B) { daxpyIncToBenchmark(b, 100000, -10) }
-
-func daxpyIncToBenchmark(b *testing.B, n, inc int) {
- x := randomSlice(n, inc)
- y := randomSlice(n, inc)
- dst := randomSlice(n, inc)
- var ini int
- if inc < 0 {
- ini = (-n + 1) * inc
- }
- a := rand.Float64()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- AxpyIncTo(dst, uintptr(inc), uintptr(ini), a, x, y,
- uintptr(n), uintptr(inc), uintptr(inc), uintptr(ini), uintptr(ini))
- }
- gs = y
-}
-
-func randomSlice(n, inc int) []float64 {
- if inc < 0 {
- inc = -inc
}
- x := make([]float64, (n-1)*inc+1)
- for i := range x {
- x[i] = rand.Float64()
}
- return x
}

asm/f64: Updated axpy test code to use value sigils in guards.