mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 00:38:14 +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
@@ -72,45 +72,24 @@ pri func ieee_hasher.up!(x: slice base.u8),
|
||||
pri func ieee_hasher.up_arm_crc32!(x: slice base.u8),
|
||||
choose cpu_arch >= arm_crc32,
|
||||
{
|
||||
var s : base.u32
|
||||
var s : base.arm_crc32_u32
|
||||
var p : slice base.u8
|
||||
|
||||
s = 0xFFFF_FFFF ^ this.state
|
||||
s = s.create(a: 0xFFFF_FFFF ^ this.state)
|
||||
|
||||
// Align to a 16-byte boundary.
|
||||
while (args.x.length() > 0) and ((15 & args.x.uintptr_low_12_bits()) <> 0) {
|
||||
s = IEEE_TABLE[0][((s & 0xFF) as base.u8) ^ args.x[0]] ^ (s >> 8)
|
||||
s = s._crc32b(b: args.x[0])
|
||||
args.x = args.x[1 ..]
|
||||
} endwhile
|
||||
|
||||
// See "Multi-Byte Lookup Tables" in std/crc32/README.md for more detail on
|
||||
// the slicing-by-M algorithm. We use an M of 16.
|
||||
iterate (p = args.x)(length: 16, advance: 16, unroll: 2) {
|
||||
s ^= ((p[0x00] as base.u32) << 0) |
|
||||
((p[0x01] as base.u32) << 8) |
|
||||
((p[0x02] as base.u32) << 16) |
|
||||
((p[0x03] as base.u32) << 24)
|
||||
s = IEEE_TABLE[0x00][p[0x0F]] ^
|
||||
IEEE_TABLE[0x01][p[0x0E]] ^
|
||||
IEEE_TABLE[0x02][p[0x0D]] ^
|
||||
IEEE_TABLE[0x03][p[0x0C]] ^
|
||||
IEEE_TABLE[0x04][p[0x0B]] ^
|
||||
IEEE_TABLE[0x05][p[0x0A]] ^
|
||||
IEEE_TABLE[0x06][p[0x09]] ^
|
||||
IEEE_TABLE[0x07][p[0x08]] ^
|
||||
IEEE_TABLE[0x08][p[0x07]] ^
|
||||
IEEE_TABLE[0x09][p[0x06]] ^
|
||||
IEEE_TABLE[0x0A][p[0x05]] ^
|
||||
IEEE_TABLE[0x0B][p[0x04]] ^
|
||||
IEEE_TABLE[0x0C][0xFF & (s >> 24)] ^
|
||||
IEEE_TABLE[0x0D][0xFF & (s >> 16)] ^
|
||||
IEEE_TABLE[0x0E][0xFF & (s >> 8)] ^
|
||||
IEEE_TABLE[0x0F][0xFF & (s >> 0)]
|
||||
iterate (p = args.x)(length: 8, advance: 8, unroll: 16) {
|
||||
s = s._crc32d(b: p.peek_u64le())
|
||||
} else (length: 1, advance: 1, unroll: 1) {
|
||||
s = IEEE_TABLE[0][((s & 0xFF) as base.u8) ^ p[0]] ^ (s >> 8)
|
||||
s = s._crc32b(b: p[0])
|
||||
}
|
||||
|
||||
this.state = 0xFFFF_FFFF ^ s
|
||||
this.state = 0xFFFF_FFFF ^ s.value()
|
||||
}
|
||||
|
||||
// The table below was created by script/print-crc32-magic-numbers.go.
|
||||
|
||||
Reference in new issue
Block a user