Prepare to add cpu_arch_utility types

This commit is contained in:
Nigel Tao committed 2021-02-18 16:16:48 +11:00
1 parent 869be76fae
commit 492068f3dc
8 files changed
+77 -29

No files matched your search

+18 -8
View File
@@ -75,10 +75,15 @@ var (
typeExprDecodeFrameOptions = a.NewTypeExpr(0, t.IDBase, t.IDDecodeFrameOptions, nil, nil, nil)
typeExprARMCRC32U32 = a.NewTypeExpr(0, t.IDBase, t.IDARMCRC32U32, nil, nil, nil)
typeExprARMNeon64 = a.NewTypeExpr(0, t.IDBase, t.IDARMNeon64, nil, nil, nil)
typeExprARMNeon128 = a.NewTypeExpr(0, t.IDBase, t.IDARMNeon128, nil, nil, nil)
typeExprX86M128I = a.NewTypeExpr(0, t.IDBase, t.IDX86M128I, nil, nil, nil)
typeExprARMCRC32Utility = a.NewTypeExpr(0, t.IDBase, t.IDARMCRC32Utility, nil, nil, nil)
typeExprARMCRC32U32 = a.NewTypeExpr(0, t.IDBase, t.IDARMCRC32U32, nil, nil, nil)
typeExprARMNeonUtility = a.NewTypeExpr(0, t.IDBase, t.IDARMNeonUtility, nil, nil, nil)
typeExprARMNeon64 = a.NewTypeExpr(0, t.IDBase, t.IDARMNeon64, nil, nil, nil)
typeExprARMNeon128 = a.NewTypeExpr(0, t.IDBase, t.IDARMNeon128, nil, nil, nil)
typeExprX86SSE42Utility = a.NewTypeExpr(0, t.IDBase, t.IDX86SSE42Utility, nil, nil, nil)
typeExprX86M128I = a.NewTypeExpr(0, t.IDBase, t.IDX86M128I, nil, nil, nil)
typeExprSliceU8 = a.NewTypeExpr(t.IDSlice, 0, 0, nil, nil, typeExprU8)
typeExprTableU8 = a.NewTypeExpr(t.IDTable, 0, 0, nil, nil, typeExprU8)
@@ -128,10 +133,15 @@ var builtInTypeMap = typeMap{
t.IDDecodeFrameOptions: typeExprDecodeFrameOptions,
t.IDARMCRC32U32: typeExprARMCRC32U32,
t.IDARMNeon64: typeExprARMNeon64,
t.IDARMNeon128: typeExprARMNeon128,
t.IDX86M128I: typeExprX86M128I,
t.IDARMCRC32Utility: typeExprARMCRC32Utility,
t.IDARMCRC32U32: typeExprARMCRC32U32,
t.IDARMNeonUtility: typeExprARMNeonUtility,
t.IDARMNeon64: typeExprARMNeon64,
t.IDARMNeon128: typeExprARMNeon128,
t.IDX86SSE42Utility: typeExprX86SSE42Utility,
t.IDX86M128I: typeExprX86M128I,
}
func (c *Checker) parseBuiltInFuncs(m map[t.QQID]*a.Func, ss []string) error {
+4 -4
View File
@@ -49,14 +49,14 @@ func calcCPUArchBits(n *a.Func) (ret cpuArchBits) {
}
func (q *checker) tcheckCPUArchBits(cab cpuArchBits, typ *a.TypeExpr) error {
if qid := typ.Innermost().QID(); qid[0] == t.IDBase {
if qid := typ.Innermost().QID(); (qid[0] == t.IDBase) && qid[1].IsBuiltInCPUArch() {
need := cpuArchBits(0)
switch qid[1] {
case t.IDARMCRC32U32:
case t.IDARMCRC32Utility, t.IDARMCRC32U32:
need = cpuArchBitsARMCRC32
case t.IDARMNeon64, t.IDARMNeon128:
case t.IDARMNeonUtility, t.IDARMNeon64, t.IDARMNeon128:
need = cpuArchBitsARMNeon
case t.IDX86M128I:
case t.IDX86SSE42Utility, t.IDX86M128I:
need = cpuArchBitsX86SSE42
}
if (cab & need) != need {