Add x86_sse42_utility.make_m128i_slice128

This commit is contained in:
Nigel Tao committed 2021-02-18 22:32:21 +11:00
1 parent d4c23d091a
commit fa774e647f
6 files changed
+31 -73

No files matched your search

+2 -3
View File
@@ -680,13 +680,12 @@ var Funcs = []string{
"x86_sse42_utility.make_m128i_single_u32(a: u32) x86_m128i",
"x86_sse42_utility.make_m128i_single_u64(a: u64) x86_m128i",
"x86_sse42_utility.make_m128i_slice128(a: slice base.u8) x86_m128i",
"x86_sse42_utility.make_m128i_zeroes() x86_m128i",
// ---- x86_m128i
"x86_m128i.load_u32!(a: u32)",
"x86_m128i.load_u64!(a: u64)",
"x86_m128i.load_slice128!(a: slice base.u8)",
"x86_m128i.truncate_u32() u32",
"x86_m128i.truncate_u64() u64",
"x86_m128i.store_slice128!(a: slice base.u8)",
+11 -21
View File
@@ -19,6 +19,7 @@ import (
"fmt"
"math/big"
"strconv"
"strings"
"github.com/google/wuffs/lib/interval"
@@ -1220,9 +1221,16 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (bounds, e
}
} else if recvTyp.IsCPUArchType() {
if method >= t.IDLoadSlice128 {
if m := method - t.IDLoadSlice128; m < t.ID(len(lsMethodAdvances)) {
advance, update = lsMethodAdvances[m], false
if s := method.Str(q.tm); strings.HasPrefix(s, "make_") || strings.HasPrefix(s, "store_") {
switch {
case strings.HasSuffix(s, "_slice64"): // 64 bits is 8 bytes.
advance = eight
case strings.HasSuffix(s, "_slice128"): // 128 bits is 16 bytes.
advance = sixteen
case strings.HasSuffix(s, "_slice256"): // 256 bits is 32 bytes.
advance = thirtyTwo
case strings.HasSuffix(s, "_slice512"): // 512 bits is 64 bytes.
advance = sixtyFour
}
}
}
@@ -1439,24 +1447,6 @@ var ioMethodAdvances = [...]struct {
t.IDWriteExtendedTokenFast - t.IDPeekU8: {one, true},
}
var lsMethodAdvances = [...]*big.Int{
// 64 bits is 8 bytes.
// 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,
t.IDCreateSlice64 - t.IDLoadSlice128: eight,
t.IDCreateSlice128 - t.IDLoadSlice128: sixteen,
}
func makeConstValueExpr(tm *t.Map, cv *big.Int) (*a.Expr, error) {
id, err := tm.Insert(cv.String())
if err != nil {
-5
View File
@@ -607,11 +607,6 @@ func (q *checker) tcheckExprCall(n *a.Expr, depth uint32) error {
}
genericType1 = a.NewTypeExpr(t.IDSlice, 0, 0, nil, nil, genericType2.Inner())
}
if f.FuncName().IsBuiltInLoad() && (lhs.LHS().AsExpr().Operator() != 0) {
return fmt.Errorf(`check: %q receiver %q must be a local variable`,
f.QQID().Str(q.tm), lhs.LHS().AsExpr().Str(q.tm))
}
}
// Check that the func's in type matches the arguments.
+10 -18
View File
@@ -115,7 +115,6 @@ func (x ID) IsTightRight() bool { return x < ID(len(isTightRight)) && isTightRig
func (x ID) IsAssign() bool { return minAssign <= x && x <= maxAssign }
func (x ID) IsBuiltInCPUArch() bool { return minBuiltInCPUArch <= x && x <= maxBuiltInCPUArch }
func (x ID) IsBuiltInLoad() bool { return minBuiltInLoad <= x && x <= maxBuiltInLoad }
func (x ID) IsCannotAssignTo() bool { return minCannotAssignTo <= x && x <= maxCannotAssignTo }
func (x ID) IsClose() bool { return minClose <= x && x <= maxClose }
func (x ID) IsKeyword() bool { return minKeyword <= x && x <= maxKeyword }
@@ -699,18 +698,13 @@ const (
// --------
minBuiltInLoad = 0x380
maxBuiltInLoad = 0x387
IDStoreSlice64 = ID(0x380)
IDStoreSlice128 = ID(0x381)
IDStoreSlice256 = ID(0x382)
IDStoreSlice512 = ID(0x383)
IDLoadSlice128 = ID(0x382)
IDLoadSlice256 = ID(0x383)
IDLoadSlice512 = ID(0x384)
IDTruncateU32 = ID(0x388)
IDTruncateU64 = ID(0x389)
IDStoreSlice128 = ID(0x38A)
IDStoreSlice256 = ID(0x38B)
IDStoreSlice512 = ID(0x38C)
IDTruncateU32 = ID(0x388)
IDTruncateU64 = ID(0x389)
IDCreateSlice64 = ID(0x390)
IDCreateSlice128 = ID(0x391)
@@ -1117,16 +1111,14 @@ var builtInsByID = [nBuiltInIDs]string{
IDX86M128I: "x86_m128i",
IDLoadSlice128: "load_slice128",
IDLoadSlice256: "load_slice256",
IDLoadSlice512: "load_slice512",
IDTruncateU32: "truncate_u32",
IDTruncateU64: "truncate_u64",
IDStoreSlice64: "store_slice64",
IDStoreSlice128: "store_slice128",
IDStoreSlice256: "store_slice256",
IDStoreSlice512: "store_slice512",
IDTruncateU32: "truncate_u32",
IDTruncateU64: "truncate_u64",
IDCreateSlice64: "create_slice64",
IDCreateSlice128: "create_slice128",
}