From d5c0d28527e7141d6b078ab741e84f2a7bd69944 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 8 Mar 2022 03:40:07 -0800 Subject: [PATCH] huff0: Skip unneeded exhaust check (#517) When not filling there is no reason to check if exhausted. ``` BenchmarkDecompress4XNoTable/gettysburg/10000-32 11867 11550 -2.67% BenchmarkDecompress4XNoTable/gettysburg/262143-32 336139 331035 -1.52% BenchmarkDecompress4XNoTable/twain/10000-32 11922 11561 -3.03% BenchmarkDecompress4XNoTable/twain/262143-32 387406 374386 -3.36% BenchmarkDecompress4XNoTable/pngdata.001/10000-32 12262 11961 -2.45% BenchmarkDecompress4XNoTable/pngdata.001/262143-32 319131 308746 -3.25% ``` --- huff0/decompress_amd64.s | 24 ++++++++++++------------ huff0/decompress_amd64.s.in | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/huff0/decompress_amd64.s b/huff0/decompress_amd64.s index 6d883c60dc..6c2b01db44 100644 --- a/huff0/decompress_amd64.s +++ b/huff0/decompress_amd64.s @@ -66,14 +66,14 @@ main_loop: SHLQ CL, AX ORQ AX, br_value - // } -skip_fill0: - // exhausted = exhausted || (br0.off < 4) CMPQ br_offset, $4 SETLT DL ORB DL, DH + // } +skip_fill0: + // val0 := br0.peekTopBits(peekBits) MOVQ br_value, AX MOVQ peek_bits, CX @@ -136,14 +136,14 @@ skip_fill0: SHLQ CL, AX ORQ AX, br_value - // } -skip_fill1: - // exhausted = exhausted || (br1.off < 4) CMPQ br_offset, $4 SETLT DL ORB DL, DH + // } +skip_fill1: + // val0 := br1.peekTopBits(peekBits) MOVQ br_value, AX MOVQ peek_bits, CX @@ -206,14 +206,14 @@ skip_fill1: SHLQ CL, AX ORQ AX, br_value - // } -skip_fill2: - // exhausted = exhausted || (br2.off < 4) CMPQ br_offset, $4 SETLT DL ORB DL, DH + // } +skip_fill2: + // val0 := br2.peekTopBits(peekBits) MOVQ br_value, AX MOVQ peek_bits, CX @@ -276,14 +276,14 @@ skip_fill2: SHLQ CL, AX ORQ AX, br_value - // } -skip_fill3: - // exhausted = exhausted || (br3.off < 4) CMPQ br_offset, $4 SETLT DL ORB DL, DH + // } +skip_fill3: + // val0 := br3.peekTopBits(peekBits) MOVQ br_value, AX MOVQ peek_bits, CX diff --git a/huff0/decompress_amd64.s.in b/huff0/decompress_amd64.s.in index 34bb290b63..d28655489f 100644 --- a/huff0/decompress_amd64.s.in +++ b/huff0/decompress_amd64.s.in @@ -66,13 +66,13 @@ main_loop: MOVQ br_bits_read, CX SHLQ CL, AX ORQ AX, br_value - // } -skip_fill{{ var "id" }}: // exhausted = exhausted || (br{{ var "id"}}.off < 4) CMPQ br_offset, $4 SETLT DL ORB DL, DH + // } +skip_fill{{ var "id" }}: // val0 := br{{ var "id"}}.peekTopBits(peekBits) MOVQ br_value, AX