Add sse128_i.load_slice128

This commit is contained in:
Nigel Tao committed 2021-01-23 22:58:21 +11:00
1 parent 2f78804e62
commit d1b741338b
5 files changed
+118 -25

No files matched your search

+26 -3
View File
@@ -1153,10 +1153,21 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (bounds, e
advance, update = au.advance, au.update
}
}
} else if recvTyp.IsCPUArchType() {
if method >= t.IDLoadSlice128 {
if m := method - t.IDLoadSlice128; m < t.ID(len(lsMethodAdvances)) {
advance, update = lsMethodAdvances[m], false
}
}
}
if (advance != nil) || (advanceExpr != nil) {
if ok, err := q.optimizeIOMethodAdvance(recv, advance, advanceExpr, update); err != nil {
subject := recv
if recv.MType().IsCPUArchType() {
subject = n.Args()[0].AsArg().Value()
}
if ok, err := q.optimizeIOMethodAdvance(subject, advance, advanceExpr, update); err != nil {
return bounds{}, err
} else if !ok {
adv := ""
@@ -1166,9 +1177,9 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (bounds, e
adv = advanceExpr.Str(q.tm)
}
return bounds{}, fmt.Errorf("check: could not prove %s pre-condition: %s.length() >= %s",
method.Str(q.tm), recv.Str(q.tm), adv)
method.Str(q.tm), subject.Str(q.tm), adv)
}
// TODO: drop other recv-related facts?
// TODO: drop other subject-related facts?
}
return bounds{}, errNotASpecialCase
@@ -1363,6 +1374,18 @@ var ioMethodAdvances = [...]struct {
t.IDWriteExtendedTokenFast - t.IDPeekU8: {one, true},
}
var lsMethodAdvances = [...]*big.Int{
// 128 bits is 16 bytes. 256 bits is 32 bytes. 512 bits is 64 bytes.
t.IDLoadSlice128 - t.IDLoadSlice128: sixteen,
t.IDLoadSlice256 - t.IDLoadSlice128: thirtyTwo,
t.IDLoadSlice512 - t.IDLoadSlice128: sixtyFour,
t.IDStoreSlice128 - t.IDLoadSlice128: sixteen,
t.IDStoreSlice256 - t.IDLoadSlice128: thirtyTwo,
t.IDStoreSlice512 - t.IDLoadSlice128: sixtyFour,
}
func makeConstValueExpr(tm *t.Map, cv *big.Int) (*a.Expr, error) {
id, err := tm.Insert(cv.String())
if err != nil {