mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Add base.arm_crc32_u32 type
On a Raspberry Pi 4 (32-bit armv7l) with -march=native and -mfpu=neon
("native" means "armv8-a+crc+simd"):
wuffs_crc32_ieee_10k/clang9 825MB/s ± 0% 6802MB/s ± 0% +724.00% (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/clang9 837MB/s ± 0% 6199MB/s ± 0% +640.25% (p=0.008 n=5+5)
wuffs_crc32_ieee_10k/gcc8 960MB/s ± 0% 4495MB/s ± 0% +368.35% (p=0.016 n=4+5)
wuffs_crc32_ieee_100k/gcc8 961MB/s ± 0% 4447MB/s ± 0% +363.01% (p=0.016 n=5+4)
mimic_crc32_ieee_10k 638MB/s ± 0% 631MB/s ± 0% -1.17% (p=0.008 n=5+5)
mimic_crc32_ieee_100k 639MB/s ± 0% 639MB/s ± 0% +0.02% (p=0.008 n=5+5)
wuffs_gzip_decode_10k/clang9 83.0MB/s ± 0% 90.7MB/s ± 0% +9.26% (p=0.008 n=5+5)
wuffs_gzip_decode_100k/clang9 100MB/s ± 0% 112MB/s ± 0% +11.91% (p=0.008 n=5+5)
wuffs_gzip_decode_10k/gcc8 86.1MB/s ± 0% 91.9MB/s ± 0% +6.72% (p=0.008 n=5+5)
wuffs_gzip_decode_100k/gcc8 102MB/s ± 0% 112MB/s ± 0% +9.34% (p=0.008 n=5+5)
mimic_gzip_decode_10k 98.8MB/s ± 0% 98.2MB/s ± 0% -0.60% (p=0.008 n=5+5)
mimic_gzip_decode_100k 128MB/s ± 0% 128MB/s ± 0% -0.08% (p=0.008 n=5+5)
wuffs_png_decode_image_19k_8bpp/clang9 67.6MB/s ± 0% 70.8MB/s ± 0% +4.72% (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang9 92.8MB/s ± 0% 98.8MB/s ± 0% +6.49% (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9 255MB/s ± 0% 269MB/s ± 0% +5.44% (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9 123MB/s ± 0% 123MB/s ± 0% +0.13% (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9 110MB/s ± 0% 112MB/s ± 0% +1.46% (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang9 88.4MB/s ± 0% 92.8MB/s ± 0% +4.90% (p=0.008 n=5+5)
wuffs_png_decode_image_19k_8bpp/gcc8 67.2MB/s ± 0% 70.8MB/s ± 0% +5.37% (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc8 94.0MB/s ± 0% 98.2MB/s ± 0% +4.45% (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc8 236MB/s ± 0% 248MB/s ± 0% +4.84% (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc8 114MB/s ± 0% 115MB/s ± 0% +1.11% (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc8 102MB/s ± 0% 104MB/s ± 0% +2.17% (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc8 88.8MB/s ± 0% 94.3MB/s ± 0% +6.21% (p=0.008 n=5+5)
mimic_png_decode_image_19k_8bpp 43.7MB/s ± 1% 43.4MB/s ± 1% ~ (p=0.095 n=5+5)
mimic_png_decode_image_40k_24bpp 54.6MB/s ± 0% 53.9MB/s ± 0% -1.25% (p=0.008 n=5+5)
mimic_png_decode_image_77k_8bpp 125MB/s ± 0% 124MB/s ± 0% -0.73% (p=0.008 n=5+5)
mimic_png_decode_image_552k_32bpp_ignore_checksum skipped
mimic_png_decode_image_552k_32bpp_verify_checksum 102MB/s ± 0% 101MB/s ± 0% -0.95% (p=0.008 n=5+5)
mimic_png_decode_image_4002k_24bpp 81.3MB/s ± 0% 81.0MB/s ± 0% -0.46% (p=0.016 n=4+5)
This commit is contained in:
1 parent
81ba41e251
commit
84f3592dbe
10 files changed
+94
-106
No files matched your search
@@ -95,6 +95,8 @@ func (g *gen) writeBuiltinCall(b *buffer, n *a.Expr, sideEffectsOnly bool, depth
|
||||
|
||||
if qid[1].IsNumType() {
|
||||
return g.writeBuiltinNumType(b, recv, method.Ident(), n.Args(), depth)
|
||||
} else if qid[1].IsBuiltInCPUArch() {
|
||||
return g.writeBuiltinCPUArch(b, recv, method.Ident(), n.Args(), sideEffectsOnly, depth)
|
||||
} else {
|
||||
switch qid[1] {
|
||||
case t.IDIOReader:
|
||||
@@ -144,8 +146,6 @@ func (g *gen) writeBuiltinCall(b *buffer, n *a.Expr, sideEffectsOnly bool, depth
|
||||
b.writes("&empty_io_buffer")
|
||||
return nil
|
||||
}
|
||||
case t.IDX86M128I:
|
||||
return g.writeBuiltinCPUArch(b, recv, method.Ident(), n.Args(), sideEffectsOnly, depth)
|
||||
}
|
||||
}
|
||||
return errNoSuchBuiltin
|
||||
@@ -524,8 +524,11 @@ func (g *gen) writeBuiltinCPUArch(b *buffer, recv *a.Expr, method t.ID, args []*
|
||||
}
|
||||
|
||||
const create = "create"
|
||||
methodStr := method.Str(g.tm)
|
||||
if strings.HasPrefix(methodStr, create) {
|
||||
if methodStr := method.Str(g.tm); methodStr == "value" {
|
||||
return g.writeExpr(b, recv, false, depth)
|
||||
} else if methodStr == create {
|
||||
return g.writeExpr(b, args[0].AsArg().Value(), false, depth)
|
||||
} else if strings.HasPrefix(methodStr, create) {
|
||||
b.printf("%s(", methodStr[len(create):])
|
||||
for i, o := range args {
|
||||
if i > 0 {
|
||||
@@ -552,6 +555,10 @@ func (g *gen) writeBuiltinCPUArch(b *buffer, recv *a.Expr, method t.ID, args []*
|
||||
b.writes(after)
|
||||
}
|
||||
} else {
|
||||
armCRC32U32 := recv.MType().Eq(typeExprARMCRC32U32)
|
||||
if armCRC32U32 {
|
||||
b.writeb('_')
|
||||
}
|
||||
b.printf("%s(", methodStr)
|
||||
if err := g.writeExpr(b, recv, false, depth); err != nil {
|
||||
return err
|
||||
@@ -560,7 +567,9 @@ func (g *gen) writeBuiltinCPUArch(b *buffer, recv *a.Expr, method t.ID, args []*
|
||||
b.writes(", ")
|
||||
after := ""
|
||||
v := o.AsArg().Value()
|
||||
if !v.MType().IsCPUArchType() {
|
||||
if armCRC32U32 {
|
||||
// No-op.
|
||||
} else if !v.MType().IsCPUArchType() {
|
||||
b.writes("(int32_t)(")
|
||||
after = ")"
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ var (
|
||||
|
||||
maxInt64 = big.NewInt((1 << 63) - 1)
|
||||
|
||||
typeExprARMCRC32U32 = a.NewTypeExpr(0, t.IDBase, t.IDARMCRC32U32, nil, nil, nil)
|
||||
typeExprPixelSwizzler = a.NewTypeExpr(0, t.IDBase, t.IDPixelSwizzler, nil, nil, nil)
|
||||
typeExprUtility = a.NewTypeExpr(0, t.IDBase, t.IDUtility, nil, nil, nil)
|
||||
)
|
||||
|
||||
@@ -577,7 +577,8 @@ var cTypeNames = [...]string{
|
||||
t.IDTokenReader: "wuffs_base__token_buffer*",
|
||||
t.IDTokenWriter: "wuffs_base__token_buffer*",
|
||||
|
||||
t.IDX86M128I: "__m128i",
|
||||
t.IDARMCRC32U32: "uint32_t",
|
||||
t.IDX86M128I: "__m128i",
|
||||
}
|
||||
|
||||
const noSuchCOperator = " no_such_C_operator "
|
||||
|
||||
@@ -351,6 +351,8 @@ func (g *gen) writeVars(b *buffer, f *funk, inStructDecl bool) error {
|
||||
b.writes(" = wuffs_base__make_status(NULL);\n")
|
||||
} else if typ.IsIOType() {
|
||||
b.printf(" = &%s%s;\n", uPrefix, name)
|
||||
} else if typ.Eq(typeExprARMCRC32U32) {
|
||||
b.writes(" = 0;\n")
|
||||
} else {
|
||||
b.writes(" = {0};\n")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user