Skip to content

Commit

Permalink
huff0: Skip unneeded exhaust check (#517)
Browse files Browse the repository at this point in the history
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%
```
  • Loading branch information
klauspost committed Mar 8, 2022
1 parent 8e863ce commit d5c0d28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions huff0/decompress_amd64.s
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions huff0/decompress_amd64.s.in
Expand Up @@ -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
Expand Down

0 comments on commit d5c0d28

Please sign in to comment.