summaryrefslogtreecommitdiff
path: root/vendor/github.com/klauspost
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/klauspost')
-rw-r--r--vendor/github.com/klauspost/compress/LICENSE304
-rw-r--r--vendor/github.com/klauspost/compress/internal/le/le.go5
-rw-r--r--vendor/github.com/klauspost/compress/internal/le/unsafe_disabled.go42
-rw-r--r--vendor/github.com/klauspost/compress/internal/le/unsafe_enabled.go55
-rw-r--r--vendor/github.com/klauspost/compress/internal/race/norace.go13
-rw-r--r--vendor/github.com/klauspost/compress/internal/race/race.go26
-rw-r--r--vendor/github.com/klauspost/compress/s2/.gitignore15
-rw-r--r--vendor/github.com/klauspost/compress/s2/LICENSE28
-rw-r--r--vendor/github.com/klauspost/compress/s2/README.md1120
-rw-r--r--vendor/github.com/klauspost/compress/s2/decode.go443
-rw-r--r--vendor/github.com/klauspost/compress/s2/decode_amd64.s568
-rw-r--r--vendor/github.com/klauspost/compress/s2/decode_arm64.s574
-rw-r--r--vendor/github.com/klauspost/compress/s2/decode_asm.go17
-rw-r--r--vendor/github.com/klauspost/compress/s2/decode_other.go288
-rw-r--r--vendor/github.com/klauspost/compress/s2/dict.go350
-rw-r--r--vendor/github.com/klauspost/compress/s2/encode.go414
-rw-r--r--vendor/github.com/klauspost/compress/s2/encode_all.go1480
-rw-r--r--vendor/github.com/klauspost/compress/s2/encode_amd64.go317
-rw-r--r--vendor/github.com/klauspost/compress/s2/encode_best.go796
-rw-r--r--vendor/github.com/klauspost/compress/s2/encode_better.go1510
-rw-r--r--vendor/github.com/klauspost/compress/s2/encode_go.go741
-rw-r--r--vendor/github.com/klauspost/compress/s2/encodeblock_amd64.go228
-rw-r--r--vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s21303
-rw-r--r--vendor/github.com/klauspost/compress/s2/index.go602
-rw-r--r--vendor/github.com/klauspost/compress/s2/lz4convert.go585
-rw-r--r--vendor/github.com/klauspost/compress/s2/lz4sconvert.go467
-rw-r--r--vendor/github.com/klauspost/compress/s2/reader.go1075
-rw-r--r--vendor/github.com/klauspost/compress/s2/s2.go151
-rw-r--r--vendor/github.com/klauspost/compress/s2/writer.go1064
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/.gitignore24
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml57
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/CONTRIBUTING.txt35
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/LICENSE22
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/README.md512
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/cpuid.go1679
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/cpuid_386.s47
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/cpuid_amd64.s72
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s36
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/detect_arm64.go250
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/detect_ref.go17
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/detect_x86.go45
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/featureid_string.go308
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go129
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go208
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go16
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go8
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go11
-rw-r--r--vendor/github.com/klauspost/cpuid/v2/test-architectures.sh15
-rw-r--r--vendor/github.com/klauspost/crc32/.gitignore24
-rw-r--r--vendor/github.com/klauspost/crc32/LICENSE27
-rw-r--r--vendor/github.com/klauspost/crc32/README.md42
-rw-r--r--vendor/github.com/klauspost/crc32/crc32.go253
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_amd64.go253
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_amd64.s527
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_arm64.go50
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_arm64.s97
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_generic.go91
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_loong64.go50
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_loong64.s160
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_otherarch.go15
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_ppc64le.go88
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_ppc64le.s736
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_s390x.go91
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_s390x.s225
-rw-r--r--vendor/github.com/klauspost/crc32/crc32_table_ppc64le.s3285
-rw-r--r--vendor/github.com/klauspost/crc32/gen.go7
66 files changed, 0 insertions, 44093 deletions
diff --git a/vendor/github.com/klauspost/compress/LICENSE b/vendor/github.com/klauspost/compress/LICENSE
deleted file mode 100644
index 87d557477..000000000
--- a/vendor/github.com/klauspost/compress/LICENSE
+++ /dev/null
@@ -1,304 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-Copyright (c) 2019 Klaus Post. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------
-
-Files: gzhttp/*
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2016-2017 The New York Times Company
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-------------------
-
-Files: s2/cmd/internal/readahead/*
-
-The MIT License (MIT)
-
-Copyright (c) 2015 Klaus Post
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
----------------------
-Files: snappy/*
-Files: internal/snapref/*
-
-Copyright (c) 2011 The Snappy-Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
------------------
-
-Files: s2/cmd/internal/filepathx/*
-
-Copyright 2016 The filepathx Authors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/klauspost/compress/internal/le/le.go b/vendor/github.com/klauspost/compress/internal/le/le.go
deleted file mode 100644
index e54909e16..000000000
--- a/vendor/github.com/klauspost/compress/internal/le/le.go
+++ /dev/null
@@ -1,5 +0,0 @@
-package le
-
-type Indexer interface {
- int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
-}
diff --git a/vendor/github.com/klauspost/compress/internal/le/unsafe_disabled.go b/vendor/github.com/klauspost/compress/internal/le/unsafe_disabled.go
deleted file mode 100644
index 0cfb5c0e2..000000000
--- a/vendor/github.com/klauspost/compress/internal/le/unsafe_disabled.go
+++ /dev/null
@@ -1,42 +0,0 @@
-//go:build !(amd64 || arm64 || ppc64le || riscv64) || nounsafe || purego || appengine
-
-package le
-
-import (
- "encoding/binary"
-)
-
-// Load8 will load from b at index i.
-func Load8[I Indexer](b []byte, i I) byte {
- return b[i]
-}
-
-// Load16 will load from b at index i.
-func Load16[I Indexer](b []byte, i I) uint16 {
- return binary.LittleEndian.Uint16(b[i:])
-}
-
-// Load32 will load from b at index i.
-func Load32[I Indexer](b []byte, i I) uint32 {
- return binary.LittleEndian.Uint32(b[i:])
-}
-
-// Load64 will load from b at index i.
-func Load64[I Indexer](b []byte, i I) uint64 {
- return binary.LittleEndian.Uint64(b[i:])
-}
-
-// Store16 will store v at b.
-func Store16(b []byte, v uint16) {
- binary.LittleEndian.PutUint16(b, v)
-}
-
-// Store32 will store v at b.
-func Store32(b []byte, v uint32) {
- binary.LittleEndian.PutUint32(b, v)
-}
-
-// Store64 will store v at b.
-func Store64(b []byte, v uint64) {
- binary.LittleEndian.PutUint64(b, v)
-}
diff --git a/vendor/github.com/klauspost/compress/internal/le/unsafe_enabled.go b/vendor/github.com/klauspost/compress/internal/le/unsafe_enabled.go
deleted file mode 100644
index ada45cd90..000000000
--- a/vendor/github.com/klauspost/compress/internal/le/unsafe_enabled.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// We enable 64 bit LE platforms:
-
-//go:build (amd64 || arm64 || ppc64le || riscv64) && !nounsafe && !purego && !appengine
-
-package le
-
-import (
- "unsafe"
-)
-
-// Load8 will load from b at index i.
-func Load8[I Indexer](b []byte, i I) byte {
- //return binary.LittleEndian.Uint16(b[i:])
- //return *(*uint16)(unsafe.Pointer(&b[i]))
- return *(*byte)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(b)), i))
-}
-
-// Load16 will load from b at index i.
-func Load16[I Indexer](b []byte, i I) uint16 {
- //return binary.LittleEndian.Uint16(b[i:])
- //return *(*uint16)(unsafe.Pointer(&b[i]))
- return *(*uint16)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(b)), i))
-}
-
-// Load32 will load from b at index i.
-func Load32[I Indexer](b []byte, i I) uint32 {
- //return binary.LittleEndian.Uint32(b[i:])
- //return *(*uint32)(unsafe.Pointer(&b[i]))
- return *(*uint32)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(b)), i))
-}
-
-// Load64 will load from b at index i.
-func Load64[I Indexer](b []byte, i I) uint64 {
- //return binary.LittleEndian.Uint64(b[i:])
- //return *(*uint64)(unsafe.Pointer(&b[i]))
- return *(*uint64)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(b)), i))
-}
-
-// Store16 will store v at b.
-func Store16(b []byte, v uint16) {
- //binary.LittleEndian.PutUint16(b, v)
- *(*uint16)(unsafe.Pointer(unsafe.SliceData(b))) = v
-}
-
-// Store32 will store v at b.
-func Store32(b []byte, v uint32) {
- //binary.LittleEndian.PutUint32(b, v)
- *(*uint32)(unsafe.Pointer(unsafe.SliceData(b))) = v
-}
-
-// Store64 will store v at b.
-func Store64(b []byte, v uint64) {
- //binary.LittleEndian.PutUint64(b, v)
- *(*uint64)(unsafe.Pointer(unsafe.SliceData(b))) = v
-}
diff --git a/vendor/github.com/klauspost/compress/internal/race/norace.go b/vendor/github.com/klauspost/compress/internal/race/norace.go
deleted file mode 100644
index affbbbb59..000000000
--- a/vendor/github.com/klauspost/compress/internal/race/norace.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !race
-
-package race
-
-func ReadSlice[T any](s []T) {
-}
-
-func WriteSlice[T any](s []T) {
-}
diff --git a/vendor/github.com/klauspost/compress/internal/race/race.go b/vendor/github.com/klauspost/compress/internal/race/race.go
deleted file mode 100644
index f5e240dcd..000000000
--- a/vendor/github.com/klauspost/compress/internal/race/race.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build race
-
-package race
-
-import (
- "runtime"
- "unsafe"
-)
-
-func ReadSlice[T any](s []T) {
- if len(s) == 0 {
- return
- }
- runtime.RaceReadRange(unsafe.Pointer(&s[0]), len(s)*int(unsafe.Sizeof(s[0])))
-}
-
-func WriteSlice[T any](s []T) {
- if len(s) == 0 {
- return
- }
- runtime.RaceWriteRange(unsafe.Pointer(&s[0]), len(s)*int(unsafe.Sizeof(s[0])))
-}
diff --git a/vendor/github.com/klauspost/compress/s2/.gitignore b/vendor/github.com/klauspost/compress/s2/.gitignore
deleted file mode 100644
index 3a89c6e3e..000000000
--- a/vendor/github.com/klauspost/compress/s2/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-testdata/bench
-
-# These explicitly listed benchmark data files are for an obsolete version of
-# snappy_test.go.
-testdata/alice29.txt
-testdata/asyoulik.txt
-testdata/fireworks.jpeg
-testdata/geo.protodata
-testdata/html
-testdata/html_x_4
-testdata/kppkn.gtb
-testdata/lcet10.txt
-testdata/paper-100k.pdf
-testdata/plrabn12.txt
-testdata/urls.10K
diff --git a/vendor/github.com/klauspost/compress/s2/LICENSE b/vendor/github.com/klauspost/compress/s2/LICENSE
deleted file mode 100644
index 1d2d645bd..000000000
--- a/vendor/github.com/klauspost/compress/s2/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2011 The Snappy-Go Authors. All rights reserved.
-Copyright (c) 2019 Klaus Post. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/klauspost/compress/s2/README.md b/vendor/github.com/klauspost/compress/s2/README.md
deleted file mode 100644
index 1d9220cbf..000000000
--- a/vendor/github.com/klauspost/compress/s2/README.md
+++ /dev/null
@@ -1,1120 +0,0 @@
-# S2 Compression
-
-S2 is an extension of [Snappy](https://github.com/google/snappy).
-
-S2 is aimed for high throughput, which is why it features concurrent compression for bigger payloads.
-
-Decoding is compatible with Snappy compressed content, but content compressed with S2 cannot be decompressed by Snappy.
-This means that S2 can seamlessly replace Snappy without converting compressed content.
-
-S2 can produce Snappy compatible output, faster and better than Snappy.
-If you want full benefit of the changes you should use s2 without Snappy compatibility.
-
-S2 is designed to have high throughput on content that cannot be compressed.
-This is important, so you don't have to worry about spending CPU cycles on already compressed data.
-
-## Benefits over Snappy
-
-* Better compression
-* Adjustable compression (3 levels)
-* Concurrent stream compression
-* Faster decompression, even for Snappy compatible content
-* Concurrent Snappy/S2 stream decompression
-* Skip forward in compressed stream
-* Random seeking with indexes
-* Compatible with reading Snappy compressed content
-* Smaller block size overhead on incompressible blocks
-* Block concatenation
-* Block Dictionary support
-* Uncompressed stream mode
-* Automatic stream size padding
-* Snappy compatible block compression
-
-## Drawbacks over Snappy
-
-* Not optimized for 32 bit systems
-* Streams use slightly more memory due to larger blocks and concurrency (configurable)
-
-# Usage
-
-Installation: `go get -u github.com/klauspost/compress/s2`
-
-Full package documentation:
-
-[![godoc][1]][2]
-
-[1]: https://godoc.org/github.com/klauspost/compress?status.svg
-[2]: https://godoc.org/github.com/klauspost/compress/s2
-
-## Compression
-
-```Go
-func EncodeStream(src io.Reader, dst io.Writer) error {
- enc := s2.NewWriter(dst)
- _, err := io.Copy(enc, src)
- if err != nil {
- enc.Close()
- return err
- }
- // Blocks until compression is done.
- return enc.Close()
-}
-```
-
-You should always call `enc.Close()`, otherwise you will leak resources and your encode will be incomplete.
-
-For the best throughput, you should attempt to reuse the `Writer` using the `Reset()` method.
-
-The Writer in S2 is always buffered, therefore `NewBufferedWriter` in Snappy can be replaced with `NewWriter` in S2.
-It is possible to flush any buffered data using the `Flush()` method.
-This will block until all data sent to the encoder has been written to the output.
-
-S2 also supports the `io.ReaderFrom` interface, which will consume all input from a reader.
-
-As a final method to compress data, if you have a single block of data you would like to have encoded as a stream,
-a slightly more efficient method is to use the `EncodeBuffer` method.
-This will take ownership of the buffer until the stream is closed.
-
-```Go
-func EncodeStream(src []byte, dst io.Writer) error {
- enc := s2.NewWriter(dst)
- // The encoder owns the buffer until Flush or Close is called.
- err := enc.EncodeBuffer(src)
- if err != nil {
- enc.Close()
- return err
- }
- // Blocks until compression is done.
- return enc.Close()
-}
-```
-
-Each call to `EncodeBuffer` will result in discrete blocks being created without buffering,
-so it should only be used a single time per stream.
-If you need to write several blocks, you should use the regular io.Writer interface.
-
-
-## Decompression
-
-```Go
-func DecodeStream(src io.Reader, dst io.Writer) error {
- dec := s2.NewReader(src)
- _, err := io.Copy(dst, dec)
- return err
-}
-```
-
-Similar to the Writer, a Reader can be reused using the `Reset` method.
-
-For the best possible throughput, there is a `EncodeBuffer(buf []byte)` function available.
-However, it requires that the provided buffer isn't used after it is handed over to S2 and until the stream is flushed or closed.
-
-For smaller data blocks, there is also a non-streaming interface: `Encode()`, `EncodeBetter()` and `Decode()`.
-Do however note that these functions (similar to Snappy) does not provide validation of data,
-so data corruption may be undetected. Stream encoding provides CRC checks of data.
-
-It is possible to efficiently skip forward in a compressed stream using the `Skip()` method.
-For big skips the decompressor is able to skip blocks without decompressing them.
-
-## Single Blocks
-
-Similar to Snappy S2 offers single block compression.
-Blocks do not offer the same flexibility and safety as streams,
-but may be preferable for very small payloads, less than 100K.
-
-Using a simple `dst := s2.Encode(nil, src)` will compress `src` and return the compressed result.
-It is possible to provide a destination buffer.
-If the buffer has a capacity of `s2.MaxEncodedLen(len(src))` it will be used.
-If not a new will be allocated.
-
-Alternatively `EncodeBetter`/`EncodeBest` can also be used for better, but slightly slower compression.
-
-Similarly to decompress a block you can use `dst, err := s2.Decode(nil, src)`.
-Again an optional destination buffer can be supplied.
-The `s2.DecodedLen(src)` can be used to get the minimum capacity needed.
-If that is not satisfied a new buffer will be allocated.
-
-Block function always operate on a single goroutine since it should only be used for small payloads.
-
-# Commandline tools
-
-Some very simply commandline tools are provided; `s2c` for compression and `s2d` for decompression.
-
-Binaries can be downloaded on the [Releases Page](https://github.com/klauspost/compress/releases).
-
-Installing then requires Go to be installed. To install them, use:
-
-`go install github.com/klauspost/compress/s2/cmd/s2c@latest && go install github.com/klauspost/compress/s2/cmd/s2d@latest`
-
-To build binaries to the current folder use:
-
-`go build github.com/klauspost/compress/s2/cmd/s2c && go build github.com/klauspost/compress/s2/cmd/s2d`
-
-
-## s2c
-
-```
-Usage: s2c [options] file1 file2
-
-Compresses all files supplied as input separately.
-Output files are written as 'filename.ext.s2' or 'filename.ext.snappy'.
-By default output files will be overwritten.
-Use - as the only file name to read from stdin and write to stdout.
-
-Wildcards are accepted: testdir/*.txt will compress all files in testdir ending with .txt
-Directories can be wildcards as well. testdir/*/*.txt will match testdir/subdir/b.txt
-
-File names beginning with 'http://' and 'https://' will be downloaded and compressed.
-Only http response code 200 is accepted.
-
-Options:
- -bench int
- Run benchmark n times. No output will be written
- -blocksize string
- Max block size. Examples: 64K, 256K, 1M, 4M. Must be power of two and <= 4MB (default "4M")
- -c Write all output to stdout. Multiple input files will be concatenated
- -cpu int
- Compress using this amount of threads (default 32)
- -faster
- Compress faster, but with a minor compression loss
- -help
- Display help
- -index
- Add seek index (default true)
- -o string
- Write output to another file. Single input file only
- -pad string
- Pad size to a multiple of this value, Examples: 500, 64K, 256K, 1M, 4M, etc (default "1")
- -q Don't write any output to terminal, except errors
- -rm
- Delete source file(s) after successful compression
- -safe
- Do not overwrite output files
- -slower
- Compress more, but a lot slower
- -snappy
- Generate Snappy compatible output stream
- -verify
- Verify written files
-
-```
-
-## s2d
-
-```
-Usage: s2d [options] file1 file2
-
-Decompresses all files supplied as input. Input files must end with '.s2' or '.snappy'.
-Output file names have the extension removed. By default output files will be overwritten.
-Use - as the only file name to read from stdin and write to stdout.
-
-Wildcards are accepted: testdir/*.txt will compress all files in testdir ending with .txt
-Directories can be wildcards as well. testdir/*/*.txt will match testdir/subdir/b.txt
-
-File names beginning with 'http://' and 'https://' will be downloaded and decompressed.
-Extensions on downloaded files are ignored. Only http response code 200 is accepted.
-
-Options:
- -bench int
- Run benchmark n times. No output will be written
- -c Write all output to stdout. Multiple input files will be concatenated
- -help
- Display help
- -o string
- Write output to another file. Single input file only
- -offset string
- Start at offset. Examples: 92, 64K, 256K, 1M, 4M. Requires Index
- -q Don't write any output to terminal, except errors
- -rm
- Delete source file(s) after successful decompression
- -safe
- Do not overwrite output files
- -tail string
- Return last of compressed file. Examples: 92, 64K, 256K, 1M, 4M. Requires Index
- -verify
- Verify files, but do not write output
-```
-
-## s2sx: self-extracting archives
-
-s2sx allows creating self-extracting archives with no dependencies.
-
-By default, executables are created for the same platforms as the host os,
-but this can be overridden with `-os` and `-arch` parameters.
-
-Extracted files have 0666 permissions, except when untar option used.
-
-```
-Usage: s2sx [options] file1 file2
-
-Compresses all files supplied as input separately.
-If files have '.s2' extension they are assumed to be compressed already.
-Output files are written as 'filename.s2sx' and with '.exe' for windows targets.
-If output is big, an additional file with ".more" is written. This must be included as well.
-By default output files will be overwritten.
-
-Wildcards are accepted: testdir/*.txt will compress all files in testdir ending with .txt
-Directories can be wildcards as well. testdir/*/*.txt will match testdir/subdir/b.txt
-
-Options:
- -arch string
- Destination architecture (default "amd64")
- -c Write all output to stdout. Multiple input files will be concatenated
- -cpu int
- Compress using this amount of threads (default 32)
- -help
- Display help
- -max string
- Maximum executable size. Rest will be written to another file. (default "1G")
- -os string
- Destination operating system (default "windows")
- -q Don't write any output to terminal, except errors
- -rm
- Delete source file(s) after successful compression
- -safe
- Do not overwrite output files
- -untar
- Untar on destination
-```
-
-Available platforms are:
-
- * darwin-amd64
- * darwin-arm64
- * linux-amd64
- * linux-arm
- * linux-arm64
- * linux-mips64
- * linux-ppc64le
- * windows-386
- * windows-amd64
-
-By default, there is a size limit of 1GB for the output executable.
-
-When this is exceeded the remaining file content is written to a file called
-output+`.more`. This file must be included for a successful extraction and
-placed alongside the executable for a successful extraction.
-
-This file *must* have the same name as the executable, so if the executable is renamed,
-so must the `.more` file.
-
-This functionality is disabled with stdin/stdout.
-
-### Self-extracting TAR files
-
-If you wrap a TAR file you can specify `-untar` to make it untar on the destination host.
-
-Files are extracted to the current folder with the path specified in the tar file.
-
-Note that tar files are not validated before they are wrapped.
-
-For security reasons files that move below the root folder are not allowed.
-
-# Performance
-
-This section will focus on comparisons to Snappy.
-This package is solely aimed at replacing Snappy as a high speed compression package.
-If you are mainly looking for better compression [zstandard](https://github.com/klauspost/compress/tree/master/zstd#zstd)
-gives better compression, but typically at speeds slightly below "better" mode in this package.
-
-Compression is increased compared to Snappy, mostly around 5-20% and the throughput is typically 25-40% increased (single threaded) compared to the Snappy Go implementation.
-
-Streams are concurrently compressed. The stream will be distributed among all available CPU cores for the best possible throughput.
-
-A "better" compression mode is also available. This allows to trade a bit of speed for a minor compression gain.
-The content compressed in this mode is fully compatible with the standard decoder.
-
-Snappy vs S2 **compression** speed on 16 core (32 thread) computer, using all threads and a single thread (1 CPU):
-
-| File | S2 Speed | S2 Throughput | S2 % smaller | S2 "better" | "better" throughput | "better" % smaller |
-|---------------------------------------------------------------------------------------------------------|----------|---------------|--------------|-------------|---------------------|--------------------|
-| [rawstudio-mint14.tar](https://files.klauspost.com/compress/rawstudio-mint14.7z) | 16.33x | 10556 MB/s | 8.0% | 6.04x | 5252 MB/s | 14.7% |
-| (1 CPU) | 1.08x | 940 MB/s | - | 0.46x | 400 MB/s | - |
-| [github-june-2days-2019.json](https://files.klauspost.com/compress/github-june-2days-2019.json.zst) | 16.51x | 15224 MB/s | 31.70% | 9.47x | 8734 MB/s | 37.71% |
-| (1 CPU) | 1.26x | 1157 MB/s | - | 0.60x | 556 MB/s | - |
-| [github-ranks-backup.bin](https://files.klauspost.com/compress/github-ranks-backup.bin.zst) | 15.14x | 12598 MB/s | -5.76% | 6.23x | 5675 MB/s | 3.62% |
-| (1 CPU) | 1.02x | 932 MB/s | - | 0.47x | 432 MB/s | - |
-| [consensus.db.10gb](https://files.klauspost.com/compress/consensus.db.10gb.zst) | 11.21x | 12116 MB/s | 15.95% | 3.24x | 3500 MB/s | 18.00% |
-| (1 CPU) | 1.05x | 1135 MB/s | - | 0.27x | 292 MB/s | - |
-| [apache.log](https://files.klauspost.com/compress/apache.log.zst) | 8.55x | 16673 MB/s | 20.54% | 5.85x | 11420 MB/s | 24.97% |
-| (1 CPU) | 1.91x | 1771 MB/s | - | 0.53x | 1041 MB/s | - |
-| [gob-stream](https://files.klauspost.com/compress/gob-stream.7z) | 15.76x | 14357 MB/s | 24.01% | 8.67x | 7891 MB/s | 33.68% |
-| (1 CPU) | 1.17x | 1064 MB/s | - | 0.65x | 595 MB/s | - |
-| [10gb.tar](http://mattmahoney.net/dc/10gb.html) | 13.33x | 9835 MB/s | 2.34% | 6.85x | 4863 MB/s | 9.96% |
-| (1 CPU) | 0.97x | 689 MB/s | - | 0.55x | 387 MB/s | - |
-| sharnd.out.2gb | 9.11x | 13213 MB/s | 0.01% | 1.49x | 9184 MB/s | 0.01% |
-| (1 CPU) | 0.88x | 5418 MB/s | - | 0.77x | 5417 MB/s | - |
-| [sofia-air-quality-dataset csv](https://files.klauspost.com/compress/sofia-air-quality-dataset.tar.zst) | 22.00x | 11477 MB/s | 18.73% | 11.15x | 5817 MB/s | 27.88% |
-| (1 CPU) | 1.23x | 642 MB/s | - | 0.71x | 642 MB/s | - |
-| [silesia.tar](http://sun.aei.polsl.pl/~sdeor/corpus/silesia.zip) | 11.23x | 6520 MB/s | 5.9% | 5.35x | 3109 MB/s | 15.88% |
-| (1 CPU) | 1.05x | 607 MB/s | - | 0.52x | 304 MB/s | - |
-| [enwik9](https://files.klauspost.com/compress/enwik9.zst) | 19.28x | 8440 MB/s | 4.04% | 9.31x | 4076 MB/s | 18.04% |
-| (1 CPU) | 1.12x | 488 MB/s | - | 0.57x | 250 MB/s | - |
-
-### Legend
-
-* `S2 Speed`: Speed of S2 compared to Snappy, using 16 cores and 1 core.
-* `S2 Throughput`: Throughput of S2 in MB/s.
-* `S2 % smaller`: How many percent of the Snappy output size is S2 better.
-* `S2 "better"`: Speed when enabling "better" compression mode in S2 compared to Snappy.
-* `"better" throughput`: Speed when enabling "better" compression mode in S2 compared to Snappy.
-* `"better" % smaller`: How many percent of the Snappy output size is S2 better when using "better" compression.
-
-There is a good speedup across the board when using a single thread and a significant speedup when using multiple threads.
-
-Machine generated data gets by far the biggest compression boost, with size being reduced by up to 35% of Snappy size.
-
-The "better" compression mode sees a good improvement in all cases, but usually at a performance cost.
-
-Incompressible content (`sharnd.out.2gb`, 2GB random data) sees the smallest speedup.
-This is likely dominated by synchronization overhead, which is confirmed by the fact that single threaded performance is higher (see above).
-
-## Decompression
-
-S2 attempts to create content that is also fast to decompress, except in "better" mode where the smallest representation is used.
-
-S2 vs Snappy **decompression** speed. Both operating on single core:
-
-| File | S2 Throughput | vs. Snappy | Better Throughput | vs. Snappy |
-|-----------------------------------------------------------------------------------------------------|---------------|------------|-------------------|------------|
-| [rawstudio-mint14.tar](https://files.klauspost.com/compress/rawstudio-mint14.7z) | 2117 MB/s | 1.14x | 1738 MB/s | 0.94x |
-| [github-june-2days-2019.json](https://files.klauspost.com/compress/github-june-2days-2019.json.zst) | 2401 MB/s | 1.25x | 2307 MB/s | 1.20x |
-| [github-ranks-backup.bin](https://files.klauspost.com/compress/github-ranks-backup.bin.zst) | 2075 MB/s | 0.98x | 1764 MB/s | 0.83x |
-| [consensus.db.10gb](https://files.klauspost.com/compress/consensus.db.10gb.zst) | 2967 MB/s | 1.05x | 2885 MB/s | 1.02x |
-| [adresser.json](https://files.klauspost.com/compress/adresser.json.zst) | 4141 MB/s | 1.07x | 4184 MB/s | 1.08x |
-| [gob-stream](https://files.klauspost.com/compress/gob-stream.7z) | 2264 MB/s | 1.12x | 2185 MB/s | 1.08x |
-| [10gb.tar](http://mattmahoney.net/dc/10gb.html) | 1525 MB/s | 1.03x | 1347 MB/s | 0.91x |
-| sharnd.out.2gb | 3813 MB/s | 0.79x | 3900 MB/s | 0.81x |
-| [enwik9](http://mattmahoney.net/dc/textdata.html) | 1246 MB/s | 1.29x | 967 MB/s | 1.00x |
-| [silesia.tar](http://sun.aei.polsl.pl/~sdeor/corpus/silesia.zip) | 1433 MB/s | 1.12x | 1203 MB/s | 0.94x |
-| [enwik10](https://encode.su/threads/3315-enwik10-benchmark-results) | 1284 MB/s | 1.32x | 1010 MB/s | 1.04x |
-
-### Legend
-
-* `S2 Throughput`: Decompression speed of S2 encoded content.
-* `Better Throughput`: Decompression speed of S2 "better" encoded content.
-* `vs Snappy`: Decompression speed of S2 "better" mode compared to Snappy and absolute speed.
-
-
-While the decompression code hasn't changed, there is a significant speedup in decompression speed.
-S2 prefers longer matches and will typically only find matches that are 6 bytes or longer.
-While this reduces compression a bit, it improves decompression speed.
-
-The "better" compression mode will actively look for shorter matches, which is why it has a decompression speed quite similar to Snappy.
-
-Without assembly decompression is also very fast; single goroutine decompression speed. No assembly:
-
-| File | S2 Throughput | S2 throughput |
-|--------------------------------|---------------|---------------|
-| consensus.db.10gb.s2 | 1.84x | 2289.8 MB/s |
-| 10gb.tar.s2 | 1.30x | 867.07 MB/s |
-| rawstudio-mint14.tar.s2 | 1.66x | 1329.65 MB/s |
-| github-june-2days-2019.json.s2 | 2.36x | 1831.59 MB/s |
-| github-ranks-backup.bin.s2 | 1.73x | 1390.7 MB/s |
-| enwik9.s2 | 1.67x | 681.53 MB/s |
-| adresser.json.s2 | 3.41x | 4230.53 MB/s |
-| silesia.tar.s2 | 1.52x | 811.58 |
-
-Even though S2 typically compresses better than Snappy, decompression speed is always better.
-
-### Concurrent Stream Decompression
-
-For full stream decompression S2 offers a [DecodeConcurrent](https://pkg.go.dev/github.com/klauspost/compress/s2#Reader.DecodeConcurrent)
-that will decode a full stream using multiple goroutines.
-
-Example scaling, AMD Ryzen 3950X, 16 cores, decompression using `s2d -bench=3 <input>`, best of 3:
-
-| Input | `-cpu=1` | `-cpu=2` | `-cpu=4` | `-cpu=8` | `-cpu=16` |
-|-------------------------------------------|------------|------------|------------|------------|-------------|
-| enwik10.snappy | 1098.6MB/s | 1819.8MB/s | 3625.6MB/s | 6910.6MB/s | 10818.2MB/s |
-| enwik10.s2 | 1303.5MB/s | 2606.1MB/s | 4847.9MB/s | 8878.4MB/s | 9592.1MB/s |
-| sofia-air-quality-dataset.tar.snappy | 1302.0MB/s | 2165.0MB/s | 4244.5MB/s | 8241.0MB/s | 12920.5MB/s |
-| sofia-air-quality-dataset.tar.s2 | 1399.2MB/s | 2463.2MB/s | 5196.5MB/s | 9639.8MB/s | 11439.5MB/s |
-| sofia-air-quality-dataset.tar.s2 (no asm) | 837.5MB/s | 1652.6MB/s | 3183.6MB/s | 5945.0MB/s | 9620.7MB/s |
-
-Scaling can be expected to be pretty linear until memory bandwidth is saturated.
-
-For now the DecodeConcurrent can only be used for full streams without seeking or combining with regular reads.
-
-## Block compression
-
-
-When compressing blocks no concurrent compression is performed just as Snappy.
-This is because blocks are for smaller payloads and generally will not benefit from concurrent compression.
-
-An important change is that incompressible blocks will not be more than at most 10 bytes bigger than the input.
-In rare, worst case scenario Snappy blocks could be significantly bigger than the input.
-
-### Mixed content blocks
-
-The most reliable is a wide dataset.
-For this we use [`webdevdata.org-2015-01-07-subset`](https://files.klauspost.com/compress/webdevdata.org-2015-01-07-4GB-subset.7z),
-53927 files, total input size: 4,014,735,833 bytes. Single goroutine used.
-
-| * | Input | Output | Reduction | MB/s |
-|-------------------|------------|------------|------------|------------|
-| S2 | 4014735833 | 1059723369 | 73.60% | **936.73** |
-| S2 Better | 4014735833 | 961580539 | 76.05% | 451.10 |
-| S2 Best | 4014735833 | 899182886 | **77.60%** | 46.84 |
-| Snappy | 4014735833 | 1128706759 | 71.89% | 790.15 |
-| S2, Snappy Output | 4014735833 | 1093823291 | 72.75% | 936.60 |
-| LZ4 | 4014735833 | 1063768713 | 73.50% | 452.02 |
-
-S2 delivers both the best single threaded throughput with regular mode and the best compression rate with "best".
-"Better" mode provides the same compression speed as LZ4 with better compression ratio.
-
-When outputting Snappy compatible output it still delivers better throughput (150MB/s more) and better compression.
-
-As can be seen from the other benchmarks decompression should also be easier on the S2 generated output.
-
-Though they cannot be compared due to different decompression speeds here are the speed/size comparisons for
-other Go compressors:
-
-| * | Input | Output | Reduction | MB/s |
-|-------------------|------------|------------|-----------|--------|
-| Zstd Fastest (Go) | 4014735833 | 794608518 | 80.21% | 236.04 |
-| Zstd Best (Go) | 4014735833 | 704603356 | 82.45% | 35.63 |
-| Deflate (Go) l1 | 4014735833 | 871294239 | 78.30% | 214.04 |
-| Deflate (Go) l9 | 4014735833 | 730389060 | 81.81% | 41.17 |
-
-### Standard block compression
-
-Benchmarking single block performance is subject to a lot more variation since it only tests a limited number of file patterns.
-So individual benchmarks should only be seen as a guideline and the overall picture is more important.
-
-These micro-benchmarks are with data in cache and trained branch predictors. For a more realistic benchmark see the mixed content above.
-
-Block compression. Parallel benchmark running on 16 cores, 16 goroutines.
-
-AMD64 assembly is use for both S2 and Snappy.
-
-| Absolute Perf | Snappy size | S2 Size | Snappy Speed | S2 Speed | Snappy dec | S2 dec |
-|-----------------------|-------------|---------|--------------|-------------|-------------|-------------|
-| html | 22843 | 20868 | 16246 MB/s | 18617 MB/s | 40972 MB/s | 49263 MB/s |
-| urls.10K | 335492 | 286541 | 7943 MB/s | 10201 MB/s | 22523 MB/s | 26484 MB/s |
-| fireworks.jpeg | 123034 | 123100 | 349544 MB/s | 303228 MB/s | 718321 MB/s | 827552 MB/s |
-| fireworks.jpeg (200B) | 146 | 155 | 8869 MB/s | 20180 MB/s | 33691 MB/s | 52421 MB/s |
-| paper-100k.pdf | 85304 | 84202 | 167546 MB/s | 112988 MB/s | 326905 MB/s | 291944 MB/s |
-| html_x_4 | 92234 | 20870 | 15194 MB/s | 54457 MB/s | 30843 MB/s | 32217 MB/s |
-| alice29.txt | 88034 | 85934 | 5936 MB/s | 6540 MB/s | 12882 MB/s | 20044 MB/s |
-| asyoulik.txt | 77503 | 79575 | 5517 MB/s | 6657 MB/s | 12735 MB/s | 22806 MB/s |
-| lcet10.txt | 234661 | 220383 | 6235 MB/s | 6303 MB/s | 14519 MB/s | 18697 MB/s |
-| plrabn12.txt | 319267 | 318196 | 5159 MB/s | 6074 MB/s | 11923 MB/s | 19901 MB/s |
-| geo.protodata | 23335 | 18606 | 21220 MB/s | 25432 MB/s | 56271 MB/s | 62540 MB/s |
-| kppkn.gtb | 69526 | 65019 | 9732 MB/s | 8905 MB/s | 18491 MB/s | 18969 MB/s |
-| alice29.txt (128B) | 80 | 82 | 6691 MB/s | 17179 MB/s | 31883 MB/s | 38874 MB/s |
-| alice29.txt (1000B) | 774 | 774 | 12204 MB/s | 13273 MB/s | 48056 MB/s | 52341 MB/s |
-| alice29.txt (10000B) | 6648 | 6933 | 10044 MB/s | 12824 MB/s | 32378 MB/s | 46322 MB/s |
-| alice29.txt (20000B) | 12686 | 13516 | 7733 MB/s | 12160 MB/s | 30566 MB/s | 58969 MB/s |
-
-
-Speed is generally at or above Snappy. Small blocks gets a significant speedup, although at the expense of size.
-
-Decompression speed is better than Snappy, except in one case.
-
-Since payloads are very small the variance in terms of size is rather big, so they should only be seen as a general guideline.
-
-Size is on average around Snappy, but varies on content type.
-In cases where compression is worse, it usually is compensated by a speed boost.
-
-
-### Better compression
-
-Benchmarking single block performance is subject to a lot more variation since it only tests a limited number of file patterns.
-So individual benchmarks should only be seen as a guideline and the overall picture is more important.
-
-| Absolute Perf | Snappy size | Better Size | Snappy Speed | Better Speed | Snappy dec | Better dec |
-|-----------------------|-------------|-------------|--------------|--------------|-------------|-------------|
-| html | 22843 | 18972 | 16246 MB/s | 8621 MB/s | 40972 MB/s | 40292 MB/s |
-| urls.10K | 335492 | 248079 | 7943 MB/s | 5104 MB/s | 22523 MB/s | 20981 MB/s |
-| fireworks.jpeg | 123034 | 123100 | 349544 MB/s | 84429 MB/s | 718321 MB/s | 823698 MB/s |
-| fireworks.jpeg (200B) | 146 | 149 | 8869 MB/s | 7125 MB/s | 33691 MB/s | 30101 MB/s |
-| paper-100k.pdf | 85304 | 82887 | 167546 MB/s | 11087 MB/s | 326905 MB/s | 198869 MB/s |
-| html_x_4 | 92234 | 18982 | 15194 MB/s | 29316 MB/s | 30843 MB/s | 30937 MB/s |
-| alice29.txt | 88034 | 71611 | 5936 MB/s | 3709 MB/s | 12882 MB/s | 16611 MB/s |
-| asyoulik.txt | 77503 | 65941 | 5517 MB/s | 3380 MB/s | 12735 MB/s | 14975 MB/s |
-| lcet10.txt | 234661 | 184939 | 6235 MB/s | 3537 MB/s | 14519 MB/s | 16634 MB/s |
-| plrabn12.txt | 319267 | 264990 | 5159 MB/s | 2960 MB/s | 11923 MB/s | 13382 MB/s |
-| geo.protodata | 23335 | 17689 | 21220 MB/s | 10859 MB/s | 56271 MB/s | 57961 MB/s |
-| kppkn.gtb | 69526 | 55398 | 9732 MB/s | 5206 MB/s | 18491 MB/s | 16524 MB/s |
-| alice29.txt (128B) | 80 | 78 | 6691 MB/s | 7422 MB/s | 31883 MB/s | 34225 MB/s |
-| alice29.txt (1000B) | 774 | 746 | 12204 MB/s | 5734 MB/s | 48056 MB/s | 42068 MB/s |
-| alice29.txt (10000B) | 6648 | 6218 | 10044 MB/s | 6055 MB/s | 32378 MB/s | 28813 MB/s |
-| alice29.txt (20000B) | 12686 | 11492 | 7733 MB/s | 3143 MB/s | 30566 MB/s | 27315 MB/s |
-
-
-Except for the mostly incompressible JPEG image compression is better and usually in the
-double digits in terms of percentage reduction over Snappy.
-
-The PDF sample shows a significant slowdown compared to Snappy, as this mode tries harder
-to compress the data. Very small blocks are also not favorable for better compression, so throughput is way down.
-
-This mode aims to provide better compression at the expense of performance and achieves that
-without a huge performance penalty, except on very small blocks.
-
-Decompression speed suffers a little compared to the regular S2 mode,
-but still manages to be close to Snappy in spite of increased compression.
-
-# Best compression mode
-
-S2 offers a "best" compression mode.
-
-This will compress as much as possible with little regard to CPU usage.
-
-Mainly for offline compression, but where decompression speed should still
-be high and compatible with other S2 compressed data.
-
-Some examples compared on 16 core CPU, amd64 assembly used:
-
-```
-* enwik10
-Default... 10000000000 -> 4759950115 [47.60%]; 1.03s, 9263.0MB/s
-Better... 10000000000 -> 4084706676 [40.85%]; 2.16s, 4415.4MB/s
-Best... 10000000000 -> 3615520079 [36.16%]; 42.259s, 225.7MB/s
-
-* github-june-2days-2019.json
-Default... 6273951764 -> 1041700255 [16.60%]; 431ms, 13882.3MB/s
-Better... 6273951764 -> 945841238 [15.08%]; 547ms, 10938.4MB/s
-Best... 6273951764 -> 826392576 [13.17%]; 9.455s, 632.8MB/s
-
-* nyc-taxi-data-10M.csv
-Default... 3325605752 -> 1093516949 [32.88%]; 324ms, 9788.7MB/s
-Better... 3325605752 -> 885394158 [26.62%]; 491ms, 6459.4MB/s
-Best... 3325605752 -> 773681257 [23.26%]; 8.29s, 412.0MB/s
-
-* 10gb.tar
-Default... 10065157632 -> 5915541066 [58.77%]; 1.028s, 9337.4MB/s
-Better... 10065157632 -> 5453844650 [54.19%]; 1.597s, 4862.7MB/s
-Best... 10065157632 -> 5192495021 [51.59%]; 32.78s, 308.2MB/
-
-* consensus.db.10gb
-Default... 10737418240 -> 4549762344 [42.37%]; 882ms, 12118.4MB/s
-Better... 10737418240 -> 4438535064 [41.34%]; 1.533s, 3500.9MB/s
-Best... 10737418240 -> 4210602774 [39.21%]; 42.96s, 254.4MB/s
-```
-
-Decompression speed should be around the same as using the 'better' compression mode.
-
-## Dictionaries
-
-*Note: S2 dictionary compression is currently at an early implementation stage, with no assembly for
-neither encoding nor decoding. Performance improvements can be expected in the future.*
-
-Adding dictionaries allow providing a custom dictionary that will serve as lookup in the beginning of blocks.
-
-The same dictionary *must* be used for both encoding and decoding.
-S2 does not keep track of whether the same dictionary is used,
-and using the wrong dictionary will most often not result in an error when decompressing.
-
-Blocks encoded *without* dictionaries can be decompressed seamlessly *with* a dictionary.
-This means it is possible to switch from an encoding without dictionaries to an encoding with dictionaries
-and treat the blocks similarly.
-
-Similar to [zStandard dictionaries](https://github.com/facebook/zstd#the-case-for-small-data-compression),
-the same usage scenario applies to S2 dictionaries.
-
-> Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no universal dictionary). Hence, deploying one dictionary per type of data will provide the greatest benefits. Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file.
-
-S2 further limits the dictionary to only be enabled on the first 64KB of a block.
-This will remove any negative (speed) impacts of the dictionaries on bigger blocks.
-
-### Compression
-
-Using the [github_users_sample_set](https://github.com/facebook/zstd/releases/download/v1.1.3/github_users_sample_set.tar.zst)
-and a 64KB dictionary trained with zStandard the following sizes can be achieved.
-
-| | Default | Better | Best |
-|--------------------|------------------|------------------|-----------------------|
-| Without Dictionary | 3362023 (44.92%) | 3083163 (41.19%) | 3057944 (40.86%) |
-| With Dictionary | 921524 (12.31%) | 873154 (11.67%) | 785503 bytes (10.49%) |
-
-So for highly repetitive content, this case provides an almost 3x reduction in size.
-
-For less uniform data we will use the Go source code tree.
-Compressing First 64KB of all `.go` files in `go/src`, Go 1.19.5, 8912 files, 51253563 bytes input:
-
-| | Default | Better | Best |
-|--------------------|-------------------|-------------------|-------------------|
-| Without Dictionary | 22955767 (44.79%) | 20189613 (39.39% | 19482828 (38.01%) |
-| With Dictionary | 19654568 (38.35%) | 16289357 (31.78%) | 15184589 (29.63%) |
-| Saving/file | 362 bytes | 428 bytes | 472 bytes |
-
-
-### Creating Dictionaries
-
-There are no tools to create dictionaries in S2.
-However, there are multiple ways to create a useful dictionary:
-
-#### Using a Sample File
-
-If your input is very uniform, you can just use a sample file as the dictionary.
-
-For example in the `github_users_sample_set` above, the average compression only goes up from
-10.49% to 11.48% by using the first file as dictionary compared to using a dedicated dictionary.
-
-```Go
- // Read a sample
- sample, err := os.ReadFile("sample.json")
-
- // Create a dictionary.
- dict := s2.MakeDict(sample, nil)
-
- // b := dict.Bytes() will provide a dictionary that can be saved
- // and reloaded with s2.NewDict(b).
-
- // To encode:
- encoded := dict.Encode(nil, file)
-
- // To decode:
- decoded, err := dict.Decode(nil, file)
-```
-
-#### Using Zstandard
-
-Zstandard dictionaries can easily be converted to S2 dictionaries.
-
-This can be helpful to generate dictionaries for files that don't have a fixed structure.
-
-
-Example, with training set files placed in `./training-set`:
-
-`λ zstd -r --train-fastcover training-set/* --maxdict=65536 -o name.dict`
-
-This will create a dictionary of 64KB, that can be converted to a dictionary like this:
-
-```Go
- // Decode the Zstandard dictionary.
- insp, err := zstd.InspectDictionary(zdict)
- if err != nil {
- panic(err)
- }
-
- // We are only interested in the contents.
- // Assume that files start with "// Copyright (c) 2023".
- // Search for the longest match for that.
- // This may save a few bytes.
- dict := s2.MakeDict(insp.Content(), []byte("// Copyright (c) 2023"))
-
- // b := dict.Bytes() will provide a dictionary that can be saved
- // and reloaded with s2.NewDict(b).
-
- // We can now encode using this dictionary
- encodedWithDict := dict.Encode(nil, payload)
-
- // To decode content:
- decoded, err := dict.Decode(nil, encodedWithDict)
-```
-
-It is recommended to save the dictionary returned by ` b:= dict.Bytes()`, since that will contain only the S2 dictionary.
-
-This dictionary can later be loaded using `s2.NewDict(b)`. The dictionary then no longer requires `zstd` to be initialized.
-
-Also note how `s2.MakeDict` allows you to search for a common starting sequence of your files.
-This can be omitted, at the expense of a few bytes.
-
-# Snappy Compatibility
-
-S2 now offers full compatibility with Snappy.
-
-This means that the efficient encoders of S2 can be used to generate fully Snappy compatible output.
-
-There is a [snappy](https://github.com/klauspost/compress/tree/master/snappy) package that can be used by
-simply changing imports from `github.com/golang/snappy` to `github.com/klauspost/compress/snappy`.
-This uses "better" mode for all operations.
-If you would like more control, you can use the s2 package as described below:
-
-## Blocks
-
-Snappy compatible blocks can be generated with the S2 encoder.
-Compression and speed is typically a bit better `MaxEncodedLen` is also smaller for smaller memory usage. Replace
-
-| Snappy | S2 replacement |
-|---------------------------|-----------------------|
-| snappy.Encode(...) | s2.EncodeSnappy(...) |
-| snappy.MaxEncodedLen(...) | s2.MaxEncodedLen(...) |
-
-`s2.EncodeSnappy` can be replaced with `s2.EncodeSnappyBetter` or `s2.EncodeSnappyBest` to get more efficiently compressed snappy compatible output.
-
-`s2.ConcatBlocks` is compatible with snappy blocks.
-
-Comparison of [`webdevdata.org-2015-01-07-subset`](https://files.klauspost.com/compress/webdevdata.org-2015-01-07-4GB-subset.7z),
-53927 files, total input size: 4,014,735,833 bytes. amd64, single goroutine used:
-
-| Encoder | Size | MB/s | Reduction |
-|-----------------------|------------|------------|------------|
-| snappy.Encode | 1128706759 | 725.59 | 71.89% |
-| s2.EncodeSnappy | 1093823291 | **899.16** | 72.75% |
-| s2.EncodeSnappyBetter | 1001158548 | 578.49 | 75.06% |
-| s2.EncodeSnappyBest | 944507998 | 66.00 | **76.47%** |
-
-## Streams
-
-For streams, replace `enc = snappy.NewBufferedWriter(w)` with `enc = s2.NewWriter(w, s2.WriterSnappyCompat())`.
-All other options are available, but note that block size limit is different for snappy.
-
-Comparison of different streams, AMD Ryzen 3950x, 16 cores. Size and throughput:
-
-| File | snappy.NewWriter | S2 Snappy | S2 Snappy, Better | S2 Snappy, Best |
-|-----------------------------|--------------------------|---------------------------|--------------------------|-------------------------|
-| nyc-taxi-data-10M.csv | 1316042016 - 539.47MB/s | 1307003093 - 10132.73MB/s | 1174534014 - 5002.44MB/s | 1115904679 - 177.97MB/s |
-| enwik10 (xml) | 5088294643 - 451.13MB/s | 5175840939 - 9440.69MB/s | 4560784526 - 4487.21MB/s | 4340299103 - 158.92MB/s |
-| 10gb.tar (mixed) | 6056946612 - 729.73MB/s | 6208571995 - 9978.05MB/s | 5741646126 - 4919.98MB/s | 5548973895 - 180.44MB/s |
-| github-june-2days-2019.json | 1525176492 - 933.00MB/s | 1476519054 - 13150.12MB/s | 1400547532 - 5803.40MB/s | 1321887137 - 204.29MB/s |
-| consensus.db.10gb (db) | 5412897703 - 1102.14MB/s | 5354073487 - 13562.91MB/s | 5335069899 - 5294.73MB/s | 5201000954 - 175.72MB/s |
-
-# Decompression
-
-All decompression functions map directly to equivalent s2 functions.
-
-| Snappy | S2 replacement |
-|------------------------|--------------------|
-| snappy.Decode(...) | s2.Decode(...) |
-| snappy.DecodedLen(...) | s2.DecodedLen(...) |
-| snappy.NewReader(...) | s2.NewReader(...) |
-
-Features like [quick forward skipping without decompression](https://pkg.go.dev/github.com/klauspost/compress/s2#Reader.Skip)
-are also available for Snappy streams.
-
-If you know you are only decompressing snappy streams, setting [`ReaderMaxBlockSize(64<<10)`](https://pkg.go.dev/github.com/klauspost/compress/s2#ReaderMaxBlockSize)
-on your Reader will reduce memory consumption.
-
-# Concatenating blocks and streams.
-
-Concatenating streams will concatenate the output of both without recompressing them.
-While this is inefficient in terms of compression it might be usable in certain scenarios.
-The 10 byte 'stream identifier' of the second stream can optionally be stripped, but it is not a requirement.
-
-Blocks can be concatenated using the `ConcatBlocks` function.
-
-Snappy blocks/streams can safely be concatenated with S2 blocks and streams.
-Streams with indexes (see below) will currently not work on concatenated streams.
-
-# Stream Seek Index
-
-S2 and Snappy streams can have indexes. These indexes will allow random seeking within the compressed data.
-
-The index can either be appended to the stream as a skippable block or returned for separate storage.
-
-When the index is appended to a stream it will be skipped by regular decoders,
-so the output remains compatible with other decoders.
-
-## Creating an Index
-
-To automatically add an index to a stream, add `WriterAddIndex()` option to your writer.
-Then the index will be added to the stream when `Close()` is called.
-
-```
- // Add Index to stream...
- enc := s2.NewWriter(w, s2.WriterAddIndex())
- io.Copy(enc, r)
- enc.Close()
-```
-
-If you want to store the index separately, you can use `CloseIndex()` instead of the regular `Close()`.
-This will return the index. Note that `CloseIndex()` should only be called once, and you shouldn't call `Close()`.
-
-```
- // Get index for separate storage...
- enc := s2.NewWriter(w)
- io.Copy(enc, r)
- index, err := enc.CloseIndex()
-```
-
-The `index` can then be used needing to read from the stream.
-This means the index can be used without needing to seek to the end of the stream
-or for manually forwarding streams. See below.
-
-Finally, an existing S2/Snappy stream can be indexed using the `s2.IndexStream(r io.Reader)` function.
-
-## Using Indexes
-
-To use indexes there is a `ReadSeeker(random bool, index []byte) (*ReadSeeker, error)` function available.
-
-Calling ReadSeeker will return an [io.ReadSeeker](https://pkg.go.dev/io#ReadSeeker) compatible version of the reader.
-
-If 'random' is specified the returned io.Seeker can be used for random seeking, otherwise only forward seeking is supported.
-Enabling random seeking requires the original input to support the [io.Seeker](https://pkg.go.dev/io#Seeker) interface.
-
-```
- dec := s2.NewReader(r)
- rs, err := dec.ReadSeeker(false, nil)
- rs.Seek(wantOffset, io.SeekStart)
-```
-
-Get a seeker to seek forward. Since no index is provided, the index is read from the stream.
-This requires that an index was added and that `r` supports the [io.Seeker](https://pkg.go.dev/io#Seeker) interface.
-
-A custom index can be specified which will be used if supplied.
-When using a custom index, it will not be read from the input stream.
-
-```
- dec := s2.NewReader(r)
- rs, err := dec.ReadSeeker(false, index)
- rs.Seek(wantOffset, io.SeekStart)
-```
-
-This will read the index from `index`. Since we specify non-random (forward only) seeking `r` does not have to be an io.Seeker
-
-```
- dec := s2.NewReader(r)
- rs, err := dec.ReadSeeker(true, index)
- rs.Seek(wantOffset, io.SeekStart)
-```
-
-Finally, since we specify that we want to do random seeking `r` must be an io.Seeker.
-
-The returned [ReadSeeker](https://pkg.go.dev/github.com/klauspost/compress/s2#ReadSeeker) contains a shallow reference to the existing Reader,
-meaning changes performed to one is reflected in the other.
-
-To check if a stream contains an index at the end, the `(*Index).LoadStream(rs io.ReadSeeker) error` can be used.
-
-## Manually Forwarding Streams
-
-Indexes can also be read outside the decoder using the [Index](https://pkg.go.dev/github.com/klauspost/compress/s2#Index) type.
-This can be used for parsing indexes, either separate or in streams.
-
-In some cases it may not be possible to serve a seekable stream.
-This can for instance be an HTTP stream, where the Range request
-is sent at the start of the stream.
-
-With a little bit of extra code it is still possible to use indexes
-to forward to specific offset with a single forward skip.
-
-It is possible to load the index manually like this:
-```
- var index s2.Index
- _, err = index.Load(idxBytes)
-```
-
-This can be used to figure out how much to offset the compressed stream:
-
-```
- compressedOffset, uncompressedOffset, err := index.Find(wantOffset)
-```
-
-The `compressedOffset` is the number of bytes that should be skipped
-from the beginning of the compressed file.
-
-The `uncompressedOffset` will then be offset of the uncompressed bytes returned
-when decoding from that position. This will always be <= wantOffset.
-
-When creating a decoder it must be specified that it should *not* expect a stream identifier
-at the beginning of the stream. Assuming the io.Reader `r` has been forwarded to `compressedOffset`
-we create the decoder like this:
-
-```
- dec := s2.NewReader(r, s2.ReaderIgnoreStreamIdentifier())
-```
-
-We are not completely done. We still need to forward the stream the uncompressed bytes we didn't want.
-This is done using the regular "Skip" function:
-
-```
- err = dec.Skip(wantOffset - uncompressedOffset)
-```
-
-This will ensure that we are at exactly the offset we want, and reading from `dec` will start at the requested offset.
-
-# Compact storage
-
-For compact storage [RemoveIndexHeaders](https://pkg.go.dev/github.com/klauspost/compress/s2#RemoveIndexHeaders) can be used to remove any redundant info from
-a serialized index. If you remove the header it must be restored before [Loading](https://pkg.go.dev/github.com/klauspost/compress/s2#Index.Load).
-
-This is expected to save 20 bytes. These can be restored using [RestoreIndexHeaders](https://pkg.go.dev/github.com/klauspost/compress/s2#RestoreIndexHeaders). This removes a layer of security, but is the most compact representation. Returns nil if headers contains errors.
-
-## Index Format:
-
-Each block is structured as a snappy skippable block, with the chunk ID 0x99.
-
-The block can be read from the front, but contains information so it can be read from the back as well.
-
-Numbers are stored as fixed size little endian values or [zigzag encoded](https://developers.google.com/protocol-buffers/docs/encoding#signed_integers) [base 128 varints](https://developers.google.com/protocol-buffers/docs/encoding),
-with un-encoded value length of 64 bits, unless other limits are specified.
-
-| Content | Format |
-|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
-| ID, `[1]byte` | Always 0x99. |
-| Data Length, `[3]byte` | 3 byte little-endian length of the chunk in bytes, following this. |
-| Header `[6]byte` | Header, must be `[115, 50, 105, 100, 120, 0]` or in text: "s2idx\x00". |
-| UncompressedSize, Varint | Total Uncompressed size. |
-| CompressedSize, Varint | Total Compressed size if known. Should be -1 if unknown. |
-| EstBlockSize, Varint | Block Size, used for guessing uncompressed offsets. Must be >= 0. |
-| Entries, Varint | Number of Entries in index, must be < 65536 and >=0. |
-| HasUncompressedOffsets `byte` | 0 if no uncompressed offsets are present, 1 if present. Other values are invalid. |
-| UncompressedOffsets, [Entries]VarInt | Uncompressed offsets. See below how to decode. |
-| CompressedOffsets, [Entries]VarInt | Compressed offsets. See below how to decode. |
-| Block Size, `[4]byte` | Little Endian total encoded size (including header and trailer). Can be used for searching backwards to start of block. |
-| Trailer `[6]byte` | Trailer, must be `[0, 120, 100, 105, 50, 115]` or in text: "\x00xdi2s". Can be used for identifying block from end of stream. |
-
-For regular streams the uncompressed offsets are fully predictable,
-so `HasUncompressedOffsets` allows to specify that compressed blocks all have
-exactly `EstBlockSize` bytes of uncompressed content.
-
-Entries *must* be in order, starting with the lowest offset,
-and there *must* be no uncompressed offset duplicates.
-Entries *may* point to the start of a skippable block,
-but it is then not allowed to also have an entry for the next block since
-that would give an uncompressed offset duplicate.
-
-There is no requirement for all blocks to be represented in the index.
-In fact there is a maximum of 65536 block entries in an index.
-
-The writer can use any method to reduce the number of entries.
-An implicit block start at 0,0 can be assumed.
-
-### Decoding entries:
-
-```
-// Read Uncompressed entries.
-// Each assumes EstBlockSize delta from previous.
-for each entry {
- uOff = 0
- if HasUncompressedOffsets == 1 {
- uOff = ReadVarInt // Read value from stream
- }
-
- // Except for the first entry, use previous values.
- if entryNum == 0 {
- entry[entryNum].UncompressedOffset = uOff
- continue
- }
-
- // Uncompressed uses previous offset and adds EstBlockSize
- entry[entryNum].UncompressedOffset = entry[entryNum-1].UncompressedOffset + EstBlockSize + uOff
-}
-
-
-// Guess that the first block will be 50% of uncompressed size.
-// Integer truncating division must be used.
-CompressGuess := EstBlockSize / 2
-
-// Read Compressed entries.
-// Each assumes CompressGuess delta from previous.
-// CompressGuess is adjusted for each value.
-for each entry {
- cOff = ReadVarInt // Read value from stream
-
- // Except for the first entry, use previous values.
- if entryNum == 0 {
- entry[entryNum].CompressedOffset = cOff
- continue
- }
-
- // Compressed uses previous and our estimate.
- entry[entryNum].CompressedOffset = entry[entryNum-1].CompressedOffset + CompressGuess + cOff
-
- // Adjust compressed offset for next loop, integer truncating division must be used.
- CompressGuess += cOff/2
-}
-```
-
-To decode from any given uncompressed offset `(wantOffset)`:
-
-* Iterate entries until `entry[n].UncompressedOffset > wantOffset`.
-* Start decoding from `entry[n-1].CompressedOffset`.
-* Discard `entry[n-1].UncompressedOffset - wantOffset` bytes from the decoded stream.
-
-See [using indexes](https://github.com/klauspost/compress/tree/master/s2#using-indexes) for functions that perform the operations with a simpler interface.
-
-
-# Format Extensions
-
-* Frame [Stream identifier](https://github.com/google/snappy/blob/master/framing_format.txt#L68) changed from `sNaPpY` to `S2sTwO`.
-* [Framed compressed blocks](https://github.com/google/snappy/blob/master/format_description.txt) can be up to 4MB (up from 64KB).
-* Compressed blocks can have an offset of `0`, which indicates to repeat the last seen offset.
-
-Repeat offsets must be encoded as a [2.2.1. Copy with 1-byte offset (01)](https://github.com/google/snappy/blob/master/format_description.txt#L89), where the offset is 0.
-
-The length is specified by reading the 3-bit length specified in the tag and decode using this table:
-
-| Length | Actual Length |
-|--------|----------------------|
-| 0 | 4 |
-| 1 | 5 |
-| 2 | 6 |
-| 3 | 7 |
-| 4 | 8 |
-| 5 | 8 + read 1 byte |
-| 6 | 260 + read 2 bytes |
-| 7 | 65540 + read 3 bytes |
-
-This allows any repeat offset + length to be represented by 2 to 5 bytes.
-It also allows to emit matches longer than 64 bytes with one copy + one repeat instead of several 64 byte copies.
-
-Lengths are stored as little endian values.
-
-The first copy of a block cannot be a repeat offset and the offset is reset on every block in streams.
-
-Default streaming block size is 1MB.
-
-# Dictionary Encoding
-
-Adding dictionaries allow providing a custom dictionary that will serve as lookup in the beginning of blocks.
-
-A dictionary provides an initial repeat value that can be used to point to a common header.
-
-Other than that the dictionary contains values that can be used as back-references.
-
-Often used data should be placed at the *end* of the dictionary since offsets < 2048 bytes will be smaller.
-
-## Format
-
-Dictionary *content* must at least 16 bytes and less or equal to 64KiB (65536 bytes).
-
-Encoding: `[repeat value (uvarint)][dictionary content...]`
-
-Before the dictionary content, an unsigned base-128 (uvarint) encoded value specifying the initial repeat offset.
-This value is an offset into the dictionary content and not a back-reference offset,
-so setting this to 0 will make the repeat value point to the first value of the dictionary.
-
-The value must be less than the dictionary length-8
-
-## Encoding
-
-From the decoder point of view the dictionary content is seen as preceding the encoded content.
-
-`[dictionary content][decoded output]`
-
-Backreferences to the dictionary are encoded as ordinary backreferences that have an offset before the start of the decoded block.
-
-Matches copying from the dictionary are **not** allowed to cross from the dictionary into the decoded data.
-However, if a copy ends at the end of the dictionary the next repeat will point to the start of the decoded buffer, which is allowed.
-
-The first match can be a repeat value, which will use the repeat offset stored in the dictionary.
-
-When 64KB (65536 bytes) has been en/decoded it is no longer allowed to reference the dictionary,
-neither by a copy nor repeat operations.
-If the boundary is crossed while copying from the dictionary, the operation should complete,
-but the next instruction is not allowed to reference the dictionary.
-
-Valid blocks encoded *without* a dictionary can be decoded with any dictionary.
-There are no checks whether the supplied dictionary is the correct for a block.
-Because of this there is no overhead by using a dictionary.
-
-## Example
-
-This is the dictionary content. Elements are separated by `[]`.
-
-Dictionary: `[0x0a][Yesterday 25 bananas were added to Benjamins brown bag]`.
-
-Initial repeat offset is set at 10, which is the letter `2`.
-
-Encoded `[LIT "10"][REPEAT len=10][LIT "hich"][MATCH off=50 len=6][MATCH off=31 len=6][MATCH off=61 len=10]`
-
-Decoded: `[10][ bananas w][hich][ were ][brown ][were added]`
-
-Output: `10 bananas which were brown were added`
-
-
-## Streams
-
-For streams each block can use the dictionary.
-
-The dictionary cannot not currently be provided on the stream.
-
-
-# LICENSE
-
-This code is based on the [Snappy-Go](https://github.com/golang/snappy) implementation.
-
-Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
diff --git a/vendor/github.com/klauspost/compress/s2/decode.go b/vendor/github.com/klauspost/compress/s2/decode.go
deleted file mode 100644
index 264ffd0a9..000000000
--- a/vendor/github.com/klauspost/compress/s2/decode.go
+++ /dev/null
@@ -1,443 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "strconv"
-
- "github.com/klauspost/compress/internal/race"
-)
-
-var (
- // ErrCorrupt reports that the input is invalid.
- ErrCorrupt = errors.New("s2: corrupt input")
- // ErrCRC reports that the input failed CRC validation (streams only)
- ErrCRC = errors.New("s2: corrupt input, crc mismatch")
- // ErrTooLarge reports that the uncompressed length is too large.
- ErrTooLarge = errors.New("s2: decoded block is too large")
- // ErrUnsupported reports that the input isn't supported.
- ErrUnsupported = errors.New("s2: unsupported input")
-)
-
-// DecodedLen returns the length of the decoded block.
-func DecodedLen(src []byte) (int, error) {
- v, _, err := decodedLen(src)
- return v, err
-}
-
-// decodedLen returns the length of the decoded block and the number of bytes
-// that the length header occupied.
-func decodedLen(src []byte) (blockLen, headerLen int, err error) {
- v, n := binary.Uvarint(src)
- if n <= 0 || v > 0xffffffff {
- return 0, 0, ErrCorrupt
- }
-
- const wordSize = 32 << (^uint(0) >> 32 & 1)
- if wordSize == 32 && v > 0x7fffffff {
- return 0, 0, ErrTooLarge
- }
- return int(v), n, nil
-}
-
-const (
- decodeErrCodeCorrupt = 1
-)
-
-// Decode returns the decoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire decoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-func Decode(dst, src []byte) ([]byte, error) {
- dLen, s, err := decodedLen(src)
- if err != nil {
- return nil, err
- }
- if dLen <= cap(dst) {
- dst = dst[:dLen]
- } else {
- dst = make([]byte, dLen)
- }
-
- race.WriteSlice(dst)
- race.ReadSlice(src[s:])
-
- if s2Decode(dst, src[s:]) != 0 {
- return nil, ErrCorrupt
- }
- return dst, nil
-}
-
-// s2DecodeDict writes the decoding of src to dst. It assumes that the varint-encoded
-// length of the decompressed bytes has already been read, and that len(dst)
-// equals that length.
-//
-// It returns 0 on success or a decodeErrCodeXxx error code on failure.
-func s2DecodeDict(dst, src []byte, dict *Dict) int {
- if dict == nil {
- return s2Decode(dst, src)
- }
- const debug = false
- const debugErrs = debug
-
- if debug {
- fmt.Println("Starting decode, dst len:", len(dst))
- }
- var d, s, length int
- offset := len(dict.dict) - dict.repeat
-
- // As long as we can read at least 5 bytes...
- for s < len(src)-5 {
- // Removing bounds checks is SLOWER, when if doing
- // in := src[s:s+5]
- // Checked on Go 1.18
- switch src[s] & 0x03 {
- case tagLiteral:
- x := uint32(src[s] >> 2)
- switch {
- case x < 60:
- s++
- case x == 60:
- s += 2
- x = uint32(src[s-1])
- case x == 61:
- in := src[s : s+3]
- x = uint32(in[1]) | uint32(in[2])<<8
- s += 3
- case x == 62:
- in := src[s : s+4]
- // Load as 32 bit and shift down.
- x = uint32(in[0]) | uint32(in[1])<<8 | uint32(in[2])<<16 | uint32(in[3])<<24
- x >>= 8
- s += 4
- case x == 63:
- in := src[s : s+5]
- x = uint32(in[1]) | uint32(in[2])<<8 | uint32(in[3])<<16 | uint32(in[4])<<24
- s += 5
- }
- length = int(x) + 1
- if debug {
- fmt.Println("literals, length:", length, "d-after:", d+length)
- }
- if length > len(dst)-d || length > len(src)-s || (strconv.IntSize == 32 && length <= 0) {
- if debugErrs {
- fmt.Println("corrupt literal: length:", length, "d-left:", len(dst)-d, "src-left:", len(src)-s)
- }
- return decodeErrCodeCorrupt
- }
-
- copy(dst[d:], src[s:s+length])
- d += length
- s += length
- continue
-
- case tagCopy1:
- s += 2
- toffset := int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- length = int(src[s-2]) >> 2 & 0x7
- if toffset == 0 {
- if debug {
- fmt.Print("(repeat) ")
- }
- // keep last offset
- switch length {
- case 5:
- length = int(src[s]) + 4
- s += 1
- case 6:
- in := src[s : s+2]
- length = int(uint32(in[0])|(uint32(in[1])<<8)) + (1 << 8)
- s += 2
- case 7:
- in := src[s : s+3]
- length = int((uint32(in[2])<<16)|(uint32(in[1])<<8)|uint32(in[0])) + (1 << 16)
- s += 3
- default: // 0-> 4
- }
- } else {
- offset = toffset
- }
- length += 4
- case tagCopy2:
- in := src[s : s+3]
- offset = int(uint32(in[1]) | uint32(in[2])<<8)
- length = 1 + int(in[0])>>2
- s += 3
-
- case tagCopy4:
- in := src[s : s+5]
- offset = int(uint32(in[1]) | uint32(in[2])<<8 | uint32(in[3])<<16 | uint32(in[4])<<24)
- length = 1 + int(in[0])>>2
- s += 5
- }
-
- if offset <= 0 || length > len(dst)-d {
- if debugErrs {
- fmt.Println("match error; offset:", offset, "length:", length, "dst-left:", len(dst)-d)
- }
- return decodeErrCodeCorrupt
- }
-
- // copy from dict
- if d < offset {
- if d > MaxDictSrcOffset {
- if debugErrs {
- fmt.Println("dict after", MaxDictSrcOffset, "d:", d, "offset:", offset, "length:", length)
- }
- return decodeErrCodeCorrupt
- }
- startOff := len(dict.dict) - offset + d
- if startOff < 0 || startOff+length > len(dict.dict) {
- if debugErrs {
- fmt.Printf("offset (%d) + length (%d) bigger than dict (%d)\n", offset, length, len(dict.dict))
- }
- return decodeErrCodeCorrupt
- }
- if debug {
- fmt.Println("dict copy, length:", length, "offset:", offset, "d-after:", d+length, "dict start offset:", startOff)
- }
- copy(dst[d:d+length], dict.dict[startOff:])
- d += length
- continue
- }
-
- if debug {
- fmt.Println("copy, length:", length, "offset:", offset, "d-after:", d+length)
- }
-
- // Copy from an earlier sub-slice of dst to a later sub-slice.
- // If no overlap, use the built-in copy:
- if offset > length {
- copy(dst[d:d+length], dst[d-offset:])
- d += length
- continue
- }
-
- // Unlike the built-in copy function, this byte-by-byte copy always runs
- // forwards, even if the slices overlap. Conceptually, this is:
- //
- // d += forwardCopy(dst[d:d+length], dst[d-offset:])
- //
- // We align the slices into a and b and show the compiler they are the same size.
- // This allows the loop to run without bounds checks.
- a := dst[d : d+length]
- b := dst[d-offset:]
- b = b[:len(a)]
- for i := range a {
- a[i] = b[i]
- }
- d += length
- }
-
- // Remaining with extra checks...
- for s < len(src) {
- switch src[s] & 0x03 {
- case tagLiteral:
- x := uint32(src[s] >> 2)
- switch {
- case x < 60:
- s++
- case x == 60:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-1])
- case x == 61:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-2]) | uint32(src[s-1])<<8
- case x == 62:
- s += 4
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16
- case x == 63:
- s += 5
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24
- }
- length = int(x) + 1
- if length > len(dst)-d || length > len(src)-s || (strconv.IntSize == 32 && length <= 0) {
- if debugErrs {
- fmt.Println("corrupt literal: length:", length, "d-left:", len(dst)-d, "src-left:", len(src)-s)
- }
- return decodeErrCodeCorrupt
- }
- if debug {
- fmt.Println("literals, length:", length, "d-after:", d+length)
- }
-
- copy(dst[d:], src[s:s+length])
- d += length
- s += length
- continue
-
- case tagCopy1:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- length = int(src[s-2]) >> 2 & 0x7
- toffset := int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- if toffset == 0 {
- if debug {
- fmt.Print("(repeat) ")
- }
- // keep last offset
- switch length {
- case 5:
- s += 1
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- length = int(uint32(src[s-1])) + 4
- case 6:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- length = int(uint32(src[s-2])|(uint32(src[s-1])<<8)) + (1 << 8)
- case 7:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- length = int(uint32(src[s-3])|(uint32(src[s-2])<<8)|(uint32(src[s-1])<<16)) + (1 << 16)
- default: // 0-> 4
- }
- } else {
- offset = toffset
- }
- length += 4
- case tagCopy2:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- length = 1 + int(src[s-3])>>2
- offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8)
-
- case tagCopy4:
- s += 5
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- if debugErrs {
- fmt.Println("src went oob")
- }
- return decodeErrCodeCorrupt
- }
- length = 1 + int(src[s-5])>>2
- offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24)
- }
-
- if offset <= 0 || length > len(dst)-d {
- if debugErrs {
- fmt.Println("match error; offset:", offset, "length:", length, "dst-left:", len(dst)-d)
- }
- return decodeErrCodeCorrupt
- }
-
- // copy from dict
- if d < offset {
- if d > MaxDictSrcOffset {
- if debugErrs {
- fmt.Println("dict after", MaxDictSrcOffset, "d:", d, "offset:", offset, "length:", length)
- }
- return decodeErrCodeCorrupt
- }
- rOff := len(dict.dict) - (offset - d)
- if debug {
- fmt.Println("starting dict entry from dict offset", len(dict.dict)-rOff)
- }
- if rOff+length > len(dict.dict) {
- if debugErrs {
- fmt.Println("err: END offset", rOff+length, "bigger than dict", len(dict.dict), "dict offset:", rOff, "length:", length)
- }
- return decodeErrCodeCorrupt
- }
- if rOff < 0 {
- if debugErrs {
- fmt.Println("err: START offset", rOff, "less than 0", len(dict.dict), "dict offset:", rOff, "length:", length)
- }
- return decodeErrCodeCorrupt
- }
- copy(dst[d:d+length], dict.dict[rOff:])
- d += length
- continue
- }
-
- if debug {
- fmt.Println("copy, length:", length, "offset:", offset, "d-after:", d+length)
- }
-
- // Copy from an earlier sub-slice of dst to a later sub-slice.
- // If no overlap, use the built-in copy:
- if offset > length {
- copy(dst[d:d+length], dst[d-offset:])
- d += length
- continue
- }
-
- // Unlike the built-in copy function, this byte-by-byte copy always runs
- // forwards, even if the slices overlap. Conceptually, this is:
- //
- // d += forwardCopy(dst[d:d+length], dst[d-offset:])
- //
- // We align the slices into a and b and show the compiler they are the same size.
- // This allows the loop to run without bounds checks.
- a := dst[d : d+length]
- b := dst[d-offset:]
- b = b[:len(a)]
- for i := range a {
- a[i] = b[i]
- }
- d += length
- }
-
- if d != len(dst) {
- if debugErrs {
- fmt.Println("wanted length", len(dst), "got", d)
- }
- return decodeErrCodeCorrupt
- }
- return 0
-}
diff --git a/vendor/github.com/klauspost/compress/s2/decode_amd64.s b/vendor/github.com/klauspost/compress/s2/decode_amd64.s
deleted file mode 100644
index 9b105e03c..000000000
--- a/vendor/github.com/klauspost/compress/s2/decode_amd64.s
+++ /dev/null
@@ -1,568 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-// +build gc
-// +build !noasm
-
-#include "textflag.h"
-
-#define R_TMP0 AX
-#define R_TMP1 BX
-#define R_LEN CX
-#define R_OFF DX
-#define R_SRC SI
-#define R_DST DI
-#define R_DBASE R8
-#define R_DLEN R9
-#define R_DEND R10
-#define R_SBASE R11
-#define R_SLEN R12
-#define R_SEND R13
-#define R_TMP2 R14
-#define R_TMP3 R15
-
-// The asm code generally follows the pure Go code in decode_other.go, except
-// where marked with a "!!!".
-
-// func decode(dst, src []byte) int
-//
-// All local variables fit into registers. The non-zero stack size is only to
-// spill registers and push args when issuing a CALL. The register allocation:
-// - R_TMP0 scratch
-// - R_TMP1 scratch
-// - R_LEN length or x (shared)
-// - R_OFF offset
-// - R_SRC &src[s]
-// - R_DST &dst[d]
-// + R_DBASE dst_base
-// + R_DLEN dst_len
-// + R_DEND dst_base + dst_len
-// + R_SBASE src_base
-// + R_SLEN src_len
-// + R_SEND src_base + src_len
-// - R_TMP2 used by doCopy
-// - R_TMP3 used by doCopy
-//
-// The registers R_DBASE-R_SEND (marked with a "+") are set at the start of the
-// function, and after a CALL returns, and are not otherwise modified.
-//
-// The d variable is implicitly R_DST - R_DBASE, and len(dst)-d is R_DEND - R_DST.
-// The s variable is implicitly R_SRC - R_SBASE, and len(src)-s is R_SEND - R_SRC.
-TEXT ·s2Decode(SB), NOSPLIT, $48-56
- // Initialize R_SRC, R_DST and R_DBASE-R_SEND.
- MOVQ dst_base+0(FP), R_DBASE
- MOVQ dst_len+8(FP), R_DLEN
- MOVQ R_DBASE, R_DST
- MOVQ R_DBASE, R_DEND
- ADDQ R_DLEN, R_DEND
- MOVQ src_base+24(FP), R_SBASE
- MOVQ src_len+32(FP), R_SLEN
- MOVQ R_SBASE, R_SRC
- MOVQ R_SBASE, R_SEND
- ADDQ R_SLEN, R_SEND
- XORQ R_OFF, R_OFF
-
-loop:
- // for s < len(src)
- CMPQ R_SRC, R_SEND
- JEQ end
-
- // R_LEN = uint32(src[s])
- //
- // switch src[s] & 0x03
- MOVBLZX (R_SRC), R_LEN
- MOVL R_LEN, R_TMP1
- ANDL $3, R_TMP1
- CMPL R_TMP1, $1
- JAE tagCopy
-
- // ----------------------------------------
- // The code below handles literal tags.
-
- // case tagLiteral:
- // x := uint32(src[s] >> 2)
- // switch
- SHRL $2, R_LEN
- CMPL R_LEN, $60
- JAE tagLit60Plus
-
- // case x < 60:
- // s++
- INCQ R_SRC
-
-doLit:
- // This is the end of the inner "switch", when we have a literal tag.
- //
- // We assume that R_LEN == x and x fits in a uint32, where x is the variable
- // used in the pure Go decode_other.go code.
-
- // length = int(x) + 1
- //
- // Unlike the pure Go code, we don't need to check if length <= 0 because
- // R_LEN can hold 64 bits, so the increment cannot overflow.
- INCQ R_LEN
-
- // Prepare to check if copying length bytes will run past the end of dst or
- // src.
- //
- // R_TMP0 = len(dst) - d
- // R_TMP1 = len(src) - s
- MOVQ R_DEND, R_TMP0
- SUBQ R_DST, R_TMP0
- MOVQ R_SEND, R_TMP1
- SUBQ R_SRC, R_TMP1
-
- // !!! Try a faster technique for short (16 or fewer bytes) copies.
- //
- // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 {
- // goto callMemmove // Fall back on calling runtime·memmove.
- // }
- //
- // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s
- // against 21 instead of 16, because it cannot assume that all of its input
- // is contiguous in memory and so it needs to leave enough source bytes to
- // read the next tag without refilling buffers, but Go's Decode assumes
- // contiguousness (the src argument is a []byte).
- CMPQ R_LEN, $16
- JGT callMemmove
- CMPQ R_TMP0, $16
- JLT callMemmove
- CMPQ R_TMP1, $16
- JLT callMemmove
-
- // !!! Implement the copy from src to dst as a 16-byte load and store.
- // (Decode's documentation says that dst and src must not overlap.)
- //
- // This always copies 16 bytes, instead of only length bytes, but that's
- // OK. If the input is a valid Snappy encoding then subsequent iterations
- // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a
- // non-nil error), so the overrun will be ignored.
- //
- // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or
- // 16-byte loads and stores. This technique probably wouldn't be as
- // effective on architectures that are fussier about alignment.
- MOVOU 0(R_SRC), X0
- MOVOU X0, 0(R_DST)
-
- // d += length
- // s += length
- ADDQ R_LEN, R_DST
- ADDQ R_LEN, R_SRC
- JMP loop
-
-callMemmove:
- // if length > len(dst)-d || length > len(src)-s { etc }
- CMPQ R_LEN, R_TMP0
- JGT errCorrupt
- CMPQ R_LEN, R_TMP1
- JGT errCorrupt
-
- // copy(dst[d:], src[s:s+length])
- //
- // This means calling runtime·memmove(&dst[d], &src[s], length), so we push
- // R_DST, R_SRC and R_LEN as arguments. Coincidentally, we also need to spill those
- // three registers to the stack, to save local variables across the CALL.
- MOVQ R_DST, 0(SP)
- MOVQ R_SRC, 8(SP)
- MOVQ R_LEN, 16(SP)
- MOVQ R_DST, 24(SP)
- MOVQ R_SRC, 32(SP)
- MOVQ R_LEN, 40(SP)
- MOVQ R_OFF, 48(SP)
- CALL runtime·memmove(SB)
-
- // Restore local variables: unspill registers from the stack and
- // re-calculate R_DBASE-R_SEND.
- MOVQ 24(SP), R_DST
- MOVQ 32(SP), R_SRC
- MOVQ 40(SP), R_LEN
- MOVQ 48(SP), R_OFF
- MOVQ dst_base+0(FP), R_DBASE
- MOVQ dst_len+8(FP), R_DLEN
- MOVQ R_DBASE, R_DEND
- ADDQ R_DLEN, R_DEND
- MOVQ src_base+24(FP), R_SBASE
- MOVQ src_len+32(FP), R_SLEN
- MOVQ R_SBASE, R_SEND
- ADDQ R_SLEN, R_SEND
-
- // d += length
- // s += length
- ADDQ R_LEN, R_DST
- ADDQ R_LEN, R_SRC
- JMP loop
-
-tagLit60Plus:
- // !!! This fragment does the
- //
- // s += x - 58; if uint(s) > uint(len(src)) { etc }
- //
- // checks. In the asm version, we code it once instead of once per switch case.
- ADDQ R_LEN, R_SRC
- SUBQ $58, R_SRC
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // case x == 60:
- CMPL R_LEN, $61
- JEQ tagLit61
- JA tagLit62Plus
-
- // x = uint32(src[s-1])
- MOVBLZX -1(R_SRC), R_LEN
- JMP doLit
-
-tagLit61:
- // case x == 61:
- // x = uint32(src[s-2]) | uint32(src[s-1])<<8
- MOVWLZX -2(R_SRC), R_LEN
- JMP doLit
-
-tagLit62Plus:
- CMPL R_LEN, $62
- JA tagLit63
-
- // case x == 62:
- // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16
- // We read one byte, safe to read one back, since we are just reading tag.
- // x = binary.LittleEndian.Uint32(src[s-1:]) >> 8
- MOVL -4(R_SRC), R_LEN
- SHRL $8, R_LEN
- JMP doLit
-
-tagLit63:
- // case x == 63:
- // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24
- MOVL -4(R_SRC), R_LEN
- JMP doLit
-
-// The code above handles literal tags.
-// ----------------------------------------
-// The code below handles copy tags.
-
-tagCopy4:
- // case tagCopy4:
- // s += 5
- ADDQ $5, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // length = 1 + int(src[s-5])>>2
- SHRQ $2, R_LEN
- INCQ R_LEN
-
- // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24)
- MOVLQZX -4(R_SRC), R_OFF
- JMP doCopy
-
-tagCopy2:
- // case tagCopy2:
- // s += 3
- ADDQ $3, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // length = 1 + int(src[s-3])>>2
- SHRQ $2, R_LEN
- INCQ R_LEN
-
- // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8)
- MOVWQZX -2(R_SRC), R_OFF
- JMP doCopy
-
-tagCopy:
- // We have a copy tag. We assume that:
- // - R_TMP1 == src[s] & 0x03
- // - R_LEN == src[s]
- CMPQ R_TMP1, $2
- JEQ tagCopy2
- JA tagCopy4
-
- // case tagCopy1:
- // s += 2
- ADDQ $2, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- // length = 4 + int(src[s-2])>>2&0x7
- MOVBQZX -1(R_SRC), R_TMP1
- MOVQ R_LEN, R_TMP0
- SHRQ $2, R_LEN
- ANDQ $0xe0, R_TMP0
- ANDQ $7, R_LEN
- SHLQ $3, R_TMP0
- ADDQ $4, R_LEN
- ORQ R_TMP1, R_TMP0
-
- // check if repeat code, ZF set by ORQ.
- JZ repeatCode
-
- // This is a regular copy, transfer our temporary value to R_OFF (length)
- MOVQ R_TMP0, R_OFF
- JMP doCopy
-
-// This is a repeat code.
-repeatCode:
- // If length < 9, reuse last offset, with the length already calculated.
- CMPQ R_LEN, $9
- JL doCopyRepeat
-
- // Read additional bytes for length.
- JE repeatLen1
-
- // Rare, so the extra branch shouldn't hurt too much.
- CMPQ R_LEN, $10
- JE repeatLen2
- JMP repeatLen3
-
-// Read repeat lengths.
-repeatLen1:
- // s ++
- ADDQ $1, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // length = src[s-1] + 8
- MOVBQZX -1(R_SRC), R_LEN
- ADDL $8, R_LEN
- JMP doCopyRepeat
-
-repeatLen2:
- // s +=2
- ADDQ $2, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // length = uint32(src[s-2]) | (uint32(src[s-1])<<8) + (1 << 8)
- MOVWQZX -2(R_SRC), R_LEN
- ADDL $260, R_LEN
- JMP doCopyRepeat
-
-repeatLen3:
- // s +=3
- ADDQ $3, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- CMPQ R_SRC, R_SEND
- JA errCorrupt
-
- // length = uint32(src[s-3]) | (uint32(src[s-2])<<8) | (uint32(src[s-1])<<16) + (1 << 16)
- // Read one byte further back (just part of the tag, shifted out)
- MOVL -4(R_SRC), R_LEN
- SHRL $8, R_LEN
- ADDL $65540, R_LEN
- JMP doCopyRepeat
-
-doCopy:
- // This is the end of the outer "switch", when we have a copy tag.
- //
- // We assume that:
- // - R_LEN == length && R_LEN > 0
- // - R_OFF == offset
-
- // if d < offset { etc }
- MOVQ R_DST, R_TMP1
- SUBQ R_DBASE, R_TMP1
- CMPQ R_TMP1, R_OFF
- JLT errCorrupt
-
- // Repeat values can skip the test above, since any offset > 0 will be in dst.
-doCopyRepeat:
- // if offset <= 0 { etc }
- CMPQ R_OFF, $0
- JLE errCorrupt
-
- // if length > len(dst)-d { etc }
- MOVQ R_DEND, R_TMP1
- SUBQ R_DST, R_TMP1
- CMPQ R_LEN, R_TMP1
- JGT errCorrupt
-
- // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length
- //
- // Set:
- // - R_TMP2 = len(dst)-d
- // - R_TMP3 = &dst[d-offset]
- MOVQ R_DEND, R_TMP2
- SUBQ R_DST, R_TMP2
- MOVQ R_DST, R_TMP3
- SUBQ R_OFF, R_TMP3
-
- // !!! Try a faster technique for short (16 or fewer bytes) forward copies.
- //
- // First, try using two 8-byte load/stores, similar to the doLit technique
- // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is
- // still OK if offset >= 8. Note that this has to be two 8-byte load/stores
- // and not one 16-byte load/store, and the first store has to be before the
- // second load, due to the overlap if offset is in the range [8, 16).
- //
- // if length > 16 || offset < 8 || len(dst)-d < 16 {
- // goto slowForwardCopy
- // }
- // copy 16 bytes
- // d += length
- CMPQ R_LEN, $16
- JGT slowForwardCopy
- CMPQ R_OFF, $8
- JLT slowForwardCopy
- CMPQ R_TMP2, $16
- JLT slowForwardCopy
- MOVQ 0(R_TMP3), R_TMP0
- MOVQ R_TMP0, 0(R_DST)
- MOVQ 8(R_TMP3), R_TMP1
- MOVQ R_TMP1, 8(R_DST)
- ADDQ R_LEN, R_DST
- JMP loop
-
-slowForwardCopy:
- // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we
- // can still try 8-byte load stores, provided we can overrun up to 10 extra
- // bytes. As above, the overrun will be fixed up by subsequent iterations
- // of the outermost loop.
- //
- // The C++ snappy code calls this technique IncrementalCopyFastPath. Its
- // commentary says:
- //
- // ----
- //
- // The main part of this loop is a simple copy of eight bytes at a time
- // until we've copied (at least) the requested amount of bytes. However,
- // if d and d-offset are less than eight bytes apart (indicating a
- // repeating pattern of length < 8), we first need to expand the pattern in
- // order to get the correct results. For instance, if the buffer looks like
- // this, with the eight-byte <d-offset> and <d> patterns marked as
- // intervals:
- //
- // abxxxxxxxxxxxx
- // [------] d-offset
- // [------] d
- //
- // a single eight-byte copy from <d-offset> to <d> will repeat the pattern
- // once, after which we can move <d> two bytes without moving <d-offset>:
- //
- // ababxxxxxxxxxx
- // [------] d-offset
- // [------] d
- //
- // and repeat the exercise until the two no longer overlap.
- //
- // This allows us to do very well in the special case of one single byte
- // repeated many times, without taking a big hit for more general cases.
- //
- // The worst case of extra writing past the end of the match occurs when
- // offset == 1 and length == 1; the last copy will read from byte positions
- // [0..7] and write to [4..11], whereas it was only supposed to write to
- // position 1. Thus, ten excess bytes.
- //
- // ----
- //
- // That "10 byte overrun" worst case is confirmed by Go's
- // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy
- // and finishSlowForwardCopy algorithm.
- //
- // if length > len(dst)-d-10 {
- // goto verySlowForwardCopy
- // }
- SUBQ $10, R_TMP2
- CMPQ R_LEN, R_TMP2
- JGT verySlowForwardCopy
-
- // We want to keep the offset, so we use R_TMP2 from here.
- MOVQ R_OFF, R_TMP2
-
-makeOffsetAtLeast8:
- // !!! As above, expand the pattern so that offset >= 8 and we can use
- // 8-byte load/stores.
- //
- // for offset < 8 {
- // copy 8 bytes from dst[d-offset:] to dst[d:]
- // length -= offset
- // d += offset
- // offset += offset
- // // The two previous lines together means that d-offset, and therefore
- // // R_TMP3, is unchanged.
- // }
- CMPQ R_TMP2, $8
- JGE fixUpSlowForwardCopy
- MOVQ (R_TMP3), R_TMP1
- MOVQ R_TMP1, (R_DST)
- SUBQ R_TMP2, R_LEN
- ADDQ R_TMP2, R_DST
- ADDQ R_TMP2, R_TMP2
- JMP makeOffsetAtLeast8
-
-fixUpSlowForwardCopy:
- // !!! Add length (which might be negative now) to d (implied by R_DST being
- // &dst[d]) so that d ends up at the right place when we jump back to the
- // top of the loop. Before we do that, though, we save R_DST to R_TMP0 so that, if
- // length is positive, copying the remaining length bytes will write to the
- // right place.
- MOVQ R_DST, R_TMP0
- ADDQ R_LEN, R_DST
-
-finishSlowForwardCopy:
- // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative
- // length means that we overrun, but as above, that will be fixed up by
- // subsequent iterations of the outermost loop.
- CMPQ R_LEN, $0
- JLE loop
- MOVQ (R_TMP3), R_TMP1
- MOVQ R_TMP1, (R_TMP0)
- ADDQ $8, R_TMP3
- ADDQ $8, R_TMP0
- SUBQ $8, R_LEN
- JMP finishSlowForwardCopy
-
-verySlowForwardCopy:
- // verySlowForwardCopy is a simple implementation of forward copy. In C
- // parlance, this is a do/while loop instead of a while loop, since we know
- // that length > 0. In Go syntax:
- //
- // for {
- // dst[d] = dst[d - offset]
- // d++
- // length--
- // if length == 0 {
- // break
- // }
- // }
- MOVB (R_TMP3), R_TMP1
- MOVB R_TMP1, (R_DST)
- INCQ R_TMP3
- INCQ R_DST
- DECQ R_LEN
- JNZ verySlowForwardCopy
- JMP loop
-
-// The code above handles copy tags.
-// ----------------------------------------
-
-end:
- // This is the end of the "for s < len(src)".
- //
- // if d != len(dst) { etc }
- CMPQ R_DST, R_DEND
- JNE errCorrupt
-
- // return 0
- MOVQ $0, ret+48(FP)
- RET
-
-errCorrupt:
- // return decodeErrCodeCorrupt
- MOVQ $1, ret+48(FP)
- RET
diff --git a/vendor/github.com/klauspost/compress/s2/decode_arm64.s b/vendor/github.com/klauspost/compress/s2/decode_arm64.s
deleted file mode 100644
index 78e463f34..000000000
--- a/vendor/github.com/klauspost/compress/s2/decode_arm64.s
+++ /dev/null
@@ -1,574 +0,0 @@
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-// +build gc
-// +build !noasm
-
-#include "textflag.h"
-
-#define R_TMP0 R2
-#define R_TMP1 R3
-#define R_LEN R4
-#define R_OFF R5
-#define R_SRC R6
-#define R_DST R7
-#define R_DBASE R8
-#define R_DLEN R9
-#define R_DEND R10
-#define R_SBASE R11
-#define R_SLEN R12
-#define R_SEND R13
-#define R_TMP2 R14
-#define R_TMP3 R15
-
-// TEST_SRC will check if R_SRC is <= SRC_END
-#define TEST_SRC() \
- CMP R_SEND, R_SRC \
- BGT errCorrupt
-
-// MOVD R_SRC, R_TMP1
-// SUB R_SBASE, R_TMP1, R_TMP1
-// CMP R_SLEN, R_TMP1
-// BGT errCorrupt
-
-// The asm code generally follows the pure Go code in decode_other.go, except
-// where marked with a "!!!".
-
-// func decode(dst, src []byte) int
-//
-// All local variables fit into registers. The non-zero stack size is only to
-// spill registers and push args when issuing a CALL. The register allocation:
-// - R_TMP0 scratch
-// - R_TMP1 scratch
-// - R_LEN length or x
-// - R_OFF offset
-// - R_SRC &src[s]
-// - R_DST &dst[d]
-// + R_DBASE dst_base
-// + R_DLEN dst_len
-// + R_DEND dst_base + dst_len
-// + R_SBASE src_base
-// + R_SLEN src_len
-// + R_SEND src_base + src_len
-// - R_TMP2 used by doCopy
-// - R_TMP3 used by doCopy
-//
-// The registers R_DBASE-R_SEND (marked with a "+") are set at the start of the
-// function, and after a CALL returns, and are not otherwise modified.
-//
-// The d variable is implicitly R_DST - R_DBASE, and len(dst)-d is R_DEND - R_DST.
-// The s variable is implicitly R_SRC - R_SBASE, and len(src)-s is R_SEND - R_SRC.
-TEXT ·s2Decode(SB), NOSPLIT, $56-56
- // Initialize R_SRC, R_DST and R_DBASE-R_SEND.
- MOVD dst_base+0(FP), R_DBASE
- MOVD dst_len+8(FP), R_DLEN
- MOVD R_DBASE, R_DST
- MOVD R_DBASE, R_DEND
- ADD R_DLEN, R_DEND, R_DEND
- MOVD src_base+24(FP), R_SBASE
- MOVD src_len+32(FP), R_SLEN
- MOVD R_SBASE, R_SRC
- MOVD R_SBASE, R_SEND
- ADD R_SLEN, R_SEND, R_SEND
- MOVD $0, R_OFF
-
-loop:
- // for s < len(src)
- CMP R_SEND, R_SRC
- BEQ end
-
- // R_LEN = uint32(src[s])
- //
- // switch src[s] & 0x03
- MOVBU (R_SRC), R_LEN
- MOVW R_LEN, R_TMP1
- ANDW $3, R_TMP1
- MOVW $1, R1
- CMPW R1, R_TMP1
- BGE tagCopy
-
- // ----------------------------------------
- // The code below handles literal tags.
-
- // case tagLiteral:
- // x := uint32(src[s] >> 2)
- // switch
- MOVW $60, R1
- LSRW $2, R_LEN, R_LEN
- CMPW R_LEN, R1
- BLS tagLit60Plus
-
- // case x < 60:
- // s++
- ADD $1, R_SRC, R_SRC
-
-doLit:
- // This is the end of the inner "switch", when we have a literal tag.
- //
- // We assume that R_LEN == x and x fits in a uint32, where x is the variable
- // used in the pure Go decode_other.go code.
-
- // length = int(x) + 1
- //
- // Unlike the pure Go code, we don't need to check if length <= 0 because
- // R_LEN can hold 64 bits, so the increment cannot overflow.
- ADD $1, R_LEN, R_LEN
-
- // Prepare to check if copying length bytes will run past the end of dst or
- // src.
- //
- // R_TMP0 = len(dst) - d
- // R_TMP1 = len(src) - s
- MOVD R_DEND, R_TMP0
- SUB R_DST, R_TMP0, R_TMP0
- MOVD R_SEND, R_TMP1
- SUB R_SRC, R_TMP1, R_TMP1
-
- // !!! Try a faster technique for short (16 or fewer bytes) copies.
- //
- // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 {
- // goto callMemmove // Fall back on calling runtime·memmove.
- // }
- //
- // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s
- // against 21 instead of 16, because it cannot assume that all of its input
- // is contiguous in memory and so it needs to leave enough source bytes to
- // read the next tag without refilling buffers, but Go's Decode assumes
- // contiguousness (the src argument is a []byte).
- CMP $16, R_LEN
- BGT callMemmove
- CMP $16, R_TMP0
- BLT callMemmove
- CMP $16, R_TMP1
- BLT callMemmove
-
- // !!! Implement the copy from src to dst as a 16-byte load and store.
- // (Decode's documentation says that dst and src must not overlap.)
- //
- // This always copies 16 bytes, instead of only length bytes, but that's
- // OK. If the input is a valid Snappy encoding then subsequent iterations
- // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a
- // non-nil error), so the overrun will be ignored.
- //
- // Note that on arm64, it is legal and cheap to issue unaligned 8-byte or
- // 16-byte loads and stores. This technique probably wouldn't be as
- // effective on architectures that are fussier about alignment.
- LDP 0(R_SRC), (R_TMP2, R_TMP3)
- STP (R_TMP2, R_TMP3), 0(R_DST)
-
- // d += length
- // s += length
- ADD R_LEN, R_DST, R_DST
- ADD R_LEN, R_SRC, R_SRC
- B loop
-
-callMemmove:
- // if length > len(dst)-d || length > len(src)-s { etc }
- CMP R_TMP0, R_LEN
- BGT errCorrupt
- CMP R_TMP1, R_LEN
- BGT errCorrupt
-
- // copy(dst[d:], src[s:s+length])
- //
- // This means calling runtime·memmove(&dst[d], &src[s], length), so we push
- // R_DST, R_SRC and R_LEN as arguments. Coincidentally, we also need to spill those
- // three registers to the stack, to save local variables across the CALL.
- MOVD R_DST, 8(RSP)
- MOVD R_SRC, 16(RSP)
- MOVD R_LEN, 24(RSP)
- MOVD R_DST, 32(RSP)
- MOVD R_SRC, 40(RSP)
- MOVD R_LEN, 48(RSP)
- MOVD R_OFF, 56(RSP)
- CALL runtime·memmove(SB)
-
- // Restore local variables: unspill registers from the stack and
- // re-calculate R_DBASE-R_SEND.
- MOVD 32(RSP), R_DST
- MOVD 40(RSP), R_SRC
- MOVD 48(RSP), R_LEN
- MOVD 56(RSP), R_OFF
- MOVD dst_base+0(FP), R_DBASE
- MOVD dst_len+8(FP), R_DLEN
- MOVD R_DBASE, R_DEND
- ADD R_DLEN, R_DEND, R_DEND
- MOVD src_base+24(FP), R_SBASE
- MOVD src_len+32(FP), R_SLEN
- MOVD R_SBASE, R_SEND
- ADD R_SLEN, R_SEND, R_SEND
-
- // d += length
- // s += length
- ADD R_LEN, R_DST, R_DST
- ADD R_LEN, R_SRC, R_SRC
- B loop
-
-tagLit60Plus:
- // !!! This fragment does the
- //
- // s += x - 58; if uint(s) > uint(len(src)) { etc }
- //
- // checks. In the asm version, we code it once instead of once per switch case.
- ADD R_LEN, R_SRC, R_SRC
- SUB $58, R_SRC, R_SRC
- TEST_SRC()
-
- // case x == 60:
- MOVW $61, R1
- CMPW R1, R_LEN
- BEQ tagLit61
- BGT tagLit62Plus
-
- // x = uint32(src[s-1])
- MOVBU -1(R_SRC), R_LEN
- B doLit
-
-tagLit61:
- // case x == 61:
- // x = uint32(src[s-2]) | uint32(src[s-1])<<8
- MOVHU -2(R_SRC), R_LEN
- B doLit
-
-tagLit62Plus:
- CMPW $62, R_LEN
- BHI tagLit63
-
- // case x == 62:
- // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16
- MOVHU -3(R_SRC), R_LEN
- MOVBU -1(R_SRC), R_TMP1
- ORR R_TMP1<<16, R_LEN
- B doLit
-
-tagLit63:
- // case x == 63:
- // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24
- MOVWU -4(R_SRC), R_LEN
- B doLit
-
- // The code above handles literal tags.
- // ----------------------------------------
- // The code below handles copy tags.
-
-tagCopy4:
- // case tagCopy4:
- // s += 5
- ADD $5, R_SRC, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- MOVD R_SRC, R_TMP1
- SUB R_SBASE, R_TMP1, R_TMP1
- CMP R_SLEN, R_TMP1
- BGT errCorrupt
-
- // length = 1 + int(src[s-5])>>2
- MOVD $1, R1
- ADD R_LEN>>2, R1, R_LEN
-
- // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24)
- MOVWU -4(R_SRC), R_OFF
- B doCopy
-
-tagCopy2:
- // case tagCopy2:
- // s += 3
- ADD $3, R_SRC, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- TEST_SRC()
-
- // length = 1 + int(src[s-3])>>2
- MOVD $1, R1
- ADD R_LEN>>2, R1, R_LEN
-
- // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8)
- MOVHU -2(R_SRC), R_OFF
- B doCopy
-
-tagCopy:
- // We have a copy tag. We assume that:
- // - R_TMP1 == src[s] & 0x03
- // - R_LEN == src[s]
- CMP $2, R_TMP1
- BEQ tagCopy2
- BGT tagCopy4
-
- // case tagCopy1:
- // s += 2
- ADD $2, R_SRC, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- TEST_SRC()
-
- // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- // Calculate offset in R_TMP0 in case it is a repeat.
- MOVD R_LEN, R_TMP0
- AND $0xe0, R_TMP0
- MOVBU -1(R_SRC), R_TMP1
- ORR R_TMP0<<3, R_TMP1, R_TMP0
-
- // length = 4 + int(src[s-2])>>2&0x7
- MOVD $7, R1
- AND R_LEN>>2, R1, R_LEN
- ADD $4, R_LEN, R_LEN
-
- // check if repeat code with offset 0.
- CMP $0, R_TMP0
- BEQ repeatCode
-
- // This is a regular copy, transfer our temporary value to R_OFF (offset)
- MOVD R_TMP0, R_OFF
- B doCopy
-
- // This is a repeat code.
-repeatCode:
- // If length < 9, reuse last offset, with the length already calculated.
- CMP $9, R_LEN
- BLT doCopyRepeat
- BEQ repeatLen1
- CMP $10, R_LEN
- BEQ repeatLen2
-
-repeatLen3:
- // s +=3
- ADD $3, R_SRC, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- TEST_SRC()
-
- // length = uint32(src[s-3]) | (uint32(src[s-2])<<8) | (uint32(src[s-1])<<16) + 65540
- MOVBU -1(R_SRC), R_TMP0
- MOVHU -3(R_SRC), R_LEN
- ORR R_TMP0<<16, R_LEN, R_LEN
- ADD $65540, R_LEN, R_LEN
- B doCopyRepeat
-
-repeatLen2:
- // s +=2
- ADD $2, R_SRC, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- TEST_SRC()
-
- // length = uint32(src[s-2]) | (uint32(src[s-1])<<8) + 260
- MOVHU -2(R_SRC), R_LEN
- ADD $260, R_LEN, R_LEN
- B doCopyRepeat
-
-repeatLen1:
- // s +=1
- ADD $1, R_SRC, R_SRC
-
- // if uint(s) > uint(len(src)) { etc }
- TEST_SRC()
-
- // length = src[s-1] + 8
- MOVBU -1(R_SRC), R_LEN
- ADD $8, R_LEN, R_LEN
- B doCopyRepeat
-
-doCopy:
- // This is the end of the outer "switch", when we have a copy tag.
- //
- // We assume that:
- // - R_LEN == length && R_LEN > 0
- // - R_OFF == offset
-
- // if d < offset { etc }
- MOVD R_DST, R_TMP1
- SUB R_DBASE, R_TMP1, R_TMP1
- CMP R_OFF, R_TMP1
- BLT errCorrupt
-
- // Repeat values can skip the test above, since any offset > 0 will be in dst.
-doCopyRepeat:
-
- // if offset <= 0 { etc }
- CMP $0, R_OFF
- BLE errCorrupt
-
- // if length > len(dst)-d { etc }
- MOVD R_DEND, R_TMP1
- SUB R_DST, R_TMP1, R_TMP1
- CMP R_TMP1, R_LEN
- BGT errCorrupt
-
- // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length
- //
- // Set:
- // - R_TMP2 = len(dst)-d
- // - R_TMP3 = &dst[d-offset]
- MOVD R_DEND, R_TMP2
- SUB R_DST, R_TMP2, R_TMP2
- MOVD R_DST, R_TMP3
- SUB R_OFF, R_TMP3, R_TMP3
-
- // !!! Try a faster technique for short (16 or fewer bytes) forward copies.
- //
- // First, try using two 8-byte load/stores, similar to the doLit technique
- // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is
- // still OK if offset >= 8. Note that this has to be two 8-byte load/stores
- // and not one 16-byte load/store, and the first store has to be before the
- // second load, due to the overlap if offset is in the range [8, 16).
- //
- // if length > 16 || offset < 8 || len(dst)-d < 16 {
- // goto slowForwardCopy
- // }
- // copy 16 bytes
- // d += length
- CMP $16, R_LEN
- BGT slowForwardCopy
- CMP $8, R_OFF
- BLT slowForwardCopy
- CMP $16, R_TMP2
- BLT slowForwardCopy
- MOVD 0(R_TMP3), R_TMP0
- MOVD R_TMP0, 0(R_DST)
- MOVD 8(R_TMP3), R_TMP1
- MOVD R_TMP1, 8(R_DST)
- ADD R_LEN, R_DST, R_DST
- B loop
-
-slowForwardCopy:
- // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we
- // can still try 8-byte load stores, provided we can overrun up to 10 extra
- // bytes. As above, the overrun will be fixed up by subsequent iterations
- // of the outermost loop.
- //
- // The C++ snappy code calls this technique IncrementalCopyFastPath. Its
- // commentary says:
- //
- // ----
- //
- // The main part of this loop is a simple copy of eight bytes at a time
- // until we've copied (at least) the requested amount of bytes. However,
- // if d and d-offset are less than eight bytes apart (indicating a
- // repeating pattern of length < 8), we first need to expand the pattern in
- // order to get the correct results. For instance, if the buffer looks like
- // this, with the eight-byte <d-offset> and <d> patterns marked as
- // intervals:
- //
- // abxxxxxxxxxxxx
- // [------] d-offset
- // [------] d
- //
- // a single eight-byte copy from <d-offset> to <d> will repeat the pattern
- // once, after which we can move <d> two bytes without moving <d-offset>:
- //
- // ababxxxxxxxxxx
- // [------] d-offset
- // [------] d
- //
- // and repeat the exercise until the two no longer overlap.
- //
- // This allows us to do very well in the special case of one single byte
- // repeated many times, without taking a big hit for more general cases.
- //
- // The worst case of extra writing past the end of the match occurs when
- // offset == 1 and length == 1; the last copy will read from byte positions
- // [0..7] and write to [4..11], whereas it was only supposed to write to
- // position 1. Thus, ten excess bytes.
- //
- // ----
- //
- // That "10 byte overrun" worst case is confirmed by Go's
- // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy
- // and finishSlowForwardCopy algorithm.
- //
- // if length > len(dst)-d-10 {
- // goto verySlowForwardCopy
- // }
- SUB $10, R_TMP2, R_TMP2
- CMP R_TMP2, R_LEN
- BGT verySlowForwardCopy
-
- // We want to keep the offset, so we use R_TMP2 from here.
- MOVD R_OFF, R_TMP2
-
-makeOffsetAtLeast8:
- // !!! As above, expand the pattern so that offset >= 8 and we can use
- // 8-byte load/stores.
- //
- // for offset < 8 {
- // copy 8 bytes from dst[d-offset:] to dst[d:]
- // length -= offset
- // d += offset
- // offset += offset
- // // The two previous lines together means that d-offset, and therefore
- // // R_TMP3, is unchanged.
- // }
- CMP $8, R_TMP2
- BGE fixUpSlowForwardCopy
- MOVD (R_TMP3), R_TMP1
- MOVD R_TMP1, (R_DST)
- SUB R_TMP2, R_LEN, R_LEN
- ADD R_TMP2, R_DST, R_DST
- ADD R_TMP2, R_TMP2, R_TMP2
- B makeOffsetAtLeast8
-
-fixUpSlowForwardCopy:
- // !!! Add length (which might be negative now) to d (implied by R_DST being
- // &dst[d]) so that d ends up at the right place when we jump back to the
- // top of the loop. Before we do that, though, we save R_DST to R_TMP0 so that, if
- // length is positive, copying the remaining length bytes will write to the
- // right place.
- MOVD R_DST, R_TMP0
- ADD R_LEN, R_DST, R_DST
-
-finishSlowForwardCopy:
- // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative
- // length means that we overrun, but as above, that will be fixed up by
- // subsequent iterations of the outermost loop.
- MOVD $0, R1
- CMP R1, R_LEN
- BLE loop
- MOVD (R_TMP3), R_TMP1
- MOVD R_TMP1, (R_TMP0)
- ADD $8, R_TMP3, R_TMP3
- ADD $8, R_TMP0, R_TMP0
- SUB $8, R_LEN, R_LEN
- B finishSlowForwardCopy
-
-verySlowForwardCopy:
- // verySlowForwardCopy is a simple implementation of forward copy. In C
- // parlance, this is a do/while loop instead of a while loop, since we know
- // that length > 0. In Go syntax:
- //
- // for {
- // dst[d] = dst[d - offset]
- // d++
- // length--
- // if length == 0 {
- // break
- // }
- // }
- MOVB (R_TMP3), R_TMP1
- MOVB R_TMP1, (R_DST)
- ADD $1, R_TMP3, R_TMP3
- ADD $1, R_DST, R_DST
- SUB $1, R_LEN, R_LEN
- CBNZ R_LEN, verySlowForwardCopy
- B loop
-
- // The code above handles copy tags.
- // ----------------------------------------
-
-end:
- // This is the end of the "for s < len(src)".
- //
- // if d != len(dst) { etc }
- CMP R_DEND, R_DST
- BNE errCorrupt
-
- // return 0
- MOVD $0, ret+48(FP)
- RET
-
-errCorrupt:
- // return decodeErrCodeCorrupt
- MOVD $1, R_TMP0
- MOVD R_TMP0, ret+48(FP)
- RET
diff --git a/vendor/github.com/klauspost/compress/s2/decode_asm.go b/vendor/github.com/klauspost/compress/s2/decode_asm.go
deleted file mode 100644
index cb3576edd..000000000
--- a/vendor/github.com/klauspost/compress/s2/decode_asm.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (amd64 || arm64) && !appengine && gc && !noasm
-// +build amd64 arm64
-// +build !appengine
-// +build gc
-// +build !noasm
-
-package s2
-
-// decode has the same semantics as in decode_other.go.
-//
-//go:noescape
-func s2Decode(dst, src []byte) int
diff --git a/vendor/github.com/klauspost/compress/s2/decode_other.go b/vendor/github.com/klauspost/compress/s2/decode_other.go
deleted file mode 100644
index c99d40b69..000000000
--- a/vendor/github.com/klauspost/compress/s2/decode_other.go
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (!amd64 && !arm64) || appengine || !gc || noasm
-// +build !amd64,!arm64 appengine !gc noasm
-
-package s2
-
-import (
- "fmt"
- "strconv"
-
- "github.com/klauspost/compress/internal/le"
-)
-
-// decode writes the decoding of src to dst. It assumes that the varint-encoded
-// length of the decompressed bytes has already been read, and that len(dst)
-// equals that length.
-//
-// It returns 0 on success or a decodeErrCodeXxx error code on failure.
-func s2Decode(dst, src []byte) int {
- const debug = false
- if debug {
- fmt.Println("Starting decode, dst len:", len(dst))
- }
- var d, s, length int
- offset := 0
-
- // As long as we can read at least 5 bytes...
- for s < len(src)-5 {
- // Removing bounds checks is SLOWER, when if doing
- // in := src[s:s+5]
- // Checked on Go 1.18
- switch src[s] & 0x03 {
- case tagLiteral:
- x := uint32(src[s] >> 2)
- switch {
- case x < 60:
- s++
- case x == 60:
- x = uint32(src[s+1])
- s += 2
- case x == 61:
- x = uint32(le.Load16(src, s+1))
- s += 3
- case x == 62:
- // Load as 32 bit and shift down.
- x = le.Load32(src, s)
- x >>= 8
- s += 4
- case x == 63:
- x = le.Load32(src, s+1)
- s += 5
- }
- length = int(x) + 1
- if length > len(dst)-d || length > len(src)-s || (strconv.IntSize == 32 && length <= 0) {
- if debug {
- fmt.Println("corrupt: lit size", length)
- }
- return decodeErrCodeCorrupt
- }
- if debug {
- fmt.Println("literals, length:", length, "d-after:", d+length)
- }
-
- copy(dst[d:], src[s:s+length])
- d += length
- s += length
- continue
-
- case tagCopy1:
- s += 2
- toffset := int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- length = int(src[s-2]) >> 2 & 0x7
- if toffset == 0 {
- if debug {
- fmt.Print("(repeat) ")
- }
- // keep last offset
- switch length {
- case 5:
- length = int(src[s]) + 4
- s += 1
- case 6:
- length = int(le.Load16(src, s)) + 1<<8
- s += 2
- case 7:
- in := src[s : s+3]
- length = int((uint32(in[2])<<16)|(uint32(in[1])<<8)|uint32(in[0])) + (1 << 16)
- s += 3
- default: // 0-> 4
- }
- } else {
- offset = toffset
- }
- length += 4
- case tagCopy2:
- offset = int(le.Load16(src, s+1))
- length = 1 + int(src[s])>>2
- s += 3
-
- case tagCopy4:
- offset = int(le.Load32(src, s+1))
- length = 1 + int(src[s])>>2
- s += 5
- }
-
- if offset <= 0 || d < offset || length > len(dst)-d {
- if debug {
- fmt.Println("corrupt: match, length", length, "offset:", offset, "dst avail:", len(dst)-d, "dst pos:", d)
- }
-
- return decodeErrCodeCorrupt
- }
-
- if debug {
- fmt.Println("copy, length:", length, "offset:", offset, "d-after:", d+length)
- }
-
- // Copy from an earlier sub-slice of dst to a later sub-slice.
- // If no overlap, use the built-in copy:
- if offset > length {
- copy(dst[d:d+length], dst[d-offset:])
- d += length
- continue
- }
-
- // Unlike the built-in copy function, this byte-by-byte copy always runs
- // forwards, even if the slices overlap. Conceptually, this is:
- //
- // d += forwardCopy(dst[d:d+length], dst[d-offset:])
- //
- // We align the slices into a and b and show the compiler they are the same size.
- // This allows the loop to run without bounds checks.
- a := dst[d : d+length]
- b := dst[d-offset:]
- b = b[:len(a)]
- for i := range a {
- a[i] = b[i]
- }
- d += length
- }
-
- // Remaining with extra checks...
- for s < len(src) {
- switch src[s] & 0x03 {
- case tagLiteral:
- x := uint32(src[s] >> 2)
- switch {
- case x < 60:
- s++
- case x == 60:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-1])
- case x == 61:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-2]) | uint32(src[s-1])<<8
- case x == 62:
- s += 4
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16
- case x == 63:
- s += 5
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24
- }
- length = int(x) + 1
- if length > len(dst)-d || length > len(src)-s || (strconv.IntSize == 32 && length <= 0) {
- if debug {
- fmt.Println("corrupt: lit size", length)
- }
- return decodeErrCodeCorrupt
- }
- if debug {
- fmt.Println("literals, length:", length, "d-after:", d+length)
- }
-
- copy(dst[d:], src[s:s+length])
- d += length
- s += length
- continue
-
- case tagCopy1:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = int(src[s-2]) >> 2 & 0x7
- toffset := int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]))
- if toffset == 0 {
- if debug {
- fmt.Print("(repeat) ")
- }
- // keep last offset
- switch length {
- case 5:
- s += 1
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = int(uint32(src[s-1])) + 4
- case 6:
- s += 2
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = int(uint32(src[s-2])|(uint32(src[s-1])<<8)) + (1 << 8)
- case 7:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = int(uint32(src[s-3])|(uint32(src[s-2])<<8)|(uint32(src[s-1])<<16)) + (1 << 16)
- default: // 0-> 4
- }
- } else {
- offset = toffset
- }
- length += 4
- case tagCopy2:
- s += 3
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = 1 + int(src[s-3])>>2
- offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8)
-
- case tagCopy4:
- s += 5
- if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line.
- return decodeErrCodeCorrupt
- }
- length = 1 + int(src[s-5])>>2
- offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24)
- }
-
- if offset <= 0 || d < offset || length > len(dst)-d {
- if debug {
- fmt.Println("corrupt: match, length", length, "offset:", offset, "dst avail:", len(dst)-d, "dst pos:", d)
- }
- return decodeErrCodeCorrupt
- }
-
- if debug {
- fmt.Println("copy, length:", length, "offset:", offset, "d-after:", d+length)
- }
-
- // Copy from an earlier sub-slice of dst to a later sub-slice.
- // If no overlap, use the built-in copy:
- if offset > length {
- copy(dst[d:d+length], dst[d-offset:])
- d += length
- continue
- }
-
- // Unlike the built-in copy function, this byte-by-byte copy always runs
- // forwards, even if the slices overlap. Conceptually, this is:
- //
- // d += forwardCopy(dst[d:d+length], dst[d-offset:])
- //
- // We align the slices into a and b and show the compiler they are the same size.
- // This allows the loop to run without bounds checks.
- a := dst[d : d+length]
- b := dst[d-offset:]
- b = b[:len(a)]
- for i := range a {
- a[i] = b[i]
- }
- d += length
- }
-
- if d != len(dst) {
- return decodeErrCodeCorrupt
- }
- return 0
-}
diff --git a/vendor/github.com/klauspost/compress/s2/dict.go b/vendor/github.com/klauspost/compress/s2/dict.go
deleted file mode 100644
index f125ad096..000000000
--- a/vendor/github.com/klauspost/compress/s2/dict.go
+++ /dev/null
@@ -1,350 +0,0 @@
-// Copyright (c) 2022+ Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "bytes"
- "encoding/binary"
- "sync"
-)
-
-const (
- // MinDictSize is the minimum dictionary size when repeat has been read.
- MinDictSize = 16
-
- // MaxDictSize is the maximum dictionary size when repeat has been read.
- MaxDictSize = 65536
-
- // MaxDictSrcOffset is the maximum offset where a dictionary entry can start.
- MaxDictSrcOffset = 65535
-)
-
-// Dict contains a dictionary that can be used for encoding and decoding s2
-type Dict struct {
- dict []byte
- repeat int // Repeat as index of dict
-
- fast, better, best sync.Once
- fastTable *[1 << 14]uint16
-
- betterTableShort *[1 << 14]uint16
- betterTableLong *[1 << 17]uint16
-
- bestTableShort *[1 << 16]uint32
- bestTableLong *[1 << 19]uint32
-}
-
-// NewDict will read a dictionary.
-// It will return nil if the dictionary is invalid.
-func NewDict(dict []byte) *Dict {
- if len(dict) == 0 {
- return nil
- }
- var d Dict
- // Repeat is the first value of the dict
- r, n := binary.Uvarint(dict)
- if n <= 0 {
- return nil
- }
- dict = dict[n:]
- d.dict = dict
- if cap(d.dict) < len(d.dict)+16 {
- d.dict = append(make([]byte, 0, len(d.dict)+16), d.dict...)
- }
- if len(dict) < MinDictSize || len(dict) > MaxDictSize {
- return nil
- }
- d.repeat = int(r)
- if d.repeat > len(dict) {
- return nil
- }
- return &d
-}
-
-// Bytes will return a serialized version of the dictionary.
-// The output can be sent to NewDict.
-func (d *Dict) Bytes() []byte {
- dst := make([]byte, binary.MaxVarintLen16+len(d.dict))
- return append(dst[:binary.PutUvarint(dst, uint64(d.repeat))], d.dict...)
-}
-
-// MakeDict will create a dictionary.
-// 'data' must be at least MinDictSize.
-// If data is longer than MaxDictSize only the last MaxDictSize bytes will be used.
-// If searchStart is set the start repeat value will be set to the last
-// match of this content.
-// If no matches are found, it will attempt to find shorter matches.
-// This content should match the typical start of a block.
-// If at least 4 bytes cannot be matched, repeat is set to start of block.
-func MakeDict(data []byte, searchStart []byte) *Dict {
- if len(data) == 0 {
- return nil
- }
- if len(data) > MaxDictSize {
- data = data[len(data)-MaxDictSize:]
- }
- var d Dict
- dict := data
- d.dict = dict
- if cap(d.dict) < len(d.dict)+16 {
- d.dict = append(make([]byte, 0, len(d.dict)+16), d.dict...)
- }
- if len(dict) < MinDictSize {
- return nil
- }
-
- // Find the longest match possible, last entry if multiple.
- for s := len(searchStart); s > 4; s-- {
- if idx := bytes.LastIndex(data, searchStart[:s]); idx >= 0 && idx <= len(data)-8 {
- d.repeat = idx
- break
- }
- }
-
- return &d
-}
-
-// MakeDictManual will create a dictionary.
-// 'data' must be at least MinDictSize and less than or equal to MaxDictSize.
-// A manual first repeat index into data must be provided.
-// It must be less than len(data)-8.
-func MakeDictManual(data []byte, firstIdx uint16) *Dict {
- if len(data) < MinDictSize || int(firstIdx) >= len(data)-8 || len(data) > MaxDictSize {
- return nil
- }
- var d Dict
- dict := data
- d.dict = dict
- if cap(d.dict) < len(d.dict)+16 {
- d.dict = append(make([]byte, 0, len(d.dict)+16), d.dict...)
- }
-
- d.repeat = int(firstIdx)
- return &d
-}
-
-// Encode returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func (d *Dict) Encode(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if cap(dst) < n {
- dst = make([]byte, n)
- } else {
- dst = dst[:n]
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- dstP := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:dstP]
- }
- if len(src) < minNonLiteralBlockSize {
- dstP += emitLiteral(dst[dstP:], src)
- return dst[:dstP]
- }
- n := encodeBlockDictGo(dst[dstP:], src, d)
- if n > 0 {
- dstP += n
- return dst[:dstP]
- }
- // Not compressible
- dstP += emitLiteral(dst[dstP:], src)
- return dst[:dstP]
-}
-
-// EncodeBetter returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// EncodeBetter compresses better than Encode but typically with a
-// 10-40% speed decrease on both compression and decompression.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func (d *Dict) EncodeBetter(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if len(dst) < n {
- dst = make([]byte, n)
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- dstP := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:dstP]
- }
- if len(src) < minNonLiteralBlockSize {
- dstP += emitLiteral(dst[dstP:], src)
- return dst[:dstP]
- }
- n := encodeBlockBetterDict(dst[dstP:], src, d)
- if n > 0 {
- dstP += n
- return dst[:dstP]
- }
- // Not compressible
- dstP += emitLiteral(dst[dstP:], src)
- return dst[:dstP]
-}
-
-// EncodeBest returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// EncodeBest compresses as good as reasonably possible but with a
-// big speed decrease.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func (d *Dict) EncodeBest(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if len(dst) < n {
- dst = make([]byte, n)
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- dstP := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:dstP]
- }
- if len(src) < minNonLiteralBlockSize {
- dstP += emitLiteral(dst[dstP:], src)
- return dst[:dstP]
- }
- n := encodeBlockBest(dst[dstP:], src, d)
- if n > 0 {
- dstP += n
- return dst[:dstP]
- }
- // Not compressible
- dstP += emitLiteral(dst[dstP:], src)
- return dst[:dstP]
-}
-
-// Decode returns the decoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire decoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-func (d *Dict) Decode(dst, src []byte) ([]byte, error) {
- dLen, s, err := decodedLen(src)
- if err != nil {
- return nil, err
- }
- if dLen <= cap(dst) {
- dst = dst[:dLen]
- } else {
- dst = make([]byte, dLen)
- }
- if s2DecodeDict(dst, src[s:], d) != 0 {
- return nil, ErrCorrupt
- }
- return dst, nil
-}
-
-func (d *Dict) initFast() {
- d.fast.Do(func() {
- const (
- tableBits = 14
- maxTableSize = 1 << tableBits
- )
-
- var table [maxTableSize]uint16
- // We stop so any entry of length 8 can always be read.
- for i := 0; i < len(d.dict)-8-2; i += 3 {
- x0 := load64(d.dict, i)
- h0 := hash6(x0, tableBits)
- h1 := hash6(x0>>8, tableBits)
- h2 := hash6(x0>>16, tableBits)
- table[h0] = uint16(i)
- table[h1] = uint16(i + 1)
- table[h2] = uint16(i + 2)
- }
- d.fastTable = &table
- })
-}
-
-func (d *Dict) initBetter() {
- d.better.Do(func() {
- const (
- // Long hash matches.
- lTableBits = 17
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 14
- maxSTableSize = 1 << sTableBits
- )
-
- var lTable [maxLTableSize]uint16
- var sTable [maxSTableSize]uint16
-
- // We stop so any entry of length 8 can always be read.
- for i := 0; i < len(d.dict)-8; i++ {
- cv := load64(d.dict, i)
- lTable[hash7(cv, lTableBits)] = uint16(i)
- sTable[hash4(cv, sTableBits)] = uint16(i)
- }
- d.betterTableShort = &sTable
- d.betterTableLong = &lTable
- })
-}
-
-func (d *Dict) initBest() {
- d.best.Do(func() {
- const (
- // Long hash matches.
- lTableBits = 19
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 16
- maxSTableSize = 1 << sTableBits
- )
-
- var lTable [maxLTableSize]uint32
- var sTable [maxSTableSize]uint32
-
- // We stop so any entry of length 8 can always be read.
- for i := 0; i < len(d.dict)-8; i++ {
- cv := load64(d.dict, i)
- hashL := hash8(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL := lTable[hashL]
- candidateS := sTable[hashS]
- lTable[hashL] = uint32(i) | candidateL<<16
- sTable[hashS] = uint32(i) | candidateS<<16
- }
- d.bestTableShort = &sTable
- d.bestTableLong = &lTable
- })
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encode.go b/vendor/github.com/klauspost/compress/s2/encode.go
deleted file mode 100644
index 20b802270..000000000
--- a/vendor/github.com/klauspost/compress/s2/encode.go
+++ /dev/null
@@ -1,414 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "encoding/binary"
- "math"
- "math/bits"
- "sync"
-
- "github.com/klauspost/compress/internal/race"
-)
-
-// Encode returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func Encode(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if cap(dst) < n {
- dst = make([]byte, n)
- } else {
- dst = dst[:n]
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
- n := encodeBlock(dst[d:], src)
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-var estblockPool [2]sync.Pool
-
-// EstimateBlockSize will perform a very fast compression
-// without outputting the result and return the compressed output size.
-// The function returns -1 if no improvement could be achieved.
-// Using actual compression will most often produce better compression than the estimate.
-func EstimateBlockSize(src []byte) (d int) {
- if len(src) <= inputMargin || int64(len(src)) > 0xffffffff {
- return -1
- }
- if len(src) <= 1024 {
- const sz, pool = 2048, 0
- tmp, ok := estblockPool[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer estblockPool[pool].Put(tmp)
-
- d = calcBlockSizeSmall(src, tmp)
- } else {
- const sz, pool = 32768, 1
- tmp, ok := estblockPool[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer estblockPool[pool].Put(tmp)
-
- d = calcBlockSize(src, tmp)
- }
-
- if d == 0 {
- return -1
- }
- // Size of the varint encoded block size.
- d += (bits.Len64(uint64(len(src))) + 7) / 7
-
- if d >= len(src) {
- return -1
- }
- return d
-}
-
-// EncodeBetter returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// EncodeBetter compresses better than Encode but typically with a
-// 10-40% speed decrease on both compression and decompression.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func EncodeBetter(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if len(dst) < n {
- dst = make([]byte, n)
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
- n := encodeBlockBetter(dst[d:], src)
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-// EncodeBest returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// EncodeBest compresses as good as reasonably possible but with a
-// big speed decrease.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func EncodeBest(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if len(dst) < n {
- dst = make([]byte, n)
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
- n := encodeBlockBest(dst[d:], src, nil)
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-// EncodeSnappy returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The output is Snappy compatible and will likely decompress faster.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func EncodeSnappy(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if cap(dst) < n {
- dst = make([]byte, n)
- } else {
- dst = dst[:n]
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
-
- n := encodeBlockSnappy(dst[d:], src)
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-// EncodeSnappyBetter returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The output is Snappy compatible and will likely decompress faster.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func EncodeSnappyBetter(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if cap(dst) < n {
- dst = make([]byte, n)
- } else {
- dst = dst[:n]
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
-
- n := encodeBlockBetterSnappy(dst[d:], src)
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-// EncodeSnappyBest returns the encoded form of src. The returned slice may be a sub-
-// slice of dst if dst was large enough to hold the entire encoded block.
-// Otherwise, a newly allocated slice will be returned.
-//
-// The output is Snappy compatible and will likely decompress faster.
-//
-// The dst and src must not overlap. It is valid to pass a nil dst.
-//
-// The blocks will require the same amount of memory to decode as encoding,
-// and does not make for concurrent decoding.
-// Also note that blocks do not contain CRC information, so corruption may be undetected.
-//
-// If you need to encode larger amounts of data, consider using
-// the streaming interface which gives all of these features.
-func EncodeSnappyBest(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if cap(dst) < n {
- dst = make([]byte, n)
- } else {
- dst = dst[:n]
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
-
- n := encodeBlockBestSnappy(dst[d:], src)
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-// ConcatBlocks will concatenate the supplied blocks and append them to the supplied destination.
-// If the destination is nil or too small, a new will be allocated.
-// The blocks are not validated, so garbage in = garbage out.
-// dst may not overlap block data.
-// Any data in dst is preserved as is, so it will not be considered a block.
-func ConcatBlocks(dst []byte, blocks ...[]byte) ([]byte, error) {
- totalSize := uint64(0)
- compSize := 0
- for _, b := range blocks {
- l, hdr, err := decodedLen(b)
- if err != nil {
- return nil, err
- }
- totalSize += uint64(l)
- compSize += len(b) - hdr
- }
- if totalSize == 0 {
- dst = append(dst, 0)
- return dst, nil
- }
- if totalSize > math.MaxUint32 {
- return nil, ErrTooLarge
- }
- var tmp [binary.MaxVarintLen32]byte
- hdrSize := binary.PutUvarint(tmp[:], totalSize)
- wantSize := hdrSize + compSize
-
- if cap(dst)-len(dst) < wantSize {
- dst = append(make([]byte, 0, wantSize+len(dst)), dst...)
- }
- dst = append(dst, tmp[:hdrSize]...)
- for _, b := range blocks {
- _, hdr, err := decodedLen(b)
- if err != nil {
- return nil, err
- }
- dst = append(dst, b[hdr:]...)
- }
- return dst, nil
-}
-
-// inputMargin is the minimum number of extra input bytes to keep, inside
-// encodeBlock's inner loop. On some architectures, this margin lets us
-// implement a fast path for emitLiteral, where the copy of short (<= 16 byte)
-// literals can be implemented as a single load to and store from a 16-byte
-// register. That literal's actual length can be as short as 1 byte, so this
-// can copy up to 15 bytes too much, but that's OK as subsequent iterations of
-// the encoding loop will fix up the copy overrun, and this inputMargin ensures
-// that we don't overrun the dst and src buffers.
-const inputMargin = 8
-
-// minNonLiteralBlockSize is the minimum size of the input to encodeBlock that
-// will be accepted by the encoder.
-const minNonLiteralBlockSize = 32
-
-const intReduction = 2 - (1 << (^uint(0) >> 63)) // 1 (32 bits) or 0 (64 bits)
-
-// MaxBlockSize is the maximum value where MaxEncodedLen will return a valid block size.
-// Blocks this big are highly discouraged, though.
-// Half the size on 32 bit systems.
-const MaxBlockSize = (1<<(32-intReduction) - 1) - binary.MaxVarintLen32 - 5
-
-// MaxEncodedLen returns the maximum length of a snappy block, given its
-// uncompressed length.
-//
-// It will return a negative value if srcLen is too large to encode.
-// 32 bit platforms will have lower thresholds for rejecting big content.
-func MaxEncodedLen(srcLen int) int {
- n := uint64(srcLen)
- if intReduction == 1 {
- // 32 bits
- if n > math.MaxInt32 {
- // Also includes negative.
- return -1
- }
- } else if n > 0xffffffff {
- // 64 bits
- // Also includes negative.
- return -1
- }
- // Size of the varint encoded block size.
- n = n + uint64((bits.Len64(n)+7)/7)
-
- // Add maximum size of encoding block as literals.
- n += uint64(literalExtraSize(int64(srcLen)))
- if intReduction == 1 {
- // 32 bits
- if n > math.MaxInt32 {
- return -1
- }
- } else if n > 0xffffffff {
- // 64 bits
- // Also includes negative.
- return -1
- }
- return int(n)
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encode_all.go b/vendor/github.com/klauspost/compress/s2/encode_all.go
deleted file mode 100644
index a473b6452..000000000
--- a/vendor/github.com/klauspost/compress/s2/encode_all.go
+++ /dev/null
@@ -1,1480 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "bytes"
- "encoding/binary"
- "fmt"
- "math/bits"
-
- "github.com/klauspost/compress/internal/le"
-)
-
-func load32(b []byte, i int) uint32 {
- return le.Load32(b, i)
-}
-
-func load64(b []byte, i int) uint64 {
- return le.Load64(b, i)
-}
-
-// hash6 returns the hash of the lowest 6 bytes of u to fit in a hash table with h bits.
-// Preferably h should be a constant and should always be <64.
-func hash6(u uint64, h uint8) uint32 {
- const prime6bytes = 227718039650203
- return uint32(((u << (64 - 48)) * prime6bytes) >> ((64 - h) & 63))
-}
-
-func encodeGo(dst, src []byte) []byte {
- if n := MaxEncodedLen(len(src)); n < 0 {
- panic(ErrTooLarge)
- } else if len(dst) < n {
- dst = make([]byte, n)
- }
-
- // The block starts with the varint-encoded length of the decompressed bytes.
- d := binary.PutUvarint(dst, uint64(len(src)))
-
- if len(src) == 0 {
- return dst[:d]
- }
- if len(src) < minNonLiteralBlockSize {
- d += emitLiteral(dst[d:], src)
- return dst[:d]
- }
- var n int
- if len(src) < 64<<10 {
- n = encodeBlockGo64K(dst[d:], src)
- } else {
- n = encodeBlockGo(dst[d:], src)
- }
- if n > 0 {
- d += n
- return dst[:d]
- }
- // Not compressible
- d += emitLiteral(dst[d:], src)
- return dst[:d]
-}
-
-// encodeBlockGo encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockGo(dst, src []byte) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 14
- maxTableSize = 1 << tableBits
-
- debug = false
- )
- var table [maxTableSize]uint32
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
-
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>6 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint32(s)
- table[hash1] = uint32(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
-
- // Bail if we exceed the maximum size.
- if d+(base-nextEmit) > dstLimit {
- return 0
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
- if nextEmit > 0 {
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- } else {
- // First match, cannot be repeat.
- d += emitCopy(dst[d:], repeat, s-base)
- }
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint32(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint32(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards.
- // The top bytes will be rechecked to get the full match.
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopy(dst[d:], repeat, s-base)
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s)
- if debug && s == candidate {
- panic("s == candidate")
- }
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockGo64K is a specialized version for compressing blocks <= 64KB
-func encodeBlockGo64K(dst, src []byte) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 14
- maxTableSize = 1 << tableBits
-
- debug = false
- )
-
- var table [maxTableSize]uint16
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
-
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>5 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint16(s)
- table[hash1] = uint16(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
-
- // Bail if we exceed the maximum size.
- if d+(base-nextEmit) > dstLimit {
- return 0
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
- if nextEmit > 0 {
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- } else {
- // First match, cannot be repeat.
- d += emitCopy(dst[d:], repeat, s-base)
- }
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint16(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint16(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards.
- // The top bytes will be rechecked to get the full match.
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopy(dst[d:], repeat, s-base)
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint16(s - 2)
- table[currHash] = uint16(s)
- if debug && s == candidate {
- panic("s == candidate")
- }
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-func encodeBlockSnappyGo(dst, src []byte) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 14
- maxTableSize = 1 << tableBits
- )
- var table [maxTableSize]uint32
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
-
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>6 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint32(s)
- table[hash1] = uint32(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- // Bail if we exceed the maximum size.
- if d+(base-nextEmit) > dstLimit {
- return 0
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeat(dst[d:], repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint32(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint32(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeat(dst[d:], repeat, s-base)
- if false {
- // Validate match.
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s)
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockSnappyGo64K is a special version of encodeBlockSnappyGo for sizes <64KB
-func encodeBlockSnappyGo64K(dst, src []byte) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 14
- maxTableSize = 1 << tableBits
- )
-
- var table [maxTableSize]uint16
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
-
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>5 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint16(s)
- table[hash1] = uint16(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- // Bail if we exceed the maximum size.
- if d+(base-nextEmit) > dstLimit {
- return 0
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeat(dst[d:], repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint16(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint16(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeat(dst[d:], repeat, s-base)
- if false {
- // Validate match.
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint16(s - 2)
- table[currHash] = uint16(s)
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockGo encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockDictGo(dst, src []byte, dict *Dict) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 14
- maxTableSize = 1 << tableBits
- maxAhead = 8 // maximum bytes ahead without checking sLimit
-
- debug = false
- )
- dict.initFast()
-
- var table [maxTableSize]uint32
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if sLimit > MaxDictSrcOffset-maxAhead {
- sLimit = MaxDictSrcOffset - maxAhead
- }
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form can start with a dict entry (copy or repeat).
- s := 0
-
- // Convert dict repeat to offset
- repeat := len(dict.dict) - dict.repeat
- cv := load64(src, 0)
-
- // While in dict
-searchDict:
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>6 + 4
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- if nextS > sLimit {
- if debug {
- fmt.Println("slimit reached", s, nextS)
- }
- break searchDict
- }
- candidateDict := int(dict.fastTable[hash0])
- candidateDict2 := int(dict.fastTable[hash1])
- candidate2 := int(table[hash1])
- candidate := int(table[hash0])
- table[hash0] = uint32(s)
- table[hash1] = uint32(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
-
- if repeat > s {
- candidate := len(dict.dict) - repeat + s
- if repeat-s >= 4 && uint32(cv) == load32(dict.dict, candidate) {
- // Extend back
- base := s
- for i := candidate; base > nextEmit && i > 0 && dict.dict[i-1] == src[base-1]; {
- i--
- base--
- }
- // Bail if we exceed the maximum size.
- if d+(base-nextEmit) > dstLimit {
- return 0
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if debug && nextEmit != base {
- fmt.Println("emitted ", base-nextEmit, "literals")
- }
- s += 4
- candidate += 4
- for candidate < len(dict.dict)-8 && s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(dict.dict, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- d += emitRepeat(dst[d:], repeat, s-base)
- if debug {
- fmt.Println("emitted dict repeat length", s-base, "offset:", repeat, "s:", s)
- }
- nextEmit = s
- if s >= sLimit {
- break searchDict
- }
- cv = load64(src, s)
- continue
- }
- } else if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if debug && nextEmit != base {
- fmt.Println("emitted ", base-nextEmit, "literals")
- }
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- if nextEmit > 0 {
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- } else {
- // First match, cannot be repeat.
- d += emitCopy(dst[d:], repeat, s-base)
- }
-
- nextEmit = s
- if s >= sLimit {
- break searchDict
- }
- if debug {
- fmt.Println("emitted reg repeat", s-base, "s:", s)
- }
- cv = load64(src, s)
- continue searchDict
- }
- if s == 0 {
- cv = load64(src, nextS)
- s = nextS
- continue searchDict
- }
- // Start with table. These matches will always be closer.
- if uint32(cv) == load32(src, candidate) {
- goto emitMatch
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint32(s + 2)
- candidate = candidate2
- s++
- goto emitMatch
- }
-
- // Check dict. Dicts have longer offsets, so we want longer matches.
- if cv == load64(dict.dict, candidateDict) {
- table[hash2] = uint32(s + 2)
- goto emitDict
- }
-
- candidateDict = int(dict.fastTable[hash2])
- // Check if upper 7 bytes match
- if candidateDict2 >= 1 {
- if cv^load64(dict.dict, candidateDict2-1) < (1 << 8) {
- table[hash2] = uint32(s + 2)
- candidateDict = candidateDict2
- s++
- goto emitDict
- }
- }
-
- table[hash2] = uint32(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- goto emitMatch
- }
- if candidateDict >= 2 {
- // Check if upper 6 bytes match
- if cv^load64(dict.dict, candidateDict-2) < (1 << 16) {
- s += 2
- goto emitDict
- }
- }
-
- cv = load64(src, nextS)
- s = nextS
- continue searchDict
-
- emitDict:
- {
- if debug {
- if load32(dict.dict, candidateDict) != load32(src, s) {
- panic("dict emit mismatch")
- }
- }
- // Extend backwards.
- // The top bytes will be rechecked to get the full match.
- for candidateDict > 0 && s > nextEmit && dict.dict[candidateDict-1] == src[s-1] {
- candidateDict--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
- if debug && nextEmit != s {
- fmt.Println("emitted ", s-nextEmit, "literals")
- }
- {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = s + (len(dict.dict)) - candidateDict
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateDict += 4
- for s <= len(src)-8 && len(dict.dict)-candidateDict >= 8 {
- if diff := load64(src, s) ^ load64(dict.dict, candidateDict); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateDict += 8
- }
-
- // Matches longer than 64 are split.
- if s <= sLimit || s-base < 8 {
- d += emitCopy(dst[d:], repeat, s-base)
- } else {
- // Split to ensure we don't start a copy within next block
- d += emitCopy(dst[d:], repeat, 4)
- d += emitRepeat(dst[d:], repeat, s-base-4)
- }
- if false {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := dict.dict[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
- if debug {
- fmt.Println("emitted dict copy, length", s-base, "offset:", repeat, "s:", s)
- }
- nextEmit = s
- if s >= sLimit {
- break searchDict
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index and continue loop to try new candidate.
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>8, tableBits)
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s - 1)
- cv = load64(src, s)
- }
- continue
- }
- emitMatch:
-
- // Extend backwards.
- // The top bytes will be rechecked to get the full match.
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
- if debug && nextEmit != s {
- fmt.Println("emitted ", s-nextEmit, "literals")
- }
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopy(dst[d:], repeat, s-base)
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
- if debug {
- fmt.Println("emitted src copy, length", s-base, "offset:", repeat, "s:", s)
- }
- nextEmit = s
- if s >= sLimit {
- break searchDict
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s)
- if debug && s == candidate {
- panic("s == candidate")
- }
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
- // Search without dict:
- if repeat > s {
- repeat = 0
- }
-
- // No more dict
- sLimit = len(src) - inputMargin
- if s >= sLimit {
- goto emitRemainder
- }
- if debug {
- fmt.Println("non-dict matching at", s, "repeat:", repeat)
- }
- cv = load64(src, s)
- if debug {
- fmt.Println("now", s, "->", sLimit, "out:", d, "left:", len(src)-s, "nextemit:", nextEmit, "dstLimit:", dstLimit, "s:", s)
- }
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>6 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint32(s)
- table[hash1] = uint32(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if repeat > 0 && uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- // Bail if we exceed the maximum size.
- if d+(base-nextEmit) > dstLimit {
- return 0
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if debug && nextEmit != base {
- fmt.Println("emitted ", base-nextEmit, "literals")
- }
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
- if nextEmit > 0 {
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- } else {
- // First match, cannot be repeat.
- d += emitCopy(dst[d:], repeat, s-base)
- }
- if debug {
- fmt.Println("emitted src repeat length", s-base, "offset:", repeat, "s:", s)
- }
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint32(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint32(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards.
- // The top bytes will be rechecked to get the full match.
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
- if debug && nextEmit != s {
- fmt.Println("emitted ", s-nextEmit, "literals")
- }
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopy(dst[d:], repeat, s-base)
- if debug {
- // Validate match.
- if s <= candidate {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
- if debug {
- fmt.Println("emitted src copy, length", s-base, "offset:", repeat, "s:", s)
- }
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s)
- if debug && s == candidate {
- panic("s == candidate")
- }
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- if debug && nextEmit != s {
- fmt.Println("emitted ", len(src)-nextEmit, "literals")
- }
- }
- return d
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encode_amd64.go b/vendor/github.com/klauspost/compress/s2/encode_amd64.go
deleted file mode 100644
index 7aadd255f..000000000
--- a/vendor/github.com/klauspost/compress/s2/encode_amd64.go
+++ /dev/null
@@ -1,317 +0,0 @@
-//go:build !appengine && !noasm && gc
-// +build !appengine,!noasm,gc
-
-package s2
-
-import (
- "sync"
-
- "github.com/klauspost/compress/internal/race"
-)
-
-const hasAmd64Asm = true
-
-var encPools [4]sync.Pool
-
-// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlock(dst, src []byte) (d int) {
- race.ReadSlice(src)
- race.WriteSlice(dst)
-
- const (
- // Use 12 bit table when less than...
- limit12B = 16 << 10
- // Use 10 bit table when less than...
- limit10B = 4 << 10
- // Use 8 bit table when less than...
- limit8B = 512
- )
-
- if len(src) >= 4<<20 {
- const sz, pool = 65536, 0
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeBlockAsm(dst, src, tmp)
- }
- if len(src) >= limit12B {
- const sz, pool = 65536, 0
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeBlockAsm4MB(dst, src, tmp)
- }
- if len(src) >= limit10B {
- const sz, pool = 16384, 1
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeBlockAsm12B(dst, src, tmp)
- }
- if len(src) >= limit8B {
- const sz, pool = 4096, 2
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeBlockAsm10B(dst, src, tmp)
- }
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
- const sz, pool = 1024, 3
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeBlockAsm8B(dst, src, tmp)
-}
-
-var encBetterPools [5]sync.Pool
-
-// encodeBlockBetter encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBetter(dst, src []byte) (d int) {
- race.ReadSlice(src)
- race.WriteSlice(dst)
-
- const (
- // Use 12 bit table when less than...
- limit12B = 16 << 10
- // Use 10 bit table when less than...
- limit10B = 4 << 10
- // Use 8 bit table when less than...
- limit8B = 512
- )
-
- if len(src) > 4<<20 {
- const sz, pool = 589824, 0
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
- return encodeBetterBlockAsm(dst, src, tmp)
- }
- if len(src) >= limit12B {
- const sz, pool = 589824, 0
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
-
- return encodeBetterBlockAsm4MB(dst, src, tmp)
- }
- if len(src) >= limit10B {
- const sz, pool = 81920, 0
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
-
- return encodeBetterBlockAsm12B(dst, src, tmp)
- }
- if len(src) >= limit8B {
- const sz, pool = 20480, 1
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
- return encodeBetterBlockAsm10B(dst, src, tmp)
- }
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- const sz, pool = 5120, 2
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
- return encodeBetterBlockAsm8B(dst, src, tmp)
-}
-
-// encodeBlockSnappy encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockSnappy(dst, src []byte) (d int) {
- race.ReadSlice(src)
- race.WriteSlice(dst)
-
- const (
- // Use 12 bit table when less than...
- limit12B = 16 << 10
- // Use 10 bit table when less than...
- limit10B = 4 << 10
- // Use 8 bit table when less than...
- limit8B = 512
- )
- if len(src) > 65536 {
- const sz, pool = 65536, 0
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeSnappyBlockAsm(dst, src, tmp)
- }
- if len(src) >= limit12B {
- const sz, pool = 65536, 0
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeSnappyBlockAsm64K(dst, src, tmp)
- }
- if len(src) >= limit10B {
- const sz, pool = 16384, 1
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeSnappyBlockAsm12B(dst, src, tmp)
- }
- if len(src) >= limit8B {
- const sz, pool = 4096, 2
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeSnappyBlockAsm10B(dst, src, tmp)
- }
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
- const sz, pool = 1024, 3
- tmp, ok := encPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encPools[pool].Put(tmp)
- return encodeSnappyBlockAsm8B(dst, src, tmp)
-}
-
-// encodeBlockSnappy encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBetterSnappy(dst, src []byte) (d int) {
- race.ReadSlice(src)
- race.WriteSlice(dst)
-
- const (
- // Use 12 bit table when less than...
- limit12B = 16 << 10
- // Use 10 bit table when less than...
- limit10B = 4 << 10
- // Use 8 bit table when less than...
- limit8B = 512
- )
- if len(src) > 65536 {
- const sz, pool = 589824, 0
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
- return encodeSnappyBetterBlockAsm(dst, src, tmp)
- }
-
- if len(src) >= limit12B {
- const sz, pool = 294912, 4
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
-
- return encodeSnappyBetterBlockAsm64K(dst, src, tmp)
- }
- if len(src) >= limit10B {
- const sz, pool = 81920, 0
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
-
- return encodeSnappyBetterBlockAsm12B(dst, src, tmp)
- }
- if len(src) >= limit8B {
- const sz, pool = 20480, 1
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
- return encodeSnappyBetterBlockAsm10B(dst, src, tmp)
- }
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- const sz, pool = 5120, 2
- tmp, ok := encBetterPools[pool].Get().(*[sz]byte)
- if !ok {
- tmp = &[sz]byte{}
- }
- race.WriteSlice(tmp[:])
- defer encBetterPools[pool].Put(tmp)
- return encodeSnappyBetterBlockAsm8B(dst, src, tmp)
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encode_best.go b/vendor/github.com/klauspost/compress/s2/encode_best.go
deleted file mode 100644
index 47bac7423..000000000
--- a/vendor/github.com/klauspost/compress/s2/encode_best.go
+++ /dev/null
@@ -1,796 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "fmt"
- "math"
- "math/bits"
-)
-
-// encodeBlockBest encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBest(dst, src []byte, dict *Dict) (d int) {
- // Initialize the hash tables.
- const (
- // Long hash matches.
- lTableBits = 19
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 16
- maxSTableSize = 1 << sTableBits
-
- inputMargin = 8 + 2
-
- debug = false
- )
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
- sLimitDict := len(src) - inputMargin
- if sLimitDict > MaxDictSrcOffset-inputMargin {
- sLimitDict = MaxDictSrcOffset - inputMargin
- }
-
- var lTable [maxLTableSize]uint64
- var sTable [maxSTableSize]uint64
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- repeat := 1
- if dict != nil {
- dict.initBest()
- s = 0
- repeat = len(dict.dict) - dict.repeat
- }
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- const lowbitMask = 0xffffffff
- getCur := func(x uint64) int {
- return int(x & lowbitMask)
- }
- getPrev := func(x uint64) int {
- return int(x >> 32)
- }
- const maxSkip = 64
-
- for {
- type match struct {
- offset int
- s int
- length int
- score int
- rep, dict bool
- }
- var best match
- for {
- // Next src position to check
- nextS := (s-nextEmit)>>8 + 1
- if nextS > maxSkip {
- nextS = s + maxSkip
- } else {
- nextS += s
- }
- if nextS > sLimit {
- goto emitRemainder
- }
- if dict != nil && s >= MaxDictSrcOffset {
- dict = nil
- if repeat > s {
- repeat = math.MinInt32
- }
- }
- hashL := hash8(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL := lTable[hashL]
- candidateS := sTable[hashS]
-
- score := func(m match) int {
- // Matches that are longer forward are penalized since we must emit it as a literal.
- score := m.length - m.s
- if nextEmit == m.s {
- // If we do not have to emit literals, we save 1 byte
- score++
- }
- offset := m.s - m.offset
- if m.rep {
- return score - emitRepeatSize(offset, m.length)
- }
- return score - emitCopySize(offset, m.length)
- }
-
- matchAt := func(offset, s int, first uint32, rep bool) match {
- if best.length != 0 && best.s-best.offset == s-offset {
- // Don't retest if we have the same offset.
- return match{offset: offset, s: s}
- }
- if load32(src, offset) != first {
- return match{offset: offset, s: s}
- }
- m := match{offset: offset, s: s, length: 4 + offset, rep: rep}
- s += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[m.length] {
- m.length++
- s++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, m.length); diff != 0 {
- m.length += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- m.length += 8
- }
- m.length -= offset
- m.score = score(m)
- if m.score <= -m.s {
- // Eliminate if no savings, we might find a better one.
- m.length = 0
- }
- return m
- }
- matchDict := func(candidate, s int, first uint32, rep bool) match {
- if s >= MaxDictSrcOffset {
- return match{offset: candidate, s: s}
- }
- // Calculate offset as if in continuous array with s
- offset := -len(dict.dict) + candidate
- if best.length != 0 && best.s-best.offset == s-offset && !rep {
- // Don't retest if we have the same offset.
- return match{offset: offset, s: s}
- }
-
- if load32(dict.dict, candidate) != first {
- return match{offset: offset, s: s}
- }
- m := match{offset: offset, s: s, length: 4 + candidate, rep: rep, dict: true}
- s += 4
- if !rep {
- for s < sLimitDict && m.length < len(dict.dict) {
- if len(src)-s < 8 || len(dict.dict)-m.length < 8 {
- if src[s] == dict.dict[m.length] {
- m.length++
- s++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(dict.dict, m.length); diff != 0 {
- m.length += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- m.length += 8
- }
- } else {
- for s < len(src) && m.length < len(dict.dict) {
- if len(src)-s < 8 || len(dict.dict)-m.length < 8 {
- if src[s] == dict.dict[m.length] {
- m.length++
- s++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(dict.dict, m.length); diff != 0 {
- m.length += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- m.length += 8
- }
- }
- m.length -= candidate
- m.score = score(m)
- if m.score <= -m.s {
- // Eliminate if no savings, we might find a better one.
- m.length = 0
- }
- return m
- }
-
- bestOf := func(a, b match) match {
- if b.length == 0 {
- return a
- }
- if a.length == 0 {
- return b
- }
- as := a.score + b.s
- bs := b.score + a.s
- if as >= bs {
- return a
- }
- return b
- }
-
- if s > 0 {
- best = bestOf(matchAt(getCur(candidateL), s, uint32(cv), false), matchAt(getPrev(candidateL), s, uint32(cv), false))
- best = bestOf(best, matchAt(getCur(candidateS), s, uint32(cv), false))
- best = bestOf(best, matchAt(getPrev(candidateS), s, uint32(cv), false))
- }
- if dict != nil {
- candidateL := dict.bestTableLong[hashL]
- candidateS := dict.bestTableShort[hashS]
- best = bestOf(best, matchDict(int(candidateL&0xffff), s, uint32(cv), false))
- best = bestOf(best, matchDict(int(candidateL>>16), s, uint32(cv), false))
- best = bestOf(best, matchDict(int(candidateS&0xffff), s, uint32(cv), false))
- best = bestOf(best, matchDict(int(candidateS>>16), s, uint32(cv), false))
- }
- {
- if (dict == nil || repeat <= s) && repeat > 0 {
- best = bestOf(best, matchAt(s-repeat+1, s+1, uint32(cv>>8), true))
- } else if s-repeat < -4 && dict != nil {
- candidate := len(dict.dict) - (repeat - s)
- best = bestOf(best, matchDict(candidate, s, uint32(cv), true))
- candidate++
- best = bestOf(best, matchDict(candidate, s+1, uint32(cv>>8), true))
- }
-
- if best.length > 0 {
- hashS := hash4(cv>>8, sTableBits)
- // s+1
- nextShort := sTable[hashS]
- s := s + 1
- cv := load64(src, s)
- hashL := hash8(cv, lTableBits)
- nextLong := lTable[hashL]
- best = bestOf(best, matchAt(getCur(nextShort), s, uint32(cv), false))
- best = bestOf(best, matchAt(getPrev(nextShort), s, uint32(cv), false))
- best = bestOf(best, matchAt(getCur(nextLong), s, uint32(cv), false))
- best = bestOf(best, matchAt(getPrev(nextLong), s, uint32(cv), false))
-
- // Dict at + 1
- if dict != nil {
- candidateL := dict.bestTableLong[hashL]
- candidateS := dict.bestTableShort[hashS]
-
- best = bestOf(best, matchDict(int(candidateL&0xffff), s, uint32(cv), false))
- best = bestOf(best, matchDict(int(candidateS&0xffff), s, uint32(cv), false))
- }
-
- // s+2
- if true {
- hashS := hash4(cv>>8, sTableBits)
-
- nextShort = sTable[hashS]
- s++
- cv = load64(src, s)
- hashL := hash8(cv, lTableBits)
- nextLong = lTable[hashL]
-
- if (dict == nil || repeat <= s) && repeat > 0 {
- // Repeat at + 2
- best = bestOf(best, matchAt(s-repeat, s, uint32(cv), true))
- } else if repeat-s > 4 && dict != nil {
- candidate := len(dict.dict) - (repeat - s)
- best = bestOf(best, matchDict(candidate, s, uint32(cv), true))
- }
- best = bestOf(best, matchAt(getCur(nextShort), s, uint32(cv), false))
- best = bestOf(best, matchAt(getPrev(nextShort), s, uint32(cv), false))
- best = bestOf(best, matchAt(getCur(nextLong), s, uint32(cv), false))
- best = bestOf(best, matchAt(getPrev(nextLong), s, uint32(cv), false))
-
- // Dict at +2
- // Very small gain
- if dict != nil {
- candidateL := dict.bestTableLong[hashL]
- candidateS := dict.bestTableShort[hashS]
-
- best = bestOf(best, matchDict(int(candidateL&0xffff), s, uint32(cv), false))
- best = bestOf(best, matchDict(int(candidateS&0xffff), s, uint32(cv), false))
- }
- }
- // Search for a match at best match end, see if that is better.
- // Allow some bytes at the beginning to mismatch.
- // Sweet spot is around 1-2 bytes, but depends on input.
- // The skipped bytes are tested in Extend backwards,
- // and still picked up as part of the match if they do.
- const skipBeginning = 2
- const skipEnd = 1
- if sAt := best.s + best.length - skipEnd; sAt < sLimit {
-
- sBack := best.s + skipBeginning - skipEnd
- backL := best.length - skipBeginning
- // Load initial values
- cv = load64(src, sBack)
-
- // Grab candidates...
- next := lTable[hash8(load64(src, sAt), lTableBits)]
-
- if checkAt := getCur(next) - backL; checkAt > 0 {
- best = bestOf(best, matchAt(checkAt, sBack, uint32(cv), false))
- }
- if checkAt := getPrev(next) - backL; checkAt > 0 {
- best = bestOf(best, matchAt(checkAt, sBack, uint32(cv), false))
- }
- // Disabled: Extremely small gain
- if false {
- next = sTable[hash4(load64(src, sAt), sTableBits)]
- if checkAt := getCur(next) - backL; checkAt > 0 {
- best = bestOf(best, matchAt(checkAt, sBack, uint32(cv), false))
- }
- if checkAt := getPrev(next) - backL; checkAt > 0 {
- best = bestOf(best, matchAt(checkAt, sBack, uint32(cv), false))
- }
- }
- }
- }
- }
-
- // Update table
- lTable[hashL] = uint64(s) | candidateL<<32
- sTable[hashS] = uint64(s) | candidateS<<32
-
- if best.length > 0 {
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards, not needed for repeats...
- s = best.s
- if !best.rep && !best.dict {
- for best.offset > 0 && s > nextEmit && src[best.offset-1] == src[s-1] {
- best.offset--
- best.length++
- s--
- }
- }
- if false && best.offset >= s {
- panic(fmt.Errorf("t %d >= s %d", best.offset, s))
- }
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := s - best.offset
- s += best.length
-
- if offset > 65535 && s-base <= 5 && !best.rep {
- // Bail if the match is equal or worse to the encoding.
- s = best.s + 1
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
- if debug && nextEmit != base {
- fmt.Println("EMIT", base-nextEmit, "literals. base-after:", base)
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if best.rep {
- if nextEmit > 0 || best.dict {
- if debug {
- fmt.Println("REPEAT, length", best.length, "offset:", offset, "s-after:", s, "dict:", best.dict, "best:", best)
- }
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], offset, best.length)
- } else {
- // First match without dict cannot be a repeat.
- if debug {
- fmt.Println("COPY, length", best.length, "offset:", offset, "s-after:", s, "dict:", best.dict, "best:", best)
- }
- d += emitCopy(dst[d:], offset, best.length)
- }
- } else {
- if debug {
- fmt.Println("COPY, length", best.length, "offset:", offset, "s-after:", s, "dict:", best.dict, "best:", best)
- }
- d += emitCopy(dst[d:], offset, best.length)
- }
- repeat = offset
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Fill tables...
- for i := best.s + 1; i < s; i++ {
- cv0 := load64(src, i)
- long0 := hash8(cv0, lTableBits)
- short0 := hash4(cv0, sTableBits)
- lTable[long0] = uint64(i) | lTable[long0]<<32
- sTable[short0] = uint64(i) | sTable[short0]<<32
- }
- cv = load64(src, s)
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- if debug && nextEmit != s {
- fmt.Println("emitted ", len(src)-nextEmit, "literals")
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockBestSnappy encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBestSnappy(dst, src []byte) (d int) {
- // Initialize the hash tables.
- const (
- // Long hash matches.
- lTableBits = 19
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 16
- maxSTableSize = 1 << sTableBits
-
- inputMargin = 8 + 2
- )
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- var lTable [maxLTableSize]uint64
- var sTable [maxSTableSize]uint64
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
- const lowbitMask = 0xffffffff
- getCur := func(x uint64) int {
- return int(x & lowbitMask)
- }
- getPrev := func(x uint64) int {
- return int(x >> 32)
- }
- const maxSkip = 64
-
- for {
- type match struct {
- offset int
- s int
- length int
- score int
- }
- var best match
- for {
- // Next src position to check
- nextS := (s-nextEmit)>>8 + 1
- if nextS > maxSkip {
- nextS = s + maxSkip
- } else {
- nextS += s
- }
- if nextS > sLimit {
- goto emitRemainder
- }
- hashL := hash8(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL := lTable[hashL]
- candidateS := sTable[hashS]
-
- score := func(m match) int {
- // Matches that are longer forward are penalized since we must emit it as a literal.
- score := m.length - m.s
- if nextEmit == m.s {
- // If we do not have to emit literals, we save 1 byte
- score++
- }
- offset := m.s - m.offset
-
- return score - emitCopyNoRepeatSize(offset, m.length)
- }
-
- matchAt := func(offset, s int, first uint32) match {
- if best.length != 0 && best.s-best.offset == s-offset {
- // Don't retest if we have the same offset.
- return match{offset: offset, s: s}
- }
- if load32(src, offset) != first {
- return match{offset: offset, s: s}
- }
- m := match{offset: offset, s: s, length: 4 + offset}
- s += 4
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, m.length); diff != 0 {
- m.length += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- m.length += 8
- }
- m.length -= offset
- m.score = score(m)
- if m.score <= -m.s {
- // Eliminate if no savings, we might find a better one.
- m.length = 0
- }
- return m
- }
-
- bestOf := func(a, b match) match {
- if b.length == 0 {
- return a
- }
- if a.length == 0 {
- return b
- }
- as := a.score + b.s
- bs := b.score + a.s
- if as >= bs {
- return a
- }
- return b
- }
-
- best = bestOf(matchAt(getCur(candidateL), s, uint32(cv)), matchAt(getPrev(candidateL), s, uint32(cv)))
- best = bestOf(best, matchAt(getCur(candidateS), s, uint32(cv)))
- best = bestOf(best, matchAt(getPrev(candidateS), s, uint32(cv)))
-
- {
- best = bestOf(best, matchAt(s-repeat+1, s+1, uint32(cv>>8)))
- if best.length > 0 {
- // s+1
- nextShort := sTable[hash4(cv>>8, sTableBits)]
- s := s + 1
- cv := load64(src, s)
- nextLong := lTable[hash8(cv, lTableBits)]
- best = bestOf(best, matchAt(getCur(nextShort), s, uint32(cv)))
- best = bestOf(best, matchAt(getPrev(nextShort), s, uint32(cv)))
- best = bestOf(best, matchAt(getCur(nextLong), s, uint32(cv)))
- best = bestOf(best, matchAt(getPrev(nextLong), s, uint32(cv)))
- // Repeat at + 2
- best = bestOf(best, matchAt(s-repeat+1, s+1, uint32(cv>>8)))
-
- // s+2
- if true {
- nextShort = sTable[hash4(cv>>8, sTableBits)]
- s++
- cv = load64(src, s)
- nextLong = lTable[hash8(cv, lTableBits)]
- best = bestOf(best, matchAt(getCur(nextShort), s, uint32(cv)))
- best = bestOf(best, matchAt(getPrev(nextShort), s, uint32(cv)))
- best = bestOf(best, matchAt(getCur(nextLong), s, uint32(cv)))
- best = bestOf(best, matchAt(getPrev(nextLong), s, uint32(cv)))
- }
- // Search for a match at best match end, see if that is better.
- if sAt := best.s + best.length; sAt < sLimit {
- sBack := best.s
- backL := best.length
- // Load initial values
- cv = load64(src, sBack)
- // Search for mismatch
- next := lTable[hash8(load64(src, sAt), lTableBits)]
- //next := sTable[hash4(load64(src, sAt), sTableBits)]
-
- if checkAt := getCur(next) - backL; checkAt > 0 {
- best = bestOf(best, matchAt(checkAt, sBack, uint32(cv)))
- }
- if checkAt := getPrev(next) - backL; checkAt > 0 {
- best = bestOf(best, matchAt(checkAt, sBack, uint32(cv)))
- }
- }
- }
- }
-
- // Update table
- lTable[hashL] = uint64(s) | candidateL<<32
- sTable[hashS] = uint64(s) | candidateS<<32
-
- if best.length > 0 {
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards, not needed for repeats...
- s = best.s
- if true {
- for best.offset > 0 && s > nextEmit && src[best.offset-1] == src[s-1] {
- best.offset--
- best.length++
- s--
- }
- }
- if false && best.offset >= s {
- panic(fmt.Errorf("t %d >= s %d", best.offset, s))
- }
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := s - best.offset
-
- s += best.length
-
- if offset > 65535 && s-base <= 5 {
- // Bail if the match is equal or worse to the encoding.
- s = best.s + 1
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
- d += emitCopyNoRepeat(dst[d:], offset, best.length)
- repeat = offset
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Fill tables...
- for i := best.s + 1; i < s; i++ {
- cv0 := load64(src, i)
- long0 := hash8(cv0, lTableBits)
- short0 := hash4(cv0, sTableBits)
- lTable[long0] = uint64(i) | lTable[long0]<<32
- sTable[short0] = uint64(i) | sTable[short0]<<32
- }
- cv = load64(src, s)
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// emitCopySize returns the size to encode the offset+length
-//
-// It assumes that:
-//
-// 1 <= offset && offset <= math.MaxUint32
-// 4 <= length && length <= 1 << 24
-func emitCopySize(offset, length int) int {
- if offset >= 65536 {
- i := 0
- if length > 64 {
- length -= 64
- if length >= 4 {
- // Emit remaining as repeats
- return 5 + emitRepeatSize(offset, length)
- }
- i = 5
- }
- if length == 0 {
- return i
- }
- return i + 5
- }
-
- // Offset no more than 2 bytes.
- if length > 64 {
- if offset < 2048 {
- // Emit 8 bytes, then rest as repeats...
- return 2 + emitRepeatSize(offset, length-8)
- }
- // Emit remaining as repeats, at least 4 bytes remain.
- return 3 + emitRepeatSize(offset, length-60)
- }
- if length >= 12 || offset >= 2048 {
- return 3
- }
- // Emit the remaining copy, encoded as 2 bytes.
- return 2
-}
-
-// emitCopyNoRepeatSize returns the size to encode the offset+length
-//
-// It assumes that:
-//
-// 1 <= offset && offset <= math.MaxUint32
-// 4 <= length && length <= 1 << 24
-func emitCopyNoRepeatSize(offset, length int) int {
- if offset >= 65536 {
- return 5 + 5*(length/64)
- }
-
- // Offset no more than 2 bytes.
- if length > 64 {
- // Emit remaining as repeats, at least 4 bytes remain.
- return 3 + 3*(length/60)
- }
- if length >= 12 || offset >= 2048 {
- return 3
- }
- // Emit the remaining copy, encoded as 2 bytes.
- return 2
-}
-
-// emitRepeatSize returns the number of bytes required to encode a repeat.
-// Length must be at least 4 and < 1<<24
-func emitRepeatSize(offset, length int) int {
- // Repeat offset, make length cheaper
- if length <= 4+4 || (length < 8+4 && offset < 2048) {
- return 2
- }
- if length < (1<<8)+4+4 {
- return 3
- }
- if length < (1<<16)+(1<<8)+4 {
- return 4
- }
- const maxRepeat = (1 << 24) - 1
- length -= (1 << 16) - 4
- left := 0
- if length > maxRepeat {
- left = length - maxRepeat + 4
- }
- if left > 0 {
- return 5 + emitRepeatSize(offset, left)
- }
- return 5
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encode_better.go b/vendor/github.com/klauspost/compress/s2/encode_better.go
deleted file mode 100644
index 90ebf89c2..000000000
--- a/vendor/github.com/klauspost/compress/s2/encode_better.go
+++ /dev/null
@@ -1,1510 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "bytes"
- "fmt"
- "math/bits"
-)
-
-// hash4 returns the hash of the lowest 4 bytes of u to fit in a hash table with h bits.
-// Preferably h should be a constant and should always be <32.
-func hash4(u uint64, h uint8) uint32 {
- const prime4bytes = 2654435761
- return (uint32(u) * prime4bytes) >> ((32 - h) & 31)
-}
-
-// hash5 returns the hash of the lowest 5 bytes of u to fit in a hash table with h bits.
-// Preferably h should be a constant and should always be <64.
-func hash5(u uint64, h uint8) uint32 {
- const prime5bytes = 889523592379
- return uint32(((u << (64 - 40)) * prime5bytes) >> ((64 - h) & 63))
-}
-
-// hash7 returns the hash of the lowest 7 bytes of u to fit in a hash table with h bits.
-// Preferably h should be a constant and should always be <64.
-func hash7(u uint64, h uint8) uint32 {
- const prime7bytes = 58295818150454627
- return uint32(((u << (64 - 56)) * prime7bytes) >> ((64 - h) & 63))
-}
-
-// hash8 returns the hash of u to fit in a hash table with h bits.
-// Preferably h should be a constant and should always be <64.
-func hash8(u uint64, h uint8) uint32 {
- const prime8bytes = 0xcf1bbcdcb7a56463
- return uint32((u * prime8bytes) >> ((64 - h) & 63))
-}
-
-// encodeBlockBetter encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBetterGo(dst, src []byte) (d int) {
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- // Initialize the hash tables.
- const (
- // Long hash matches.
- lTableBits = 17
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 14
- maxSTableSize = 1 << sTableBits
- )
-
- var lTable [maxLTableSize]uint32
- var sTable [maxSTableSize]uint32
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 6
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We initialize repeat to 0, so we never match on first attempt
- repeat := 0
-
- for {
- candidateL := 0
- nextS := 0
- for {
- // Next src position to check
- nextS = s + (s-nextEmit)>>7 + 1
- if nextS > sLimit {
- goto emitRemainder
- }
- hashL := hash7(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL = int(lTable[hashL])
- candidateS := int(sTable[hashS])
- lTable[hashL] = uint32(s)
- sTable[hashS] = uint32(s)
-
- valLong := load64(src, candidateL)
- valShort := load64(src, candidateS)
-
- // If long matches at least 8 bytes, use that.
- if cv == valLong {
- break
- }
- if cv == valShort {
- candidateL = candidateS
- break
- }
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- // Minimum length of a repeat. Tested with various values.
- // While 4-5 offers improvements in some, 6 reduces
- // regressions significantly.
- const wantRepeatBytes = 6
- const repeatMask = ((1 << (wantRepeatBytes * 8)) - 1) << (8 * checkRep)
- if false && repeat > 0 && cv&repeatMask == load64(src, s-repeat)&repeatMask {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + wantRepeatBytes + checkRep
- s += wantRepeatBytes + checkRep
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidate] {
- s++
- candidate++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
- // Index in-between
- index0 := base + 1
- index1 := s - 2
-
- for index0 < index1 {
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 2
- index1 -= 2
- }
-
- cv = load64(src, s)
- continue
- }
-
- // Long likely matches 7, so take that.
- if uint32(cv) == uint32(valLong) {
- break
- }
-
- // Check our short candidate
- if uint32(cv) == uint32(valShort) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint32(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- break
- }
- // Use our short candidate.
- candidateL = candidateS
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidateL > 0 && s > nextEmit && src[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := base - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidateL] {
- s++
- candidateL++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- if offset > 65535 && s-base <= 5 && repeat != offset {
- // Bail if the match is equal or worse to the encoding.
- s = nextS + 1
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if repeat == offset {
- d += emitRepeat(dst[d:], offset, s-base)
- } else {
- d += emitCopy(dst[d:], offset, s-base)
- repeat = offset
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- // lTable could be postponed, but very minor difference.
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // Index large values sparsely in between.
- // We do two starting from different offsets for speed.
- index2 := (index0 + index1 + 1) >> 1
- for index2 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint32(index0)
- lTable[hash7(load64(src, index2), lTableBits)] = uint32(index2)
- index0 += 2
- index2 += 2
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockBetterSnappyGo encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBetterSnappyGo(dst, src []byte) (d int) {
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- // Initialize the hash tables.
- const (
- // Long hash matches.
- lTableBits = 16
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 14
- maxSTableSize = 1 << sTableBits
- )
-
- var lTable [maxLTableSize]uint32
- var sTable [maxSTableSize]uint32
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 6
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We initialize repeat to 0, so we never match on first attempt
- repeat := 0
- const maxSkip = 100
-
- for {
- candidateL := 0
- nextS := 0
- for {
- // Next src position to check
- nextS = min(s+(s-nextEmit)>>7+1, s+maxSkip)
-
- if nextS > sLimit {
- goto emitRemainder
- }
- hashL := hash7(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL = int(lTable[hashL])
- candidateS := int(sTable[hashS])
- lTable[hashL] = uint32(s)
- sTable[hashS] = uint32(s)
-
- if uint32(cv) == load32(src, candidateL) {
- break
- }
-
- // Check our short candidate
- if uint32(cv) == load32(src, candidateS) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint32(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- break
- }
- // Use our short candidate.
- candidateL = candidateS
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidateL > 0 && s > nextEmit && src[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := base - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidateL] {
- s++
- candidateL++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- if offset > 65535 && s-base <= 5 && repeat != offset {
- // Bail if the match is equal or worse to the encoding.
- s = nextS + 1
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- d += emitCopyNoRepeat(dst[d:], offset, s-base)
- repeat = offset
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // Index large values sparsely in between.
- // We do two starting from different offsets for speed.
- index2 := (index0 + index1 + 1) >> 1
- for index2 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint32(index0)
- lTable[hash7(load64(src, index2), lTableBits)] = uint32(index2)
- index0 += 2
- index2 += 2
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-func encodeBlockBetterGo64K(dst, src []byte) (d int) {
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
- // Initialize the hash tables.
- // Use smaller tables for smaller blocks
- const (
- // Long hash matches.
- lTableBits = 16
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 13
- maxSTableSize = 1 << sTableBits
- )
-
- var lTable [maxLTableSize]uint16
- var sTable [maxSTableSize]uint16
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 6
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We initialize repeat to 0, so we never match on first attempt
- repeat := 0
-
- for {
- candidateL := 0
- nextS := 0
- for {
- // Next src position to check
- nextS = s + (s-nextEmit)>>6 + 1
- if nextS > sLimit {
- goto emitRemainder
- }
- hashL := hash7(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL = int(lTable[hashL])
- candidateS := int(sTable[hashS])
- lTable[hashL] = uint16(s)
- sTable[hashS] = uint16(s)
-
- valLong := load64(src, candidateL)
- valShort := load64(src, candidateS)
-
- // If long matches at least 8 bytes, use that.
- if cv == valLong {
- break
- }
- if cv == valShort {
- candidateL = candidateS
- break
- }
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- // Minimum length of a repeat. Tested with various values.
- // While 4-5 offers improvements in some, 6 reduces
- // regressions significantly.
- const wantRepeatBytes = 6
- const repeatMask = ((1 << (wantRepeatBytes * 8)) - 1) << (8 * checkRep)
- if false && repeat > 0 && cv&repeatMask == load64(src, s-repeat)&repeatMask {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + wantRepeatBytes + checkRep
- s += wantRepeatBytes + checkRep
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidate] {
- s++
- candidate++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
- // Index in-between
- index0 := base + 1
- index1 := s - 2
-
- for index0 < index1 {
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint16(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint16(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint16(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint16(index1 + 1)
- index0 += 2
- index1 -= 2
- }
-
- cv = load64(src, s)
- continue
- }
-
- // Long likely matches 7, so take that.
- if uint32(cv) == uint32(valLong) {
- break
- }
-
- // Check our short candidate
- if uint32(cv) == uint32(valShort) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint16(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- break
- }
- // Use our short candidate.
- candidateL = candidateS
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidateL > 0 && s > nextEmit && src[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := base - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidateL] {
- s++
- candidateL++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if repeat == offset {
- d += emitRepeat(dst[d:], offset, s-base)
- } else {
- d += emitCopy(dst[d:], offset, s-base)
- repeat = offset
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint16(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint16(index0 + 1)
-
- // lTable could be postponed, but very minor difference.
- lTable[hash7(cv1, lTableBits)] = uint16(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint16(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // Index large values sparsely in between.
- // We do two starting from different offsets for speed.
- index2 := (index0 + index1 + 1) >> 1
- for index2 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint16(index0)
- lTable[hash7(load64(src, index2), lTableBits)] = uint16(index2)
- index0 += 2
- index2 += 2
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockBetterSnappyGo encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBetterSnappyGo64K(dst, src []byte) (d int) {
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- // Initialize the hash tables.
- // Use smaller tables for smaller blocks
- const (
- // Long hash matches.
- lTableBits = 15
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 13
- maxSTableSize = 1 << sTableBits
- )
-
- var lTable [maxLTableSize]uint16
- var sTable [maxSTableSize]uint16
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 6
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- const maxSkip = 100
-
- for {
- candidateL := 0
- nextS := 0
- for {
- // Next src position to check
- nextS = min(s+(s-nextEmit)>>6+1, s+maxSkip)
-
- if nextS > sLimit {
- goto emitRemainder
- }
- hashL := hash7(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL = int(lTable[hashL])
- candidateS := int(sTable[hashS])
- lTable[hashL] = uint16(s)
- sTable[hashS] = uint16(s)
-
- if uint32(cv) == load32(src, candidateL) {
- break
- }
-
- // Check our short candidate
- if uint32(cv) == load32(src, candidateS) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint16(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- break
- }
- // Use our short candidate.
- candidateL = candidateS
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidateL > 0 && s > nextEmit && src[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := base - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidateL] {
- s++
- candidateL++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- d += emitCopyNoRepeat(dst[d:], offset, s-base)
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint16(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint16(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint16(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint16(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // Index large values sparsely in between.
- // We do two starting from different offsets for speed.
- index2 := (index0 + index1 + 1) >> 1
- for index2 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint16(index0)
- lTable[hash7(load64(src, index2), lTableBits)] = uint16(index2)
- index0 += 2
- index2 += 2
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
-
-// encodeBlockBetterDict encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src)) &&
-// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
-func encodeBlockBetterDict(dst, src []byte, dict *Dict) (d int) {
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- // Initialize the hash tables.
- const (
- // Long hash matches.
- lTableBits = 17
- maxLTableSize = 1 << lTableBits
-
- // Short hash matches.
- sTableBits = 14
- maxSTableSize = 1 << sTableBits
-
- maxAhead = 8 // maximum bytes ahead without checking sLimit
-
- debug = false
- )
-
- sLimit := len(src) - inputMargin
- if sLimit > MaxDictSrcOffset-maxAhead {
- sLimit = MaxDictSrcOffset - maxAhead
- }
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
-
- dict.initBetter()
-
- var lTable [maxLTableSize]uint32
- var sTable [maxSTableSize]uint32
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 6
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 0
- cv := load64(src, s)
-
- // We initialize repeat to 0, so we never match on first attempt
- repeat := len(dict.dict) - dict.repeat
-
- // While in dict
-searchDict:
- for {
- candidateL := 0
- nextS := 0
- for {
- // Next src position to check
- nextS = s + (s-nextEmit)>>7 + 1
- if nextS > sLimit {
- break searchDict
- }
- hashL := hash7(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL = int(lTable[hashL])
- candidateS := int(sTable[hashS])
- dictL := int(dict.betterTableLong[hashL])
- dictS := int(dict.betterTableShort[hashS])
- lTable[hashL] = uint32(s)
- sTable[hashS] = uint32(s)
-
- valLong := load64(src, candidateL)
- valShort := load64(src, candidateS)
-
- // If long matches at least 8 bytes, use that.
- if s != 0 {
- if cv == valLong {
- goto emitMatch
- }
- if cv == valShort {
- candidateL = candidateS
- goto emitMatch
- }
- }
-
- // Check dict repeat.
- if repeat >= s+4 {
- candidate := len(dict.dict) - repeat + s
- if candidate > 0 && uint32(cv) == load32(dict.dict, candidate) {
- // Extend back
- base := s
- for i := candidate; base > nextEmit && i > 0 && dict.dict[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if debug && nextEmit != base {
- fmt.Println("emitted ", base-nextEmit, "literals")
- }
- s += 4
- candidate += 4
- for candidate < len(dict.dict)-8 && s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(dict.dict, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- d += emitRepeat(dst[d:], repeat, s-base)
- if debug {
- fmt.Println("emitted dict repeat length", s-base, "offset:", repeat, "s:", s)
- }
- nextEmit = s
- if s >= sLimit {
- break searchDict
- }
- // Index in-between
- index0 := base + 1
- index1 := s - 2
-
- cv = load64(src, s)
- for index0 < index1 {
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 2
- index1 -= 2
- }
- continue
- }
- }
- // Don't try to find match at s==0
- if s == 0 {
- cv = load64(src, nextS)
- s = nextS
- continue
- }
-
- // Long likely matches 7, so take that.
- if uint32(cv) == uint32(valLong) {
- goto emitMatch
- }
-
- // Long dict...
- if uint32(cv) == load32(dict.dict, dictL) {
- candidateL = dictL
- goto emitDict
- }
-
- // Check our short candidate
- if uint32(cv) == uint32(valShort) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint32(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- goto emitMatch
- }
- // Use our short candidate.
- candidateL = candidateS
- goto emitMatch
- }
- if uint32(cv) == load32(dict.dict, dictS) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint32(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- goto emitMatch
- }
- candidateL = dictS
- goto emitDict
- }
- cv = load64(src, nextS)
- s = nextS
- }
- emitDict:
- {
- if debug {
- if load32(dict.dict, candidateL) != load32(src, s) {
- panic("dict emit mismatch")
- }
- }
- // Extend backwards.
- // The top bytes will be rechecked to get the full match.
- for candidateL > 0 && s > nextEmit && dict.dict[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteral(dst[d:], src[nextEmit:s])
- if debug && nextEmit != s {
- fmt.Println("emitted ", s-nextEmit, "literals")
- }
- {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- offset := s + (len(dict.dict)) - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s <= len(src)-8 && len(dict.dict)-candidateL >= 8 {
- if diff := load64(src, s) ^ load64(dict.dict, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- if repeat == offset {
- if debug {
- fmt.Println("emitted dict repeat, length", s-base, "offset:", offset, "s:", s, "dict offset:", candidateL)
- }
- d += emitRepeat(dst[d:], offset, s-base)
- } else {
- if debug {
- fmt.Println("emitted dict copy, length", s-base, "offset:", offset, "s:", s, "dict offset:", candidateL)
- }
- // Matches longer than 64 are split.
- if s <= sLimit || s-base < 8 {
- d += emitCopy(dst[d:], offset, s-base)
- } else {
- // Split to ensure we don't start a copy within next block.
- d += emitCopy(dst[d:], offset, 4)
- d += emitRepeat(dst[d:], offset, s-base-4)
- }
- repeat = offset
- }
- if false {
- // Validate match.
- if s <= candidateL {
- panic("s <= candidate")
- }
- a := src[base:s]
- b := dict.dict[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- break searchDict
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // index every second long in between.
- for index0 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint32(index0)
- lTable[hash7(load64(src, index1), lTableBits)] = uint32(index1)
- index0 += 2
- index1 -= 2
- }
- }
- continue
- }
- emitMatch:
-
- // Extend backwards
- for candidateL > 0 && s > nextEmit && src[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := base - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidateL] {
- s++
- candidateL++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- if offset > 65535 && s-base <= 5 && repeat != offset {
- // Bail if the match is equal or worse to the encoding.
- s = nextS + 1
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if debug && nextEmit != s {
- fmt.Println("emitted ", s-nextEmit, "literals")
- }
- if repeat == offset {
- if debug {
- fmt.Println("emitted match repeat, length", s-base, "offset:", offset, "s:", s)
- }
- d += emitRepeat(dst[d:], offset, s-base)
- } else {
- if debug {
- fmt.Println("emitted match copy, length", s-base, "offset:", offset, "s:", s)
- }
- d += emitCopy(dst[d:], offset, s-base)
- repeat = offset
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // Index large values sparsely in between.
- // We do two starting from different offsets for speed.
- index2 := (index0 + index1 + 1) >> 1
- for index2 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint32(index0)
- lTable[hash7(load64(src, index2), lTableBits)] = uint32(index2)
- index0 += 2
- index2 += 2
- }
- }
-
- // Search without dict:
- if repeat > s {
- repeat = 0
- }
-
- // No more dict
- sLimit = len(src) - inputMargin
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- if debug {
- fmt.Println("now", s, "->", sLimit, "out:", d, "left:", len(src)-s, "nextemit:", nextEmit, "dstLimit:", dstLimit, "s:", s)
- }
- for {
- candidateL := 0
- nextS := 0
- for {
- // Next src position to check
- nextS = s + (s-nextEmit)>>7 + 1
- if nextS > sLimit {
- goto emitRemainder
- }
- hashL := hash7(cv, lTableBits)
- hashS := hash4(cv, sTableBits)
- candidateL = int(lTable[hashL])
- candidateS := int(sTable[hashS])
- lTable[hashL] = uint32(s)
- sTable[hashS] = uint32(s)
-
- valLong := load64(src, candidateL)
- valShort := load64(src, candidateS)
-
- // If long matches at least 8 bytes, use that.
- if cv == valLong {
- break
- }
- if cv == valShort {
- candidateL = candidateS
- break
- }
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- // Minimum length of a repeat. Tested with various values.
- // While 4-5 offers improvements in some, 6 reduces
- // regressions significantly.
- const wantRepeatBytes = 6
- const repeatMask = ((1 << (wantRepeatBytes * 8)) - 1) << (8 * checkRep)
- if false && repeat > 0 && cv&repeatMask == load64(src, s-repeat)&repeatMask {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteral(dst[d:], src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + wantRepeatBytes + checkRep
- s += wantRepeatBytes + checkRep
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidate] {
- s++
- candidate++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
- // same as `add := emitCopy(dst[d:], repeat, s-base)` but skips storing offset.
- d += emitRepeat(dst[d:], repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
- // Index in-between
- index0 := base + 1
- index1 := s - 2
-
- for index0 < index1 {
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 2
- index1 -= 2
- }
-
- cv = load64(src, s)
- continue
- }
-
- // Long likely matches 7, so take that.
- if uint32(cv) == uint32(valLong) {
- break
- }
-
- // Check our short candidate
- if uint32(cv) == uint32(valShort) {
- // Try a long candidate at s+1
- hashL = hash7(cv>>8, lTableBits)
- candidateL = int(lTable[hashL])
- lTable[hashL] = uint32(s + 1)
- if uint32(cv>>8) == load32(src, candidateL) {
- s++
- break
- }
- // Use our short candidate.
- candidateL = candidateS
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidateL > 0 && s > nextEmit && src[candidateL-1] == src[s-1] {
- candidateL--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- base := s
- offset := base - candidateL
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidateL += 4
- for s < len(src) {
- if len(src)-s < 8 {
- if src[s] == src[candidateL] {
- s++
- candidateL++
- continue
- }
- break
- }
- if diff := load64(src, s) ^ load64(src, candidateL); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidateL += 8
- }
-
- if offset > 65535 && s-base <= 5 && repeat != offset {
- // Bail if the match is equal or worse to the encoding.
- s = nextS + 1
- if s >= sLimit {
- goto emitRemainder
- }
- cv = load64(src, s)
- continue
- }
-
- d += emitLiteral(dst[d:], src[nextEmit:base])
- if repeat == offset {
- d += emitRepeat(dst[d:], offset, s-base)
- } else {
- d += emitCopy(dst[d:], offset, s-base)
- repeat = offset
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
-
- // Index short & long
- index0 := base + 1
- index1 := s - 2
-
- cv0 := load64(src, index0)
- cv1 := load64(src, index1)
- lTable[hash7(cv0, lTableBits)] = uint32(index0)
- sTable[hash4(cv0>>8, sTableBits)] = uint32(index0 + 1)
-
- lTable[hash7(cv1, lTableBits)] = uint32(index1)
- sTable[hash4(cv1>>8, sTableBits)] = uint32(index1 + 1)
- index0 += 1
- index1 -= 1
- cv = load64(src, s)
-
- // Index large values sparsely in between.
- // We do two starting from different offsets for speed.
- index2 := (index0 + index1 + 1) >> 1
- for index2 < index1 {
- lTable[hash7(load64(src, index0), lTableBits)] = uint32(index0)
- lTable[hash7(load64(src, index2), lTableBits)] = uint32(index2)
- index0 += 2
- index2 += 2
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteral(dst[d:], src[nextEmit:])
- }
- return d
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encode_go.go b/vendor/github.com/klauspost/compress/s2/encode_go.go
deleted file mode 100644
index e25b78445..000000000
--- a/vendor/github.com/klauspost/compress/s2/encode_go.go
+++ /dev/null
@@ -1,741 +0,0 @@
-//go:build !amd64 || appengine || !gc || noasm
-// +build !amd64 appengine !gc noasm
-
-package s2
-
-import (
- "bytes"
- "math/bits"
-)
-
-const hasAmd64Asm = false
-
-// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src))
-func encodeBlock(dst, src []byte) (d int) {
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
- if len(src) <= 64<<10 {
- return encodeBlockGo64K(dst, src)
- }
- return encodeBlockGo(dst, src)
-}
-
-// encodeBlockBetter encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src))
-func encodeBlockBetter(dst, src []byte) (d int) {
- if len(src) <= 64<<10 {
- return encodeBlockBetterGo64K(dst, src)
- }
- return encodeBlockBetterGo(dst, src)
-}
-
-// encodeBlockBetter encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src))
-func encodeBlockBetterSnappy(dst, src []byte) (d int) {
- if len(src) <= 64<<10 {
- return encodeBlockBetterSnappyGo64K(dst, src)
- }
- return encodeBlockBetterSnappyGo(dst, src)
-}
-
-// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It
-// assumes that the varint-encoded length of the decompressed bytes has already
-// been written.
-//
-// It also assumes that:
-//
-// len(dst) >= MaxEncodedLen(len(src))
-func encodeBlockSnappy(dst, src []byte) (d int) {
- if len(src) < minNonLiteralBlockSize {
- return 0
- }
- if len(src) <= 64<<10 {
- return encodeBlockSnappyGo64K(dst, src)
- }
- return encodeBlockSnappyGo(dst, src)
-}
-
-// emitLiteral writes a literal chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 0 <= len(lit) && len(lit) <= math.MaxUint32
-func emitLiteral(dst, lit []byte) int {
- if len(lit) == 0 {
- return 0
- }
- const num = 63<<2 | tagLiteral
- i, n := 0, uint(len(lit)-1)
- switch {
- case n < 60:
- dst[0] = uint8(n)<<2 | tagLiteral
- i = 1
- case n < 1<<8:
- dst[1] = uint8(n)
- dst[0] = 60<<2 | tagLiteral
- i = 2
- case n < 1<<16:
- dst[2] = uint8(n >> 8)
- dst[1] = uint8(n)
- dst[0] = 61<<2 | tagLiteral
- i = 3
- case n < 1<<24:
- dst[3] = uint8(n >> 16)
- dst[2] = uint8(n >> 8)
- dst[1] = uint8(n)
- dst[0] = 62<<2 | tagLiteral
- i = 4
- default:
- dst[4] = uint8(n >> 24)
- dst[3] = uint8(n >> 16)
- dst[2] = uint8(n >> 8)
- dst[1] = uint8(n)
- dst[0] = 63<<2 | tagLiteral
- i = 5
- }
- return i + copy(dst[i:], lit)
-}
-
-// emitRepeat writes a repeat chunk and returns the number of bytes written.
-// Length must be at least 4 and < 1<<24
-func emitRepeat(dst []byte, offset, length int) int {
- // Repeat offset, make length cheaper
- length -= 4
- if length <= 4 {
- dst[0] = uint8(length)<<2 | tagCopy1
- dst[1] = 0
- return 2
- }
- if length < 8 && offset < 2048 {
- // Encode WITH offset
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length)<<2 | tagCopy1
- return 2
- }
- if length < (1<<8)+4 {
- length -= 4
- dst[2] = uint8(length)
- dst[1] = 0
- dst[0] = 5<<2 | tagCopy1
- return 3
- }
- if length < (1<<16)+(1<<8) {
- length -= 1 << 8
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 6<<2 | tagCopy1
- return 4
- }
- const maxRepeat = (1 << 24) - 1
- length -= 1 << 16
- left := 0
- if length > maxRepeat {
- left = length - maxRepeat + 4
- length = maxRepeat - 4
- }
- dst[4] = uint8(length >> 16)
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 7<<2 | tagCopy1
- if left > 0 {
- return 5 + emitRepeat(dst[5:], offset, left)
- }
- return 5
-}
-
-// emitCopy writes a copy chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 1 <= offset && offset <= math.MaxUint32
-// 4 <= length && length <= 1 << 24
-func emitCopy(dst []byte, offset, length int) int {
- if offset >= 65536 {
- i := 0
- if length > 64 {
- // Emit a length 64 copy, encoded as 5 bytes.
- dst[4] = uint8(offset >> 24)
- dst[3] = uint8(offset >> 16)
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 63<<2 | tagCopy4
- length -= 64
- if length >= 4 {
- // Emit remaining as repeats
- return 5 + emitRepeat(dst[5:], offset, length)
- }
- i = 5
- }
- if length == 0 {
- return i
- }
- // Emit a copy, offset encoded as 4 bytes.
- dst[i+0] = uint8(length-1)<<2 | tagCopy4
- dst[i+1] = uint8(offset)
- dst[i+2] = uint8(offset >> 8)
- dst[i+3] = uint8(offset >> 16)
- dst[i+4] = uint8(offset >> 24)
- return i + 5
- }
-
- // Offset no more than 2 bytes.
- if length > 64 {
- off := 3
- if offset < 2048 {
- // emit 8 bytes as tagCopy1, rest as repeats.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(8-4)<<2 | tagCopy1
- length -= 8
- off = 2
- } else {
- // Emit a length 60 copy, encoded as 3 bytes.
- // Emit remaining as repeat value (minimum 4 bytes).
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 59<<2 | tagCopy2
- length -= 60
- }
- // Emit remaining as repeats, at least 4 bytes remain.
- return off + emitRepeat(dst[off:], offset, length)
- }
- if length >= 12 || offset >= 2048 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = uint8(length-1)<<2 | tagCopy2
- return 3
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- return 2
-}
-
-// emitCopyNoRepeat writes a copy chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 1 <= offset && offset <= math.MaxUint32
-// 4 <= length && length <= 1 << 24
-func emitCopyNoRepeat(dst []byte, offset, length int) int {
- if offset >= 65536 {
- i := 0
- if length > 64 {
- // Emit a length 64 copy, encoded as 5 bytes.
- dst[4] = uint8(offset >> 24)
- dst[3] = uint8(offset >> 16)
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 63<<2 | tagCopy4
- length -= 64
- if length >= 4 {
- // Emit remaining as repeats
- return 5 + emitCopyNoRepeat(dst[5:], offset, length)
- }
- i = 5
- }
- if length == 0 {
- return i
- }
- // Emit a copy, offset encoded as 4 bytes.
- dst[i+0] = uint8(length-1)<<2 | tagCopy4
- dst[i+1] = uint8(offset)
- dst[i+2] = uint8(offset >> 8)
- dst[i+3] = uint8(offset >> 16)
- dst[i+4] = uint8(offset >> 24)
- return i + 5
- }
-
- // Offset no more than 2 bytes.
- if length > 64 {
- // Emit a length 60 copy, encoded as 3 bytes.
- // Emit remaining as repeat value (minimum 4 bytes).
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 59<<2 | tagCopy2
- length -= 60
- // Emit remaining as repeats, at least 4 bytes remain.
- return 3 + emitCopyNoRepeat(dst[3:], offset, length)
- }
- if length >= 12 || offset >= 2048 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = uint8(length-1)<<2 | tagCopy2
- return 3
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- return 2
-}
-
-// matchLen returns how many bytes match in a and b
-//
-// It assumes that:
-//
-// len(a) <= len(b)
-func matchLen(a []byte, b []byte) int {
- b = b[:len(a)]
- var checked int
- if len(a) > 4 {
- // Try 4 bytes first
- if diff := load32(a, 0) ^ load32(b, 0); diff != 0 {
- return bits.TrailingZeros32(diff) >> 3
- }
- // Switch to 8 byte matching.
- checked = 4
- a = a[4:]
- b = b[4:]
- for len(a) >= 8 {
- b = b[:len(a)]
- if diff := load64(a, 0) ^ load64(b, 0); diff != 0 {
- return checked + (bits.TrailingZeros64(diff) >> 3)
- }
- checked += 8
- a = a[8:]
- b = b[8:]
- }
- }
- b = b[:len(a)]
- for i := range a {
- if a[i] != b[i] {
- return int(i) + checked
- }
- }
- return len(a) + checked
-}
-
-// input must be > inputMargin
-func calcBlockSize(src []byte, _ *[32768]byte) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 13
- maxTableSize = 1 << tableBits
- )
-
- var table [maxTableSize]uint32
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
-
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>6 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint32(s)
- table[hash1] = uint32(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteralSize(src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeatSize(repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint32(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint32(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteralSize(src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeatSize(repeat, s-base)
- if false {
- // Validate match.
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s)
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteralSize(src[nextEmit:])
- }
- return d
-}
-
-// length must be > inputMargin.
-func calcBlockSizeSmall(src []byte, _ *[2048]byte) (d int) {
- // Initialize the hash table.
- const (
- tableBits = 9
- maxTableSize = 1 << tableBits
- )
-
- var table [maxTableSize]uint32
-
- // sLimit is when to stop looking for offset/length copies. The inputMargin
- // lets us use a fast path for emitLiteral in the main loop, while we are
- // looking for copies.
- sLimit := len(src) - inputMargin
-
- // Bail if we can't compress to at least this.
- dstLimit := len(src) - len(src)>>5 - 5
-
- // nextEmit is where in src the next emitLiteral should start from.
- nextEmit := 0
-
- // The encoded form must start with a literal, as there are no previous
- // bytes to copy, so we start looking for hash matches at s == 1.
- s := 1
- cv := load64(src, s)
-
- // We search for a repeat at -1, but don't output repeats when nextEmit == 0
- repeat := 1
-
- for {
- candidate := 0
- for {
- // Next src position to check
- nextS := s + (s-nextEmit)>>6 + 4
- if nextS > sLimit {
- goto emitRemainder
- }
- hash0 := hash6(cv, tableBits)
- hash1 := hash6(cv>>8, tableBits)
- candidate = int(table[hash0])
- candidate2 := int(table[hash1])
- table[hash0] = uint32(s)
- table[hash1] = uint32(s + 1)
- hash2 := hash6(cv>>16, tableBits)
-
- // Check repeat at offset checkRep.
- const checkRep = 1
- if uint32(cv>>(checkRep*8)) == load32(src, s-repeat+checkRep) {
- base := s + checkRep
- // Extend back
- for i := base - repeat; base > nextEmit && i > 0 && src[i-1] == src[base-1]; {
- i--
- base--
- }
- d += emitLiteralSize(src[nextEmit:base])
-
- // Extend forward
- candidate := s - repeat + 4 + checkRep
- s += 4 + checkRep
- for s <= sLimit {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeatSize(repeat, s-base)
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- cv = load64(src, s)
- continue
- }
-
- if uint32(cv) == load32(src, candidate) {
- break
- }
- candidate = int(table[hash2])
- if uint32(cv>>8) == load32(src, candidate2) {
- table[hash2] = uint32(s + 2)
- candidate = candidate2
- s++
- break
- }
- table[hash2] = uint32(s + 2)
- if uint32(cv>>16) == load32(src, candidate) {
- s += 2
- break
- }
-
- cv = load64(src, nextS)
- s = nextS
- }
-
- // Extend backwards
- for candidate > 0 && s > nextEmit && src[candidate-1] == src[s-1] {
- candidate--
- s--
- }
-
- // Bail if we exceed the maximum size.
- if d+(s-nextEmit) > dstLimit {
- return 0
- }
-
- // A 4-byte match has been found. We'll later see if more than 4 bytes
- // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit
- // them as literal bytes.
-
- d += emitLiteralSize(src[nextEmit:s])
-
- // Call emitCopy, and then see if another emitCopy could be our next
- // move. Repeat until we find no match for the input immediately after
- // what was consumed by the last emitCopy call.
- //
- // If we exit this loop normally then we need to call emitLiteral next,
- // though we don't yet know how big the literal will be. We handle that
- // by proceeding to the next iteration of the main loop. We also can
- // exit this loop via goto if we get close to exhausting the input.
- for {
- // Invariant: we have a 4-byte match at s, and no need to emit any
- // literal bytes prior to s.
- base := s
- repeat = base - candidate
-
- // Extend the 4-byte match as long as possible.
- s += 4
- candidate += 4
- for s <= len(src)-8 {
- if diff := load64(src, s) ^ load64(src, candidate); diff != 0 {
- s += bits.TrailingZeros64(diff) >> 3
- break
- }
- s += 8
- candidate += 8
- }
-
- d += emitCopyNoRepeatSize(repeat, s-base)
- if false {
- // Validate match.
- a := src[base:s]
- b := src[base-repeat : base-repeat+(s-base)]
- if !bytes.Equal(a, b) {
- panic("mismatch")
- }
- }
-
- nextEmit = s
- if s >= sLimit {
- goto emitRemainder
- }
-
- if d > dstLimit {
- // Do we have space for more, if not bail.
- return 0
- }
- // Check for an immediate match, otherwise start search at s+1
- x := load64(src, s-2)
- m2Hash := hash6(x, tableBits)
- currHash := hash6(x>>16, tableBits)
- candidate = int(table[currHash])
- table[m2Hash] = uint32(s - 2)
- table[currHash] = uint32(s)
- if uint32(x>>16) != load32(src, candidate) {
- cv = load64(src, s+1)
- s++
- break
- }
- }
- }
-
-emitRemainder:
- if nextEmit < len(src) {
- // Bail if we exceed the maximum size.
- if d+len(src)-nextEmit > dstLimit {
- return 0
- }
- d += emitLiteralSize(src[nextEmit:])
- }
- return d
-}
-
-// emitLiteral writes a literal chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 0 <= len(lit) && len(lit) <= math.MaxUint32
-func emitLiteralSize(lit []byte) int {
- if len(lit) == 0 {
- return 0
- }
- switch {
- case len(lit) <= 60:
- return len(lit) + 1
- case len(lit) <= 1<<8:
- return len(lit) + 2
- case len(lit) <= 1<<16:
- return len(lit) + 3
- case len(lit) <= 1<<24:
- return len(lit) + 4
- default:
- return len(lit) + 5
- }
-}
-
-func cvtLZ4BlockAsm(dst []byte, src []byte) (uncompressed int, dstUsed int) {
- panic("cvtLZ4BlockAsm should be unreachable")
-}
-
-func cvtLZ4BlockSnappyAsm(dst []byte, src []byte) (uncompressed int, dstUsed int) {
- panic("cvtLZ4BlockSnappyAsm should be unreachable")
-}
-
-func cvtLZ4sBlockAsm(dst []byte, src []byte) (uncompressed int, dstUsed int) {
- panic("cvtLZ4sBlockAsm should be unreachable")
-}
-
-func cvtLZ4sBlockSnappyAsm(dst []byte, src []byte) (uncompressed int, dstUsed int) {
- panic("cvtLZ4sBlockSnappyAsm should be unreachable")
-}
diff --git a/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.go b/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.go
deleted file mode 100644
index f43aa8154..000000000
--- a/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.go
+++ /dev/null
@@ -1,228 +0,0 @@
-// Code generated by command: go run gen.go -out ../encodeblock_amd64.s -stubs ../encodeblock_amd64.go -pkg=s2. DO NOT EDIT.
-
-//go:build !appengine && !noasm && gc && !noasm
-
-package s2
-
-func _dummy_()
-
-// encodeBlockAsm encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4294967295 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBlockAsm(dst []byte, src []byte, tmp *[65536]byte) int
-
-// encodeBlockAsm4MB encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4194304 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBlockAsm4MB(dst []byte, src []byte, tmp *[65536]byte) int
-
-// encodeBlockAsm12B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 16383 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBlockAsm12B(dst []byte, src []byte, tmp *[16384]byte) int
-
-// encodeBlockAsm10B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4095 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBlockAsm10B(dst []byte, src []byte, tmp *[4096]byte) int
-
-// encodeBlockAsm8B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 511 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBlockAsm8B(dst []byte, src []byte, tmp *[1024]byte) int
-
-// encodeBetterBlockAsm encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4294967295 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBetterBlockAsm(dst []byte, src []byte, tmp *[589824]byte) int
-
-// encodeBetterBlockAsm4MB encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4194304 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBetterBlockAsm4MB(dst []byte, src []byte, tmp *[589824]byte) int
-
-// encodeBetterBlockAsm12B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 16383 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBetterBlockAsm12B(dst []byte, src []byte, tmp *[81920]byte) int
-
-// encodeBetterBlockAsm10B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4095 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBetterBlockAsm10B(dst []byte, src []byte, tmp *[20480]byte) int
-
-// encodeBetterBlockAsm8B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 511 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeBetterBlockAsm8B(dst []byte, src []byte, tmp *[5120]byte) int
-
-// encodeSnappyBlockAsm encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4294967295 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBlockAsm(dst []byte, src []byte, tmp *[65536]byte) int
-
-// encodeSnappyBlockAsm64K encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 65535 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBlockAsm64K(dst []byte, src []byte, tmp *[65536]byte) int
-
-// encodeSnappyBlockAsm12B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 16383 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBlockAsm12B(dst []byte, src []byte, tmp *[16384]byte) int
-
-// encodeSnappyBlockAsm10B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4095 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBlockAsm10B(dst []byte, src []byte, tmp *[4096]byte) int
-
-// encodeSnappyBlockAsm8B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 511 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBlockAsm8B(dst []byte, src []byte, tmp *[1024]byte) int
-
-// encodeSnappyBetterBlockAsm encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4294967295 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBetterBlockAsm(dst []byte, src []byte, tmp *[589824]byte) int
-
-// encodeSnappyBetterBlockAsm64K encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 65535 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBetterBlockAsm64K(dst []byte, src []byte, tmp *[294912]byte) int
-
-// encodeSnappyBetterBlockAsm12B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 16383 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBetterBlockAsm12B(dst []byte, src []byte, tmp *[81920]byte) int
-
-// encodeSnappyBetterBlockAsm10B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4095 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBetterBlockAsm10B(dst []byte, src []byte, tmp *[20480]byte) int
-
-// encodeSnappyBetterBlockAsm8B encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 511 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func encodeSnappyBetterBlockAsm8B(dst []byte, src []byte, tmp *[5120]byte) int
-
-// calcBlockSize encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 4294967295 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func calcBlockSize(src []byte, tmp *[32768]byte) int
-
-// calcBlockSizeSmall encodes a non-empty src to a guaranteed-large-enough dst.
-// Maximum input 1024 bytes.
-// It assumes that the varint-encoded length of the decompressed bytes has already been written.
-//
-//go:noescape
-func calcBlockSizeSmall(src []byte, tmp *[2048]byte) int
-
-// emitLiteral writes a literal chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes with margin of 0 bytes
-// 0 <= len(lit) && len(lit) <= math.MaxUint32
-//
-//go:noescape
-func emitLiteral(dst []byte, lit []byte) int
-
-// emitRepeat writes a repeat chunk and returns the number of bytes written.
-// Length must be at least 4 and < 1<<32
-//
-//go:noescape
-func emitRepeat(dst []byte, offset int, length int) int
-
-// emitCopy writes a copy chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 1 <= offset && offset <= math.MaxUint32
-// 4 <= length && length <= 1 << 24
-//
-//go:noescape
-func emitCopy(dst []byte, offset int, length int) int
-
-// emitCopyNoRepeat writes a copy chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 1 <= offset && offset <= math.MaxUint32
-// 4 <= length && length <= 1 << 24
-//
-//go:noescape
-func emitCopyNoRepeat(dst []byte, offset int, length int) int
-
-// matchLen returns how many bytes match in a and b
-//
-// It assumes that:
-//
-// len(a) <= len(b)
-//
-//go:noescape
-func matchLen(a []byte, b []byte) int
-
-// cvtLZ4Block converts an LZ4 block to S2
-//
-//go:noescape
-func cvtLZ4BlockAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-
-// cvtLZ4sBlock converts an LZ4s block to S2
-//
-//go:noescape
-func cvtLZ4sBlockAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-
-// cvtLZ4Block converts an LZ4 block to Snappy
-//
-//go:noescape
-func cvtLZ4BlockSnappyAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-
-// cvtLZ4sBlock converts an LZ4s block to Snappy
-//
-//go:noescape
-func cvtLZ4sBlockSnappyAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
diff --git a/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s b/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s
deleted file mode 100644
index df9be687b..000000000
--- a/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s
+++ /dev/null
@@ -1,21303 +0,0 @@
-// Code generated by command: go run gen.go -out ../encodeblock_amd64.s -stubs ../encodeblock_amd64.go -pkg=s2. DO NOT EDIT.
-
-//go:build !appengine && !noasm && gc && !noasm
-
-#include "textflag.h"
-
-// func _dummy_()
-TEXT ·_dummy_(SB), $0
-#ifdef GOAMD64_v4
-#ifndef GOAMD64_v3
-#define GOAMD64_v3
-#endif
-#endif
- RET
-
-// func encodeBlockAsm(dst []byte, src []byte, tmp *[65536]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBlockAsm(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBlockAsm:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBlockAsm
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBlockAsm:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x06, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBlockAsm
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- SHLQ $0x10, R11
- IMULQ R9, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeBlockAsm
- LEAL 1(DX), DI
- MOVL 12(SP), R8
- MOVL DI, SI
- SUBL 16(SP), SI
- JZ repeat_extend_back_end_encodeBlockAsm
-
-repeat_extend_back_loop_encodeBlockAsm:
- CMPL DI, R8
- JBE repeat_extend_back_end_encodeBlockAsm
- MOVB -1(BX)(SI*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeBlockAsm
- LEAL -1(DI), DI
- DECL SI
- JNZ repeat_extend_back_loop_encodeBlockAsm
-
-repeat_extend_back_end_encodeBlockAsm:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 5(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeBlockAsm:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeBlockAsm
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeBlockAsm
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeBlockAsm
- CMPL SI, $0x00010000
- JB three_bytes_repeat_emit_encodeBlockAsm
- CMPL SI, $0x01000000
- JB four_bytes_repeat_emit_encodeBlockAsm
- MOVB $0xfc, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm
-
-four_bytes_repeat_emit_encodeBlockAsm:
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm
-
-three_bytes_repeat_emit_encodeBlockAsm:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm
-
-two_bytes_repeat_emit_encodeBlockAsm:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeBlockAsm
- JMP memmove_long_repeat_emit_encodeBlockAsm
-
-one_byte_repeat_emit_encodeBlockAsm:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_repeat_emit_encodeBlockAsm:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeBlockAsm
-
-memmove_long_repeat_emit_encodeBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R12
- SHRQ $0x05, R12
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_repeat_emit_encodeBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(R10)(R13*1), R11
- LEAQ -32(CX)(R13*1), R14
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsmlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_repeat_emit_encodeBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R13*1), X4
- MOVOU -16(R10)(R13*1), X5
- MOVOA X4, -32(CX)(R13*1)
- MOVOA X5, -16(CX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R9, R13
- JAE emit_lit_memmove_long_repeat_emit_encodeBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeBlockAsm:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R9
- SUBL DX, R9
- LEAQ (BX)(DX*1), R10
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_repeat_extend_encodeBlockAsm:
- CMPL R9, $0x10
- JB matchlen_match8_repeat_extend_encodeBlockAsm
- MOVQ (R10)(R12*1), R11
- MOVQ 8(R10)(R12*1), R13
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm
- XORQ 8(SI)(R12*1), R13
- JNZ matchlen_bsf_16repeat_extend_encodeBlockAsm
- LEAL -16(R9), R9
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_repeat_extend_encodeBlockAsm
-
-matchlen_bsf_16repeat_extend_encodeBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm
-
-matchlen_match8_repeat_extend_encodeBlockAsm:
- CMPL R9, $0x08
- JB matchlen_match4_repeat_extend_encodeBlockAsm
- MOVQ (R10)(R12*1), R11
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm
- LEAL -8(R9), R9
- LEAL 8(R12), R12
- JMP matchlen_match4_repeat_extend_encodeBlockAsm
-
-matchlen_bsf_8_repeat_extend_encodeBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm
-
-matchlen_match4_repeat_extend_encodeBlockAsm:
- CMPL R9, $0x04
- JB matchlen_match2_repeat_extend_encodeBlockAsm
- MOVL (R10)(R12*1), R11
- CMPL (SI)(R12*1), R11
- JNE matchlen_match2_repeat_extend_encodeBlockAsm
- LEAL -4(R9), R9
- LEAL 4(R12), R12
-
-matchlen_match2_repeat_extend_encodeBlockAsm:
- CMPL R9, $0x01
- JE matchlen_match1_repeat_extend_encodeBlockAsm
- JB repeat_extend_forward_end_encodeBlockAsm
- MOVW (R10)(R12*1), R11
- CMPW (SI)(R12*1), R11
- JNE matchlen_match1_repeat_extend_encodeBlockAsm
- LEAL 2(R12), R12
- SUBL $0x02, R9
- JZ repeat_extend_forward_end_encodeBlockAsm
-
-matchlen_match1_repeat_extend_encodeBlockAsm:
- MOVB (R10)(R12*1), R11
- CMPB (SI)(R12*1), R11
- JNE repeat_extend_forward_end_encodeBlockAsm
- LEAL 1(R12), R12
-
-repeat_extend_forward_end_encodeBlockAsm:
- ADDL R12, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
- TESTL R8, R8
- JZ repeat_as_copy_encodeBlockAsm
-
- // emitRepeat
-emit_repeat_again_match_repeat_encodeBlockAsm:
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_match_repeat_encodeBlockAsm
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm
- CMPL DI, $0x00000800
- JB repeat_two_offset_match_repeat_encodeBlockAsm
-
-cant_repeat_two_offset_match_repeat_encodeBlockAsm:
- CMPL SI, $0x00000104
- JB repeat_three_match_repeat_encodeBlockAsm
- CMPL SI, $0x00010100
- JB repeat_four_match_repeat_encodeBlockAsm
- CMPL SI, $0x0100ffff
- JB repeat_five_match_repeat_encodeBlockAsm
- LEAL -16842747(SI), SI
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_repeat_encodeBlockAsm
-
-repeat_five_match_repeat_encodeBlockAsm:
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_four_match_repeat_encodeBlockAsm:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_three_match_repeat_encodeBlockAsm:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_match_repeat_encodeBlockAsm:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_offset_match_repeat_encodeBlockAsm:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_as_copy_encodeBlockAsm:
- // emitCopy
- CMPL DI, $0x00010000
- JB two_byte_offset_repeat_as_copy_encodeBlockAsm
- CMPL SI, $0x40
- JBE four_bytes_remain_repeat_as_copy_encodeBlockAsm
- MOVB $0xff, (CX)
- MOVL DI, 1(CX)
- LEAL -64(SI), SI
- ADDQ $0x05, CX
- CMPL SI, $0x04
- JB four_bytes_remain_repeat_as_copy_encodeBlockAsm
-
- // emitRepeat
-emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy:
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy
- CMPL SI, $0x00010100
- JB repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy
- CMPL SI, $0x0100ffff
- JB repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy
- LEAL -16842747(SI), SI
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy
-
-repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy:
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-four_bytes_remain_repeat_as_copy_encodeBlockAsm:
- TESTL SI, SI
- JZ repeat_end_emit_encodeBlockAsm
- XORL R8, R8
- LEAL -1(R8)(SI*4), SI
- MOVB SI, (CX)
- MOVL DI, 1(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-two_byte_offset_repeat_as_copy_encodeBlockAsm:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm
- CMPL DI, $0x00000800
- JAE long_offset_short_repeat_as_copy_encodeBlockAsm
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB DI, 1(CX)
- MOVL DI, R9
- SHRL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, SI
-
- // emitRepeat
- LEAL -4(SI), SI
- JMP cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
-
-emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
- CMPL SI, $0x00010100
- JB repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
- CMPL SI, $0x0100ffff
- JB repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
- LEAL -16842747(SI), SI
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b
-
-repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-long_offset_short_repeat_as_copy_encodeBlockAsm:
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
-
- // emitRepeat
-emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short
- CMPL SI, $0x00010100
- JB repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short
- CMPL SI, $0x0100ffff
- JB repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short
- LEAL -16842747(SI), SI
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy_short
-
-repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-two_byte_offset_short_repeat_as_copy_encodeBlockAsm:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm
-
-emit_copy_three_repeat_as_copy_encodeBlockAsm:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeBlockAsm:
- MOVL DX, 12(SP)
- JMP search_loop_encodeBlockAsm
-
-no_repeat_found_encodeBlockAsm:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBlockAsm
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeBlockAsm
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeBlockAsm
- MOVL 20(SP), DX
- JMP search_loop_encodeBlockAsm
-
-candidate3_match_encodeBlockAsm:
- ADDL $0x02, DX
- JMP candidate_match_encodeBlockAsm
-
-candidate2_match_encodeBlockAsm:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeBlockAsm:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBlockAsm
-
-match_extend_back_loop_encodeBlockAsm:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBlockAsm
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBlockAsm
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBlockAsm
- JMP match_extend_back_loop_encodeBlockAsm
-
-match_extend_back_end_encodeBlockAsm:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 5(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBlockAsm:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeBlockAsm
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeBlockAsm
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeBlockAsm
- CMPL R8, $0x00010000
- JB three_bytes_match_emit_encodeBlockAsm
- CMPL R8, $0x01000000
- JB four_bytes_match_emit_encodeBlockAsm
- MOVB $0xfc, (CX)
- MOVL R8, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_match_emit_encodeBlockAsm
-
-four_bytes_match_emit_encodeBlockAsm:
- MOVL R8, R10
- SHRL $0x10, R10
- MOVB $0xf8, (CX)
- MOVW R8, 1(CX)
- MOVB R10, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_encodeBlockAsm
-
-three_bytes_match_emit_encodeBlockAsm:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBlockAsm
-
-two_bytes_match_emit_encodeBlockAsm:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeBlockAsm
- JMP memmove_long_match_emit_encodeBlockAsm
-
-one_byte_match_emit_encodeBlockAsm:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBlockAsm:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeBlockAsm
-
-emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm
-
-emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm
-
-emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBlockAsm:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeBlockAsm
-
-memmove_long_match_emit_encodeBlockAsm:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeBlockAsmlarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeBlockAsm:
-match_nolit_loop_encodeBlockAsm:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeBlockAsm:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeBlockAsm
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeBlockAsm
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeBlockAsm
-
-matchlen_bsf_16match_nolit_encodeBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeBlockAsm
-
-matchlen_match8_match_nolit_encodeBlockAsm:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeBlockAsm
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeBlockAsm
-
-matchlen_bsf_8_match_nolit_encodeBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeBlockAsm
-
-matchlen_match4_match_nolit_encodeBlockAsm:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeBlockAsm
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeBlockAsm
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeBlockAsm:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeBlockAsm
- JB match_nolit_end_encodeBlockAsm
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeBlockAsm
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeBlockAsm
-
-matchlen_match1_match_nolit_encodeBlockAsm:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeBlockAsm
- LEAL 1(R10), R10
-
-match_nolit_end_encodeBlockAsm:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL SI, $0x00010000
- JB two_byte_offset_match_nolit_encodeBlockAsm
- CMPL R10, $0x40
- JBE four_bytes_remain_match_nolit_encodeBlockAsm
- MOVB $0xff, (CX)
- MOVL SI, 1(CX)
- LEAL -64(R10), R10
- ADDQ $0x05, CX
- CMPL R10, $0x04
- JB four_bytes_remain_match_nolit_encodeBlockAsm
-
- // emitRepeat
-emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy:
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm_emit_copy
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm_emit_copy
- CMPL R10, $0x00010100
- JB repeat_four_match_nolit_encodeBlockAsm_emit_copy
- CMPL R10, $0x0100ffff
- JB repeat_five_match_nolit_encodeBlockAsm_emit_copy
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy
-
-repeat_five_match_nolit_encodeBlockAsm_emit_copy:
- LEAL -65536(R10), R10
- MOVL R10, SI
- MOVW $0x001d, (CX)
- MOVW R10, 2(CX)
- SARL $0x10, SI
- MOVB SI, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_four_match_nolit_encodeBlockAsm_emit_copy:
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_three_match_nolit_encodeBlockAsm_emit_copy:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_two_match_nolit_encodeBlockAsm_emit_copy:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-four_bytes_remain_match_nolit_encodeBlockAsm:
- TESTL R10, R10
- JZ match_nolit_emitcopy_end_encodeBlockAsm
- XORL DI, DI
- LEAL -1(DI)(R10*4), R10
- MOVB R10, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-two_byte_offset_match_nolit_encodeBlockAsm:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBlockAsm
- CMPL SI, $0x00000800
- JAE long_offset_short_match_nolit_encodeBlockAsm
- MOVL $0x00000001, DI
- LEAL 16(DI), DI
- MOVB SI, 1(CX)
- MOVL SI, R8
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b
-
-emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm_emit_copy_short_2b
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm_emit_copy_short_2b
- CMPL R10, $0x00010100
- JB repeat_four_match_nolit_encodeBlockAsm_emit_copy_short_2b
- CMPL R10, $0x0100ffff
- JB repeat_five_match_nolit_encodeBlockAsm_emit_copy_short_2b
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy_short_2b
-
-repeat_five_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- LEAL -65536(R10), R10
- MOVL R10, SI
- MOVW $0x001d, (CX)
- MOVW R10, 2(CX)
- SARL $0x10, SI
- MOVB SI, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_four_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_three_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_two_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-long_offset_short_match_nolit_encodeBlockAsm:
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
-
- // emitRepeat
-emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy_short:
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm_emit_copy_short
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm_emit_copy_short
- CMPL R10, $0x00010100
- JB repeat_four_match_nolit_encodeBlockAsm_emit_copy_short
- CMPL R10, $0x0100ffff
- JB repeat_five_match_nolit_encodeBlockAsm_emit_copy_short
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy_short
-
-repeat_five_match_nolit_encodeBlockAsm_emit_copy_short:
- LEAL -65536(R10), R10
- MOVL R10, SI
- MOVW $0x001d, (CX)
- MOVW R10, 2(CX)
- SARL $0x10, SI
- MOVB SI, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_four_match_nolit_encodeBlockAsm_emit_copy_short:
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_three_match_nolit_encodeBlockAsm_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_two_match_nolit_encodeBlockAsm_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-two_byte_offset_short_match_nolit_encodeBlockAsm:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeBlockAsm
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBlockAsm
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm
-
-emit_copy_three_match_nolit_encodeBlockAsm:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeBlockAsm:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBlockAsm
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBlockAsm:
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x10, R8
- IMULQ R9, R8
- SHRQ $0x32, R8
- SHLQ $0x10, SI
- IMULQ R9, SI
- SHRQ $0x32, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeBlockAsm
- INCL DX
- JMP search_loop_encodeBlockAsm
-
-emit_remainder_encodeBlockAsm:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 5(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBlockAsm:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBlockAsm
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBlockAsm
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBlockAsm
- CMPL DX, $0x00010000
- JB three_bytes_emit_remainder_encodeBlockAsm
- CMPL DX, $0x01000000
- JB four_bytes_emit_remainder_encodeBlockAsm
- MOVB $0xfc, (CX)
- MOVL DX, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm
-
-four_bytes_emit_remainder_encodeBlockAsm:
- MOVL DX, BX
- SHRL $0x10, BX
- MOVB $0xf8, (CX)
- MOVW DX, 1(CX)
- MOVB BL, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm
-
-three_bytes_emit_remainder_encodeBlockAsm:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm
-
-two_bytes_emit_remainder_encodeBlockAsm:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBlockAsm
- JMP memmove_long_emit_remainder_encodeBlockAsm
-
-one_byte_emit_remainder_encodeBlockAsm:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBlockAsm:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBlockAsm
-
-memmove_long_emit_remainder_encodeBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsmlarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBlockAsm:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBlockAsm4MB(dst []byte, src []byte, tmp *[65536]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBlockAsm4MB(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBlockAsm4MB:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBlockAsm4MB
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBlockAsm4MB:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x06, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBlockAsm4MB
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- SHLQ $0x10, R11
- IMULQ R9, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeBlockAsm4MB
- LEAL 1(DX), DI
- MOVL 12(SP), R8
- MOVL DI, SI
- SUBL 16(SP), SI
- JZ repeat_extend_back_end_encodeBlockAsm4MB
-
-repeat_extend_back_loop_encodeBlockAsm4MB:
- CMPL DI, R8
- JBE repeat_extend_back_end_encodeBlockAsm4MB
- MOVB -1(BX)(SI*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeBlockAsm4MB
- LEAL -1(DI), DI
- DECL SI
- JNZ repeat_extend_back_loop_encodeBlockAsm4MB
-
-repeat_extend_back_end_encodeBlockAsm4MB:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 4(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeBlockAsm4MB:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeBlockAsm4MB
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeBlockAsm4MB
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeBlockAsm4MB
- CMPL SI, $0x00010000
- JB three_bytes_repeat_emit_encodeBlockAsm4MB
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm4MB
-
-three_bytes_repeat_emit_encodeBlockAsm4MB:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm4MB
-
-two_bytes_repeat_emit_encodeBlockAsm4MB:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeBlockAsm4MB
- JMP memmove_long_repeat_emit_encodeBlockAsm4MB
-
-one_byte_repeat_emit_encodeBlockAsm4MB:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeBlockAsm4MB:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm4MB
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm4MB
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm4MB
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_repeat_emit_encodeBlockAsm4MB:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeBlockAsm4MB
-
-memmove_long_repeat_emit_encodeBlockAsm4MB:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R12
- SHRQ $0x05, R12
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_repeat_emit_encodeBlockAsm4MBlarge_forward_sse_loop_32
- LEAQ -32(R10)(R13*1), R11
- LEAQ -32(CX)(R13*1), R14
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm4MBlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_repeat_emit_encodeBlockAsm4MBlarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm4MBlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R13*1), X4
- MOVOU -16(R10)(R13*1), X5
- MOVOA X4, -32(CX)(R13*1)
- MOVOA X5, -16(CX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R9, R13
- JAE emit_lit_memmove_long_repeat_emit_encodeBlockAsm4MBlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeBlockAsm4MB:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R9
- SUBL DX, R9
- LEAQ (BX)(DX*1), R10
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_repeat_extend_encodeBlockAsm4MB:
- CMPL R9, $0x10
- JB matchlen_match8_repeat_extend_encodeBlockAsm4MB
- MOVQ (R10)(R12*1), R11
- MOVQ 8(R10)(R12*1), R13
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm4MB
- XORQ 8(SI)(R12*1), R13
- JNZ matchlen_bsf_16repeat_extend_encodeBlockAsm4MB
- LEAL -16(R9), R9
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_repeat_extend_encodeBlockAsm4MB
-
-matchlen_bsf_16repeat_extend_encodeBlockAsm4MB:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm4MB
-
-matchlen_match8_repeat_extend_encodeBlockAsm4MB:
- CMPL R9, $0x08
- JB matchlen_match4_repeat_extend_encodeBlockAsm4MB
- MOVQ (R10)(R12*1), R11
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm4MB
- LEAL -8(R9), R9
- LEAL 8(R12), R12
- JMP matchlen_match4_repeat_extend_encodeBlockAsm4MB
-
-matchlen_bsf_8_repeat_extend_encodeBlockAsm4MB:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm4MB
-
-matchlen_match4_repeat_extend_encodeBlockAsm4MB:
- CMPL R9, $0x04
- JB matchlen_match2_repeat_extend_encodeBlockAsm4MB
- MOVL (R10)(R12*1), R11
- CMPL (SI)(R12*1), R11
- JNE matchlen_match2_repeat_extend_encodeBlockAsm4MB
- LEAL -4(R9), R9
- LEAL 4(R12), R12
-
-matchlen_match2_repeat_extend_encodeBlockAsm4MB:
- CMPL R9, $0x01
- JE matchlen_match1_repeat_extend_encodeBlockAsm4MB
- JB repeat_extend_forward_end_encodeBlockAsm4MB
- MOVW (R10)(R12*1), R11
- CMPW (SI)(R12*1), R11
- JNE matchlen_match1_repeat_extend_encodeBlockAsm4MB
- LEAL 2(R12), R12
- SUBL $0x02, R9
- JZ repeat_extend_forward_end_encodeBlockAsm4MB
-
-matchlen_match1_repeat_extend_encodeBlockAsm4MB:
- MOVB (R10)(R12*1), R11
- CMPB (SI)(R12*1), R11
- JNE repeat_extend_forward_end_encodeBlockAsm4MB
- LEAL 1(R12), R12
-
-repeat_extend_forward_end_encodeBlockAsm4MB:
- ADDL R12, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
- TESTL R8, R8
- JZ repeat_as_copy_encodeBlockAsm4MB
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_match_repeat_encodeBlockAsm4MB
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm4MB
- CMPL DI, $0x00000800
- JB repeat_two_offset_match_repeat_encodeBlockAsm4MB
-
-cant_repeat_two_offset_match_repeat_encodeBlockAsm4MB:
- CMPL SI, $0x00000104
- JB repeat_three_match_repeat_encodeBlockAsm4MB
- CMPL SI, $0x00010100
- JB repeat_four_match_repeat_encodeBlockAsm4MB
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_four_match_repeat_encodeBlockAsm4MB:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_three_match_repeat_encodeBlockAsm4MB:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_match_repeat_encodeBlockAsm4MB:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_offset_match_repeat_encodeBlockAsm4MB:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_as_copy_encodeBlockAsm4MB:
- // emitCopy
- CMPL DI, $0x00010000
- JB two_byte_offset_repeat_as_copy_encodeBlockAsm4MB
- CMPL SI, $0x40
- JBE four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB
- MOVB $0xff, (CX)
- MOVL DI, 1(CX)
- LEAL -64(SI), SI
- ADDQ $0x05, CX
- CMPL SI, $0x04
- JB four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy
- CMPL SI, $0x00010100
- JB repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB:
- TESTL SI, SI
- JZ repeat_end_emit_encodeBlockAsm4MB
- XORL R8, R8
- LEAL -1(R8)(SI*4), SI
- MOVB SI, (CX)
- MOVL DI, 1(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-two_byte_offset_repeat_as_copy_encodeBlockAsm4MB:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm4MB
- CMPL DI, $0x00000800
- JAE long_offset_short_repeat_as_copy_encodeBlockAsm4MB
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, SI
-
- // emitRepeat
- LEAL -4(SI), SI
- JMP cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b
- CMPL SI, $0x00010100
- JB repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-long_offset_short_repeat_as_copy_encodeBlockAsm4MB:
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short
- CMPL SI, $0x00010100
- JB repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short
- LEAL -65536(SI), SI
- MOVL SI, DI
- MOVW $0x001d, (CX)
- MOVW SI, 2(CX)
- SARL $0x10, DI
- MOVB DI, 4(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short:
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-two_byte_offset_short_repeat_as_copy_encodeBlockAsm4MB:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm4MB
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm4MB
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm4MB
-
-emit_copy_three_repeat_as_copy_encodeBlockAsm4MB:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeBlockAsm4MB:
- MOVL DX, 12(SP)
- JMP search_loop_encodeBlockAsm4MB
-
-no_repeat_found_encodeBlockAsm4MB:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBlockAsm4MB
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeBlockAsm4MB
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeBlockAsm4MB
- MOVL 20(SP), DX
- JMP search_loop_encodeBlockAsm4MB
-
-candidate3_match_encodeBlockAsm4MB:
- ADDL $0x02, DX
- JMP candidate_match_encodeBlockAsm4MB
-
-candidate2_match_encodeBlockAsm4MB:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeBlockAsm4MB:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBlockAsm4MB
-
-match_extend_back_loop_encodeBlockAsm4MB:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBlockAsm4MB
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBlockAsm4MB
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBlockAsm4MB
- JMP match_extend_back_loop_encodeBlockAsm4MB
-
-match_extend_back_end_encodeBlockAsm4MB:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 4(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBlockAsm4MB:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeBlockAsm4MB
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeBlockAsm4MB
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeBlockAsm4MB
- CMPL R8, $0x00010000
- JB three_bytes_match_emit_encodeBlockAsm4MB
- MOVL R8, R10
- SHRL $0x10, R10
- MOVB $0xf8, (CX)
- MOVW R8, 1(CX)
- MOVB R10, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_encodeBlockAsm4MB
-
-three_bytes_match_emit_encodeBlockAsm4MB:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBlockAsm4MB
-
-two_bytes_match_emit_encodeBlockAsm4MB:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeBlockAsm4MB
- JMP memmove_long_match_emit_encodeBlockAsm4MB
-
-one_byte_match_emit_encodeBlockAsm4MB:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBlockAsm4MB:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBlockAsm4MB:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeBlockAsm4MB
-
-memmove_long_match_emit_encodeBlockAsm4MB:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeBlockAsm4MBlarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm4MBlarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeBlockAsm4MBlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm4MBlarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeBlockAsm4MBlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeBlockAsm4MB:
-match_nolit_loop_encodeBlockAsm4MB:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeBlockAsm4MB:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeBlockAsm4MB
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm4MB
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeBlockAsm4MB
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeBlockAsm4MB
-
-matchlen_bsf_16match_nolit_encodeBlockAsm4MB:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeBlockAsm4MB
-
-matchlen_match8_match_nolit_encodeBlockAsm4MB:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeBlockAsm4MB
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm4MB
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeBlockAsm4MB
-
-matchlen_bsf_8_match_nolit_encodeBlockAsm4MB:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeBlockAsm4MB
-
-matchlen_match4_match_nolit_encodeBlockAsm4MB:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeBlockAsm4MB
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeBlockAsm4MB
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeBlockAsm4MB:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeBlockAsm4MB
- JB match_nolit_end_encodeBlockAsm4MB
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeBlockAsm4MB
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeBlockAsm4MB
-
-matchlen_match1_match_nolit_encodeBlockAsm4MB:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeBlockAsm4MB
- LEAL 1(R10), R10
-
-match_nolit_end_encodeBlockAsm4MB:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL SI, $0x00010000
- JB two_byte_offset_match_nolit_encodeBlockAsm4MB
- CMPL R10, $0x40
- JBE four_bytes_remain_match_nolit_encodeBlockAsm4MB
- MOVB $0xff, (CX)
- MOVL SI, 1(CX)
- LEAL -64(R10), R10
- ADDQ $0x05, CX
- CMPL R10, $0x04
- JB four_bytes_remain_match_nolit_encodeBlockAsm4MB
-
- // emitRepeat
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy
- CMPL R10, $0x00010100
- JB repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy
- LEAL -65536(R10), R10
- MOVL R10, SI
- MOVW $0x001d, (CX)
- MOVW R10, 2(CX)
- SARL $0x10, SI
- MOVB SI, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy:
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-four_bytes_remain_match_nolit_encodeBlockAsm4MB:
- TESTL R10, R10
- JZ match_nolit_emitcopy_end_encodeBlockAsm4MB
- XORL DI, DI
- LEAL -1(DI)(R10*4), R10
- MOVB R10, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-two_byte_offset_match_nolit_encodeBlockAsm4MB:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBlockAsm4MB
- CMPL SI, $0x00000800
- JAE long_offset_short_match_nolit_encodeBlockAsm4MB
- MOVL $0x00000001, DI
- LEAL 16(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b
- CMPL R10, $0x00010100
- JB repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b
- LEAL -65536(R10), R10
- MOVL R10, SI
- MOVW $0x001d, (CX)
- MOVW R10, 2(CX)
- SARL $0x10, SI
- MOVB SI, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b:
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-long_offset_short_match_nolit_encodeBlockAsm4MB:
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short
- CMPL R10, $0x00010100
- JB repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short
- LEAL -65536(R10), R10
- MOVL R10, SI
- MOVW $0x001d, (CX)
- MOVW R10, 2(CX)
- SARL $0x10, SI
- MOVB SI, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short:
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-two_byte_offset_short_match_nolit_encodeBlockAsm4MB:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeBlockAsm4MB
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBlockAsm4MB
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm4MB
-
-emit_copy_three_match_nolit_encodeBlockAsm4MB:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeBlockAsm4MB:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBlockAsm4MB
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBlockAsm4MB:
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x10, R8
- IMULQ R9, R8
- SHRQ $0x32, R8
- SHLQ $0x10, SI
- IMULQ R9, SI
- SHRQ $0x32, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeBlockAsm4MB
- INCL DX
- JMP search_loop_encodeBlockAsm4MB
-
-emit_remainder_encodeBlockAsm4MB:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 4(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBlockAsm4MB:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBlockAsm4MB
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBlockAsm4MB
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBlockAsm4MB
- CMPL DX, $0x00010000
- JB three_bytes_emit_remainder_encodeBlockAsm4MB
- MOVL DX, BX
- SHRL $0x10, BX
- MOVB $0xf8, (CX)
- MOVW DX, 1(CX)
- MOVB BL, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm4MB
-
-three_bytes_emit_remainder_encodeBlockAsm4MB:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm4MB
-
-two_bytes_emit_remainder_encodeBlockAsm4MB:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBlockAsm4MB
- JMP memmove_long_emit_remainder_encodeBlockAsm4MB
-
-one_byte_emit_remainder_encodeBlockAsm4MB:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBlockAsm4MB:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm4MB_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBlockAsm4MB:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBlockAsm4MB
-
-memmove_long_emit_remainder_encodeBlockAsm4MB:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBlockAsm4MBlarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm4MBlarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBlockAsm4MBlarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm4MBlarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBlockAsm4MBlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBlockAsm4MB:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBlockAsm12B(dst []byte, src []byte, tmp *[16384]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBlockAsm12B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000080, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBlockAsm12B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBlockAsm12B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBlockAsm12B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBlockAsm12B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x000000cf1bbcdcbb, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x18, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- SHLQ $0x18, R11
- IMULQ R9, R11
- SHRQ $0x34, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x18, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeBlockAsm12B
- LEAL 1(DX), DI
- MOVL 12(SP), R8
- MOVL DI, SI
- SUBL 16(SP), SI
- JZ repeat_extend_back_end_encodeBlockAsm12B
-
-repeat_extend_back_loop_encodeBlockAsm12B:
- CMPL DI, R8
- JBE repeat_extend_back_end_encodeBlockAsm12B
- MOVB -1(BX)(SI*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeBlockAsm12B
- LEAL -1(DI), DI
- DECL SI
- JNZ repeat_extend_back_loop_encodeBlockAsm12B
-
-repeat_extend_back_end_encodeBlockAsm12B:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeBlockAsm12B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeBlockAsm12B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeBlockAsm12B
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeBlockAsm12B
- JB three_bytes_repeat_emit_encodeBlockAsm12B
-
-three_bytes_repeat_emit_encodeBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm12B
-
-two_bytes_repeat_emit_encodeBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeBlockAsm12B
- JMP memmove_long_repeat_emit_encodeBlockAsm12B
-
-one_byte_repeat_emit_encodeBlockAsm12B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm12B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm12B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm12B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_repeat_emit_encodeBlockAsm12B:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeBlockAsm12B
-
-memmove_long_repeat_emit_encodeBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R12
- SHRQ $0x05, R12
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_repeat_emit_encodeBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R13*1), R11
- LEAQ -32(CX)(R13*1), R14
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm12Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_repeat_emit_encodeBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R13*1), X4
- MOVOU -16(R10)(R13*1), X5
- MOVOA X4, -32(CX)(R13*1)
- MOVOA X5, -16(CX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R9, R13
- JAE emit_lit_memmove_long_repeat_emit_encodeBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeBlockAsm12B:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R9
- SUBL DX, R9
- LEAQ (BX)(DX*1), R10
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_repeat_extend_encodeBlockAsm12B:
- CMPL R9, $0x10
- JB matchlen_match8_repeat_extend_encodeBlockAsm12B
- MOVQ (R10)(R12*1), R11
- MOVQ 8(R10)(R12*1), R13
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm12B
- XORQ 8(SI)(R12*1), R13
- JNZ matchlen_bsf_16repeat_extend_encodeBlockAsm12B
- LEAL -16(R9), R9
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_repeat_extend_encodeBlockAsm12B
-
-matchlen_bsf_16repeat_extend_encodeBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm12B
-
-matchlen_match8_repeat_extend_encodeBlockAsm12B:
- CMPL R9, $0x08
- JB matchlen_match4_repeat_extend_encodeBlockAsm12B
- MOVQ (R10)(R12*1), R11
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm12B
- LEAL -8(R9), R9
- LEAL 8(R12), R12
- JMP matchlen_match4_repeat_extend_encodeBlockAsm12B
-
-matchlen_bsf_8_repeat_extend_encodeBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm12B
-
-matchlen_match4_repeat_extend_encodeBlockAsm12B:
- CMPL R9, $0x04
- JB matchlen_match2_repeat_extend_encodeBlockAsm12B
- MOVL (R10)(R12*1), R11
- CMPL (SI)(R12*1), R11
- JNE matchlen_match2_repeat_extend_encodeBlockAsm12B
- LEAL -4(R9), R9
- LEAL 4(R12), R12
-
-matchlen_match2_repeat_extend_encodeBlockAsm12B:
- CMPL R9, $0x01
- JE matchlen_match1_repeat_extend_encodeBlockAsm12B
- JB repeat_extend_forward_end_encodeBlockAsm12B
- MOVW (R10)(R12*1), R11
- CMPW (SI)(R12*1), R11
- JNE matchlen_match1_repeat_extend_encodeBlockAsm12B
- LEAL 2(R12), R12
- SUBL $0x02, R9
- JZ repeat_extend_forward_end_encodeBlockAsm12B
-
-matchlen_match1_repeat_extend_encodeBlockAsm12B:
- MOVB (R10)(R12*1), R11
- CMPB (SI)(R12*1), R11
- JNE repeat_extend_forward_end_encodeBlockAsm12B
- LEAL 1(R12), R12
-
-repeat_extend_forward_end_encodeBlockAsm12B:
- ADDL R12, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
- TESTL R8, R8
- JZ repeat_as_copy_encodeBlockAsm12B
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_match_repeat_encodeBlockAsm12B
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm12B
- CMPL DI, $0x00000800
- JB repeat_two_offset_match_repeat_encodeBlockAsm12B
-
-cant_repeat_two_offset_match_repeat_encodeBlockAsm12B:
- CMPL SI, $0x00000104
- JB repeat_three_match_repeat_encodeBlockAsm12B
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_three_match_repeat_encodeBlockAsm12B:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_two_match_repeat_encodeBlockAsm12B:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_two_offset_match_repeat_encodeBlockAsm12B:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_as_copy_encodeBlockAsm12B:
- // emitCopy
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm12B
- CMPL DI, $0x00000800
- JAE long_offset_short_repeat_as_copy_encodeBlockAsm12B
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, SI
-
- // emitRepeat
- LEAL -4(SI), SI
- JMP cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-long_offset_short_repeat_as_copy_encodeBlockAsm12B:
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-two_byte_offset_short_repeat_as_copy_encodeBlockAsm12B:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm12B
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm12B
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm12B
-
-emit_copy_three_repeat_as_copy_encodeBlockAsm12B:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeBlockAsm12B:
- MOVL DX, 12(SP)
- JMP search_loop_encodeBlockAsm12B
-
-no_repeat_found_encodeBlockAsm12B:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBlockAsm12B
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeBlockAsm12B
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeBlockAsm12B
- MOVL 20(SP), DX
- JMP search_loop_encodeBlockAsm12B
-
-candidate3_match_encodeBlockAsm12B:
- ADDL $0x02, DX
- JMP candidate_match_encodeBlockAsm12B
-
-candidate2_match_encodeBlockAsm12B:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeBlockAsm12B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBlockAsm12B
-
-match_extend_back_loop_encodeBlockAsm12B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBlockAsm12B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBlockAsm12B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBlockAsm12B
- JMP match_extend_back_loop_encodeBlockAsm12B
-
-match_extend_back_end_encodeBlockAsm12B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBlockAsm12B:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeBlockAsm12B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeBlockAsm12B
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeBlockAsm12B
- JB three_bytes_match_emit_encodeBlockAsm12B
-
-three_bytes_match_emit_encodeBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBlockAsm12B
-
-two_bytes_match_emit_encodeBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeBlockAsm12B
- JMP memmove_long_match_emit_encodeBlockAsm12B
-
-one_byte_match_emit_encodeBlockAsm12B:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBlockAsm12B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBlockAsm12B:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeBlockAsm12B
-
-memmove_long_match_emit_encodeBlockAsm12B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm12Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeBlockAsm12B:
-match_nolit_loop_encodeBlockAsm12B:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeBlockAsm12B:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeBlockAsm12B
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm12B
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeBlockAsm12B
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeBlockAsm12B
-
-matchlen_bsf_16match_nolit_encodeBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeBlockAsm12B
-
-matchlen_match8_match_nolit_encodeBlockAsm12B:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeBlockAsm12B
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm12B
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeBlockAsm12B
-
-matchlen_bsf_8_match_nolit_encodeBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeBlockAsm12B
-
-matchlen_match4_match_nolit_encodeBlockAsm12B:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeBlockAsm12B
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeBlockAsm12B
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeBlockAsm12B:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeBlockAsm12B
- JB match_nolit_end_encodeBlockAsm12B
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeBlockAsm12B
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeBlockAsm12B
-
-matchlen_match1_match_nolit_encodeBlockAsm12B:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeBlockAsm12B
- LEAL 1(R10), R10
-
-match_nolit_end_encodeBlockAsm12B:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBlockAsm12B
- CMPL SI, $0x00000800
- JAE long_offset_short_match_nolit_encodeBlockAsm12B
- MOVL $0x00000001, DI
- LEAL 16(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short_2b
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short_2b
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-long_offset_short_match_nolit_encodeBlockAsm12B:
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-two_byte_offset_short_match_nolit_encodeBlockAsm12B:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeBlockAsm12B
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBlockAsm12B
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm12B
-
-emit_copy_three_match_nolit_encodeBlockAsm12B:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeBlockAsm12B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBlockAsm12B
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBlockAsm12B:
- MOVQ $0x000000cf1bbcdcbb, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x18, R8
- IMULQ R9, R8
- SHRQ $0x34, R8
- SHLQ $0x18, SI
- IMULQ R9, SI
- SHRQ $0x34, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeBlockAsm12B
- INCL DX
- JMP search_loop_encodeBlockAsm12B
-
-emit_remainder_encodeBlockAsm12B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBlockAsm12B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBlockAsm12B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBlockAsm12B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBlockAsm12B
- JB three_bytes_emit_remainder_encodeBlockAsm12B
-
-three_bytes_emit_remainder_encodeBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm12B
-
-two_bytes_emit_remainder_encodeBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBlockAsm12B
- JMP memmove_long_emit_remainder_encodeBlockAsm12B
-
-one_byte_emit_remainder_encodeBlockAsm12B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm12B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBlockAsm12B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBlockAsm12B
-
-memmove_long_emit_remainder_encodeBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm12Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBlockAsm12B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBlockAsm10B(dst []byte, src []byte, tmp *[4096]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBlockAsm10B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000020, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBlockAsm10B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBlockAsm10B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBlockAsm10B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBlockAsm10B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- SHLQ $0x20, R11
- IMULQ R9, R11
- SHRQ $0x36, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeBlockAsm10B
- LEAL 1(DX), DI
- MOVL 12(SP), R8
- MOVL DI, SI
- SUBL 16(SP), SI
- JZ repeat_extend_back_end_encodeBlockAsm10B
-
-repeat_extend_back_loop_encodeBlockAsm10B:
- CMPL DI, R8
- JBE repeat_extend_back_end_encodeBlockAsm10B
- MOVB -1(BX)(SI*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeBlockAsm10B
- LEAL -1(DI), DI
- DECL SI
- JNZ repeat_extend_back_loop_encodeBlockAsm10B
-
-repeat_extend_back_end_encodeBlockAsm10B:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeBlockAsm10B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeBlockAsm10B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeBlockAsm10B
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeBlockAsm10B
- JB three_bytes_repeat_emit_encodeBlockAsm10B
-
-three_bytes_repeat_emit_encodeBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm10B
-
-two_bytes_repeat_emit_encodeBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeBlockAsm10B
- JMP memmove_long_repeat_emit_encodeBlockAsm10B
-
-one_byte_repeat_emit_encodeBlockAsm10B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm10B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm10B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm10B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_repeat_emit_encodeBlockAsm10B:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeBlockAsm10B
-
-memmove_long_repeat_emit_encodeBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R12
- SHRQ $0x05, R12
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_repeat_emit_encodeBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R13*1), R11
- LEAQ -32(CX)(R13*1), R14
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm10Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_repeat_emit_encodeBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R13*1), X4
- MOVOU -16(R10)(R13*1), X5
- MOVOA X4, -32(CX)(R13*1)
- MOVOA X5, -16(CX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R9, R13
- JAE emit_lit_memmove_long_repeat_emit_encodeBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeBlockAsm10B:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R9
- SUBL DX, R9
- LEAQ (BX)(DX*1), R10
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_repeat_extend_encodeBlockAsm10B:
- CMPL R9, $0x10
- JB matchlen_match8_repeat_extend_encodeBlockAsm10B
- MOVQ (R10)(R12*1), R11
- MOVQ 8(R10)(R12*1), R13
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm10B
- XORQ 8(SI)(R12*1), R13
- JNZ matchlen_bsf_16repeat_extend_encodeBlockAsm10B
- LEAL -16(R9), R9
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_repeat_extend_encodeBlockAsm10B
-
-matchlen_bsf_16repeat_extend_encodeBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm10B
-
-matchlen_match8_repeat_extend_encodeBlockAsm10B:
- CMPL R9, $0x08
- JB matchlen_match4_repeat_extend_encodeBlockAsm10B
- MOVQ (R10)(R12*1), R11
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm10B
- LEAL -8(R9), R9
- LEAL 8(R12), R12
- JMP matchlen_match4_repeat_extend_encodeBlockAsm10B
-
-matchlen_bsf_8_repeat_extend_encodeBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm10B
-
-matchlen_match4_repeat_extend_encodeBlockAsm10B:
- CMPL R9, $0x04
- JB matchlen_match2_repeat_extend_encodeBlockAsm10B
- MOVL (R10)(R12*1), R11
- CMPL (SI)(R12*1), R11
- JNE matchlen_match2_repeat_extend_encodeBlockAsm10B
- LEAL -4(R9), R9
- LEAL 4(R12), R12
-
-matchlen_match2_repeat_extend_encodeBlockAsm10B:
- CMPL R9, $0x01
- JE matchlen_match1_repeat_extend_encodeBlockAsm10B
- JB repeat_extend_forward_end_encodeBlockAsm10B
- MOVW (R10)(R12*1), R11
- CMPW (SI)(R12*1), R11
- JNE matchlen_match1_repeat_extend_encodeBlockAsm10B
- LEAL 2(R12), R12
- SUBL $0x02, R9
- JZ repeat_extend_forward_end_encodeBlockAsm10B
-
-matchlen_match1_repeat_extend_encodeBlockAsm10B:
- MOVB (R10)(R12*1), R11
- CMPB (SI)(R12*1), R11
- JNE repeat_extend_forward_end_encodeBlockAsm10B
- LEAL 1(R12), R12
-
-repeat_extend_forward_end_encodeBlockAsm10B:
- ADDL R12, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
- TESTL R8, R8
- JZ repeat_as_copy_encodeBlockAsm10B
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_match_repeat_encodeBlockAsm10B
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm10B
- CMPL DI, $0x00000800
- JB repeat_two_offset_match_repeat_encodeBlockAsm10B
-
-cant_repeat_two_offset_match_repeat_encodeBlockAsm10B:
- CMPL SI, $0x00000104
- JB repeat_three_match_repeat_encodeBlockAsm10B
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_three_match_repeat_encodeBlockAsm10B:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_two_match_repeat_encodeBlockAsm10B:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_two_offset_match_repeat_encodeBlockAsm10B:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_as_copy_encodeBlockAsm10B:
- // emitCopy
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm10B
- CMPL DI, $0x00000800
- JAE long_offset_short_repeat_as_copy_encodeBlockAsm10B
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, SI
-
- // emitRepeat
- LEAL -4(SI), SI
- JMP cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-long_offset_short_repeat_as_copy_encodeBlockAsm10B:
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL SI, R8
- LEAL -4(SI), SI
- CMPL R8, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short
- CMPL DI, $0x00000800
- JB repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short:
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-two_byte_offset_short_repeat_as_copy_encodeBlockAsm10B:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm10B
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm10B
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm10B
-
-emit_copy_three_repeat_as_copy_encodeBlockAsm10B:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeBlockAsm10B:
- MOVL DX, 12(SP)
- JMP search_loop_encodeBlockAsm10B
-
-no_repeat_found_encodeBlockAsm10B:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBlockAsm10B
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeBlockAsm10B
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeBlockAsm10B
- MOVL 20(SP), DX
- JMP search_loop_encodeBlockAsm10B
-
-candidate3_match_encodeBlockAsm10B:
- ADDL $0x02, DX
- JMP candidate_match_encodeBlockAsm10B
-
-candidate2_match_encodeBlockAsm10B:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeBlockAsm10B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBlockAsm10B
-
-match_extend_back_loop_encodeBlockAsm10B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBlockAsm10B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBlockAsm10B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBlockAsm10B
- JMP match_extend_back_loop_encodeBlockAsm10B
-
-match_extend_back_end_encodeBlockAsm10B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBlockAsm10B:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeBlockAsm10B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeBlockAsm10B
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeBlockAsm10B
- JB three_bytes_match_emit_encodeBlockAsm10B
-
-three_bytes_match_emit_encodeBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBlockAsm10B
-
-two_bytes_match_emit_encodeBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeBlockAsm10B
- JMP memmove_long_match_emit_encodeBlockAsm10B
-
-one_byte_match_emit_encodeBlockAsm10B:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBlockAsm10B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBlockAsm10B:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeBlockAsm10B
-
-memmove_long_match_emit_encodeBlockAsm10B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm10Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeBlockAsm10B:
-match_nolit_loop_encodeBlockAsm10B:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeBlockAsm10B:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeBlockAsm10B
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm10B
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeBlockAsm10B
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeBlockAsm10B
-
-matchlen_bsf_16match_nolit_encodeBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeBlockAsm10B
-
-matchlen_match8_match_nolit_encodeBlockAsm10B:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeBlockAsm10B
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm10B
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeBlockAsm10B
-
-matchlen_bsf_8_match_nolit_encodeBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeBlockAsm10B
-
-matchlen_match4_match_nolit_encodeBlockAsm10B:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeBlockAsm10B
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeBlockAsm10B
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeBlockAsm10B:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeBlockAsm10B
- JB match_nolit_end_encodeBlockAsm10B
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeBlockAsm10B
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeBlockAsm10B
-
-matchlen_match1_match_nolit_encodeBlockAsm10B:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeBlockAsm10B
- LEAL 1(R10), R10
-
-match_nolit_end_encodeBlockAsm10B:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBlockAsm10B
- CMPL SI, $0x00000800
- JAE long_offset_short_match_nolit_encodeBlockAsm10B
- MOVL $0x00000001, DI
- LEAL 16(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short_2b
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short_2b
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-long_offset_short_match_nolit_encodeBlockAsm10B:
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R10, DI
- LEAL -4(R10), R10
- CMPL DI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short
- CMPL SI, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short:
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-two_byte_offset_short_match_nolit_encodeBlockAsm10B:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeBlockAsm10B
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBlockAsm10B
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm10B
-
-emit_copy_three_match_nolit_encodeBlockAsm10B:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeBlockAsm10B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBlockAsm10B
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBlockAsm10B:
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x20, R8
- IMULQ R9, R8
- SHRQ $0x36, R8
- SHLQ $0x20, SI
- IMULQ R9, SI
- SHRQ $0x36, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeBlockAsm10B
- INCL DX
- JMP search_loop_encodeBlockAsm10B
-
-emit_remainder_encodeBlockAsm10B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBlockAsm10B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBlockAsm10B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBlockAsm10B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBlockAsm10B
- JB three_bytes_emit_remainder_encodeBlockAsm10B
-
-three_bytes_emit_remainder_encodeBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm10B
-
-two_bytes_emit_remainder_encodeBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBlockAsm10B
- JMP memmove_long_emit_remainder_encodeBlockAsm10B
-
-one_byte_emit_remainder_encodeBlockAsm10B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm10B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBlockAsm10B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBlockAsm10B
-
-memmove_long_emit_remainder_encodeBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm10Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBlockAsm10B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBlockAsm8B(dst []byte, src []byte, tmp *[1024]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBlockAsm8B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000008, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBlockAsm8B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBlockAsm8B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBlockAsm8B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x04, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBlockAsm8B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x38, R10
- SHLQ $0x20, R11
- IMULQ R9, R11
- SHRQ $0x38, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x38, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeBlockAsm8B
- LEAL 1(DX), DI
- MOVL 12(SP), R8
- MOVL DI, SI
- SUBL 16(SP), SI
- JZ repeat_extend_back_end_encodeBlockAsm8B
-
-repeat_extend_back_loop_encodeBlockAsm8B:
- CMPL DI, R8
- JBE repeat_extend_back_end_encodeBlockAsm8B
- MOVB -1(BX)(SI*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeBlockAsm8B
- LEAL -1(DI), DI
- DECL SI
- JNZ repeat_extend_back_loop_encodeBlockAsm8B
-
-repeat_extend_back_end_encodeBlockAsm8B:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeBlockAsm8B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeBlockAsm8B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeBlockAsm8B
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeBlockAsm8B
- JB three_bytes_repeat_emit_encodeBlockAsm8B
-
-three_bytes_repeat_emit_encodeBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeBlockAsm8B
-
-two_bytes_repeat_emit_encodeBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeBlockAsm8B
- JMP memmove_long_repeat_emit_encodeBlockAsm8B
-
-one_byte_repeat_emit_encodeBlockAsm8B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeBlockAsm8B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm8B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm8B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_repeat_emit_encodeBlockAsm8B
-
-emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_repeat_emit_encodeBlockAsm8B:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeBlockAsm8B
-
-memmove_long_repeat_emit_encodeBlockAsm8B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R12
- SHRQ $0x05, R12
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_repeat_emit_encodeBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R13*1), R11
- LEAQ -32(CX)(R13*1), R14
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm8Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_repeat_emit_encodeBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R13*1), X4
- MOVOU -16(R10)(R13*1), X5
- MOVOA X4, -32(CX)(R13*1)
- MOVOA X5, -16(CX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R9, R13
- JAE emit_lit_memmove_long_repeat_emit_encodeBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeBlockAsm8B:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R9
- SUBL DX, R9
- LEAQ (BX)(DX*1), R10
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_repeat_extend_encodeBlockAsm8B:
- CMPL R9, $0x10
- JB matchlen_match8_repeat_extend_encodeBlockAsm8B
- MOVQ (R10)(R12*1), R11
- MOVQ 8(R10)(R12*1), R13
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm8B
- XORQ 8(SI)(R12*1), R13
- JNZ matchlen_bsf_16repeat_extend_encodeBlockAsm8B
- LEAL -16(R9), R9
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_repeat_extend_encodeBlockAsm8B
-
-matchlen_bsf_16repeat_extend_encodeBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm8B
-
-matchlen_match8_repeat_extend_encodeBlockAsm8B:
- CMPL R9, $0x08
- JB matchlen_match4_repeat_extend_encodeBlockAsm8B
- MOVQ (R10)(R12*1), R11
- XORQ (SI)(R12*1), R11
- JNZ matchlen_bsf_8_repeat_extend_encodeBlockAsm8B
- LEAL -8(R9), R9
- LEAL 8(R12), R12
- JMP matchlen_match4_repeat_extend_encodeBlockAsm8B
-
-matchlen_bsf_8_repeat_extend_encodeBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP repeat_extend_forward_end_encodeBlockAsm8B
-
-matchlen_match4_repeat_extend_encodeBlockAsm8B:
- CMPL R9, $0x04
- JB matchlen_match2_repeat_extend_encodeBlockAsm8B
- MOVL (R10)(R12*1), R11
- CMPL (SI)(R12*1), R11
- JNE matchlen_match2_repeat_extend_encodeBlockAsm8B
- LEAL -4(R9), R9
- LEAL 4(R12), R12
-
-matchlen_match2_repeat_extend_encodeBlockAsm8B:
- CMPL R9, $0x01
- JE matchlen_match1_repeat_extend_encodeBlockAsm8B
- JB repeat_extend_forward_end_encodeBlockAsm8B
- MOVW (R10)(R12*1), R11
- CMPW (SI)(R12*1), R11
- JNE matchlen_match1_repeat_extend_encodeBlockAsm8B
- LEAL 2(R12), R12
- SUBL $0x02, R9
- JZ repeat_extend_forward_end_encodeBlockAsm8B
-
-matchlen_match1_repeat_extend_encodeBlockAsm8B:
- MOVB (R10)(R12*1), R11
- CMPB (SI)(R12*1), R11
- JNE repeat_extend_forward_end_encodeBlockAsm8B
- LEAL 1(R12), R12
-
-repeat_extend_forward_end_encodeBlockAsm8B:
- ADDL R12, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
- TESTL R8, R8
- JZ repeat_as_copy_encodeBlockAsm8B
-
- // emitRepeat
- MOVL SI, DI
- LEAL -4(SI), SI
- CMPL DI, $0x08
- JBE repeat_two_match_repeat_encodeBlockAsm8B
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm8B
-
-cant_repeat_two_offset_match_repeat_encodeBlockAsm8B:
- CMPL SI, $0x00000104
- JB repeat_three_match_repeat_encodeBlockAsm8B
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_three_match_repeat_encodeBlockAsm8B:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_two_match_repeat_encodeBlockAsm8B:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_as_copy_encodeBlockAsm8B:
- // emitCopy
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm8B
- CMPL DI, $0x00000800
- JAE long_offset_short_repeat_as_copy_encodeBlockAsm8B
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, SI
-
- // emitRepeat
- LEAL -4(SI), SI
- JMP cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b
- MOVL SI, DI
- LEAL -4(SI), SI
- CMPL DI, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-long_offset_short_repeat_as_copy_encodeBlockAsm8B:
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL SI, DI
- LEAL -4(SI), SI
- CMPL DI, $0x08
- JBE repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short
- CMPL DI, $0x0c
- JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short
-
-cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short:
- CMPL SI, $0x00000104
- JB repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short
- LEAL -256(SI), SI
- MOVW $0x0019, (CX)
- MOVW SI, 2(CX)
- ADDQ $0x04, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short:
- LEAL -4(SI), SI
- MOVW $0x0015, (CX)
- MOVB SI, 2(CX)
- ADDQ $0x03, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short:
- SHLL $0x02, SI
- ORL $0x01, SI
- MOVW SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
- XORQ R8, R8
- LEAL 1(R8)(SI*4), SI
- MOVB DI, 1(CX)
- SARL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-two_byte_offset_short_repeat_as_copy_encodeBlockAsm8B:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeBlockAsm8B
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeBlockAsm8B
-
-emit_copy_three_repeat_as_copy_encodeBlockAsm8B:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeBlockAsm8B:
- MOVL DX, 12(SP)
- JMP search_loop_encodeBlockAsm8B
-
-no_repeat_found_encodeBlockAsm8B:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBlockAsm8B
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeBlockAsm8B
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeBlockAsm8B
- MOVL 20(SP), DX
- JMP search_loop_encodeBlockAsm8B
-
-candidate3_match_encodeBlockAsm8B:
- ADDL $0x02, DX
- JMP candidate_match_encodeBlockAsm8B
-
-candidate2_match_encodeBlockAsm8B:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeBlockAsm8B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBlockAsm8B
-
-match_extend_back_loop_encodeBlockAsm8B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBlockAsm8B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBlockAsm8B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBlockAsm8B
- JMP match_extend_back_loop_encodeBlockAsm8B
-
-match_extend_back_end_encodeBlockAsm8B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBlockAsm8B:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeBlockAsm8B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeBlockAsm8B
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeBlockAsm8B
- JB three_bytes_match_emit_encodeBlockAsm8B
-
-three_bytes_match_emit_encodeBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBlockAsm8B
-
-two_bytes_match_emit_encodeBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeBlockAsm8B
- JMP memmove_long_match_emit_encodeBlockAsm8B
-
-one_byte_match_emit_encodeBlockAsm8B:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBlockAsm8B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBlockAsm8B:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeBlockAsm8B
-
-memmove_long_match_emit_encodeBlockAsm8B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm8Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeBlockAsm8B:
-match_nolit_loop_encodeBlockAsm8B:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeBlockAsm8B:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeBlockAsm8B
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm8B
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeBlockAsm8B
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeBlockAsm8B
-
-matchlen_bsf_16match_nolit_encodeBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeBlockAsm8B
-
-matchlen_match8_match_nolit_encodeBlockAsm8B:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeBlockAsm8B
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeBlockAsm8B
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeBlockAsm8B
-
-matchlen_bsf_8_match_nolit_encodeBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeBlockAsm8B
-
-matchlen_match4_match_nolit_encodeBlockAsm8B:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeBlockAsm8B
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeBlockAsm8B
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeBlockAsm8B:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeBlockAsm8B
- JB match_nolit_end_encodeBlockAsm8B
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeBlockAsm8B
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeBlockAsm8B
-
-matchlen_match1_match_nolit_encodeBlockAsm8B:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeBlockAsm8B
- LEAL 1(R10), R10
-
-match_nolit_end_encodeBlockAsm8B:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBlockAsm8B
- CMPL SI, $0x00000800
- JAE long_offset_short_match_nolit_encodeBlockAsm8B
- MOVL $0x00000001, DI
- LEAL 16(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short_2b
- MOVL R10, SI
- LEAL -4(R10), R10
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short_2b
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-long_offset_short_match_nolit_encodeBlockAsm8B:
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R10, SI
- LEAL -4(R10), R10
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short
- LEAL -256(R10), R10
- MOVW $0x0019, (CX)
- MOVW R10, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (CX)
- MOVB R10, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
- XORQ DI, DI
- LEAL 1(DI)(R10*4), R10
- MOVB SI, 1(CX)
- SARL $0x08, SI
- SHLL $0x05, SI
- ORL SI, R10
- MOVB R10, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-two_byte_offset_short_match_nolit_encodeBlockAsm8B:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeBlockAsm8B
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBlockAsm8B
-
-emit_copy_three_match_nolit_encodeBlockAsm8B:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeBlockAsm8B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBlockAsm8B
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBlockAsm8B:
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x20, R8
- IMULQ R9, R8
- SHRQ $0x38, R8
- SHLQ $0x20, SI
- IMULQ R9, SI
- SHRQ $0x38, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeBlockAsm8B
- INCL DX
- JMP search_loop_encodeBlockAsm8B
-
-emit_remainder_encodeBlockAsm8B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBlockAsm8B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBlockAsm8B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBlockAsm8B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBlockAsm8B
- JB three_bytes_emit_remainder_encodeBlockAsm8B
-
-three_bytes_emit_remainder_encodeBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBlockAsm8B
-
-two_bytes_emit_remainder_encodeBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBlockAsm8B
- JMP memmove_long_emit_remainder_encodeBlockAsm8B
-
-one_byte_emit_remainder_encodeBlockAsm8B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBlockAsm8B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBlockAsm8B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBlockAsm8B
-
-memmove_long_emit_remainder_encodeBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm8Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBlockAsm8B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBetterBlockAsm(dst []byte, src []byte, tmp *[589824]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBetterBlockAsm(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00001200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBetterBlockAsm:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBetterBlockAsm
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -6(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBetterBlockAsm:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x07, SI
- CMPL SI, $0x63
- JBE check_maxskip_ok_encodeBetterBlockAsm
- LEAL 100(DX), SI
- JMP check_maxskip_cont_encodeBetterBlockAsm
-
-check_maxskip_ok_encodeBetterBlockAsm:
- LEAL 1(DX)(SI*1), SI
-
-check_maxskip_cont_encodeBetterBlockAsm:
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x00cf1bbcdcbfa563, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x2f, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL 524288(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 524288(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeBetterBlockAsm
- CMPQ R11, DI
- JNE no_short_found_encodeBetterBlockAsm
- MOVL R8, SI
- JMP candidate_match_encodeBetterBlockAsm
-
-no_short_found_encodeBetterBlockAsm:
- CMPL R10, DI
- JEQ candidate_match_encodeBetterBlockAsm
- CMPL R11, DI
- JEQ candidateS_match_encodeBetterBlockAsm
- MOVL 20(SP), DX
- JMP search_loop_encodeBetterBlockAsm
-
-candidateS_match_encodeBetterBlockAsm:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x2f, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBetterBlockAsm
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeBetterBlockAsm:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBetterBlockAsm
-
-match_extend_back_loop_encodeBetterBlockAsm:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBetterBlockAsm
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBetterBlockAsm
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBetterBlockAsm
- JMP match_extend_back_loop_encodeBetterBlockAsm
-
-match_extend_back_end_encodeBetterBlockAsm:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 5(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBetterBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBetterBlockAsm:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeBetterBlockAsm:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeBetterBlockAsm
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeBetterBlockAsm
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeBetterBlockAsm
-
-matchlen_bsf_16match_nolit_encodeBetterBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm
-
-matchlen_match8_match_nolit_encodeBetterBlockAsm:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeBetterBlockAsm
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeBetterBlockAsm
-
-matchlen_bsf_8_match_nolit_encodeBetterBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm
-
-matchlen_match4_match_nolit_encodeBetterBlockAsm:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeBetterBlockAsm
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeBetterBlockAsm
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeBetterBlockAsm:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeBetterBlockAsm
- JB match_nolit_end_encodeBetterBlockAsm
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeBetterBlockAsm
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeBetterBlockAsm
-
-matchlen_match1_match_nolit_encodeBetterBlockAsm:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeBetterBlockAsm
- LEAL 1(R12), R12
-
-match_nolit_end_encodeBetterBlockAsm:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- CMPL 16(SP), R8
- JEQ match_is_repeat_encodeBetterBlockAsm
- CMPL R12, $0x01
- JA match_length_ok_encodeBetterBlockAsm
- CMPL R8, $0x0000ffff
- JBE match_length_ok_encodeBetterBlockAsm
- MOVL 20(SP), DX
- INCL DX
- JMP search_loop_encodeBetterBlockAsm
-
-match_length_ok_encodeBetterBlockAsm:
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeBetterBlockAsm
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeBetterBlockAsm
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeBetterBlockAsm
- CMPL SI, $0x00010000
- JB three_bytes_match_emit_encodeBetterBlockAsm
- CMPL SI, $0x01000000
- JB four_bytes_match_emit_encodeBetterBlockAsm
- MOVB $0xfc, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm
-
-four_bytes_match_emit_encodeBetterBlockAsm:
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm
-
-three_bytes_match_emit_encodeBetterBlockAsm:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm
-
-two_bytes_match_emit_encodeBetterBlockAsm:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeBetterBlockAsm
- JMP memmove_long_match_emit_encodeBetterBlockAsm
-
-one_byte_match_emit_encodeBetterBlockAsm:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBetterBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBetterBlockAsm:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeBetterBlockAsm
-
-memmove_long_match_emit_encodeBetterBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeBetterBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsmlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeBetterBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeBetterBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeBetterBlockAsm:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R8, $0x00010000
- JB two_byte_offset_match_nolit_encodeBetterBlockAsm
- CMPL R12, $0x40
- JBE four_bytes_remain_match_nolit_encodeBetterBlockAsm
- MOVB $0xff, (CX)
- MOVL R8, 1(CX)
- LEAL -64(R12), R12
- ADDQ $0x05, CX
- CMPL R12, $0x04
- JB four_bytes_remain_match_nolit_encodeBetterBlockAsm
-
- // emitRepeat
-emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy:
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy
- CMPL R12, $0x0100ffff
- JB repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy
- LEAL -16842747(R12), R12
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy
-
-repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy:
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-four_bytes_remain_match_nolit_encodeBetterBlockAsm:
- TESTL R12, R12
- JZ match_nolit_emitcopy_end_encodeBetterBlockAsm
- XORL SI, SI
- LEAL -1(SI)(R12*4), R12
- MOVB R12, (CX)
- MOVL R8, 1(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-two_byte_offset_match_nolit_encodeBetterBlockAsm:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm
- CMPL R8, $0x00000800
- JAE long_offset_short_match_nolit_encodeBetterBlockAsm
- MOVL $0x00000001, SI
- LEAL 16(SI), SI
- MOVB R8, 1(CX)
- MOVL R8, R9
- SHRL $0x08, R9
- SHLL $0x05, R9
- ORL R9, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R12
-
- // emitRepeat
- LEAL -4(R12), R12
- JMP cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
-
-emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
- CMPL R12, $0x0100ffff
- JB repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
- LEAL -16842747(R12), R12
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b
-
-repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-long_offset_short_match_nolit_encodeBetterBlockAsm:
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
-
- // emitRepeat
-emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short
- CMPL R12, $0x0100ffff
- JB repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short
- LEAL -16842747(R12), R12
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy_short
-
-repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-two_byte_offset_short_match_nolit_encodeBetterBlockAsm:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-emit_copy_three_match_nolit_encodeBetterBlockAsm:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-match_is_repeat_encodeBetterBlockAsm:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_repeat_encodeBetterBlockAsm
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_repeat_encodeBetterBlockAsm
- CMPL SI, $0x00010000
- JB three_bytes_match_emit_repeat_encodeBetterBlockAsm
- CMPL SI, $0x01000000
- JB four_bytes_match_emit_repeat_encodeBetterBlockAsm
- MOVB $0xfc, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm
-
-four_bytes_match_emit_repeat_encodeBetterBlockAsm:
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm
-
-three_bytes_match_emit_repeat_encodeBetterBlockAsm:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm
-
-two_bytes_match_emit_repeat_encodeBetterBlockAsm:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_repeat_encodeBetterBlockAsm
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm
-
-one_byte_match_emit_repeat_encodeBetterBlockAsm:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_repeat_encodeBetterBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_repeat_encodeBetterBlockAsm
-
-memmove_long_match_emit_repeat_encodeBetterBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsmlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_repeat_encodeBetterBlockAsm:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitRepeat
-emit_repeat_again_match_nolit_repeat_encodeBetterBlockAsm:
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm
-
-cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_repeat_encodeBetterBlockAsm
- CMPL R12, $0x0100ffff
- JB repeat_five_match_nolit_repeat_encodeBetterBlockAsm
- LEAL -16842747(R12), R12
- MOVL $0xfffb001d, (CX)
- MOVB $0xff, 4(CX)
- ADDQ $0x05, CX
- JMP emit_repeat_again_match_nolit_repeat_encodeBetterBlockAsm
-
-repeat_five_match_nolit_repeat_encodeBetterBlockAsm:
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_four_match_nolit_repeat_encodeBetterBlockAsm:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_three_match_nolit_repeat_encodeBetterBlockAsm:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_match_nolit_repeat_encodeBetterBlockAsm:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm
-
-repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
-
-match_nolit_emitcopy_end_encodeBetterBlockAsm:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBetterBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBetterBlockAsm:
- MOVQ $0x00cf1bbcdcbfa563, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x2f, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x32, R11
- SHLQ $0x08, R12
- IMULQ SI, R12
- SHRQ $0x2f, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x32, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 524288(AX)(R11*4)
- MOVL R14, 524288(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeBetterBlockAsm:
- CMPQ R8, R9
- JAE search_loop_encodeBetterBlockAsm
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x2f, R10
- SHLQ $0x08, R11
- IMULQ SI, R11
- SHRQ $0x2f, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeBetterBlockAsm
-
-emit_remainder_encodeBetterBlockAsm:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 5(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBetterBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBetterBlockAsm:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBetterBlockAsm
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBetterBlockAsm
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBetterBlockAsm
- CMPL DX, $0x00010000
- JB three_bytes_emit_remainder_encodeBetterBlockAsm
- CMPL DX, $0x01000000
- JB four_bytes_emit_remainder_encodeBetterBlockAsm
- MOVB $0xfc, (CX)
- MOVL DX, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm
-
-four_bytes_emit_remainder_encodeBetterBlockAsm:
- MOVL DX, BX
- SHRL $0x10, BX
- MOVB $0xf8, (CX)
- MOVW DX, 1(CX)
- MOVB BL, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm
-
-three_bytes_emit_remainder_encodeBetterBlockAsm:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm
-
-two_bytes_emit_remainder_encodeBetterBlockAsm:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBetterBlockAsm
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm
-
-one_byte_emit_remainder_encodeBetterBlockAsm:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBetterBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBetterBlockAsm:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBetterBlockAsm
-
-memmove_long_emit_remainder_encodeBetterBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsmlarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBetterBlockAsm:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBetterBlockAsm4MB(dst []byte, src []byte, tmp *[589824]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBetterBlockAsm4MB(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00001200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBetterBlockAsm4MB:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBetterBlockAsm4MB
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -6(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBetterBlockAsm4MB:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x07, SI
- CMPL SI, $0x63
- JBE check_maxskip_ok_encodeBetterBlockAsm4MB
- LEAL 100(DX), SI
- JMP check_maxskip_cont_encodeBetterBlockAsm4MB
-
-check_maxskip_ok_encodeBetterBlockAsm4MB:
- LEAL 1(DX)(SI*1), SI
-
-check_maxskip_cont_encodeBetterBlockAsm4MB:
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm4MB
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x00cf1bbcdcbfa563, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x2f, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL 524288(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 524288(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeBetterBlockAsm4MB
- CMPQ R11, DI
- JNE no_short_found_encodeBetterBlockAsm4MB
- MOVL R8, SI
- JMP candidate_match_encodeBetterBlockAsm4MB
-
-no_short_found_encodeBetterBlockAsm4MB:
- CMPL R10, DI
- JEQ candidate_match_encodeBetterBlockAsm4MB
- CMPL R11, DI
- JEQ candidateS_match_encodeBetterBlockAsm4MB
- MOVL 20(SP), DX
- JMP search_loop_encodeBetterBlockAsm4MB
-
-candidateS_match_encodeBetterBlockAsm4MB:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x2f, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBetterBlockAsm4MB
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeBetterBlockAsm4MB:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBetterBlockAsm4MB
-
-match_extend_back_loop_encodeBetterBlockAsm4MB:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBetterBlockAsm4MB
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBetterBlockAsm4MB
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBetterBlockAsm4MB
- JMP match_extend_back_loop_encodeBetterBlockAsm4MB
-
-match_extend_back_end_encodeBetterBlockAsm4MB:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 4(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBetterBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBetterBlockAsm4MB:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeBetterBlockAsm4MB:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeBetterBlockAsm4MB
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm4MB
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeBetterBlockAsm4MB
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeBetterBlockAsm4MB
-
-matchlen_bsf_16match_nolit_encodeBetterBlockAsm4MB:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm4MB
-
-matchlen_match8_match_nolit_encodeBetterBlockAsm4MB:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeBetterBlockAsm4MB
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm4MB
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeBetterBlockAsm4MB
-
-matchlen_bsf_8_match_nolit_encodeBetterBlockAsm4MB:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm4MB
-
-matchlen_match4_match_nolit_encodeBetterBlockAsm4MB:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeBetterBlockAsm4MB
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeBetterBlockAsm4MB
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeBetterBlockAsm4MB:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeBetterBlockAsm4MB
- JB match_nolit_end_encodeBetterBlockAsm4MB
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeBetterBlockAsm4MB
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeBetterBlockAsm4MB
-
-matchlen_match1_match_nolit_encodeBetterBlockAsm4MB:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeBetterBlockAsm4MB
- LEAL 1(R12), R12
-
-match_nolit_end_encodeBetterBlockAsm4MB:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- CMPL 16(SP), R8
- JEQ match_is_repeat_encodeBetterBlockAsm4MB
- CMPL R12, $0x01
- JA match_length_ok_encodeBetterBlockAsm4MB
- CMPL R8, $0x0000ffff
- JBE match_length_ok_encodeBetterBlockAsm4MB
- MOVL 20(SP), DX
- INCL DX
- JMP search_loop_encodeBetterBlockAsm4MB
-
-match_length_ok_encodeBetterBlockAsm4MB:
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeBetterBlockAsm4MB
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeBetterBlockAsm4MB
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeBetterBlockAsm4MB
- CMPL SI, $0x00010000
- JB three_bytes_match_emit_encodeBetterBlockAsm4MB
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm4MB
-
-three_bytes_match_emit_encodeBetterBlockAsm4MB:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm4MB
-
-two_bytes_match_emit_encodeBetterBlockAsm4MB:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeBetterBlockAsm4MB
- JMP memmove_long_match_emit_encodeBetterBlockAsm4MB
-
-one_byte_match_emit_encodeBetterBlockAsm4MB:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBetterBlockAsm4MB:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBetterBlockAsm4MB:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeBetterBlockAsm4MB
-
-memmove_long_match_emit_encodeBetterBlockAsm4MB:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm4MBlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm4MBlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeBetterBlockAsm4MB:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R8, $0x00010000
- JB two_byte_offset_match_nolit_encodeBetterBlockAsm4MB
- CMPL R12, $0x40
- JBE four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB
- MOVB $0xff, (CX)
- MOVL R8, 1(CX)
- LEAL -64(R12), R12
- ADDQ $0x05, CX
- CMPL R12, $0x04
- JB four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB:
- TESTL R12, R12
- JZ match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
- XORL SI, SI
- LEAL -1(SI)(R12*4), R12
- MOVB R12, (CX)
- MOVL R8, 1(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-two_byte_offset_match_nolit_encodeBetterBlockAsm4MB:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm4MB
- CMPL R8, $0x00000800
- JAE long_offset_short_match_nolit_encodeBetterBlockAsm4MB
- MOVL $0x00000001, SI
- LEAL 16(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R12
-
- // emitRepeat
- LEAL -4(R12), R12
- JMP cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-long_offset_short_match_nolit_encodeBetterBlockAsm4MB:
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-two_byte_offset_short_match_nolit_encodeBetterBlockAsm4MB:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm4MB
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm4MB
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-emit_copy_three_match_nolit_encodeBetterBlockAsm4MB:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-match_is_repeat_encodeBetterBlockAsm4MB:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm4MB
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_repeat_encodeBetterBlockAsm4MB
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_repeat_encodeBetterBlockAsm4MB
- CMPL SI, $0x00010000
- JB three_bytes_match_emit_repeat_encodeBetterBlockAsm4MB
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm4MB
-
-three_bytes_match_emit_repeat_encodeBetterBlockAsm4MB:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm4MB
-
-two_bytes_match_emit_repeat_encodeBetterBlockAsm4MB:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_repeat_encodeBetterBlockAsm4MB
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm4MB
-
-one_byte_match_emit_repeat_encodeBetterBlockAsm4MB:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_repeat_encodeBetterBlockAsm4MB:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_33through64
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm4MB:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_repeat_encodeBetterBlockAsm4MB
-
-memmove_long_match_emit_repeat_encodeBetterBlockAsm4MB:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm4MBlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm4MBlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_repeat_encodeBetterBlockAsm4MB:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm4MB
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB
-
-cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm4MB
- CMPL R12, $0x00010100
- JB repeat_four_match_nolit_repeat_encodeBetterBlockAsm4MB
- LEAL -65536(R12), R12
- MOVL R12, R8
- MOVW $0x001d, (CX)
- MOVW R12, 2(CX)
- SARL $0x10, R8
- MOVB R8, 4(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_four_match_nolit_repeat_encodeBetterBlockAsm4MB:
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_three_match_nolit_repeat_encodeBetterBlockAsm4MB:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_match_nolit_repeat_encodeBetterBlockAsm4MB:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm4MB
-
-repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
-
-match_nolit_emitcopy_end_encodeBetterBlockAsm4MB:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm4MB
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBetterBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBetterBlockAsm4MB:
- MOVQ $0x00cf1bbcdcbfa563, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x2f, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x32, R11
- SHLQ $0x08, R12
- IMULQ SI, R12
- SHRQ $0x2f, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x32, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 524288(AX)(R11*4)
- MOVL R14, 524288(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeBetterBlockAsm4MB:
- CMPQ R8, R9
- JAE search_loop_encodeBetterBlockAsm4MB
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x2f, R10
- SHLQ $0x08, R11
- IMULQ SI, R11
- SHRQ $0x2f, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeBetterBlockAsm4MB
-
-emit_remainder_encodeBetterBlockAsm4MB:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 4(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBetterBlockAsm4MB
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBetterBlockAsm4MB:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBetterBlockAsm4MB
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBetterBlockAsm4MB
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBetterBlockAsm4MB
- CMPL DX, $0x00010000
- JB three_bytes_emit_remainder_encodeBetterBlockAsm4MB
- MOVL DX, BX
- SHRL $0x10, BX
- MOVB $0xf8, (CX)
- MOVW DX, 1(CX)
- MOVB BL, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm4MB
-
-three_bytes_emit_remainder_encodeBetterBlockAsm4MB:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm4MB
-
-two_bytes_emit_remainder_encodeBetterBlockAsm4MB:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBetterBlockAsm4MB
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm4MB
-
-one_byte_emit_remainder_encodeBetterBlockAsm4MB:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBetterBlockAsm4MB:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm4MB
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm4MB_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBetterBlockAsm4MB:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBetterBlockAsm4MB
-
-memmove_long_emit_remainder_encodeBetterBlockAsm4MB:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm4MBlarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm4MBlarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm4MBlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBetterBlockAsm4MB:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBetterBlockAsm12B(dst []byte, src []byte, tmp *[81920]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBetterBlockAsm12B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000280, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBetterBlockAsm12B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBetterBlockAsm12B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -6(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBetterBlockAsm12B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x06, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm12B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x34, R11
- MOVL (AX)(R10*4), SI
- MOVL 65536(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 65536(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeBetterBlockAsm12B
- CMPQ R11, DI
- JNE no_short_found_encodeBetterBlockAsm12B
- MOVL R8, SI
- JMP candidate_match_encodeBetterBlockAsm12B
-
-no_short_found_encodeBetterBlockAsm12B:
- CMPL R10, DI
- JEQ candidate_match_encodeBetterBlockAsm12B
- CMPL R11, DI
- JEQ candidateS_match_encodeBetterBlockAsm12B
- MOVL 20(SP), DX
- JMP search_loop_encodeBetterBlockAsm12B
-
-candidateS_match_encodeBetterBlockAsm12B:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBetterBlockAsm12B
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeBetterBlockAsm12B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBetterBlockAsm12B
-
-match_extend_back_loop_encodeBetterBlockAsm12B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBetterBlockAsm12B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBetterBlockAsm12B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBetterBlockAsm12B
- JMP match_extend_back_loop_encodeBetterBlockAsm12B
-
-match_extend_back_end_encodeBetterBlockAsm12B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBetterBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBetterBlockAsm12B:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeBetterBlockAsm12B:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeBetterBlockAsm12B
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm12B
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeBetterBlockAsm12B
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeBetterBlockAsm12B
-
-matchlen_bsf_16match_nolit_encodeBetterBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm12B
-
-matchlen_match8_match_nolit_encodeBetterBlockAsm12B:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeBetterBlockAsm12B
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm12B
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeBetterBlockAsm12B
-
-matchlen_bsf_8_match_nolit_encodeBetterBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm12B
-
-matchlen_match4_match_nolit_encodeBetterBlockAsm12B:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeBetterBlockAsm12B
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeBetterBlockAsm12B
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeBetterBlockAsm12B:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeBetterBlockAsm12B
- JB match_nolit_end_encodeBetterBlockAsm12B
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeBetterBlockAsm12B
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeBetterBlockAsm12B
-
-matchlen_match1_match_nolit_encodeBetterBlockAsm12B:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeBetterBlockAsm12B
- LEAL 1(R12), R12
-
-match_nolit_end_encodeBetterBlockAsm12B:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- CMPL 16(SP), R8
- JEQ match_is_repeat_encodeBetterBlockAsm12B
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeBetterBlockAsm12B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeBetterBlockAsm12B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeBetterBlockAsm12B
- JB three_bytes_match_emit_encodeBetterBlockAsm12B
-
-three_bytes_match_emit_encodeBetterBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm12B
-
-two_bytes_match_emit_encodeBetterBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeBetterBlockAsm12B
- JMP memmove_long_match_emit_encodeBetterBlockAsm12B
-
-one_byte_match_emit_encodeBetterBlockAsm12B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBetterBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBetterBlockAsm12B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeBetterBlockAsm12B
-
-memmove_long_match_emit_encodeBetterBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm12Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeBetterBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeBetterBlockAsm12B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm12B
- CMPL R8, $0x00000800
- JAE long_offset_short_match_nolit_encodeBetterBlockAsm12B
- MOVL $0x00000001, SI
- LEAL 16(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R12
-
- // emitRepeat
- LEAL -4(R12), R12
- JMP cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-long_offset_short_match_nolit_encodeBetterBlockAsm12B:
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-two_byte_offset_short_match_nolit_encodeBetterBlockAsm12B:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm12B
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm12B
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-emit_copy_three_match_nolit_encodeBetterBlockAsm12B:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-match_is_repeat_encodeBetterBlockAsm12B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm12B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_repeat_encodeBetterBlockAsm12B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_repeat_encodeBetterBlockAsm12B
- JB three_bytes_match_emit_repeat_encodeBetterBlockAsm12B
-
-three_bytes_match_emit_repeat_encodeBetterBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm12B
-
-two_bytes_match_emit_repeat_encodeBetterBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_repeat_encodeBetterBlockAsm12B
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm12B
-
-one_byte_match_emit_repeat_encodeBetterBlockAsm12B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_repeat_encodeBetterBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm12B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_repeat_encodeBetterBlockAsm12B
-
-memmove_long_match_emit_repeat_encodeBetterBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm12Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_repeat_encodeBetterBlockAsm12B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm12B
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B
-
-cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm12B
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_three_match_nolit_repeat_encodeBetterBlockAsm12B:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_two_match_nolit_repeat_encodeBetterBlockAsm12B:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm12B
-
-repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
-
-match_nolit_emitcopy_end_encodeBetterBlockAsm12B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm12B
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBetterBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBetterBlockAsm12B:
- MOVQ $0x0000cf1bbcdcbf9b, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x32, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x34, R11
- SHLQ $0x10, R12
- IMULQ SI, R12
- SHRQ $0x32, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x34, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 65536(AX)(R11*4)
- MOVL R14, 65536(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeBetterBlockAsm12B:
- CMPQ R8, R9
- JAE search_loop_encodeBetterBlockAsm12B
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x32, R10
- SHLQ $0x10, R11
- IMULQ SI, R11
- SHRQ $0x32, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeBetterBlockAsm12B
-
-emit_remainder_encodeBetterBlockAsm12B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBetterBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBetterBlockAsm12B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBetterBlockAsm12B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBetterBlockAsm12B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBetterBlockAsm12B
- JB three_bytes_emit_remainder_encodeBetterBlockAsm12B
-
-three_bytes_emit_remainder_encodeBetterBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm12B
-
-two_bytes_emit_remainder_encodeBetterBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBetterBlockAsm12B
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm12B
-
-one_byte_emit_remainder_encodeBetterBlockAsm12B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBetterBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm12B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBetterBlockAsm12B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBetterBlockAsm12B
-
-memmove_long_emit_remainder_encodeBetterBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm12Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBetterBlockAsm12B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBetterBlockAsm10B(dst []byte, src []byte, tmp *[20480]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBetterBlockAsm10B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x000000a0, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBetterBlockAsm10B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBetterBlockAsm10B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -6(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBetterBlockAsm10B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm10B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x36, R11
- MOVL (AX)(R10*4), SI
- MOVL 16384(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 16384(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeBetterBlockAsm10B
- CMPQ R11, DI
- JNE no_short_found_encodeBetterBlockAsm10B
- MOVL R8, SI
- JMP candidate_match_encodeBetterBlockAsm10B
-
-no_short_found_encodeBetterBlockAsm10B:
- CMPL R10, DI
- JEQ candidate_match_encodeBetterBlockAsm10B
- CMPL R11, DI
- JEQ candidateS_match_encodeBetterBlockAsm10B
- MOVL 20(SP), DX
- JMP search_loop_encodeBetterBlockAsm10B
-
-candidateS_match_encodeBetterBlockAsm10B:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBetterBlockAsm10B
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeBetterBlockAsm10B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBetterBlockAsm10B
-
-match_extend_back_loop_encodeBetterBlockAsm10B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBetterBlockAsm10B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBetterBlockAsm10B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBetterBlockAsm10B
- JMP match_extend_back_loop_encodeBetterBlockAsm10B
-
-match_extend_back_end_encodeBetterBlockAsm10B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBetterBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBetterBlockAsm10B:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeBetterBlockAsm10B:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeBetterBlockAsm10B
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm10B
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeBetterBlockAsm10B
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeBetterBlockAsm10B
-
-matchlen_bsf_16match_nolit_encodeBetterBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm10B
-
-matchlen_match8_match_nolit_encodeBetterBlockAsm10B:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeBetterBlockAsm10B
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm10B
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeBetterBlockAsm10B
-
-matchlen_bsf_8_match_nolit_encodeBetterBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm10B
-
-matchlen_match4_match_nolit_encodeBetterBlockAsm10B:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeBetterBlockAsm10B
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeBetterBlockAsm10B
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeBetterBlockAsm10B:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeBetterBlockAsm10B
- JB match_nolit_end_encodeBetterBlockAsm10B
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeBetterBlockAsm10B
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeBetterBlockAsm10B
-
-matchlen_match1_match_nolit_encodeBetterBlockAsm10B:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeBetterBlockAsm10B
- LEAL 1(R12), R12
-
-match_nolit_end_encodeBetterBlockAsm10B:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- CMPL 16(SP), R8
- JEQ match_is_repeat_encodeBetterBlockAsm10B
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeBetterBlockAsm10B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeBetterBlockAsm10B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeBetterBlockAsm10B
- JB three_bytes_match_emit_encodeBetterBlockAsm10B
-
-three_bytes_match_emit_encodeBetterBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm10B
-
-two_bytes_match_emit_encodeBetterBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeBetterBlockAsm10B
- JMP memmove_long_match_emit_encodeBetterBlockAsm10B
-
-one_byte_match_emit_encodeBetterBlockAsm10B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBetterBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBetterBlockAsm10B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeBetterBlockAsm10B
-
-memmove_long_match_emit_encodeBetterBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm10Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeBetterBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeBetterBlockAsm10B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm10B
- CMPL R8, $0x00000800
- JAE long_offset_short_match_nolit_encodeBetterBlockAsm10B
- MOVL $0x00000001, SI
- LEAL 16(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R12
-
- // emitRepeat
- LEAL -4(R12), R12
- JMP cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-long_offset_short_match_nolit_encodeBetterBlockAsm10B:
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-two_byte_offset_short_match_nolit_encodeBetterBlockAsm10B:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm10B
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm10B
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-emit_copy_three_match_nolit_encodeBetterBlockAsm10B:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-match_is_repeat_encodeBetterBlockAsm10B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm10B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_repeat_encodeBetterBlockAsm10B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_repeat_encodeBetterBlockAsm10B
- JB three_bytes_match_emit_repeat_encodeBetterBlockAsm10B
-
-three_bytes_match_emit_repeat_encodeBetterBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm10B
-
-two_bytes_match_emit_repeat_encodeBetterBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_repeat_encodeBetterBlockAsm10B
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm10B
-
-one_byte_match_emit_repeat_encodeBetterBlockAsm10B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_repeat_encodeBetterBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm10B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_repeat_encodeBetterBlockAsm10B
-
-memmove_long_match_emit_repeat_encodeBetterBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm10Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_repeat_encodeBetterBlockAsm10B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm10B
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B
- CMPL R8, $0x00000800
- JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B
-
-cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm10B
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_three_match_nolit_repeat_encodeBetterBlockAsm10B:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_two_match_nolit_repeat_encodeBetterBlockAsm10B:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm10B
-
-repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B:
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
-
-match_nolit_emitcopy_end_encodeBetterBlockAsm10B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm10B
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBetterBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBetterBlockAsm10B:
- MOVQ $0x0000cf1bbcdcbf9b, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x34, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x36, R11
- SHLQ $0x10, R12
- IMULQ SI, R12
- SHRQ $0x34, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x36, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 16384(AX)(R11*4)
- MOVL R14, 16384(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeBetterBlockAsm10B:
- CMPQ R8, R9
- JAE search_loop_encodeBetterBlockAsm10B
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x34, R10
- SHLQ $0x10, R11
- IMULQ SI, R11
- SHRQ $0x34, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeBetterBlockAsm10B
-
-emit_remainder_encodeBetterBlockAsm10B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBetterBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBetterBlockAsm10B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBetterBlockAsm10B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBetterBlockAsm10B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBetterBlockAsm10B
- JB three_bytes_emit_remainder_encodeBetterBlockAsm10B
-
-three_bytes_emit_remainder_encodeBetterBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm10B
-
-two_bytes_emit_remainder_encodeBetterBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBetterBlockAsm10B
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm10B
-
-one_byte_emit_remainder_encodeBetterBlockAsm10B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBetterBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm10B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBetterBlockAsm10B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBetterBlockAsm10B
-
-memmove_long_emit_remainder_encodeBetterBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm10Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBetterBlockAsm10B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeBetterBlockAsm8B(dst []byte, src []byte, tmp *[5120]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeBetterBlockAsm8B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000028, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeBetterBlockAsm8B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeBetterBlockAsm8B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -6(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeBetterBlockAsm8B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x04, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm8B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x38, R11
- MOVL (AX)(R10*4), SI
- MOVL 4096(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 4096(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeBetterBlockAsm8B
- CMPQ R11, DI
- JNE no_short_found_encodeBetterBlockAsm8B
- MOVL R8, SI
- JMP candidate_match_encodeBetterBlockAsm8B
-
-no_short_found_encodeBetterBlockAsm8B:
- CMPL R10, DI
- JEQ candidate_match_encodeBetterBlockAsm8B
- CMPL R11, DI
- JEQ candidateS_match_encodeBetterBlockAsm8B
- MOVL 20(SP), DX
- JMP search_loop_encodeBetterBlockAsm8B
-
-candidateS_match_encodeBetterBlockAsm8B:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeBetterBlockAsm8B
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeBetterBlockAsm8B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeBetterBlockAsm8B
-
-match_extend_back_loop_encodeBetterBlockAsm8B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeBetterBlockAsm8B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeBetterBlockAsm8B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeBetterBlockAsm8B
- JMP match_extend_back_loop_encodeBetterBlockAsm8B
-
-match_extend_back_end_encodeBetterBlockAsm8B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeBetterBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeBetterBlockAsm8B:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeBetterBlockAsm8B:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeBetterBlockAsm8B
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm8B
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeBetterBlockAsm8B
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeBetterBlockAsm8B
-
-matchlen_bsf_16match_nolit_encodeBetterBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm8B
-
-matchlen_match8_match_nolit_encodeBetterBlockAsm8B:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeBetterBlockAsm8B
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeBetterBlockAsm8B
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeBetterBlockAsm8B
-
-matchlen_bsf_8_match_nolit_encodeBetterBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeBetterBlockAsm8B
-
-matchlen_match4_match_nolit_encodeBetterBlockAsm8B:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeBetterBlockAsm8B
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeBetterBlockAsm8B
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeBetterBlockAsm8B:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeBetterBlockAsm8B
- JB match_nolit_end_encodeBetterBlockAsm8B
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeBetterBlockAsm8B
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeBetterBlockAsm8B
-
-matchlen_match1_match_nolit_encodeBetterBlockAsm8B:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeBetterBlockAsm8B
- LEAL 1(R12), R12
-
-match_nolit_end_encodeBetterBlockAsm8B:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- CMPL 16(SP), R8
- JEQ match_is_repeat_encodeBetterBlockAsm8B
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeBetterBlockAsm8B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeBetterBlockAsm8B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeBetterBlockAsm8B
- JB three_bytes_match_emit_encodeBetterBlockAsm8B
-
-three_bytes_match_emit_encodeBetterBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeBetterBlockAsm8B
-
-two_bytes_match_emit_encodeBetterBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeBetterBlockAsm8B
- JMP memmove_long_match_emit_encodeBetterBlockAsm8B
-
-one_byte_match_emit_encodeBetterBlockAsm8B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeBetterBlockAsm8B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x04
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4
- CMPQ R9, $0x08
- JB emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4through7
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4:
- MOVL (R10), R11
- MOVL R11, (CX)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4through7:
- MOVL (R10), R11
- MOVL -4(R10)(R9*1), R10
- MOVL R11, (CX)
- MOVL R10, -4(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeBetterBlockAsm8B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeBetterBlockAsm8B
-
-memmove_long_match_emit_encodeBetterBlockAsm8B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm8Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeBetterBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeBetterBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeBetterBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeBetterBlockAsm8B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm8B
- CMPL R8, $0x00000800
- JAE long_offset_short_match_nolit_encodeBetterBlockAsm8B
- MOVL $0x00000001, SI
- LEAL 16(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- SUBL $0x08, R12
-
- // emitRepeat
- LEAL -4(R12), R12
- JMP cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-long_offset_short_match_nolit_encodeBetterBlockAsm8B:
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short
-
-cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-two_byte_offset_short_match_nolit_encodeBetterBlockAsm8B:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeBetterBlockAsm8B
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-emit_copy_three_match_nolit_encodeBetterBlockAsm8B:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-match_is_repeat_encodeBetterBlockAsm8B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm8B
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_repeat_encodeBetterBlockAsm8B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_repeat_encodeBetterBlockAsm8B
- JB three_bytes_match_emit_repeat_encodeBetterBlockAsm8B
-
-three_bytes_match_emit_repeat_encodeBetterBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm8B
-
-two_bytes_match_emit_repeat_encodeBetterBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_repeat_encodeBetterBlockAsm8B
- JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm8B
-
-one_byte_match_emit_repeat_encodeBetterBlockAsm8B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_repeat_encodeBetterBlockAsm8B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveShort
- CMPQ R8, $0x04
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4
- CMPQ R8, $0x08
- JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4through7
- CMPQ R8, $0x10
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4:
- MOVL (R9), R10
- MOVL R10, (CX)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4through7:
- MOVL (R9), R10
- MOVL -4(R9)(R8*1), R9
- MOVL R10, (CX)
- MOVL R9, -4(CX)(R8*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_8through16:
- MOVQ (R9), R10
- MOVQ -8(R9)(R8*1), R9
- MOVQ R10, (CX)
- MOVQ R9, -8(CX)(R8*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_17through32:
- MOVOU (R9), X0
- MOVOU -16(R9)(R8*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R8*1)
- JMP memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_33through64:
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
-
-memmove_end_copy_match_emit_repeat_encodeBetterBlockAsm8B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_repeat_encodeBetterBlockAsm8B
-
-memmove_long_match_emit_repeat_encodeBetterBlockAsm8B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveLong
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVQ R8, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R13
- SUBQ R10, R13
- DECQ R11
- JA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(R9)(R13*1), R10
- LEAQ -32(CX)(R13*1), R14
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm8Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R10
- ADDQ $0x20, R13
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(R9)(R13*1), X4
- MOVOU -16(R9)(R13*1), X5
- MOVOA X4, -32(CX)(R13*1)
- MOVOA X5, -16(CX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R8, R13
- JAE emit_lit_memmove_long_match_emit_repeat_encodeBetterBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_repeat_encodeBetterBlockAsm8B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitRepeat
- MOVL R12, SI
- LEAL -4(R12), R12
- CMPL SI, $0x08
- JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm8B
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm8B
-
-cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm8B:
- CMPL R12, $0x00000104
- JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm8B
- LEAL -256(R12), R12
- MOVW $0x0019, (CX)
- MOVW R12, 2(CX)
- ADDQ $0x04, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-repeat_three_match_nolit_repeat_encodeBetterBlockAsm8B:
- LEAL -4(R12), R12
- MOVW $0x0015, (CX)
- MOVB R12, 2(CX)
- ADDQ $0x03, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
-
-repeat_two_match_nolit_repeat_encodeBetterBlockAsm8B:
- SHLL $0x02, R12
- ORL $0x01, R12
- MOVW R12, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeBetterBlockAsm8B
- XORQ SI, SI
- LEAL 1(SI)(R12*4), R12
- MOVB R8, 1(CX)
- SARL $0x08, R8
- SHLL $0x05, R8
- ORL R8, R12
- MOVB R12, (CX)
- ADDQ $0x02, CX
-
-match_nolit_emitcopy_end_encodeBetterBlockAsm8B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeBetterBlockAsm8B
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeBetterBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeBetterBlockAsm8B:
- MOVQ $0x0000cf1bbcdcbf9b, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x36, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x38, R11
- SHLQ $0x10, R12
- IMULQ SI, R12
- SHRQ $0x36, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x38, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 4096(AX)(R11*4)
- MOVL R14, 4096(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeBetterBlockAsm8B:
- CMPQ R8, R9
- JAE search_loop_encodeBetterBlockAsm8B
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x36, R10
- SHLQ $0x10, R11
- IMULQ SI, R11
- SHRQ $0x36, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeBetterBlockAsm8B
-
-emit_remainder_encodeBetterBlockAsm8B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeBetterBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeBetterBlockAsm8B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeBetterBlockAsm8B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeBetterBlockAsm8B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeBetterBlockAsm8B
- JB three_bytes_emit_remainder_encodeBetterBlockAsm8B
-
-three_bytes_emit_remainder_encodeBetterBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm8B
-
-two_bytes_emit_remainder_encodeBetterBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeBetterBlockAsm8B
- JMP memmove_long_emit_remainder_encodeBetterBlockAsm8B
-
-one_byte_emit_remainder_encodeBetterBlockAsm8B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeBetterBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeBetterBlockAsm8B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeBetterBlockAsm8B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeBetterBlockAsm8B
-
-memmove_long_emit_remainder_encodeBetterBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm8Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeBetterBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeBetterBlockAsm8B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBlockAsm(dst []byte, src []byte, tmp *[65536]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBlockAsm(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBlockAsm:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBlockAsm
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBlockAsm:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x06, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- SHLQ $0x10, R11
- IMULQ R9, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeSnappyBlockAsm
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_encodeSnappyBlockAsm
-
-repeat_extend_back_loop_encodeSnappyBlockAsm:
- CMPL DI, SI
- JBE repeat_extend_back_end_encodeSnappyBlockAsm
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeSnappyBlockAsm
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_encodeSnappyBlockAsm
-
-repeat_extend_back_end_encodeSnappyBlockAsm:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 5(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeSnappyBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeSnappyBlockAsm:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeSnappyBlockAsm
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeSnappyBlockAsm
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeSnappyBlockAsm
- CMPL SI, $0x00010000
- JB three_bytes_repeat_emit_encodeSnappyBlockAsm
- CMPL SI, $0x01000000
- JB four_bytes_repeat_emit_encodeSnappyBlockAsm
- MOVB $0xfc, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm
-
-four_bytes_repeat_emit_encodeSnappyBlockAsm:
- MOVL SI, R10
- SHRL $0x10, R10
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R10, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm
-
-three_bytes_repeat_emit_encodeSnappyBlockAsm:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm
-
-two_bytes_repeat_emit_encodeSnappyBlockAsm:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeSnappyBlockAsm
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm
-
-one_byte_repeat_emit_encodeSnappyBlockAsm:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeSnappyBlockAsm:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8:
- MOVQ (R9), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8through16:
- MOVQ (R9), R10
- MOVQ -8(R9)(R8*1), R9
- MOVQ R10, (CX)
- MOVQ R9, -8(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_17through32:
- MOVOU (R9), X0
- MOVOU -16(R9)(R8*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_33through64:
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
-
-memmove_end_copy_repeat_emit_encodeSnappyBlockAsm:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeSnappyBlockAsm
-
-memmove_long_repeat_emit_encodeSnappyBlockAsm:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveLong
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVQ R8, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(R9)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsmlarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(R9)(R12*1), X4
- MOVOU -16(R9)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R8, R12
- JAE emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeSnappyBlockAsm:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_encodeSnappyBlockAsm
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm
-
-matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm
-
-matchlen_match8_repeat_extend_encodeSnappyBlockAsm:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_encodeSnappyBlockAsm
-
-matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm
-
-matchlen_match4_repeat_extend_encodeSnappyBlockAsm:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_encodeSnappyBlockAsm:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_encodeSnappyBlockAsm
- JB repeat_extend_forward_end_encodeSnappyBlockAsm
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_encodeSnappyBlockAsm
-
-matchlen_match1_repeat_extend_encodeSnappyBlockAsm:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_encodeSnappyBlockAsm
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_encodeSnappyBlockAsm:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
- CMPL DI, $0x00010000
- JB two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm
-
-four_bytes_loop_back_repeat_as_copy_encodeSnappyBlockAsm:
- CMPL SI, $0x40
- JBE four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm
- MOVB $0xff, (CX)
- MOVL DI, 1(CX)
- LEAL -64(SI), SI
- ADDQ $0x05, CX
- CMPL SI, $0x04
- JB four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm
- JMP four_bytes_loop_back_repeat_as_copy_encodeSnappyBlockAsm
-
-four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm:
- TESTL SI, SI
- JZ repeat_end_emit_encodeSnappyBlockAsm
- XORL R8, R8
- LEAL -1(R8)(SI*4), SI
- MOVB SI, (CX)
- MOVL DI, 1(CX)
- ADDQ $0x05, CX
- JMP repeat_end_emit_encodeSnappyBlockAsm
-
-two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm
-
-two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeSnappyBlockAsm
-
-emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeSnappyBlockAsm:
- MOVL DX, 12(SP)
- JMP search_loop_encodeSnappyBlockAsm
-
-no_repeat_found_encodeSnappyBlockAsm:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBlockAsm
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeSnappyBlockAsm
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeSnappyBlockAsm
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBlockAsm
-
-candidate3_match_encodeSnappyBlockAsm:
- ADDL $0x02, DX
- JMP candidate_match_encodeSnappyBlockAsm
-
-candidate2_match_encodeSnappyBlockAsm:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBlockAsm:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBlockAsm
-
-match_extend_back_loop_encodeSnappyBlockAsm:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBlockAsm
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBlockAsm
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBlockAsm
- JMP match_extend_back_loop_encodeSnappyBlockAsm
-
-match_extend_back_end_encodeSnappyBlockAsm:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 5(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBlockAsm:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBlockAsm
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeSnappyBlockAsm
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBlockAsm
- CMPL R8, $0x00010000
- JB three_bytes_match_emit_encodeSnappyBlockAsm
- CMPL R8, $0x01000000
- JB four_bytes_match_emit_encodeSnappyBlockAsm
- MOVB $0xfc, (CX)
- MOVL R8, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm
-
-four_bytes_match_emit_encodeSnappyBlockAsm:
- MOVL R8, R10
- SHRL $0x10, R10
- MOVB $0xf8, (CX)
- MOVW R8, 1(CX)
- MOVB R10, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm
-
-three_bytes_match_emit_encodeSnappyBlockAsm:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm
-
-two_bytes_match_emit_encodeSnappyBlockAsm:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeSnappyBlockAsm
- JMP memmove_long_match_emit_encodeSnappyBlockAsm
-
-one_byte_match_emit_encodeSnappyBlockAsm:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBlockAsm:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBlockAsm:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeSnappyBlockAsm
-
-memmove_long_match_emit_encodeSnappyBlockAsm:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsmlarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeSnappyBlockAsm:
-match_nolit_loop_encodeSnappyBlockAsm:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBlockAsm
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBlockAsm
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm
-
-matchlen_bsf_16match_nolit_encodeSnappyBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm
-
-matchlen_match8_match_nolit_encodeSnappyBlockAsm:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBlockAsm
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeSnappyBlockAsm
-
-matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm
-
-matchlen_match4_match_nolit_encodeSnappyBlockAsm:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBlockAsm
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeSnappyBlockAsm:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBlockAsm
- JB match_nolit_end_encodeSnappyBlockAsm
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeSnappyBlockAsm
-
-matchlen_match1_match_nolit_encodeSnappyBlockAsm:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeSnappyBlockAsm
- LEAL 1(R10), R10
-
-match_nolit_end_encodeSnappyBlockAsm:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL SI, $0x00010000
- JB two_byte_offset_match_nolit_encodeSnappyBlockAsm
-
-four_bytes_loop_back_match_nolit_encodeSnappyBlockAsm:
- CMPL R10, $0x40
- JBE four_bytes_remain_match_nolit_encodeSnappyBlockAsm
- MOVB $0xff, (CX)
- MOVL SI, 1(CX)
- LEAL -64(R10), R10
- ADDQ $0x05, CX
- CMPL R10, $0x04
- JB four_bytes_remain_match_nolit_encodeSnappyBlockAsm
- JMP four_bytes_loop_back_match_nolit_encodeSnappyBlockAsm
-
-four_bytes_remain_match_nolit_encodeSnappyBlockAsm:
- TESTL R10, R10
- JZ match_nolit_emitcopy_end_encodeSnappyBlockAsm
- XORL DI, DI
- LEAL -1(DI)(R10*4), R10
- MOVB R10, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBlockAsm
-
-two_byte_offset_match_nolit_encodeSnappyBlockAsm:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBlockAsm
-
-two_byte_offset_short_match_nolit_encodeSnappyBlockAsm:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBlockAsm
-
-emit_copy_three_match_nolit_encodeSnappyBlockAsm:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBlockAsm:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBlockAsm:
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x10, R8
- IMULQ R9, R8
- SHRQ $0x32, R8
- SHLQ $0x10, SI
- IMULQ R9, SI
- SHRQ $0x32, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeSnappyBlockAsm
- INCL DX
- JMP search_loop_encodeSnappyBlockAsm
-
-emit_remainder_encodeSnappyBlockAsm:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 5(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBlockAsm:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBlockAsm
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBlockAsm
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBlockAsm
- CMPL DX, $0x00010000
- JB three_bytes_emit_remainder_encodeSnappyBlockAsm
- CMPL DX, $0x01000000
- JB four_bytes_emit_remainder_encodeSnappyBlockAsm
- MOVB $0xfc, (CX)
- MOVL DX, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm
-
-four_bytes_emit_remainder_encodeSnappyBlockAsm:
- MOVL DX, BX
- SHRL $0x10, BX
- MOVB $0xf8, (CX)
- MOVW DX, 1(CX)
- MOVB BL, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm
-
-three_bytes_emit_remainder_encodeSnappyBlockAsm:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm
-
-two_bytes_emit_remainder_encodeSnappyBlockAsm:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBlockAsm
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm
-
-one_byte_emit_remainder_encodeSnappyBlockAsm:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBlockAsm:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBlockAsm
-
-memmove_long_emit_remainder_encodeSnappyBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsmlarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBlockAsm:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBlockAsm64K(dst []byte, src []byte, tmp *[65536]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBlockAsm64K(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBlockAsm64K:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBlockAsm64K
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBlockAsm64K:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x06, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm64K
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- SHLQ $0x10, R11
- IMULQ R9, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeSnappyBlockAsm64K
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_encodeSnappyBlockAsm64K
-
-repeat_extend_back_loop_encodeSnappyBlockAsm64K:
- CMPL DI, SI
- JBE repeat_extend_back_end_encodeSnappyBlockAsm64K
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeSnappyBlockAsm64K
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_encodeSnappyBlockAsm64K
-
-repeat_extend_back_end_encodeSnappyBlockAsm64K:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeSnappyBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeSnappyBlockAsm64K:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeSnappyBlockAsm64K
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeSnappyBlockAsm64K
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeSnappyBlockAsm64K
- JB three_bytes_repeat_emit_encodeSnappyBlockAsm64K
-
-three_bytes_repeat_emit_encodeSnappyBlockAsm64K:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm64K
-
-two_bytes_repeat_emit_encodeSnappyBlockAsm64K:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeSnappyBlockAsm64K
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm64K
-
-one_byte_repeat_emit_encodeSnappyBlockAsm64K:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeSnappyBlockAsm64K:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8:
- MOVQ (R9), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8through16:
- MOVQ (R9), R10
- MOVQ -8(R9)(R8*1), R9
- MOVQ R10, (CX)
- MOVQ R9, -8(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_17through32:
- MOVOU (R9), X0
- MOVOU -16(R9)(R8*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_33through64:
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
-
-memmove_end_copy_repeat_emit_encodeSnappyBlockAsm64K:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeSnappyBlockAsm64K
-
-memmove_long_repeat_emit_encodeSnappyBlockAsm64K:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveLong
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVQ R8, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32
- LEAQ -32(R9)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm64Klarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm64Klarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32:
- MOVOU -32(R9)(R12*1), X4
- MOVOU -16(R9)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R8, R12
- JAE emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeSnappyBlockAsm64K:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm64K:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_encodeSnappyBlockAsm64K
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm64K
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm64K
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm64K
-
-matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm64K:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm64K
-
-matchlen_match8_repeat_extend_encodeSnappyBlockAsm64K:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm64K
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K
-
-matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm64K:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm64K
-
-matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K
- JB repeat_extend_forward_end_encodeSnappyBlockAsm64K
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_encodeSnappyBlockAsm64K
-
-matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_encodeSnappyBlockAsm64K
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_encodeSnappyBlockAsm64K:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
-two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm64K:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm64K
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm64K
-
-two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm64K:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeSnappyBlockAsm64K
-
-emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeSnappyBlockAsm64K:
- MOVL DX, 12(SP)
- JMP search_loop_encodeSnappyBlockAsm64K
-
-no_repeat_found_encodeSnappyBlockAsm64K:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBlockAsm64K
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeSnappyBlockAsm64K
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeSnappyBlockAsm64K
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBlockAsm64K
-
-candidate3_match_encodeSnappyBlockAsm64K:
- ADDL $0x02, DX
- JMP candidate_match_encodeSnappyBlockAsm64K
-
-candidate2_match_encodeSnappyBlockAsm64K:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBlockAsm64K:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBlockAsm64K
-
-match_extend_back_loop_encodeSnappyBlockAsm64K:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBlockAsm64K
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBlockAsm64K
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBlockAsm64K
- JMP match_extend_back_loop_encodeSnappyBlockAsm64K
-
-match_extend_back_end_encodeSnappyBlockAsm64K:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBlockAsm64K:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBlockAsm64K
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeSnappyBlockAsm64K
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBlockAsm64K
- JB three_bytes_match_emit_encodeSnappyBlockAsm64K
-
-three_bytes_match_emit_encodeSnappyBlockAsm64K:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm64K
-
-two_bytes_match_emit_encodeSnappyBlockAsm64K:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeSnappyBlockAsm64K
- JMP memmove_long_match_emit_encodeSnappyBlockAsm64K
-
-one_byte_match_emit_encodeSnappyBlockAsm64K:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBlockAsm64K:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBlockAsm64K:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeSnappyBlockAsm64K
-
-memmove_long_match_emit_encodeSnappyBlockAsm64K:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm64Klarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm64Klarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeSnappyBlockAsm64K:
-match_nolit_loop_encodeSnappyBlockAsm64K:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm64K:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBlockAsm64K
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm64K
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBlockAsm64K
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm64K
-
-matchlen_bsf_16match_nolit_encodeSnappyBlockAsm64K:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm64K
-
-matchlen_match8_match_nolit_encodeSnappyBlockAsm64K:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBlockAsm64K
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm64K
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeSnappyBlockAsm64K
-
-matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm64K:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm64K
-
-matchlen_match4_match_nolit_encodeSnappyBlockAsm64K:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBlockAsm64K
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm64K
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeSnappyBlockAsm64K:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBlockAsm64K
- JB match_nolit_end_encodeSnappyBlockAsm64K
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm64K
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeSnappyBlockAsm64K
-
-matchlen_match1_match_nolit_encodeSnappyBlockAsm64K:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeSnappyBlockAsm64K
- LEAL 1(R10), R10
-
-match_nolit_end_encodeSnappyBlockAsm64K:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBlockAsm64K:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm64K
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBlockAsm64K
-
-two_byte_offset_short_match_nolit_encodeSnappyBlockAsm64K:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm64K
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm64K
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBlockAsm64K
-
-emit_copy_three_match_nolit_encodeSnappyBlockAsm64K:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBlockAsm64K:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm64K
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBlockAsm64K:
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x10, R8
- IMULQ R9, R8
- SHRQ $0x32, R8
- SHLQ $0x10, SI
- IMULQ R9, SI
- SHRQ $0x32, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeSnappyBlockAsm64K
- INCL DX
- JMP search_loop_encodeSnappyBlockAsm64K
-
-emit_remainder_encodeSnappyBlockAsm64K:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBlockAsm64K:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBlockAsm64K
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBlockAsm64K
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBlockAsm64K
- JB three_bytes_emit_remainder_encodeSnappyBlockAsm64K
-
-three_bytes_emit_remainder_encodeSnappyBlockAsm64K:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm64K
-
-two_bytes_emit_remainder_encodeSnappyBlockAsm64K:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBlockAsm64K
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm64K
-
-one_byte_emit_remainder_encodeSnappyBlockAsm64K:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBlockAsm64K:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm64K_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBlockAsm64K:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBlockAsm64K
-
-memmove_long_emit_remainder_encodeSnappyBlockAsm64K:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm64Klarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm64Klarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm64Klarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBlockAsm64K:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBlockAsm12B(dst []byte, src []byte, tmp *[16384]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBlockAsm12B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000080, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBlockAsm12B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBlockAsm12B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBlockAsm12B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm12B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x000000cf1bbcdcbb, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x18, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- SHLQ $0x18, R11
- IMULQ R9, R11
- SHRQ $0x34, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x18, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeSnappyBlockAsm12B
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_encodeSnappyBlockAsm12B
-
-repeat_extend_back_loop_encodeSnappyBlockAsm12B:
- CMPL DI, SI
- JBE repeat_extend_back_end_encodeSnappyBlockAsm12B
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeSnappyBlockAsm12B
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_encodeSnappyBlockAsm12B
-
-repeat_extend_back_end_encodeSnappyBlockAsm12B:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeSnappyBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeSnappyBlockAsm12B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeSnappyBlockAsm12B
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeSnappyBlockAsm12B
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeSnappyBlockAsm12B
- JB three_bytes_repeat_emit_encodeSnappyBlockAsm12B
-
-three_bytes_repeat_emit_encodeSnappyBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm12B
-
-two_bytes_repeat_emit_encodeSnappyBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeSnappyBlockAsm12B
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm12B
-
-one_byte_repeat_emit_encodeSnappyBlockAsm12B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeSnappyBlockAsm12B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8:
- MOVQ (R9), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8through16:
- MOVQ (R9), R10
- MOVQ -8(R9)(R8*1), R9
- MOVQ R10, (CX)
- MOVQ R9, -8(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_17through32:
- MOVOU (R9), X0
- MOVOU -16(R9)(R8*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_33through64:
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
-
-memmove_end_copy_repeat_emit_encodeSnappyBlockAsm12B:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeSnappyBlockAsm12B
-
-memmove_long_repeat_emit_encodeSnappyBlockAsm12B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveLong
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVQ R8, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(R9)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm12Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(R9)(R12*1), X4
- MOVOU -16(R9)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R8, R12
- JAE emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeSnappyBlockAsm12B:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm12B:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_encodeSnappyBlockAsm12B
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm12B
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm12B
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm12B
-
-matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm12B
-
-matchlen_match8_repeat_extend_encodeSnappyBlockAsm12B:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm12B
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B
-
-matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm12B
-
-matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B
- JB repeat_extend_forward_end_encodeSnappyBlockAsm12B
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_encodeSnappyBlockAsm12B
-
-matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_encodeSnappyBlockAsm12B
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_encodeSnappyBlockAsm12B:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
-two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm12B:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm12B
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm12B
-
-two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm12B:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeSnappyBlockAsm12B
-
-emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeSnappyBlockAsm12B:
- MOVL DX, 12(SP)
- JMP search_loop_encodeSnappyBlockAsm12B
-
-no_repeat_found_encodeSnappyBlockAsm12B:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBlockAsm12B
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeSnappyBlockAsm12B
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeSnappyBlockAsm12B
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBlockAsm12B
-
-candidate3_match_encodeSnappyBlockAsm12B:
- ADDL $0x02, DX
- JMP candidate_match_encodeSnappyBlockAsm12B
-
-candidate2_match_encodeSnappyBlockAsm12B:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBlockAsm12B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBlockAsm12B
-
-match_extend_back_loop_encodeSnappyBlockAsm12B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBlockAsm12B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBlockAsm12B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBlockAsm12B
- JMP match_extend_back_loop_encodeSnappyBlockAsm12B
-
-match_extend_back_end_encodeSnappyBlockAsm12B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBlockAsm12B:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBlockAsm12B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeSnappyBlockAsm12B
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBlockAsm12B
- JB three_bytes_match_emit_encodeSnappyBlockAsm12B
-
-three_bytes_match_emit_encodeSnappyBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm12B
-
-two_bytes_match_emit_encodeSnappyBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeSnappyBlockAsm12B
- JMP memmove_long_match_emit_encodeSnappyBlockAsm12B
-
-one_byte_match_emit_encodeSnappyBlockAsm12B:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBlockAsm12B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBlockAsm12B:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeSnappyBlockAsm12B
-
-memmove_long_match_emit_encodeSnappyBlockAsm12B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm12Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeSnappyBlockAsm12B:
-match_nolit_loop_encodeSnappyBlockAsm12B:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm12B:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBlockAsm12B
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm12B
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBlockAsm12B
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm12B
-
-matchlen_bsf_16match_nolit_encodeSnappyBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm12B
-
-matchlen_match8_match_nolit_encodeSnappyBlockAsm12B:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBlockAsm12B
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm12B
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeSnappyBlockAsm12B
-
-matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm12B
-
-matchlen_match4_match_nolit_encodeSnappyBlockAsm12B:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBlockAsm12B
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm12B
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeSnappyBlockAsm12B:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBlockAsm12B
- JB match_nolit_end_encodeSnappyBlockAsm12B
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm12B
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeSnappyBlockAsm12B
-
-matchlen_match1_match_nolit_encodeSnappyBlockAsm12B:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeSnappyBlockAsm12B
- LEAL 1(R10), R10
-
-match_nolit_end_encodeSnappyBlockAsm12B:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBlockAsm12B:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm12B
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBlockAsm12B
-
-two_byte_offset_short_match_nolit_encodeSnappyBlockAsm12B:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm12B
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm12B
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBlockAsm12B
-
-emit_copy_three_match_nolit_encodeSnappyBlockAsm12B:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBlockAsm12B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm12B
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBlockAsm12B:
- MOVQ $0x000000cf1bbcdcbb, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x18, R8
- IMULQ R9, R8
- SHRQ $0x34, R8
- SHLQ $0x18, SI
- IMULQ R9, SI
- SHRQ $0x34, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeSnappyBlockAsm12B
- INCL DX
- JMP search_loop_encodeSnappyBlockAsm12B
-
-emit_remainder_encodeSnappyBlockAsm12B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBlockAsm12B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBlockAsm12B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBlockAsm12B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBlockAsm12B
- JB three_bytes_emit_remainder_encodeSnappyBlockAsm12B
-
-three_bytes_emit_remainder_encodeSnappyBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm12B
-
-two_bytes_emit_remainder_encodeSnappyBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBlockAsm12B
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm12B
-
-one_byte_emit_remainder_encodeSnappyBlockAsm12B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm12B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBlockAsm12B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBlockAsm12B
-
-memmove_long_emit_remainder_encodeSnappyBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm12Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBlockAsm12B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBlockAsm10B(dst []byte, src []byte, tmp *[4096]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBlockAsm10B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000020, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBlockAsm10B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBlockAsm10B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBlockAsm10B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm10B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- SHLQ $0x20, R11
- IMULQ R9, R11
- SHRQ $0x36, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeSnappyBlockAsm10B
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_encodeSnappyBlockAsm10B
-
-repeat_extend_back_loop_encodeSnappyBlockAsm10B:
- CMPL DI, SI
- JBE repeat_extend_back_end_encodeSnappyBlockAsm10B
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeSnappyBlockAsm10B
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_encodeSnappyBlockAsm10B
-
-repeat_extend_back_end_encodeSnappyBlockAsm10B:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeSnappyBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeSnappyBlockAsm10B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeSnappyBlockAsm10B
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeSnappyBlockAsm10B
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeSnappyBlockAsm10B
- JB three_bytes_repeat_emit_encodeSnappyBlockAsm10B
-
-three_bytes_repeat_emit_encodeSnappyBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm10B
-
-two_bytes_repeat_emit_encodeSnappyBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeSnappyBlockAsm10B
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm10B
-
-one_byte_repeat_emit_encodeSnappyBlockAsm10B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeSnappyBlockAsm10B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8:
- MOVQ (R9), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8through16:
- MOVQ (R9), R10
- MOVQ -8(R9)(R8*1), R9
- MOVQ R10, (CX)
- MOVQ R9, -8(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_17through32:
- MOVOU (R9), X0
- MOVOU -16(R9)(R8*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_33through64:
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
-
-memmove_end_copy_repeat_emit_encodeSnappyBlockAsm10B:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeSnappyBlockAsm10B
-
-memmove_long_repeat_emit_encodeSnappyBlockAsm10B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveLong
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVQ R8, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(R9)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm10Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(R9)(R12*1), X4
- MOVOU -16(R9)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R8, R12
- JAE emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeSnappyBlockAsm10B:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm10B:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_encodeSnappyBlockAsm10B
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm10B
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm10B
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm10B
-
-matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm10B
-
-matchlen_match8_repeat_extend_encodeSnappyBlockAsm10B:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm10B
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B
-
-matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm10B
-
-matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B
- JB repeat_extend_forward_end_encodeSnappyBlockAsm10B
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_encodeSnappyBlockAsm10B
-
-matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_encodeSnappyBlockAsm10B
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_encodeSnappyBlockAsm10B:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
-two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm10B:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm10B
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm10B
-
-two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm10B:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeSnappyBlockAsm10B
-
-emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeSnappyBlockAsm10B:
- MOVL DX, 12(SP)
- JMP search_loop_encodeSnappyBlockAsm10B
-
-no_repeat_found_encodeSnappyBlockAsm10B:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBlockAsm10B
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeSnappyBlockAsm10B
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeSnappyBlockAsm10B
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBlockAsm10B
-
-candidate3_match_encodeSnappyBlockAsm10B:
- ADDL $0x02, DX
- JMP candidate_match_encodeSnappyBlockAsm10B
-
-candidate2_match_encodeSnappyBlockAsm10B:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBlockAsm10B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBlockAsm10B
-
-match_extend_back_loop_encodeSnappyBlockAsm10B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBlockAsm10B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBlockAsm10B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBlockAsm10B
- JMP match_extend_back_loop_encodeSnappyBlockAsm10B
-
-match_extend_back_end_encodeSnappyBlockAsm10B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBlockAsm10B:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBlockAsm10B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeSnappyBlockAsm10B
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBlockAsm10B
- JB three_bytes_match_emit_encodeSnappyBlockAsm10B
-
-three_bytes_match_emit_encodeSnappyBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm10B
-
-two_bytes_match_emit_encodeSnappyBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeSnappyBlockAsm10B
- JMP memmove_long_match_emit_encodeSnappyBlockAsm10B
-
-one_byte_match_emit_encodeSnappyBlockAsm10B:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBlockAsm10B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBlockAsm10B:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeSnappyBlockAsm10B
-
-memmove_long_match_emit_encodeSnappyBlockAsm10B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm10Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeSnappyBlockAsm10B:
-match_nolit_loop_encodeSnappyBlockAsm10B:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm10B:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBlockAsm10B
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm10B
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBlockAsm10B
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm10B
-
-matchlen_bsf_16match_nolit_encodeSnappyBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm10B
-
-matchlen_match8_match_nolit_encodeSnappyBlockAsm10B:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBlockAsm10B
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm10B
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeSnappyBlockAsm10B
-
-matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm10B
-
-matchlen_match4_match_nolit_encodeSnappyBlockAsm10B:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBlockAsm10B
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm10B
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeSnappyBlockAsm10B:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBlockAsm10B
- JB match_nolit_end_encodeSnappyBlockAsm10B
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm10B
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeSnappyBlockAsm10B
-
-matchlen_match1_match_nolit_encodeSnappyBlockAsm10B:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeSnappyBlockAsm10B
- LEAL 1(R10), R10
-
-match_nolit_end_encodeSnappyBlockAsm10B:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBlockAsm10B:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm10B
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBlockAsm10B
-
-two_byte_offset_short_match_nolit_encodeSnappyBlockAsm10B:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm10B
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm10B
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBlockAsm10B
-
-emit_copy_three_match_nolit_encodeSnappyBlockAsm10B:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBlockAsm10B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm10B
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBlockAsm10B:
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x20, R8
- IMULQ R9, R8
- SHRQ $0x36, R8
- SHLQ $0x20, SI
- IMULQ R9, SI
- SHRQ $0x36, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeSnappyBlockAsm10B
- INCL DX
- JMP search_loop_encodeSnappyBlockAsm10B
-
-emit_remainder_encodeSnappyBlockAsm10B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBlockAsm10B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBlockAsm10B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBlockAsm10B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBlockAsm10B
- JB three_bytes_emit_remainder_encodeSnappyBlockAsm10B
-
-three_bytes_emit_remainder_encodeSnappyBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm10B
-
-two_bytes_emit_remainder_encodeSnappyBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBlockAsm10B
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm10B
-
-one_byte_emit_remainder_encodeSnappyBlockAsm10B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm10B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBlockAsm10B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBlockAsm10B
-
-memmove_long_emit_remainder_encodeSnappyBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm10Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBlockAsm10B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBlockAsm8B(dst []byte, src []byte, tmp *[1024]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBlockAsm8B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000008, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBlockAsm8B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBlockAsm8B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBlockAsm8B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x04, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm8B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x38, R10
- SHLQ $0x20, R11
- IMULQ R9, R11
- SHRQ $0x38, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x38, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_encodeSnappyBlockAsm8B
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_encodeSnappyBlockAsm8B
-
-repeat_extend_back_loop_encodeSnappyBlockAsm8B:
- CMPL DI, SI
- JBE repeat_extend_back_end_encodeSnappyBlockAsm8B
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_encodeSnappyBlockAsm8B
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_encodeSnappyBlockAsm8B
-
-repeat_extend_back_end_encodeSnappyBlockAsm8B:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_encodeSnappyBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-repeat_dst_size_check_encodeSnappyBlockAsm8B:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_encodeSnappyBlockAsm8B
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_encodeSnappyBlockAsm8B
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_encodeSnappyBlockAsm8B
- JB three_bytes_repeat_emit_encodeSnappyBlockAsm8B
-
-three_bytes_repeat_emit_encodeSnappyBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm8B
-
-two_bytes_repeat_emit_encodeSnappyBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_encodeSnappyBlockAsm8B
- JMP memmove_long_repeat_emit_encodeSnappyBlockAsm8B
-
-one_byte_repeat_emit_encodeSnappyBlockAsm8B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_repeat_emit_encodeSnappyBlockAsm8B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8:
- MOVQ (R9), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8through16:
- MOVQ (R9), R10
- MOVQ -8(R9)(R8*1), R9
- MOVQ R10, (CX)
- MOVQ R9, -8(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_17through32:
- MOVOU (R9), X0
- MOVOU -16(R9)(R8*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R8*1)
- JMP memmove_end_copy_repeat_emit_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_33through64:
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
-
-memmove_end_copy_repeat_emit_encodeSnappyBlockAsm8B:
- MOVQ SI, CX
- JMP emit_literal_done_repeat_emit_encodeSnappyBlockAsm8B
-
-memmove_long_repeat_emit_encodeSnappyBlockAsm8B:
- LEAQ (CX)(R8*1), SI
-
- // genMemMoveLong
- MOVOU (R9), X0
- MOVOU 16(R9), X1
- MOVOU -32(R9)(R8*1), X2
- MOVOU -16(R9)(R8*1), X3
- MOVQ R8, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(R9)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm8Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(R9)(R12*1), X4
- MOVOU -16(R9)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R8, R12
- JAE emit_lit_memmove_long_repeat_emit_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R8*1)
- MOVOU X3, -16(CX)(R8*1)
- MOVQ SI, CX
-
-emit_literal_done_repeat_emit_encodeSnappyBlockAsm8B:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm8B:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_encodeSnappyBlockAsm8B
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm8B
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm8B
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_encodeSnappyBlockAsm8B
-
-matchlen_bsf_16repeat_extend_encodeSnappyBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm8B
-
-matchlen_match8_repeat_extend_encodeSnappyBlockAsm8B:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm8B
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B
-
-matchlen_bsf_8_repeat_extend_encodeSnappyBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_encodeSnappyBlockAsm8B
-
-matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B
- JB repeat_extend_forward_end_encodeSnappyBlockAsm8B
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_encodeSnappyBlockAsm8B
-
-matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_encodeSnappyBlockAsm8B
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_encodeSnappyBlockAsm8B:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
-two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm8B:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm8B
- MOVB $0xee, (CX)
- MOVW DI, 1(CX)
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm8B
-
-two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm8B:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm8B
- LEAL -15(R8), R8
- MOVB DI, 1(CX)
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, R8
- MOVB R8, (CX)
- ADDQ $0x02, CX
- JMP repeat_end_emit_encodeSnappyBlockAsm8B
-
-emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm8B:
- LEAL -2(R8), R8
- MOVB R8, (CX)
- MOVW DI, 1(CX)
- ADDQ $0x03, CX
-
-repeat_end_emit_encodeSnappyBlockAsm8B:
- MOVL DX, 12(SP)
- JMP search_loop_encodeSnappyBlockAsm8B
-
-no_repeat_found_encodeSnappyBlockAsm8B:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBlockAsm8B
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_encodeSnappyBlockAsm8B
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_encodeSnappyBlockAsm8B
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBlockAsm8B
-
-candidate3_match_encodeSnappyBlockAsm8B:
- ADDL $0x02, DX
- JMP candidate_match_encodeSnappyBlockAsm8B
-
-candidate2_match_encodeSnappyBlockAsm8B:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBlockAsm8B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBlockAsm8B
-
-match_extend_back_loop_encodeSnappyBlockAsm8B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBlockAsm8B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBlockAsm8B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBlockAsm8B
- JMP match_extend_back_loop_encodeSnappyBlockAsm8B
-
-match_extend_back_end_encodeSnappyBlockAsm8B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBlockAsm8B:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBlockAsm8B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), R8
- CMPL R8, $0x3c
- JB one_byte_match_emit_encodeSnappyBlockAsm8B
- CMPL R8, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBlockAsm8B
- JB three_bytes_match_emit_encodeSnappyBlockAsm8B
-
-three_bytes_match_emit_encodeSnappyBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBlockAsm8B
-
-two_bytes_match_emit_encodeSnappyBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB R8, 1(CX)
- ADDQ $0x02, CX
- CMPL R8, $0x40
- JB memmove_match_emit_encodeSnappyBlockAsm8B
- JMP memmove_long_match_emit_encodeSnappyBlockAsm8B
-
-one_byte_match_emit_encodeSnappyBlockAsm8B:
- SHLB $0x02, R8
- MOVB R8, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBlockAsm8B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8:
- MOVQ (DI), R10
- MOVQ R10, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8through16:
- MOVQ (DI), R10
- MOVQ -8(DI)(R9*1), DI
- MOVQ R10, (CX)
- MOVQ DI, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_17through32:
- MOVOU (DI), X0
- MOVOU -16(DI)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_33through64:
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBlockAsm8B:
- MOVQ R8, CX
- JMP emit_literal_done_match_emit_encodeSnappyBlockAsm8B
-
-memmove_long_match_emit_encodeSnappyBlockAsm8B:
- LEAQ (CX)(R9*1), R8
-
- // genMemMoveLong
- MOVOU (DI), X0
- MOVOU 16(DI), X1
- MOVOU -32(DI)(R9*1), X2
- MOVOU -16(DI)(R9*1), X3
- MOVQ R9, R11
- SHRQ $0x05, R11
- MOVQ CX, R10
- ANDL $0x0000001f, R10
- MOVQ $0x00000040, R12
- SUBQ R10, R12
- DECQ R11
- JA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(DI)(R12*1), R10
- LEAQ -32(CX)(R12*1), R13
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm8Blarge_big_loop_back:
- MOVOU (R10), X4
- MOVOU 16(R10), X5
- MOVOA X4, (R13)
- MOVOA X5, 16(R13)
- ADDQ $0x20, R13
- ADDQ $0x20, R10
- ADDQ $0x20, R12
- DECQ R11
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(DI)(R12*1), X4
- MOVOU -16(DI)(R12*1), X5
- MOVOA X4, -32(CX)(R12*1)
- MOVOA X5, -16(CX)(R12*1)
- ADDQ $0x20, R12
- CMPQ R9, R12
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ R8, CX
-
-emit_literal_done_match_emit_encodeSnappyBlockAsm8B:
-match_nolit_loop_encodeSnappyBlockAsm8B:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm8B:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBlockAsm8B
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm8B
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBlockAsm8B
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBlockAsm8B
-
-matchlen_bsf_16match_nolit_encodeSnappyBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm8B
-
-matchlen_match8_match_nolit_encodeSnappyBlockAsm8B:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBlockAsm8B
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm8B
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_encodeSnappyBlockAsm8B
-
-matchlen_bsf_8_match_nolit_encodeSnappyBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_encodeSnappyBlockAsm8B
-
-matchlen_match4_match_nolit_encodeSnappyBlockAsm8B:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBlockAsm8B
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm8B
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_encodeSnappyBlockAsm8B:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBlockAsm8B
- JB match_nolit_end_encodeSnappyBlockAsm8B
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm8B
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_encodeSnappyBlockAsm8B
-
-matchlen_match1_match_nolit_encodeSnappyBlockAsm8B:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_encodeSnappyBlockAsm8B
- LEAL 1(R10), R10
-
-match_nolit_end_encodeSnappyBlockAsm8B:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBlockAsm8B:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm8B
- MOVB $0xee, (CX)
- MOVW SI, 1(CX)
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBlockAsm8B
-
-two_byte_offset_short_match_nolit_encodeSnappyBlockAsm8B:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm8B
- LEAL -15(DI), DI
- MOVB SI, 1(CX)
- SHRL $0x08, SI
- SHLL $0x05, SI
- ORL SI, DI
- MOVB DI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBlockAsm8B
-
-emit_copy_three_match_nolit_encodeSnappyBlockAsm8B:
- LEAL -2(DI), DI
- MOVB DI, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBlockAsm8B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBlockAsm8B
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBlockAsm8B:
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x20, R8
- IMULQ R9, R8
- SHRQ $0x38, R8
- SHLQ $0x20, SI
- IMULQ R9, SI
- SHRQ $0x38, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_encodeSnappyBlockAsm8B
- INCL DX
- JMP search_loop_encodeSnappyBlockAsm8B
-
-emit_remainder_encodeSnappyBlockAsm8B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBlockAsm8B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBlockAsm8B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBlockAsm8B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBlockAsm8B
- JB three_bytes_emit_remainder_encodeSnappyBlockAsm8B
-
-three_bytes_emit_remainder_encodeSnappyBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm8B
-
-two_bytes_emit_remainder_encodeSnappyBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBlockAsm8B
- JMP memmove_long_emit_remainder_encodeSnappyBlockAsm8B
-
-one_byte_emit_remainder_encodeSnappyBlockAsm8B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBlockAsm8B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBlockAsm8B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBlockAsm8B
-
-memmove_long_emit_remainder_encodeSnappyBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm8Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBlockAsm8B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBetterBlockAsm(dst []byte, src []byte, tmp *[589824]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBetterBlockAsm(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00001200, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBetterBlockAsm:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBetterBlockAsm
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBetterBlockAsm:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x07, SI
- CMPL SI, $0x63
- JBE check_maxskip_ok_encodeSnappyBetterBlockAsm
- LEAL 100(DX), SI
- JMP check_maxskip_cont_encodeSnappyBetterBlockAsm
-
-check_maxskip_ok_encodeSnappyBetterBlockAsm:
- LEAL 1(DX)(SI*1), SI
-
-check_maxskip_cont_encodeSnappyBetterBlockAsm:
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x00cf1bbcdcbfa563, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x2f, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x32, R11
- MOVL (AX)(R10*4), SI
- MOVL 524288(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 524288(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm
- CMPQ R11, DI
- JNE no_short_found_encodeSnappyBetterBlockAsm
- MOVL R8, SI
- JMP candidate_match_encodeSnappyBetterBlockAsm
-
-no_short_found_encodeSnappyBetterBlockAsm:
- CMPL R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm
- CMPL R11, DI
- JEQ candidateS_match_encodeSnappyBetterBlockAsm
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBetterBlockAsm
-
-candidateS_match_encodeSnappyBetterBlockAsm:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x2f, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBetterBlockAsm:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm
-
-match_extend_back_loop_encodeSnappyBetterBlockAsm:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBetterBlockAsm
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBetterBlockAsm
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm
- JMP match_extend_back_loop_encodeSnappyBetterBlockAsm
-
-match_extend_back_end_encodeSnappyBetterBlockAsm:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 5(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBetterBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBetterBlockAsm:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm
-
-matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm
-
-matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm
-
-matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm
-
-matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm
- JB match_nolit_end_encodeSnappyBetterBlockAsm
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeSnappyBetterBlockAsm
-
-matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeSnappyBetterBlockAsm
- LEAL 1(R12), R12
-
-match_nolit_end_encodeSnappyBetterBlockAsm:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- CMPL R12, $0x01
- JA match_length_ok_encodeSnappyBetterBlockAsm
- CMPL R8, $0x0000ffff
- JBE match_length_ok_encodeSnappyBetterBlockAsm
- MOVL 20(SP), DX
- INCL DX
- JMP search_loop_encodeSnappyBetterBlockAsm
-
-match_length_ok_encodeSnappyBetterBlockAsm:
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeSnappyBetterBlockAsm
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBetterBlockAsm
- CMPL SI, $0x00010000
- JB three_bytes_match_emit_encodeSnappyBetterBlockAsm
- CMPL SI, $0x01000000
- JB four_bytes_match_emit_encodeSnappyBetterBlockAsm
- MOVB $0xfc, (CX)
- MOVL SI, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm
-
-four_bytes_match_emit_encodeSnappyBetterBlockAsm:
- MOVL SI, R11
- SHRL $0x10, R11
- MOVB $0xf8, (CX)
- MOVW SI, 1(CX)
- MOVB R11, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm
-
-three_bytes_match_emit_encodeSnappyBetterBlockAsm:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm
-
-two_bytes_match_emit_encodeSnappyBetterBlockAsm:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeSnappyBetterBlockAsm
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm
-
-one_byte_match_emit_encodeSnappyBetterBlockAsm:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBetterBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeSnappyBetterBlockAsm
-
-memmove_long_match_emit_encodeSnappyBetterBlockAsm:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsmlarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeSnappyBetterBlockAsm:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL R8, $0x00010000
- JB two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm
-
-four_bytes_loop_back_match_nolit_encodeSnappyBetterBlockAsm:
- CMPL R12, $0x40
- JBE four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm
- MOVB $0xff, (CX)
- MOVL R8, 1(CX)
- LEAL -64(R12), R12
- ADDQ $0x05, CX
- CMPL R12, $0x04
- JB four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm
- JMP four_bytes_loop_back_match_nolit_encodeSnappyBetterBlockAsm
-
-four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm:
- TESTL R12, R12
- JZ match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm
- XORL SI, SI
- LEAL -1(SI)(R12*4), R12
- MOVB R12, (CX)
- MOVL R8, 1(CX)
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm
-
-two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm
-
-two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm
-
-emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBetterBlockAsm:
- MOVQ $0x00cf1bbcdcbfa563, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x2f, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x32, R11
- SHLQ $0x08, R12
- IMULQ SI, R12
- SHRQ $0x2f, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x32, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 524288(AX)(R11*4)
- MOVL R14, 524288(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeSnappyBetterBlockAsm:
- CMPQ R8, R9
- JAE search_loop_encodeSnappyBetterBlockAsm
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x2f, R10
- SHLQ $0x08, R11
- IMULQ SI, R11
- SHRQ $0x2f, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeSnappyBetterBlockAsm
-
-emit_remainder_encodeSnappyBetterBlockAsm:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 5(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBetterBlockAsm
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBetterBlockAsm:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm
- CMPL DX, $0x00010000
- JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm
- CMPL DX, $0x01000000
- JB four_bytes_emit_remainder_encodeSnappyBetterBlockAsm
- MOVB $0xfc, (CX)
- MOVL DX, 1(CX)
- ADDQ $0x05, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm
-
-four_bytes_emit_remainder_encodeSnappyBetterBlockAsm:
- MOVL DX, BX
- SHRL $0x10, BX
- MOVB $0xf8, (CX)
- MOVW DX, 1(CX)
- MOVB BL, 3(CX)
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm
-
-three_bytes_emit_remainder_encodeSnappyBetterBlockAsm:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm
-
-two_bytes_emit_remainder_encodeSnappyBetterBlockAsm:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBetterBlockAsm
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm
-
-one_byte_emit_remainder_encodeSnappyBetterBlockAsm:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBetterBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm
-
-memmove_long_emit_remainder_encodeSnappyBetterBlockAsm:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsmlarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsmlarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsmlarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsmlarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsmlarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBetterBlockAsm64K(dst []byte, src []byte, tmp *[294912]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBetterBlockAsm64K(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000900, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBetterBlockAsm64K:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBetterBlockAsm64K
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBetterBlockAsm64K:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x07, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm64K
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x00cf1bbcdcbfa563, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x30, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x33, R11
- MOVL (AX)(R10*4), SI
- MOVL 262144(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 262144(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm64K
- CMPQ R11, DI
- JNE no_short_found_encodeSnappyBetterBlockAsm64K
- MOVL R8, SI
- JMP candidate_match_encodeSnappyBetterBlockAsm64K
-
-no_short_found_encodeSnappyBetterBlockAsm64K:
- CMPL R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm64K
- CMPL R11, DI
- JEQ candidateS_match_encodeSnappyBetterBlockAsm64K
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBetterBlockAsm64K
-
-candidateS_match_encodeSnappyBetterBlockAsm64K:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x08, R10
- IMULQ R9, R10
- SHRQ $0x30, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm64K
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBetterBlockAsm64K:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm64K
-
-match_extend_back_loop_encodeSnappyBetterBlockAsm64K:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBetterBlockAsm64K
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBetterBlockAsm64K
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm64K
- JMP match_extend_back_loop_encodeSnappyBetterBlockAsm64K
-
-match_extend_back_end_encodeSnappyBetterBlockAsm64K:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBetterBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBetterBlockAsm64K:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm64K:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm64K
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm64K
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm64K
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm64K
-
-matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm64K:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm64K
-
-matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm64K:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm64K
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K
-
-matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm64K:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm64K
-
-matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K
- JB match_nolit_end_encodeSnappyBetterBlockAsm64K
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeSnappyBetterBlockAsm64K
-
-matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeSnappyBetterBlockAsm64K
- LEAL 1(R12), R12
-
-match_nolit_end_encodeSnappyBetterBlockAsm64K:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm64K
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeSnappyBetterBlockAsm64K
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBetterBlockAsm64K
- JB three_bytes_match_emit_encodeSnappyBetterBlockAsm64K
-
-three_bytes_match_emit_encodeSnappyBetterBlockAsm64K:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm64K
-
-two_bytes_match_emit_encodeSnappyBetterBlockAsm64K:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeSnappyBetterBlockAsm64K
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm64K
-
-one_byte_match_emit_encodeSnappyBetterBlockAsm64K:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBetterBlockAsm64K:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm64K:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeSnappyBetterBlockAsm64K
-
-memmove_long_match_emit_encodeSnappyBetterBlockAsm64K:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm64Klarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm64Klarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm64Klarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm64Klarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm64Klarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeSnappyBetterBlockAsm64K:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm64K:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm64K
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm64K
-
-two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm64K:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm64K
-
-emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm64K:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm64K
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBetterBlockAsm64K:
- MOVQ $0x00cf1bbcdcbfa563, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x30, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x33, R11
- SHLQ $0x08, R12
- IMULQ SI, R12
- SHRQ $0x30, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x33, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 262144(AX)(R11*4)
- MOVL R14, 262144(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeSnappyBetterBlockAsm64K:
- CMPQ R8, R9
- JAE search_loop_encodeSnappyBetterBlockAsm64K
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x08, R10
- IMULQ SI, R10
- SHRQ $0x30, R10
- SHLQ $0x08, R11
- IMULQ SI, R11
- SHRQ $0x30, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeSnappyBetterBlockAsm64K
-
-emit_remainder_encodeSnappyBetterBlockAsm64K:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBetterBlockAsm64K
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBetterBlockAsm64K:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm64K
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm64K
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K
- JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-three_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-two_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBetterBlockAsm64K
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-one_byte_emit_remainder_encodeSnappyBetterBlockAsm64K:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBetterBlockAsm64K:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm64K_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm64K:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm64K
-
-memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64K:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64Klarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64Klarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64Klarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64Klarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64Klarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm64K:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBetterBlockAsm12B(dst []byte, src []byte, tmp *[81920]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBetterBlockAsm12B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000280, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBetterBlockAsm12B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBetterBlockAsm12B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBetterBlockAsm12B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x06, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm12B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x34, R11
- MOVL (AX)(R10*4), SI
- MOVL 65536(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 65536(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm12B
- CMPQ R11, DI
- JNE no_short_found_encodeSnappyBetterBlockAsm12B
- MOVL R8, SI
- JMP candidate_match_encodeSnappyBetterBlockAsm12B
-
-no_short_found_encodeSnappyBetterBlockAsm12B:
- CMPL R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm12B
- CMPL R11, DI
- JEQ candidateS_match_encodeSnappyBetterBlockAsm12B
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBetterBlockAsm12B
-
-candidateS_match_encodeSnappyBetterBlockAsm12B:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x32, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm12B
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBetterBlockAsm12B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm12B
-
-match_extend_back_loop_encodeSnappyBetterBlockAsm12B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBetterBlockAsm12B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBetterBlockAsm12B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm12B
- JMP match_extend_back_loop_encodeSnappyBetterBlockAsm12B
-
-match_extend_back_end_encodeSnappyBetterBlockAsm12B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBetterBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBetterBlockAsm12B:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm12B:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm12B
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm12B
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm12B
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm12B
-
-matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm12B
-
-matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm12B:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm12B
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B
-
-matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm12B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm12B
-
-matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B
- JB match_nolit_end_encodeSnappyBetterBlockAsm12B
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeSnappyBetterBlockAsm12B
-
-matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeSnappyBetterBlockAsm12B
- LEAL 1(R12), R12
-
-match_nolit_end_encodeSnappyBetterBlockAsm12B:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm12B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeSnappyBetterBlockAsm12B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBetterBlockAsm12B
- JB three_bytes_match_emit_encodeSnappyBetterBlockAsm12B
-
-three_bytes_match_emit_encodeSnappyBetterBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm12B
-
-two_bytes_match_emit_encodeSnappyBetterBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeSnappyBetterBlockAsm12B
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm12B
-
-one_byte_match_emit_encodeSnappyBetterBlockAsm12B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBetterBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm12B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeSnappyBetterBlockAsm12B
-
-memmove_long_match_emit_encodeSnappyBetterBlockAsm12B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm12Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeSnappyBetterBlockAsm12B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm12B:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm12B
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm12B
-
-two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm12B:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm12B
-
-emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm12B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm12B
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBetterBlockAsm12B:
- MOVQ $0x0000cf1bbcdcbf9b, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x32, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x34, R11
- SHLQ $0x10, R12
- IMULQ SI, R12
- SHRQ $0x32, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x34, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 65536(AX)(R11*4)
- MOVL R14, 65536(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeSnappyBetterBlockAsm12B:
- CMPQ R8, R9
- JAE search_loop_encodeSnappyBetterBlockAsm12B
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x32, R10
- SHLQ $0x10, R11
- IMULQ SI, R11
- SHRQ $0x32, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeSnappyBetterBlockAsm12B
-
-emit_remainder_encodeSnappyBetterBlockAsm12B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBetterBlockAsm12B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBetterBlockAsm12B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm12B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm12B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B
- JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-three_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-two_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBetterBlockAsm12B
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-one_byte_emit_remainder_encodeSnappyBetterBlockAsm12B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBetterBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm12B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm12B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm12B
-
-memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm12B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBetterBlockAsm10B(dst []byte, src []byte, tmp *[20480]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBetterBlockAsm10B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x000000a0, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBetterBlockAsm10B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBetterBlockAsm10B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBetterBlockAsm10B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm10B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x36, R11
- MOVL (AX)(R10*4), SI
- MOVL 16384(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 16384(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm10B
- CMPQ R11, DI
- JNE no_short_found_encodeSnappyBetterBlockAsm10B
- MOVL R8, SI
- JMP candidate_match_encodeSnappyBetterBlockAsm10B
-
-no_short_found_encodeSnappyBetterBlockAsm10B:
- CMPL R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm10B
- CMPL R11, DI
- JEQ candidateS_match_encodeSnappyBetterBlockAsm10B
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBetterBlockAsm10B
-
-candidateS_match_encodeSnappyBetterBlockAsm10B:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x34, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm10B
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBetterBlockAsm10B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm10B
-
-match_extend_back_loop_encodeSnappyBetterBlockAsm10B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBetterBlockAsm10B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBetterBlockAsm10B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm10B
- JMP match_extend_back_loop_encodeSnappyBetterBlockAsm10B
-
-match_extend_back_end_encodeSnappyBetterBlockAsm10B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBetterBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBetterBlockAsm10B:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm10B:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm10B
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm10B
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm10B
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm10B
-
-matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm10B
-
-matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm10B:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm10B
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B
-
-matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm10B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm10B
-
-matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B
- JB match_nolit_end_encodeSnappyBetterBlockAsm10B
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeSnappyBetterBlockAsm10B
-
-matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeSnappyBetterBlockAsm10B
- LEAL 1(R12), R12
-
-match_nolit_end_encodeSnappyBetterBlockAsm10B:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm10B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeSnappyBetterBlockAsm10B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBetterBlockAsm10B
- JB three_bytes_match_emit_encodeSnappyBetterBlockAsm10B
-
-three_bytes_match_emit_encodeSnappyBetterBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm10B
-
-two_bytes_match_emit_encodeSnappyBetterBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeSnappyBetterBlockAsm10B
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm10B
-
-one_byte_match_emit_encodeSnappyBetterBlockAsm10B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBetterBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm10B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeSnappyBetterBlockAsm10B
-
-memmove_long_match_emit_encodeSnappyBetterBlockAsm10B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm10Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeSnappyBetterBlockAsm10B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm10B:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm10B
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm10B
-
-two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm10B:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B
- CMPL R8, $0x00000800
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm10B
-
-emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm10B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm10B
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBetterBlockAsm10B:
- MOVQ $0x0000cf1bbcdcbf9b, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x34, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x36, R11
- SHLQ $0x10, R12
- IMULQ SI, R12
- SHRQ $0x34, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x36, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 16384(AX)(R11*4)
- MOVL R14, 16384(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeSnappyBetterBlockAsm10B:
- CMPQ R8, R9
- JAE search_loop_encodeSnappyBetterBlockAsm10B
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x34, R10
- SHLQ $0x10, R11
- IMULQ SI, R11
- SHRQ $0x34, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeSnappyBetterBlockAsm10B
-
-emit_remainder_encodeSnappyBetterBlockAsm10B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBetterBlockAsm10B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBetterBlockAsm10B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm10B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm10B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B
- JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-three_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-two_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBetterBlockAsm10B
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-one_byte_emit_remainder_encodeSnappyBetterBlockAsm10B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBetterBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm10B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm10B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm10B
-
-memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm10B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func encodeSnappyBetterBlockAsm8B(dst []byte, src []byte, tmp *[5120]byte) int
-// Requires: BMI, SSE2
-TEXT ·encodeSnappyBetterBlockAsm8B(SB), $24-64
- MOVQ tmp+48(FP), AX
- MOVQ dst_base+0(FP), CX
- MOVQ $0x00000028, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_encodeSnappyBetterBlockAsm8B:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_encodeSnappyBetterBlockAsm8B
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+32(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL $0x00000000, 16(SP)
- MOVQ src_base+24(FP), BX
-
-search_loop_encodeSnappyBetterBlockAsm8B:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x04, SI
- LEAL 1(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm8B
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ $0x9e3779b1, SI
- MOVQ DI, R10
- MOVQ DI, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- SHLQ $0x20, R11
- IMULQ SI, R11
- SHRQ $0x38, R11
- MOVL (AX)(R10*4), SI
- MOVL 4096(AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- MOVL DX, 4096(AX)(R11*4)
- MOVQ (BX)(SI*1), R10
- MOVQ (BX)(R8*1), R11
- CMPQ R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm8B
- CMPQ R11, DI
- JNE no_short_found_encodeSnappyBetterBlockAsm8B
- MOVL R8, SI
- JMP candidate_match_encodeSnappyBetterBlockAsm8B
-
-no_short_found_encodeSnappyBetterBlockAsm8B:
- CMPL R10, DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm8B
- CMPL R11, DI
- JEQ candidateS_match_encodeSnappyBetterBlockAsm8B
- MOVL 20(SP), DX
- JMP search_loop_encodeSnappyBetterBlockAsm8B
-
-candidateS_match_encodeSnappyBetterBlockAsm8B:
- SHRQ $0x08, DI
- MOVQ DI, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x36, R10
- MOVL (AX)(R10*4), SI
- INCL DX
- MOVL DX, (AX)(R10*4)
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_encodeSnappyBetterBlockAsm8B
- DECL DX
- MOVL R8, SI
-
-candidate_match_encodeSnappyBetterBlockAsm8B:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm8B
-
-match_extend_back_loop_encodeSnappyBetterBlockAsm8B:
- CMPL DX, DI
- JBE match_extend_back_end_encodeSnappyBetterBlockAsm8B
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_encodeSnappyBetterBlockAsm8B
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_encodeSnappyBetterBlockAsm8B
- JMP match_extend_back_loop_encodeSnappyBetterBlockAsm8B
-
-match_extend_back_end_encodeSnappyBetterBlockAsm8B:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_encodeSnappyBetterBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_dst_size_check_encodeSnappyBetterBlockAsm8B:
- MOVL DX, DI
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+32(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), R10
-
- // matchLen
- XORL R12, R12
-
-matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm8B:
- CMPL R8, $0x10
- JB matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm8B
- MOVQ (R9)(R12*1), R11
- MOVQ 8(R9)(R12*1), R13
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm8B
- XORQ 8(R10)(R12*1), R13
- JNZ matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm8B
- LEAL -16(R8), R8
- LEAL 16(R12), R12
- JMP matchlen_loopback_16_match_nolit_encodeSnappyBetterBlockAsm8B
-
-matchlen_bsf_16match_nolit_encodeSnappyBetterBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R13, R13
-
-#else
- BSFQ R13, R13
-
-#endif
- SARQ $0x03, R13
- LEAL 8(R12)(R13*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm8B
-
-matchlen_match8_match_nolit_encodeSnappyBetterBlockAsm8B:
- CMPL R8, $0x08
- JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B
- MOVQ (R9)(R12*1), R11
- XORQ (R10)(R12*1), R11
- JNZ matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm8B
- LEAL -8(R8), R8
- LEAL 8(R12), R12
- JMP matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B
-
-matchlen_bsf_8_match_nolit_encodeSnappyBetterBlockAsm8B:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL (R12)(R11*1), R12
- JMP match_nolit_end_encodeSnappyBetterBlockAsm8B
-
-matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B:
- CMPL R8, $0x04
- JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B
- MOVL (R9)(R12*1), R11
- CMPL (R10)(R12*1), R11
- JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B
- LEAL -4(R8), R8
- LEAL 4(R12), R12
-
-matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B:
- CMPL R8, $0x01
- JE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B
- JB match_nolit_end_encodeSnappyBetterBlockAsm8B
- MOVW (R9)(R12*1), R11
- CMPW (R10)(R12*1), R11
- JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B
- LEAL 2(R12), R12
- SUBL $0x02, R8
- JZ match_nolit_end_encodeSnappyBetterBlockAsm8B
-
-matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B:
- MOVB (R9)(R12*1), R11
- CMPB (R10)(R12*1), R11
- JNE match_nolit_end_encodeSnappyBetterBlockAsm8B
- LEAL 1(R12), R12
-
-match_nolit_end_encodeSnappyBetterBlockAsm8B:
- MOVL DX, R8
- SUBL SI, R8
-
- // Check if repeat
- MOVL R8, 16(SP)
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm8B
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R10
- SUBL SI, R9
- LEAL -1(R9), SI
- CMPL SI, $0x3c
- JB one_byte_match_emit_encodeSnappyBetterBlockAsm8B
- CMPL SI, $0x00000100
- JB two_bytes_match_emit_encodeSnappyBetterBlockAsm8B
- JB three_bytes_match_emit_encodeSnappyBetterBlockAsm8B
-
-three_bytes_match_emit_encodeSnappyBetterBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW SI, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm8B
-
-two_bytes_match_emit_encodeSnappyBetterBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB SI, 1(CX)
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_match_emit_encodeSnappyBetterBlockAsm8B
- JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm8B
-
-one_byte_match_emit_encodeSnappyBetterBlockAsm8B:
- SHLB $0x02, SI
- MOVB SI, (CX)
- ADDQ $0x01, CX
-
-memmove_match_emit_encodeSnappyBetterBlockAsm8B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8:
- MOVQ (R10), R11
- MOVQ R11, (CX)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8through16:
- MOVQ (R10), R11
- MOVQ -8(R10)(R9*1), R10
- MOVQ R11, (CX)
- MOVQ R10, -8(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_17through32:
- MOVOU (R10), X0
- MOVOU -16(R10)(R9*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(R9*1)
- JMP memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_33through64:
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
-
-memmove_end_copy_match_emit_encodeSnappyBetterBlockAsm8B:
- MOVQ SI, CX
- JMP emit_literal_done_match_emit_encodeSnappyBetterBlockAsm8B
-
-memmove_long_match_emit_encodeSnappyBetterBlockAsm8B:
- LEAQ (CX)(R9*1), SI
-
- // genMemMoveLong
- MOVOU (R10), X0
- MOVOU 16(R10), X1
- MOVOU -32(R10)(R9*1), X2
- MOVOU -16(R10)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ CX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R14
- SUBQ R11, R14
- DECQ R13
- JA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(R10)(R14*1), R11
- LEAQ -32(CX)(R14*1), R15
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm8Blarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R11
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(R10)(R14*1), X4
- MOVOU -16(R10)(R14*1), X5
- MOVOA X4, -32(CX)(R14*1)
- MOVOA X5, -16(CX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_match_emit_encodeSnappyBetterBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(R9*1)
- MOVOU X3, -16(CX)(R9*1)
- MOVQ SI, CX
-
-emit_literal_done_match_emit_encodeSnappyBetterBlockAsm8B:
- ADDL R12, DX
- ADDL $0x04, R12
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm8B:
- CMPL R12, $0x40
- JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm8B
- MOVB $0xee, (CX)
- MOVW R8, 1(CX)
- LEAL -60(R12), R12
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm8B
-
-two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm8B:
- MOVL R12, SI
- SHLL $0x02, SI
- CMPL R12, $0x0c
- JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm8B
- LEAL -15(SI), SI
- MOVB R8, 1(CX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, SI
- MOVB SI, (CX)
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm8B
-
-emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm8B:
- LEAL -2(SI), SI
- MOVB SI, (CX)
- MOVW R8, 1(CX)
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm8B:
- CMPL DX, 8(SP)
- JAE emit_remainder_encodeSnappyBetterBlockAsm8B
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-match_nolit_dst_ok_encodeSnappyBetterBlockAsm8B:
- MOVQ $0x0000cf1bbcdcbf9b, SI
- MOVQ $0x9e3779b1, R8
- LEAQ 1(DI), DI
- LEAQ -2(DX), R9
- MOVQ (BX)(DI*1), R10
- MOVQ 1(BX)(DI*1), R11
- MOVQ (BX)(R9*1), R12
- MOVQ 1(BX)(R9*1), R13
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x36, R10
- SHLQ $0x20, R11
- IMULQ R8, R11
- SHRQ $0x38, R11
- SHLQ $0x10, R12
- IMULQ SI, R12
- SHRQ $0x36, R12
- SHLQ $0x20, R13
- IMULQ R8, R13
- SHRQ $0x38, R13
- LEAQ 1(DI), R8
- LEAQ 1(R9), R14
- MOVL DI, (AX)(R10*4)
- MOVL R9, (AX)(R12*4)
- MOVL R8, 4096(AX)(R11*4)
- MOVL R14, 4096(AX)(R13*4)
- LEAQ 1(R9)(DI*1), R8
- SHRQ $0x01, R8
- ADDQ $0x01, DI
- SUBQ $0x01, R9
-
-index_loop_encodeSnappyBetterBlockAsm8B:
- CMPQ R8, R9
- JAE search_loop_encodeSnappyBetterBlockAsm8B
- MOVQ (BX)(DI*1), R10
- MOVQ (BX)(R8*1), R11
- SHLQ $0x10, R10
- IMULQ SI, R10
- SHRQ $0x36, R10
- SHLQ $0x10, R11
- IMULQ SI, R11
- SHRQ $0x36, R11
- MOVL DI, (AX)(R10*4)
- MOVL R8, (AX)(R11*4)
- ADDQ $0x02, DI
- ADDQ $0x02, R8
- JMP index_loop_encodeSnappyBetterBlockAsm8B
-
-emit_remainder_encodeSnappyBetterBlockAsm8B:
- MOVQ src_len+32(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_encodeSnappyBetterBlockAsm8B
- MOVQ $0x00000000, ret+56(FP)
- RET
-
-emit_remainder_ok_encodeSnappyBetterBlockAsm8B:
- MOVQ src_len+32(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm8B
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), DX
- CMPL DX, $0x3c
- JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm8B
- CMPL DX, $0x00000100
- JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B
- JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-three_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B:
- MOVB $0xf4, (CX)
- MOVW DX, 1(CX)
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-two_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B:
- MOVB $0xf0, (CX)
- MOVB DL, 1(CX)
- ADDQ $0x02, CX
- CMPL DX, $0x40
- JB memmove_emit_remainder_encodeSnappyBetterBlockAsm8B
- JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-one_byte_emit_remainder_encodeSnappyBetterBlockAsm8B:
- SHLB $0x02, DL
- MOVB DL, (CX)
- ADDQ $0x01, CX
-
-memmove_emit_remainder_encodeSnappyBetterBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveShort
- CMPQ BX, $0x03
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_1or2
- JE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_3
- CMPQ BX, $0x08
- JB emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_4through7
- CMPQ BX, $0x10
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_8through16
- CMPQ BX, $0x20
- JBE emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_17through32
- JMP emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_33through64
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_1or2:
- MOVB (AX), SI
- MOVB -1(AX)(BX*1), AL
- MOVB SI, (CX)
- MOVB AL, -1(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_3:
- MOVW (AX), SI
- MOVB 2(AX), AL
- MOVW SI, (CX)
- MOVB AL, 2(CX)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_4through7:
- MOVL (AX), SI
- MOVL -4(AX)(BX*1), AX
- MOVL SI, (CX)
- MOVL AX, -4(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_8through16:
- MOVQ (AX), SI
- MOVQ -8(AX)(BX*1), AX
- MOVQ SI, (CX)
- MOVQ AX, -8(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_17through32:
- MOVOU (AX), X0
- MOVOU -16(AX)(BX*1), X1
- MOVOU X0, (CX)
- MOVOU X1, -16(CX)(BX*1)
- JMP memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-emit_lit_memmove_emit_remainder_encodeSnappyBetterBlockAsm8B_memmove_move_33through64:
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
-
-memmove_end_copy_emit_remainder_encodeSnappyBetterBlockAsm8B:
- MOVQ DX, CX
- JMP emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm8B
-
-memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8B:
- LEAQ (CX)(SI*1), DX
- MOVL SI, BX
-
- // genMemMoveLong
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU -32(AX)(BX*1), X2
- MOVOU -16(AX)(BX*1), X3
- MOVQ BX, DI
- SHRQ $0x05, DI
- MOVQ CX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8Blarge_forward_sse_loop_32
- LEAQ -32(AX)(R8*1), SI
- LEAQ -32(CX)(R8*1), R9
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8Blarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8Blarge_big_loop_back
-
-emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8Blarge_forward_sse_loop_32:
- MOVOU -32(AX)(R8*1), X4
- MOVOU -16(AX)(R8*1), X5
- MOVOA X4, -32(CX)(R8*1)
- MOVOA X5, -16(CX)(R8*1)
- ADDQ $0x20, R8
- CMPQ BX, R8
- JAE emit_lit_memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8Blarge_forward_sse_loop_32
- MOVOU X0, (CX)
- MOVOU X1, 16(CX)
- MOVOU X2, -32(CX)(BX*1)
- MOVOU X3, -16(CX)(BX*1)
- MOVQ DX, CX
-
-emit_literal_done_emit_remainder_encodeSnappyBetterBlockAsm8B:
- MOVQ dst_base+0(FP), AX
- SUBQ AX, CX
- MOVQ CX, ret+56(FP)
- RET
-
-// func calcBlockSize(src []byte, tmp *[32768]byte) int
-// Requires: BMI, SSE2
-TEXT ·calcBlockSize(SB), $24-40
- MOVQ tmp+24(FP), AX
- XORQ CX, CX
- MOVQ $0x00000100, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_calcBlockSize:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_calcBlockSize
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+8(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+0(FP), BX
-
-search_loop_calcBlockSize:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x05, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_calcBlockSize
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x33, R10
- SHLQ $0x10, R11
- IMULQ R9, R11
- SHRQ $0x33, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x10, R10
- IMULQ R9, R10
- SHRQ $0x33, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_calcBlockSize
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_calcBlockSize
-
-repeat_extend_back_loop_calcBlockSize:
- CMPL DI, SI
- JBE repeat_extend_back_end_calcBlockSize
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_calcBlockSize
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_calcBlockSize
-
-repeat_extend_back_end_calcBlockSize:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 5(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_calcBlockSize
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-repeat_dst_size_check_calcBlockSize:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_calcBlockSize
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_calcBlockSize
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_calcBlockSize
- CMPL SI, $0x00010000
- JB three_bytes_repeat_emit_calcBlockSize
- CMPL SI, $0x01000000
- JB four_bytes_repeat_emit_calcBlockSize
- ADDQ $0x05, CX
- JMP memmove_long_repeat_emit_calcBlockSize
-
-four_bytes_repeat_emit_calcBlockSize:
- ADDQ $0x04, CX
- JMP memmove_long_repeat_emit_calcBlockSize
-
-three_bytes_repeat_emit_calcBlockSize:
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_calcBlockSize
-
-two_bytes_repeat_emit_calcBlockSize:
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_calcBlockSize
- JMP memmove_long_repeat_emit_calcBlockSize
-
-one_byte_repeat_emit_calcBlockSize:
- ADDQ $0x01, CX
-
-memmove_repeat_emit_calcBlockSize:
- LEAQ (CX)(R8*1), CX
- JMP emit_literal_done_repeat_emit_calcBlockSize
-
-memmove_long_repeat_emit_calcBlockSize:
- LEAQ (CX)(R8*1), CX
-
-emit_literal_done_repeat_emit_calcBlockSize:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+8(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_calcBlockSize:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_calcBlockSize
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_calcBlockSize
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_calcBlockSize
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_calcBlockSize
-
-matchlen_bsf_16repeat_extend_calcBlockSize:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_calcBlockSize
-
-matchlen_match8_repeat_extend_calcBlockSize:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_calcBlockSize
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_calcBlockSize
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_calcBlockSize
-
-matchlen_bsf_8_repeat_extend_calcBlockSize:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_calcBlockSize
-
-matchlen_match4_repeat_extend_calcBlockSize:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_calcBlockSize
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_calcBlockSize
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_calcBlockSize:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_calcBlockSize
- JB repeat_extend_forward_end_calcBlockSize
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_calcBlockSize
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_calcBlockSize
-
-matchlen_match1_repeat_extend_calcBlockSize:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_calcBlockSize
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_calcBlockSize:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
- CMPL DI, $0x00010000
- JB two_byte_offset_repeat_as_copy_calcBlockSize
-
-four_bytes_loop_back_repeat_as_copy_calcBlockSize:
- CMPL SI, $0x40
- JBE four_bytes_remain_repeat_as_copy_calcBlockSize
- LEAL -64(SI), SI
- ADDQ $0x05, CX
- CMPL SI, $0x04
- JB four_bytes_remain_repeat_as_copy_calcBlockSize
- JMP four_bytes_loop_back_repeat_as_copy_calcBlockSize
-
-four_bytes_remain_repeat_as_copy_calcBlockSize:
- TESTL SI, SI
- JZ repeat_end_emit_calcBlockSize
- XORL SI, SI
- ADDQ $0x05, CX
- JMP repeat_end_emit_calcBlockSize
-
-two_byte_offset_repeat_as_copy_calcBlockSize:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_calcBlockSize
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_calcBlockSize
-
-two_byte_offset_short_repeat_as_copy_calcBlockSize:
- MOVL SI, R8
- SHLL $0x02, R8
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_calcBlockSize
- CMPL DI, $0x00000800
- JAE emit_copy_three_repeat_as_copy_calcBlockSize
- ADDQ $0x02, CX
- JMP repeat_end_emit_calcBlockSize
-
-emit_copy_three_repeat_as_copy_calcBlockSize:
- ADDQ $0x03, CX
-
-repeat_end_emit_calcBlockSize:
- MOVL DX, 12(SP)
- JMP search_loop_calcBlockSize
-
-no_repeat_found_calcBlockSize:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_calcBlockSize
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_calcBlockSize
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_calcBlockSize
- MOVL 20(SP), DX
- JMP search_loop_calcBlockSize
-
-candidate3_match_calcBlockSize:
- ADDL $0x02, DX
- JMP candidate_match_calcBlockSize
-
-candidate2_match_calcBlockSize:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_calcBlockSize:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_calcBlockSize
-
-match_extend_back_loop_calcBlockSize:
- CMPL DX, DI
- JBE match_extend_back_end_calcBlockSize
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_calcBlockSize
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_calcBlockSize
- JMP match_extend_back_loop_calcBlockSize
-
-match_extend_back_end_calcBlockSize:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 5(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_calcBlockSize
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-match_dst_size_check_calcBlockSize:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_calcBlockSize
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), DI
- CMPL DI, $0x3c
- JB one_byte_match_emit_calcBlockSize
- CMPL DI, $0x00000100
- JB two_bytes_match_emit_calcBlockSize
- CMPL DI, $0x00010000
- JB three_bytes_match_emit_calcBlockSize
- CMPL DI, $0x01000000
- JB four_bytes_match_emit_calcBlockSize
- ADDQ $0x05, CX
- JMP memmove_long_match_emit_calcBlockSize
-
-four_bytes_match_emit_calcBlockSize:
- ADDQ $0x04, CX
- JMP memmove_long_match_emit_calcBlockSize
-
-three_bytes_match_emit_calcBlockSize:
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_calcBlockSize
-
-two_bytes_match_emit_calcBlockSize:
- ADDQ $0x02, CX
- CMPL DI, $0x40
- JB memmove_match_emit_calcBlockSize
- JMP memmove_long_match_emit_calcBlockSize
-
-one_byte_match_emit_calcBlockSize:
- ADDQ $0x01, CX
-
-memmove_match_emit_calcBlockSize:
- LEAQ (CX)(R9*1), CX
- JMP emit_literal_done_match_emit_calcBlockSize
-
-memmove_long_match_emit_calcBlockSize:
- LEAQ (CX)(R9*1), CX
-
-emit_literal_done_match_emit_calcBlockSize:
-match_nolit_loop_calcBlockSize:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+8(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_calcBlockSize:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_calcBlockSize
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_calcBlockSize
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_calcBlockSize
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_calcBlockSize
-
-matchlen_bsf_16match_nolit_calcBlockSize:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_calcBlockSize
-
-matchlen_match8_match_nolit_calcBlockSize:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_calcBlockSize
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_calcBlockSize
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_calcBlockSize
-
-matchlen_bsf_8_match_nolit_calcBlockSize:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_calcBlockSize
-
-matchlen_match4_match_nolit_calcBlockSize:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_calcBlockSize
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_calcBlockSize
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_calcBlockSize:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_calcBlockSize
- JB match_nolit_end_calcBlockSize
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_calcBlockSize
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_calcBlockSize
-
-matchlen_match1_match_nolit_calcBlockSize:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_calcBlockSize
- LEAL 1(R10), R10
-
-match_nolit_end_calcBlockSize:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
- CMPL SI, $0x00010000
- JB two_byte_offset_match_nolit_calcBlockSize
-
-four_bytes_loop_back_match_nolit_calcBlockSize:
- CMPL R10, $0x40
- JBE four_bytes_remain_match_nolit_calcBlockSize
- LEAL -64(R10), R10
- ADDQ $0x05, CX
- CMPL R10, $0x04
- JB four_bytes_remain_match_nolit_calcBlockSize
- JMP four_bytes_loop_back_match_nolit_calcBlockSize
-
-four_bytes_remain_match_nolit_calcBlockSize:
- TESTL R10, R10
- JZ match_nolit_emitcopy_end_calcBlockSize
- XORL SI, SI
- ADDQ $0x05, CX
- JMP match_nolit_emitcopy_end_calcBlockSize
-
-two_byte_offset_match_nolit_calcBlockSize:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_calcBlockSize
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_calcBlockSize
-
-two_byte_offset_short_match_nolit_calcBlockSize:
- MOVL R10, DI
- SHLL $0x02, DI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_calcBlockSize
- CMPL SI, $0x00000800
- JAE emit_copy_three_match_nolit_calcBlockSize
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_calcBlockSize
-
-emit_copy_three_match_nolit_calcBlockSize:
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_calcBlockSize:
- CMPL DX, 8(SP)
- JAE emit_remainder_calcBlockSize
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_calcBlockSize
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-match_nolit_dst_ok_calcBlockSize:
- MOVQ $0x0000cf1bbcdcbf9b, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x10, R8
- IMULQ R9, R8
- SHRQ $0x33, R8
- SHLQ $0x10, SI
- IMULQ R9, SI
- SHRQ $0x33, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_calcBlockSize
- INCL DX
- JMP search_loop_calcBlockSize
-
-emit_remainder_calcBlockSize:
- MOVQ src_len+8(FP), AX
- SUBL 12(SP), AX
- LEAQ 5(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_calcBlockSize
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-emit_remainder_ok_calcBlockSize:
- MOVQ src_len+8(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_calcBlockSize
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), AX
- CMPL AX, $0x3c
- JB one_byte_emit_remainder_calcBlockSize
- CMPL AX, $0x00000100
- JB two_bytes_emit_remainder_calcBlockSize
- CMPL AX, $0x00010000
- JB three_bytes_emit_remainder_calcBlockSize
- CMPL AX, $0x01000000
- JB four_bytes_emit_remainder_calcBlockSize
- ADDQ $0x05, CX
- JMP memmove_long_emit_remainder_calcBlockSize
-
-four_bytes_emit_remainder_calcBlockSize:
- ADDQ $0x04, CX
- JMP memmove_long_emit_remainder_calcBlockSize
-
-three_bytes_emit_remainder_calcBlockSize:
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_calcBlockSize
-
-two_bytes_emit_remainder_calcBlockSize:
- ADDQ $0x02, CX
- CMPL AX, $0x40
- JB memmove_emit_remainder_calcBlockSize
- JMP memmove_long_emit_remainder_calcBlockSize
-
-one_byte_emit_remainder_calcBlockSize:
- ADDQ $0x01, CX
-
-memmove_emit_remainder_calcBlockSize:
- LEAQ (CX)(SI*1), AX
- MOVQ AX, CX
- JMP emit_literal_done_emit_remainder_calcBlockSize
-
-memmove_long_emit_remainder_calcBlockSize:
- LEAQ (CX)(SI*1), AX
- MOVQ AX, CX
-
-emit_literal_done_emit_remainder_calcBlockSize:
- MOVQ CX, ret+32(FP)
- RET
-
-// func calcBlockSizeSmall(src []byte, tmp *[2048]byte) int
-// Requires: BMI, SSE2
-TEXT ·calcBlockSizeSmall(SB), $24-40
- MOVQ tmp+24(FP), AX
- XORQ CX, CX
- MOVQ $0x00000010, DX
- MOVQ AX, BX
- PXOR X0, X0
-
-zero_loop_calcBlockSizeSmall:
- MOVOU X0, (BX)
- MOVOU X0, 16(BX)
- MOVOU X0, 32(BX)
- MOVOU X0, 48(BX)
- MOVOU X0, 64(BX)
- MOVOU X0, 80(BX)
- MOVOU X0, 96(BX)
- MOVOU X0, 112(BX)
- ADDQ $0x80, BX
- DECQ DX
- JNZ zero_loop_calcBlockSizeSmall
- MOVL $0x00000000, 12(SP)
- MOVQ src_len+8(FP), DX
- LEAQ -9(DX), BX
- LEAQ -8(DX), SI
- MOVL SI, 8(SP)
- SHRQ $0x05, DX
- SUBL DX, BX
- LEAQ (CX)(BX*1), BX
- MOVQ BX, (SP)
- MOVL $0x00000001, DX
- MOVL DX, 16(SP)
- MOVQ src_base+0(FP), BX
-
-search_loop_calcBlockSizeSmall:
- MOVL DX, SI
- SUBL 12(SP), SI
- SHRL $0x04, SI
- LEAL 4(DX)(SI*1), SI
- CMPL SI, 8(SP)
- JAE emit_remainder_calcBlockSizeSmall
- MOVQ (BX)(DX*1), DI
- MOVL SI, 20(SP)
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R10
- MOVQ DI, R11
- SHRQ $0x08, R11
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x37, R10
- SHLQ $0x20, R11
- IMULQ R9, R11
- SHRQ $0x37, R11
- MOVL (AX)(R10*4), SI
- MOVL (AX)(R11*4), R8
- MOVL DX, (AX)(R10*4)
- LEAL 1(DX), R10
- MOVL R10, (AX)(R11*4)
- MOVQ DI, R10
- SHRQ $0x10, R10
- SHLQ $0x20, R10
- IMULQ R9, R10
- SHRQ $0x37, R10
- MOVL DX, R9
- SUBL 16(SP), R9
- MOVL 1(BX)(R9*1), R11
- MOVQ DI, R9
- SHRQ $0x08, R9
- CMPL R9, R11
- JNE no_repeat_found_calcBlockSizeSmall
- LEAL 1(DX), DI
- MOVL 12(SP), SI
- MOVL DI, R8
- SUBL 16(SP), R8
- JZ repeat_extend_back_end_calcBlockSizeSmall
-
-repeat_extend_back_loop_calcBlockSizeSmall:
- CMPL DI, SI
- JBE repeat_extend_back_end_calcBlockSizeSmall
- MOVB -1(BX)(R8*1), R9
- MOVB -1(BX)(DI*1), R10
- CMPB R9, R10
- JNE repeat_extend_back_end_calcBlockSizeSmall
- LEAL -1(DI), DI
- DECL R8
- JNZ repeat_extend_back_loop_calcBlockSizeSmall
-
-repeat_extend_back_end_calcBlockSizeSmall:
- MOVL DI, SI
- SUBL 12(SP), SI
- LEAQ 3(CX)(SI*1), SI
- CMPQ SI, (SP)
- JB repeat_dst_size_check_calcBlockSizeSmall
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-repeat_dst_size_check_calcBlockSizeSmall:
- MOVL 12(SP), SI
- CMPL SI, DI
- JEQ emit_literal_done_repeat_emit_calcBlockSizeSmall
- MOVL DI, R8
- MOVL DI, 12(SP)
- LEAQ (BX)(SI*1), R9
- SUBL SI, R8
- LEAL -1(R8), SI
- CMPL SI, $0x3c
- JB one_byte_repeat_emit_calcBlockSizeSmall
- CMPL SI, $0x00000100
- JB two_bytes_repeat_emit_calcBlockSizeSmall
- JB three_bytes_repeat_emit_calcBlockSizeSmall
-
-three_bytes_repeat_emit_calcBlockSizeSmall:
- ADDQ $0x03, CX
- JMP memmove_long_repeat_emit_calcBlockSizeSmall
-
-two_bytes_repeat_emit_calcBlockSizeSmall:
- ADDQ $0x02, CX
- CMPL SI, $0x40
- JB memmove_repeat_emit_calcBlockSizeSmall
- JMP memmove_long_repeat_emit_calcBlockSizeSmall
-
-one_byte_repeat_emit_calcBlockSizeSmall:
- ADDQ $0x01, CX
-
-memmove_repeat_emit_calcBlockSizeSmall:
- LEAQ (CX)(R8*1), CX
- JMP emit_literal_done_repeat_emit_calcBlockSizeSmall
-
-memmove_long_repeat_emit_calcBlockSizeSmall:
- LEAQ (CX)(R8*1), CX
-
-emit_literal_done_repeat_emit_calcBlockSizeSmall:
- ADDL $0x05, DX
- MOVL DX, SI
- SUBL 16(SP), SI
- MOVQ src_len+8(FP), R8
- SUBL DX, R8
- LEAQ (BX)(DX*1), R9
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R11, R11
-
-matchlen_loopback_16_repeat_extend_calcBlockSizeSmall:
- CMPL R8, $0x10
- JB matchlen_match8_repeat_extend_calcBlockSizeSmall
- MOVQ (R9)(R11*1), R10
- MOVQ 8(R9)(R11*1), R12
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_calcBlockSizeSmall
- XORQ 8(SI)(R11*1), R12
- JNZ matchlen_bsf_16repeat_extend_calcBlockSizeSmall
- LEAL -16(R8), R8
- LEAL 16(R11), R11
- JMP matchlen_loopback_16_repeat_extend_calcBlockSizeSmall
-
-matchlen_bsf_16repeat_extend_calcBlockSizeSmall:
-#ifdef GOAMD64_v3
- TZCNTQ R12, R12
-
-#else
- BSFQ R12, R12
-
-#endif
- SARQ $0x03, R12
- LEAL 8(R11)(R12*1), R11
- JMP repeat_extend_forward_end_calcBlockSizeSmall
-
-matchlen_match8_repeat_extend_calcBlockSizeSmall:
- CMPL R8, $0x08
- JB matchlen_match4_repeat_extend_calcBlockSizeSmall
- MOVQ (R9)(R11*1), R10
- XORQ (SI)(R11*1), R10
- JNZ matchlen_bsf_8_repeat_extend_calcBlockSizeSmall
- LEAL -8(R8), R8
- LEAL 8(R11), R11
- JMP matchlen_match4_repeat_extend_calcBlockSizeSmall
-
-matchlen_bsf_8_repeat_extend_calcBlockSizeSmall:
-#ifdef GOAMD64_v3
- TZCNTQ R10, R10
-
-#else
- BSFQ R10, R10
-
-#endif
- SARQ $0x03, R10
- LEAL (R11)(R10*1), R11
- JMP repeat_extend_forward_end_calcBlockSizeSmall
-
-matchlen_match4_repeat_extend_calcBlockSizeSmall:
- CMPL R8, $0x04
- JB matchlen_match2_repeat_extend_calcBlockSizeSmall
- MOVL (R9)(R11*1), R10
- CMPL (SI)(R11*1), R10
- JNE matchlen_match2_repeat_extend_calcBlockSizeSmall
- LEAL -4(R8), R8
- LEAL 4(R11), R11
-
-matchlen_match2_repeat_extend_calcBlockSizeSmall:
- CMPL R8, $0x01
- JE matchlen_match1_repeat_extend_calcBlockSizeSmall
- JB repeat_extend_forward_end_calcBlockSizeSmall
- MOVW (R9)(R11*1), R10
- CMPW (SI)(R11*1), R10
- JNE matchlen_match1_repeat_extend_calcBlockSizeSmall
- LEAL 2(R11), R11
- SUBL $0x02, R8
- JZ repeat_extend_forward_end_calcBlockSizeSmall
-
-matchlen_match1_repeat_extend_calcBlockSizeSmall:
- MOVB (R9)(R11*1), R10
- CMPB (SI)(R11*1), R10
- JNE repeat_extend_forward_end_calcBlockSizeSmall
- LEAL 1(R11), R11
-
-repeat_extend_forward_end_calcBlockSizeSmall:
- ADDL R11, DX
- MOVL DX, SI
- SUBL DI, SI
- MOVL 16(SP), DI
-
- // emitCopy
-two_byte_offset_repeat_as_copy_calcBlockSizeSmall:
- CMPL SI, $0x40
- JBE two_byte_offset_short_repeat_as_copy_calcBlockSizeSmall
- LEAL -60(SI), SI
- ADDQ $0x03, CX
- JMP two_byte_offset_repeat_as_copy_calcBlockSizeSmall
-
-two_byte_offset_short_repeat_as_copy_calcBlockSizeSmall:
- MOVL SI, DI
- SHLL $0x02, DI
- CMPL SI, $0x0c
- JAE emit_copy_three_repeat_as_copy_calcBlockSizeSmall
- ADDQ $0x02, CX
- JMP repeat_end_emit_calcBlockSizeSmall
-
-emit_copy_three_repeat_as_copy_calcBlockSizeSmall:
- ADDQ $0x03, CX
-
-repeat_end_emit_calcBlockSizeSmall:
- MOVL DX, 12(SP)
- JMP search_loop_calcBlockSizeSmall
-
-no_repeat_found_calcBlockSizeSmall:
- CMPL (BX)(SI*1), DI
- JEQ candidate_match_calcBlockSizeSmall
- SHRQ $0x08, DI
- MOVL (AX)(R10*4), SI
- LEAL 2(DX), R9
- CMPL (BX)(R8*1), DI
- JEQ candidate2_match_calcBlockSizeSmall
- MOVL R9, (AX)(R10*4)
- SHRQ $0x08, DI
- CMPL (BX)(SI*1), DI
- JEQ candidate3_match_calcBlockSizeSmall
- MOVL 20(SP), DX
- JMP search_loop_calcBlockSizeSmall
-
-candidate3_match_calcBlockSizeSmall:
- ADDL $0x02, DX
- JMP candidate_match_calcBlockSizeSmall
-
-candidate2_match_calcBlockSizeSmall:
- MOVL R9, (AX)(R10*4)
- INCL DX
- MOVL R8, SI
-
-candidate_match_calcBlockSizeSmall:
- MOVL 12(SP), DI
- TESTL SI, SI
- JZ match_extend_back_end_calcBlockSizeSmall
-
-match_extend_back_loop_calcBlockSizeSmall:
- CMPL DX, DI
- JBE match_extend_back_end_calcBlockSizeSmall
- MOVB -1(BX)(SI*1), R8
- MOVB -1(BX)(DX*1), R9
- CMPB R8, R9
- JNE match_extend_back_end_calcBlockSizeSmall
- LEAL -1(DX), DX
- DECL SI
- JZ match_extend_back_end_calcBlockSizeSmall
- JMP match_extend_back_loop_calcBlockSizeSmall
-
-match_extend_back_end_calcBlockSizeSmall:
- MOVL DX, DI
- SUBL 12(SP), DI
- LEAQ 3(CX)(DI*1), DI
- CMPQ DI, (SP)
- JB match_dst_size_check_calcBlockSizeSmall
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-match_dst_size_check_calcBlockSizeSmall:
- MOVL DX, DI
- MOVL 12(SP), R8
- CMPL R8, DI
- JEQ emit_literal_done_match_emit_calcBlockSizeSmall
- MOVL DI, R9
- MOVL DI, 12(SP)
- LEAQ (BX)(R8*1), DI
- SUBL R8, R9
- LEAL -1(R9), DI
- CMPL DI, $0x3c
- JB one_byte_match_emit_calcBlockSizeSmall
- CMPL DI, $0x00000100
- JB two_bytes_match_emit_calcBlockSizeSmall
- JB three_bytes_match_emit_calcBlockSizeSmall
-
-three_bytes_match_emit_calcBlockSizeSmall:
- ADDQ $0x03, CX
- JMP memmove_long_match_emit_calcBlockSizeSmall
-
-two_bytes_match_emit_calcBlockSizeSmall:
- ADDQ $0x02, CX
- CMPL DI, $0x40
- JB memmove_match_emit_calcBlockSizeSmall
- JMP memmove_long_match_emit_calcBlockSizeSmall
-
-one_byte_match_emit_calcBlockSizeSmall:
- ADDQ $0x01, CX
-
-memmove_match_emit_calcBlockSizeSmall:
- LEAQ (CX)(R9*1), CX
- JMP emit_literal_done_match_emit_calcBlockSizeSmall
-
-memmove_long_match_emit_calcBlockSizeSmall:
- LEAQ (CX)(R9*1), CX
-
-emit_literal_done_match_emit_calcBlockSizeSmall:
-match_nolit_loop_calcBlockSizeSmall:
- MOVL DX, DI
- SUBL SI, DI
- MOVL DI, 16(SP)
- ADDL $0x04, DX
- ADDL $0x04, SI
- MOVQ src_len+8(FP), DI
- SUBL DX, DI
- LEAQ (BX)(DX*1), R8
- LEAQ (BX)(SI*1), SI
-
- // matchLen
- XORL R10, R10
-
-matchlen_loopback_16_match_nolit_calcBlockSizeSmall:
- CMPL DI, $0x10
- JB matchlen_match8_match_nolit_calcBlockSizeSmall
- MOVQ (R8)(R10*1), R9
- MOVQ 8(R8)(R10*1), R11
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_calcBlockSizeSmall
- XORQ 8(SI)(R10*1), R11
- JNZ matchlen_bsf_16match_nolit_calcBlockSizeSmall
- LEAL -16(DI), DI
- LEAL 16(R10), R10
- JMP matchlen_loopback_16_match_nolit_calcBlockSizeSmall
-
-matchlen_bsf_16match_nolit_calcBlockSizeSmall:
-#ifdef GOAMD64_v3
- TZCNTQ R11, R11
-
-#else
- BSFQ R11, R11
-
-#endif
- SARQ $0x03, R11
- LEAL 8(R10)(R11*1), R10
- JMP match_nolit_end_calcBlockSizeSmall
-
-matchlen_match8_match_nolit_calcBlockSizeSmall:
- CMPL DI, $0x08
- JB matchlen_match4_match_nolit_calcBlockSizeSmall
- MOVQ (R8)(R10*1), R9
- XORQ (SI)(R10*1), R9
- JNZ matchlen_bsf_8_match_nolit_calcBlockSizeSmall
- LEAL -8(DI), DI
- LEAL 8(R10), R10
- JMP matchlen_match4_match_nolit_calcBlockSizeSmall
-
-matchlen_bsf_8_match_nolit_calcBlockSizeSmall:
-#ifdef GOAMD64_v3
- TZCNTQ R9, R9
-
-#else
- BSFQ R9, R9
-
-#endif
- SARQ $0x03, R9
- LEAL (R10)(R9*1), R10
- JMP match_nolit_end_calcBlockSizeSmall
-
-matchlen_match4_match_nolit_calcBlockSizeSmall:
- CMPL DI, $0x04
- JB matchlen_match2_match_nolit_calcBlockSizeSmall
- MOVL (R8)(R10*1), R9
- CMPL (SI)(R10*1), R9
- JNE matchlen_match2_match_nolit_calcBlockSizeSmall
- LEAL -4(DI), DI
- LEAL 4(R10), R10
-
-matchlen_match2_match_nolit_calcBlockSizeSmall:
- CMPL DI, $0x01
- JE matchlen_match1_match_nolit_calcBlockSizeSmall
- JB match_nolit_end_calcBlockSizeSmall
- MOVW (R8)(R10*1), R9
- CMPW (SI)(R10*1), R9
- JNE matchlen_match1_match_nolit_calcBlockSizeSmall
- LEAL 2(R10), R10
- SUBL $0x02, DI
- JZ match_nolit_end_calcBlockSizeSmall
-
-matchlen_match1_match_nolit_calcBlockSizeSmall:
- MOVB (R8)(R10*1), R9
- CMPB (SI)(R10*1), R9
- JNE match_nolit_end_calcBlockSizeSmall
- LEAL 1(R10), R10
-
-match_nolit_end_calcBlockSizeSmall:
- ADDL R10, DX
- MOVL 16(SP), SI
- ADDL $0x04, R10
- MOVL DX, 12(SP)
-
- // emitCopy
-two_byte_offset_match_nolit_calcBlockSizeSmall:
- CMPL R10, $0x40
- JBE two_byte_offset_short_match_nolit_calcBlockSizeSmall
- LEAL -60(R10), R10
- ADDQ $0x03, CX
- JMP two_byte_offset_match_nolit_calcBlockSizeSmall
-
-two_byte_offset_short_match_nolit_calcBlockSizeSmall:
- MOVL R10, SI
- SHLL $0x02, SI
- CMPL R10, $0x0c
- JAE emit_copy_three_match_nolit_calcBlockSizeSmall
- ADDQ $0x02, CX
- JMP match_nolit_emitcopy_end_calcBlockSizeSmall
-
-emit_copy_three_match_nolit_calcBlockSizeSmall:
- ADDQ $0x03, CX
-
-match_nolit_emitcopy_end_calcBlockSizeSmall:
- CMPL DX, 8(SP)
- JAE emit_remainder_calcBlockSizeSmall
- MOVQ -2(BX)(DX*1), DI
- CMPQ CX, (SP)
- JB match_nolit_dst_ok_calcBlockSizeSmall
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-match_nolit_dst_ok_calcBlockSizeSmall:
- MOVQ $0x9e3779b1, R9
- MOVQ DI, R8
- SHRQ $0x10, DI
- MOVQ DI, SI
- SHLQ $0x20, R8
- IMULQ R9, R8
- SHRQ $0x37, R8
- SHLQ $0x20, SI
- IMULQ R9, SI
- SHRQ $0x37, SI
- LEAL -2(DX), R9
- LEAQ (AX)(SI*4), R10
- MOVL (R10), SI
- MOVL R9, (AX)(R8*4)
- MOVL DX, (R10)
- CMPL (BX)(SI*1), DI
- JEQ match_nolit_loop_calcBlockSizeSmall
- INCL DX
- JMP search_loop_calcBlockSizeSmall
-
-emit_remainder_calcBlockSizeSmall:
- MOVQ src_len+8(FP), AX
- SUBL 12(SP), AX
- LEAQ 3(CX)(AX*1), AX
- CMPQ AX, (SP)
- JB emit_remainder_ok_calcBlockSizeSmall
- MOVQ $0x00000000, ret+32(FP)
- RET
-
-emit_remainder_ok_calcBlockSizeSmall:
- MOVQ src_len+8(FP), AX
- MOVL 12(SP), DX
- CMPL DX, AX
- JEQ emit_literal_done_emit_remainder_calcBlockSizeSmall
- MOVL AX, SI
- MOVL AX, 12(SP)
- LEAQ (BX)(DX*1), AX
- SUBL DX, SI
- LEAL -1(SI), AX
- CMPL AX, $0x3c
- JB one_byte_emit_remainder_calcBlockSizeSmall
- CMPL AX, $0x00000100
- JB two_bytes_emit_remainder_calcBlockSizeSmall
- JB three_bytes_emit_remainder_calcBlockSizeSmall
-
-three_bytes_emit_remainder_calcBlockSizeSmall:
- ADDQ $0x03, CX
- JMP memmove_long_emit_remainder_calcBlockSizeSmall
-
-two_bytes_emit_remainder_calcBlockSizeSmall:
- ADDQ $0x02, CX
- CMPL AX, $0x40
- JB memmove_emit_remainder_calcBlockSizeSmall
- JMP memmove_long_emit_remainder_calcBlockSizeSmall
-
-one_byte_emit_remainder_calcBlockSizeSmall:
- ADDQ $0x01, CX
-
-memmove_emit_remainder_calcBlockSizeSmall:
- LEAQ (CX)(SI*1), AX
- MOVQ AX, CX
- JMP emit_literal_done_emit_remainder_calcBlockSizeSmall
-
-memmove_long_emit_remainder_calcBlockSizeSmall:
- LEAQ (CX)(SI*1), AX
- MOVQ AX, CX
-
-emit_literal_done_emit_remainder_calcBlockSizeSmall:
- MOVQ CX, ret+32(FP)
- RET
-
-// func emitLiteral(dst []byte, lit []byte) int
-// Requires: SSE2
-TEXT ·emitLiteral(SB), NOSPLIT, $0-56
- MOVQ lit_len+32(FP), DX
- MOVQ dst_base+0(FP), AX
- MOVQ lit_base+24(FP), CX
- TESTQ DX, DX
- JZ emit_literal_end_standalone_skip
- MOVL DX, BX
- LEAL -1(DX), SI
- CMPL SI, $0x3c
- JB one_byte_standalone
- CMPL SI, $0x00000100
- JB two_bytes_standalone
- CMPL SI, $0x00010000
- JB three_bytes_standalone
- CMPL SI, $0x01000000
- JB four_bytes_standalone
- MOVB $0xfc, (AX)
- MOVL SI, 1(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP memmove_long_standalone
-
-four_bytes_standalone:
- MOVL SI, DI
- SHRL $0x10, DI
- MOVB $0xf8, (AX)
- MOVW SI, 1(AX)
- MOVB DI, 3(AX)
- ADDQ $0x04, BX
- ADDQ $0x04, AX
- JMP memmove_long_standalone
-
-three_bytes_standalone:
- MOVB $0xf4, (AX)
- MOVW SI, 1(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
- JMP memmove_long_standalone
-
-two_bytes_standalone:
- MOVB $0xf0, (AX)
- MOVB SI, 1(AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- CMPL SI, $0x40
- JB memmove_standalone
- JMP memmove_long_standalone
-
-one_byte_standalone:
- SHLB $0x02, SI
- MOVB SI, (AX)
- ADDQ $0x01, BX
- ADDQ $0x01, AX
-
-memmove_standalone:
- // genMemMoveShort
- CMPQ DX, $0x03
- JB emit_lit_memmove_standalone_memmove_move_1or2
- JE emit_lit_memmove_standalone_memmove_move_3
- CMPQ DX, $0x08
- JB emit_lit_memmove_standalone_memmove_move_4through7
- CMPQ DX, $0x10
- JBE emit_lit_memmove_standalone_memmove_move_8through16
- CMPQ DX, $0x20
- JBE emit_lit_memmove_standalone_memmove_move_17through32
- JMP emit_lit_memmove_standalone_memmove_move_33through64
-
-emit_lit_memmove_standalone_memmove_move_1or2:
- MOVB (CX), SI
- MOVB -1(CX)(DX*1), CL
- MOVB SI, (AX)
- MOVB CL, -1(AX)(DX*1)
- JMP emit_literal_end_standalone
-
-emit_lit_memmove_standalone_memmove_move_3:
- MOVW (CX), SI
- MOVB 2(CX), CL
- MOVW SI, (AX)
- MOVB CL, 2(AX)
- JMP emit_literal_end_standalone
-
-emit_lit_memmove_standalone_memmove_move_4through7:
- MOVL (CX), SI
- MOVL -4(CX)(DX*1), CX
- MOVL SI, (AX)
- MOVL CX, -4(AX)(DX*1)
- JMP emit_literal_end_standalone
-
-emit_lit_memmove_standalone_memmove_move_8through16:
- MOVQ (CX), SI
- MOVQ -8(CX)(DX*1), CX
- MOVQ SI, (AX)
- MOVQ CX, -8(AX)(DX*1)
- JMP emit_literal_end_standalone
-
-emit_lit_memmove_standalone_memmove_move_17through32:
- MOVOU (CX), X0
- MOVOU -16(CX)(DX*1), X1
- MOVOU X0, (AX)
- MOVOU X1, -16(AX)(DX*1)
- JMP emit_literal_end_standalone
-
-emit_lit_memmove_standalone_memmove_move_33through64:
- MOVOU (CX), X0
- MOVOU 16(CX), X1
- MOVOU -32(CX)(DX*1), X2
- MOVOU -16(CX)(DX*1), X3
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(DX*1)
- MOVOU X3, -16(AX)(DX*1)
- JMP emit_literal_end_standalone
- JMP emit_literal_end_standalone
-
-memmove_long_standalone:
- // genMemMoveLong
- MOVOU (CX), X0
- MOVOU 16(CX), X1
- MOVOU -32(CX)(DX*1), X2
- MOVOU -16(CX)(DX*1), X3
- MOVQ DX, DI
- SHRQ $0x05, DI
- MOVQ AX, SI
- ANDL $0x0000001f, SI
- MOVQ $0x00000040, R8
- SUBQ SI, R8
- DECQ DI
- JA emit_lit_memmove_long_standalonelarge_forward_sse_loop_32
- LEAQ -32(CX)(R8*1), SI
- LEAQ -32(AX)(R8*1), R9
-
-emit_lit_memmove_long_standalonelarge_big_loop_back:
- MOVOU (SI), X4
- MOVOU 16(SI), X5
- MOVOA X4, (R9)
- MOVOA X5, 16(R9)
- ADDQ $0x20, R9
- ADDQ $0x20, SI
- ADDQ $0x20, R8
- DECQ DI
- JNA emit_lit_memmove_long_standalonelarge_big_loop_back
-
-emit_lit_memmove_long_standalonelarge_forward_sse_loop_32:
- MOVOU -32(CX)(R8*1), X4
- MOVOU -16(CX)(R8*1), X5
- MOVOA X4, -32(AX)(R8*1)
- MOVOA X5, -16(AX)(R8*1)
- ADDQ $0x20, R8
- CMPQ DX, R8
- JAE emit_lit_memmove_long_standalonelarge_forward_sse_loop_32
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(DX*1)
- MOVOU X3, -16(AX)(DX*1)
- JMP emit_literal_end_standalone
- JMP emit_literal_end_standalone
-
-emit_literal_end_standalone_skip:
- XORQ BX, BX
-
-emit_literal_end_standalone:
- MOVQ BX, ret+48(FP)
- RET
-
-// func emitRepeat(dst []byte, offset int, length int) int
-TEXT ·emitRepeat(SB), NOSPLIT, $0-48
- XORQ BX, BX
- MOVQ dst_base+0(FP), AX
- MOVQ offset+24(FP), CX
- MOVQ length+32(FP), DX
-
- // emitRepeat
-emit_repeat_again_standalone:
- MOVL DX, SI
- LEAL -4(DX), DX
- CMPL SI, $0x08
- JBE repeat_two_standalone
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_standalone
- CMPL CX, $0x00000800
- JB repeat_two_offset_standalone
-
-cant_repeat_two_offset_standalone:
- CMPL DX, $0x00000104
- JB repeat_three_standalone
- CMPL DX, $0x00010100
- JB repeat_four_standalone
- CMPL DX, $0x0100ffff
- JB repeat_five_standalone
- LEAL -16842747(DX), DX
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- ADDQ $0x05, BX
- JMP emit_repeat_again_standalone
-
-repeat_five_standalone:
- LEAL -65536(DX), DX
- MOVL DX, CX
- MOVW $0x001d, (AX)
- MOVW DX, 2(AX)
- SARL $0x10, CX
- MOVB CL, 4(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP gen_emit_repeat_end
-
-repeat_four_standalone:
- LEAL -256(DX), DX
- MOVW $0x0019, (AX)
- MOVW DX, 2(AX)
- ADDQ $0x04, BX
- ADDQ $0x04, AX
- JMP gen_emit_repeat_end
-
-repeat_three_standalone:
- LEAL -4(DX), DX
- MOVW $0x0015, (AX)
- MOVB DL, 2(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
- JMP gen_emit_repeat_end
-
-repeat_two_standalone:
- SHLL $0x02, DX
- ORL $0x01, DX
- MOVW DX, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_repeat_end
-
-repeat_two_offset_standalone:
- XORQ SI, SI
- LEAL 1(SI)(DX*4), DX
- MOVB CL, 1(AX)
- SARL $0x08, CX
- SHLL $0x05, CX
- ORL CX, DX
- MOVB DL, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
-
-gen_emit_repeat_end:
- MOVQ BX, ret+40(FP)
- RET
-
-// func emitCopy(dst []byte, offset int, length int) int
-TEXT ·emitCopy(SB), NOSPLIT, $0-48
- XORQ BX, BX
- MOVQ dst_base+0(FP), AX
- MOVQ offset+24(FP), CX
- MOVQ length+32(FP), DX
-
- // emitCopy
- CMPL CX, $0x00010000
- JB two_byte_offset_standalone
- CMPL DX, $0x40
- JBE four_bytes_remain_standalone
- MOVB $0xff, (AX)
- MOVL CX, 1(AX)
- LEAL -64(DX), DX
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- CMPL DX, $0x04
- JB four_bytes_remain_standalone
-
- // emitRepeat
-emit_repeat_again_standalone_emit_copy:
- MOVL DX, SI
- LEAL -4(DX), DX
- CMPL SI, $0x08
- JBE repeat_two_standalone_emit_copy
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_standalone_emit_copy
- CMPL CX, $0x00000800
- JB repeat_two_offset_standalone_emit_copy
-
-cant_repeat_two_offset_standalone_emit_copy:
- CMPL DX, $0x00000104
- JB repeat_three_standalone_emit_copy
- CMPL DX, $0x00010100
- JB repeat_four_standalone_emit_copy
- CMPL DX, $0x0100ffff
- JB repeat_five_standalone_emit_copy
- LEAL -16842747(DX), DX
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- ADDQ $0x05, BX
- JMP emit_repeat_again_standalone_emit_copy
-
-repeat_five_standalone_emit_copy:
- LEAL -65536(DX), DX
- MOVL DX, CX
- MOVW $0x001d, (AX)
- MOVW DX, 2(AX)
- SARL $0x10, CX
- MOVB CL, 4(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP gen_emit_copy_end
-
-repeat_four_standalone_emit_copy:
- LEAL -256(DX), DX
- MOVW $0x0019, (AX)
- MOVW DX, 2(AX)
- ADDQ $0x04, BX
- ADDQ $0x04, AX
- JMP gen_emit_copy_end
-
-repeat_three_standalone_emit_copy:
- LEAL -4(DX), DX
- MOVW $0x0015, (AX)
- MOVB DL, 2(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
- JMP gen_emit_copy_end
-
-repeat_two_standalone_emit_copy:
- SHLL $0x02, DX
- ORL $0x01, DX
- MOVW DX, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-repeat_two_offset_standalone_emit_copy:
- XORQ SI, SI
- LEAL 1(SI)(DX*4), DX
- MOVB CL, 1(AX)
- SARL $0x08, CX
- SHLL $0x05, CX
- ORL CX, DX
- MOVB DL, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-four_bytes_remain_standalone:
- TESTL DX, DX
- JZ gen_emit_copy_end
- XORL SI, SI
- LEAL -1(SI)(DX*4), DX
- MOVB DL, (AX)
- MOVL CX, 1(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP gen_emit_copy_end
-
-two_byte_offset_standalone:
- CMPL DX, $0x40
- JBE two_byte_offset_short_standalone
- CMPL CX, $0x00000800
- JAE long_offset_short_standalone
- MOVL $0x00000001, SI
- LEAL 16(SI), SI
- MOVB CL, 1(AX)
- MOVL CX, DI
- SHRL $0x08, DI
- SHLL $0x05, DI
- ORL DI, SI
- MOVB SI, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- SUBL $0x08, DX
-
- // emitRepeat
- LEAL -4(DX), DX
- JMP cant_repeat_two_offset_standalone_emit_copy_short_2b
-
-emit_repeat_again_standalone_emit_copy_short_2b:
- MOVL DX, SI
- LEAL -4(DX), DX
- CMPL SI, $0x08
- JBE repeat_two_standalone_emit_copy_short_2b
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_standalone_emit_copy_short_2b
- CMPL CX, $0x00000800
- JB repeat_two_offset_standalone_emit_copy_short_2b
-
-cant_repeat_two_offset_standalone_emit_copy_short_2b:
- CMPL DX, $0x00000104
- JB repeat_three_standalone_emit_copy_short_2b
- CMPL DX, $0x00010100
- JB repeat_four_standalone_emit_copy_short_2b
- CMPL DX, $0x0100ffff
- JB repeat_five_standalone_emit_copy_short_2b
- LEAL -16842747(DX), DX
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- ADDQ $0x05, BX
- JMP emit_repeat_again_standalone_emit_copy_short_2b
-
-repeat_five_standalone_emit_copy_short_2b:
- LEAL -65536(DX), DX
- MOVL DX, CX
- MOVW $0x001d, (AX)
- MOVW DX, 2(AX)
- SARL $0x10, CX
- MOVB CL, 4(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP gen_emit_copy_end
-
-repeat_four_standalone_emit_copy_short_2b:
- LEAL -256(DX), DX
- MOVW $0x0019, (AX)
- MOVW DX, 2(AX)
- ADDQ $0x04, BX
- ADDQ $0x04, AX
- JMP gen_emit_copy_end
-
-repeat_three_standalone_emit_copy_short_2b:
- LEAL -4(DX), DX
- MOVW $0x0015, (AX)
- MOVB DL, 2(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
- JMP gen_emit_copy_end
-
-repeat_two_standalone_emit_copy_short_2b:
- SHLL $0x02, DX
- ORL $0x01, DX
- MOVW DX, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-repeat_two_offset_standalone_emit_copy_short_2b:
- XORQ SI, SI
- LEAL 1(SI)(DX*4), DX
- MOVB CL, 1(AX)
- SARL $0x08, CX
- SHLL $0x05, CX
- ORL CX, DX
- MOVB DL, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-long_offset_short_standalone:
- MOVB $0xee, (AX)
- MOVW CX, 1(AX)
- LEAL -60(DX), DX
- ADDQ $0x03, AX
- ADDQ $0x03, BX
-
- // emitRepeat
-emit_repeat_again_standalone_emit_copy_short:
- MOVL DX, SI
- LEAL -4(DX), DX
- CMPL SI, $0x08
- JBE repeat_two_standalone_emit_copy_short
- CMPL SI, $0x0c
- JAE cant_repeat_two_offset_standalone_emit_copy_short
- CMPL CX, $0x00000800
- JB repeat_two_offset_standalone_emit_copy_short
-
-cant_repeat_two_offset_standalone_emit_copy_short:
- CMPL DX, $0x00000104
- JB repeat_three_standalone_emit_copy_short
- CMPL DX, $0x00010100
- JB repeat_four_standalone_emit_copy_short
- CMPL DX, $0x0100ffff
- JB repeat_five_standalone_emit_copy_short
- LEAL -16842747(DX), DX
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- ADDQ $0x05, BX
- JMP emit_repeat_again_standalone_emit_copy_short
-
-repeat_five_standalone_emit_copy_short:
- LEAL -65536(DX), DX
- MOVL DX, CX
- MOVW $0x001d, (AX)
- MOVW DX, 2(AX)
- SARL $0x10, CX
- MOVB CL, 4(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP gen_emit_copy_end
-
-repeat_four_standalone_emit_copy_short:
- LEAL -256(DX), DX
- MOVW $0x0019, (AX)
- MOVW DX, 2(AX)
- ADDQ $0x04, BX
- ADDQ $0x04, AX
- JMP gen_emit_copy_end
-
-repeat_three_standalone_emit_copy_short:
- LEAL -4(DX), DX
- MOVW $0x0015, (AX)
- MOVB DL, 2(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
- JMP gen_emit_copy_end
-
-repeat_two_standalone_emit_copy_short:
- SHLL $0x02, DX
- ORL $0x01, DX
- MOVW DX, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-repeat_two_offset_standalone_emit_copy_short:
- XORQ SI, SI
- LEAL 1(SI)(DX*4), DX
- MOVB CL, 1(AX)
- SARL $0x08, CX
- SHLL $0x05, CX
- ORL CX, DX
- MOVB DL, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-two_byte_offset_short_standalone:
- MOVL DX, SI
- SHLL $0x02, SI
- CMPL DX, $0x0c
- JAE emit_copy_three_standalone
- CMPL CX, $0x00000800
- JAE emit_copy_three_standalone
- LEAL -15(SI), SI
- MOVB CL, 1(AX)
- SHRL $0x08, CX
- SHLL $0x05, CX
- ORL CX, SI
- MOVB SI, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end
-
-emit_copy_three_standalone:
- LEAL -2(SI), SI
- MOVB SI, (AX)
- MOVW CX, 1(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
-
-gen_emit_copy_end:
- MOVQ BX, ret+40(FP)
- RET
-
-// func emitCopyNoRepeat(dst []byte, offset int, length int) int
-TEXT ·emitCopyNoRepeat(SB), NOSPLIT, $0-48
- XORQ BX, BX
- MOVQ dst_base+0(FP), AX
- MOVQ offset+24(FP), CX
- MOVQ length+32(FP), DX
-
- // emitCopy
- CMPL CX, $0x00010000
- JB two_byte_offset_standalone_snappy
-
-four_bytes_loop_back_standalone_snappy:
- CMPL DX, $0x40
- JBE four_bytes_remain_standalone_snappy
- MOVB $0xff, (AX)
- MOVL CX, 1(AX)
- LEAL -64(DX), DX
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- CMPL DX, $0x04
- JB four_bytes_remain_standalone_snappy
- JMP four_bytes_loop_back_standalone_snappy
-
-four_bytes_remain_standalone_snappy:
- TESTL DX, DX
- JZ gen_emit_copy_end_snappy
- XORL SI, SI
- LEAL -1(SI)(DX*4), DX
- MOVB DL, (AX)
- MOVL CX, 1(AX)
- ADDQ $0x05, BX
- ADDQ $0x05, AX
- JMP gen_emit_copy_end_snappy
-
-two_byte_offset_standalone_snappy:
- CMPL DX, $0x40
- JBE two_byte_offset_short_standalone_snappy
- MOVB $0xee, (AX)
- MOVW CX, 1(AX)
- LEAL -60(DX), DX
- ADDQ $0x03, AX
- ADDQ $0x03, BX
- JMP two_byte_offset_standalone_snappy
-
-two_byte_offset_short_standalone_snappy:
- MOVL DX, SI
- SHLL $0x02, SI
- CMPL DX, $0x0c
- JAE emit_copy_three_standalone_snappy
- CMPL CX, $0x00000800
- JAE emit_copy_three_standalone_snappy
- LEAL -15(SI), SI
- MOVB CL, 1(AX)
- SHRL $0x08, CX
- SHLL $0x05, CX
- ORL CX, SI
- MOVB SI, (AX)
- ADDQ $0x02, BX
- ADDQ $0x02, AX
- JMP gen_emit_copy_end_snappy
-
-emit_copy_three_standalone_snappy:
- LEAL -2(SI), SI
- MOVB SI, (AX)
- MOVW CX, 1(AX)
- ADDQ $0x03, BX
- ADDQ $0x03, AX
-
-gen_emit_copy_end_snappy:
- MOVQ BX, ret+40(FP)
- RET
-
-// func matchLen(a []byte, b []byte) int
-// Requires: BMI
-TEXT ·matchLen(SB), NOSPLIT, $0-56
- MOVQ a_base+0(FP), AX
- MOVQ b_base+24(FP), CX
- MOVQ a_len+8(FP), DX
-
- // matchLen
- XORL SI, SI
-
-matchlen_loopback_16_standalone:
- CMPL DX, $0x10
- JB matchlen_match8_standalone
- MOVQ (AX)(SI*1), BX
- MOVQ 8(AX)(SI*1), DI
- XORQ (CX)(SI*1), BX
- JNZ matchlen_bsf_8_standalone
- XORQ 8(CX)(SI*1), DI
- JNZ matchlen_bsf_16standalone
- LEAL -16(DX), DX
- LEAL 16(SI), SI
- JMP matchlen_loopback_16_standalone
-
-matchlen_bsf_16standalone:
-#ifdef GOAMD64_v3
- TZCNTQ DI, DI
-
-#else
- BSFQ DI, DI
-
-#endif
- SARQ $0x03, DI
- LEAL 8(SI)(DI*1), SI
- JMP gen_match_len_end
-
-matchlen_match8_standalone:
- CMPL DX, $0x08
- JB matchlen_match4_standalone
- MOVQ (AX)(SI*1), BX
- XORQ (CX)(SI*1), BX
- JNZ matchlen_bsf_8_standalone
- LEAL -8(DX), DX
- LEAL 8(SI), SI
- JMP matchlen_match4_standalone
-
-matchlen_bsf_8_standalone:
-#ifdef GOAMD64_v3
- TZCNTQ BX, BX
-
-#else
- BSFQ BX, BX
-
-#endif
- SARQ $0x03, BX
- LEAL (SI)(BX*1), SI
- JMP gen_match_len_end
-
-matchlen_match4_standalone:
- CMPL DX, $0x04
- JB matchlen_match2_standalone
- MOVL (AX)(SI*1), BX
- CMPL (CX)(SI*1), BX
- JNE matchlen_match2_standalone
- LEAL -4(DX), DX
- LEAL 4(SI), SI
-
-matchlen_match2_standalone:
- CMPL DX, $0x01
- JE matchlen_match1_standalone
- JB gen_match_len_end
- MOVW (AX)(SI*1), BX
- CMPW (CX)(SI*1), BX
- JNE matchlen_match1_standalone
- LEAL 2(SI), SI
- SUBL $0x02, DX
- JZ gen_match_len_end
-
-matchlen_match1_standalone:
- MOVB (AX)(SI*1), BL
- CMPB (CX)(SI*1), BL
- JNE gen_match_len_end
- LEAL 1(SI), SI
-
-gen_match_len_end:
- MOVQ SI, ret+48(FP)
- RET
-
-// func cvtLZ4BlockAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-// Requires: SSE2
-TEXT ·cvtLZ4BlockAsm(SB), NOSPLIT, $0-64
- XORQ SI, SI
- MOVQ dst_base+0(FP), AX
- MOVQ dst_len+8(FP), CX
- MOVQ src_base+24(FP), DX
- MOVQ src_len+32(FP), BX
- LEAQ (DX)(BX*1), BX
- LEAQ -8(AX)(CX*1), CX
- XORQ DI, DI
-
-lz4_s2_loop:
- CMPQ DX, BX
- JAE lz4_s2_corrupt
- CMPQ AX, CX
- JAE lz4_s2_dstfull
- MOVBQZX (DX), R8
- MOVQ R8, R9
- MOVQ R8, R10
- SHRQ $0x04, R9
- ANDQ $0x0f, R10
- CMPQ R8, $0xf0
- JB lz4_s2_ll_end
-
-lz4_s2_ll_loop:
- INCQ DX
- CMPQ DX, BX
- JAE lz4_s2_corrupt
- MOVBQZX (DX), R8
- ADDQ R8, R9
- CMPQ R8, $0xff
- JEQ lz4_s2_ll_loop
-
-lz4_s2_ll_end:
- LEAQ (DX)(R9*1), R8
- ADDQ $0x04, R10
- CMPQ R8, BX
- JAE lz4_s2_corrupt
- INCQ DX
- INCQ R8
- TESTQ R9, R9
- JZ lz4_s2_lits_done
- LEAQ (AX)(R9*1), R11
- CMPQ R11, CX
- JAE lz4_s2_dstfull
- ADDQ R9, SI
- LEAL -1(R9), R11
- CMPL R11, $0x3c
- JB one_byte_lz4_s2
- CMPL R11, $0x00000100
- JB two_bytes_lz4_s2
- CMPL R11, $0x00010000
- JB three_bytes_lz4_s2
- CMPL R11, $0x01000000
- JB four_bytes_lz4_s2
- MOVB $0xfc, (AX)
- MOVL R11, 1(AX)
- ADDQ $0x05, AX
- JMP memmove_long_lz4_s2
-
-four_bytes_lz4_s2:
- MOVL R11, R12
- SHRL $0x10, R12
- MOVB $0xf8, (AX)
- MOVW R11, 1(AX)
- MOVB R12, 3(AX)
- ADDQ $0x04, AX
- JMP memmove_long_lz4_s2
-
-three_bytes_lz4_s2:
- MOVB $0xf4, (AX)
- MOVW R11, 1(AX)
- ADDQ $0x03, AX
- JMP memmove_long_lz4_s2
-
-two_bytes_lz4_s2:
- MOVB $0xf0, (AX)
- MOVB R11, 1(AX)
- ADDQ $0x02, AX
- CMPL R11, $0x40
- JB memmove_lz4_s2
- JMP memmove_long_lz4_s2
-
-one_byte_lz4_s2:
- SHLB $0x02, R11
- MOVB R11, (AX)
- ADDQ $0x01, AX
-
-memmove_lz4_s2:
- LEAQ (AX)(R9*1), R11
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_lz4_s2_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_lz4_s2_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_lz4_s2_memmove_move_17through32
- JMP emit_lit_memmove_lz4_s2_memmove_move_33through64
-
-emit_lit_memmove_lz4_s2_memmove_move_8:
- MOVQ (DX), R12
- MOVQ R12, (AX)
- JMP memmove_end_copy_lz4_s2
-
-emit_lit_memmove_lz4_s2_memmove_move_8through16:
- MOVQ (DX), R12
- MOVQ -8(DX)(R9*1), DX
- MOVQ R12, (AX)
- MOVQ DX, -8(AX)(R9*1)
- JMP memmove_end_copy_lz4_s2
-
-emit_lit_memmove_lz4_s2_memmove_move_17through32:
- MOVOU (DX), X0
- MOVOU -16(DX)(R9*1), X1
- MOVOU X0, (AX)
- MOVOU X1, -16(AX)(R9*1)
- JMP memmove_end_copy_lz4_s2
-
-emit_lit_memmove_lz4_s2_memmove_move_33through64:
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R9*1), X2
- MOVOU -16(DX)(R9*1), X3
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R9*1)
- MOVOU X3, -16(AX)(R9*1)
-
-memmove_end_copy_lz4_s2:
- MOVQ R11, AX
- JMP lz4_s2_lits_emit_done
-
-memmove_long_lz4_s2:
- LEAQ (AX)(R9*1), R11
-
- // genMemMoveLong
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R9*1), X2
- MOVOU -16(DX)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ AX, R12
- ANDL $0x0000001f, R12
- MOVQ $0x00000040, R14
- SUBQ R12, R14
- DECQ R13
- JA emit_lit_memmove_long_lz4_s2large_forward_sse_loop_32
- LEAQ -32(DX)(R14*1), R12
- LEAQ -32(AX)(R14*1), R15
-
-emit_lit_memmove_long_lz4_s2large_big_loop_back:
- MOVOU (R12), X4
- MOVOU 16(R12), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R12
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_lz4_s2large_big_loop_back
-
-emit_lit_memmove_long_lz4_s2large_forward_sse_loop_32:
- MOVOU -32(DX)(R14*1), X4
- MOVOU -16(DX)(R14*1), X5
- MOVOA X4, -32(AX)(R14*1)
- MOVOA X5, -16(AX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_lz4_s2large_forward_sse_loop_32
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R9*1)
- MOVOU X3, -16(AX)(R9*1)
- MOVQ R11, AX
-
-lz4_s2_lits_emit_done:
- MOVQ R8, DX
-
-lz4_s2_lits_done:
- CMPQ DX, BX
- JNE lz4_s2_match
- CMPQ R10, $0x04
- JEQ lz4_s2_done
- JMP lz4_s2_corrupt
-
-lz4_s2_match:
- LEAQ 2(DX), R8
- CMPQ R8, BX
- JAE lz4_s2_corrupt
- MOVWQZX (DX), R9
- MOVQ R8, DX
- TESTQ R9, R9
- JZ lz4_s2_corrupt
- CMPQ R9, SI
- JA lz4_s2_corrupt
- CMPQ R10, $0x13
- JNE lz4_s2_ml_done
-
-lz4_s2_ml_loop:
- MOVBQZX (DX), R8
- INCQ DX
- ADDQ R8, R10
- CMPQ DX, BX
- JAE lz4_s2_corrupt
- CMPQ R8, $0xff
- JEQ lz4_s2_ml_loop
-
-lz4_s2_ml_done:
- ADDQ R10, SI
- CMPQ R9, DI
- JNE lz4_s2_docopy
-
- // emitRepeat
-emit_repeat_again_lz4_s2:
- MOVL R10, R8
- LEAL -4(R10), R10
- CMPL R8, $0x08
- JBE repeat_two_lz4_s2
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_lz4_s2
- CMPL R9, $0x00000800
- JB repeat_two_offset_lz4_s2
-
-cant_repeat_two_offset_lz4_s2:
- CMPL R10, $0x00000104
- JB repeat_three_lz4_s2
- CMPL R10, $0x00010100
- JB repeat_four_lz4_s2
- CMPL R10, $0x0100ffff
- JB repeat_five_lz4_s2
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- JMP emit_repeat_again_lz4_s2
-
-repeat_five_lz4_s2:
- LEAL -65536(R10), R10
- MOVL R10, R9
- MOVW $0x001d, (AX)
- MOVW R10, 2(AX)
- SARL $0x10, R9
- MOVB R9, 4(AX)
- ADDQ $0x05, AX
- JMP lz4_s2_loop
-
-repeat_four_lz4_s2:
- LEAL -256(R10), R10
- MOVW $0x0019, (AX)
- MOVW R10, 2(AX)
- ADDQ $0x04, AX
- JMP lz4_s2_loop
-
-repeat_three_lz4_s2:
- LEAL -4(R10), R10
- MOVW $0x0015, (AX)
- MOVB R10, 2(AX)
- ADDQ $0x03, AX
- JMP lz4_s2_loop
-
-repeat_two_lz4_s2:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-repeat_two_offset_lz4_s2:
- XORQ R8, R8
- LEAL 1(R8)(R10*4), R10
- MOVB R9, 1(AX)
- SARL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R10
- MOVB R10, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-lz4_s2_docopy:
- MOVQ R9, DI
-
- // emitCopy
- CMPL R10, $0x40
- JBE two_byte_offset_short_lz4_s2
- CMPL R9, $0x00000800
- JAE long_offset_short_lz4_s2
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB R9, 1(AX)
- MOVL R9, R11
- SHRL $0x08, R11
- SHLL $0x05, R11
- ORL R11, R8
- MOVB R8, (AX)
- ADDQ $0x02, AX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_lz4_s2_emit_copy_short_2b
-
-emit_repeat_again_lz4_s2_emit_copy_short_2b:
- MOVL R10, R8
- LEAL -4(R10), R10
- CMPL R8, $0x08
- JBE repeat_two_lz4_s2_emit_copy_short_2b
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_lz4_s2_emit_copy_short_2b
- CMPL R9, $0x00000800
- JB repeat_two_offset_lz4_s2_emit_copy_short_2b
-
-cant_repeat_two_offset_lz4_s2_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_lz4_s2_emit_copy_short_2b
- CMPL R10, $0x00010100
- JB repeat_four_lz4_s2_emit_copy_short_2b
- CMPL R10, $0x0100ffff
- JB repeat_five_lz4_s2_emit_copy_short_2b
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- JMP emit_repeat_again_lz4_s2_emit_copy_short_2b
-
-repeat_five_lz4_s2_emit_copy_short_2b:
- LEAL -65536(R10), R10
- MOVL R10, R9
- MOVW $0x001d, (AX)
- MOVW R10, 2(AX)
- SARL $0x10, R9
- MOVB R9, 4(AX)
- ADDQ $0x05, AX
- JMP lz4_s2_loop
-
-repeat_four_lz4_s2_emit_copy_short_2b:
- LEAL -256(R10), R10
- MOVW $0x0019, (AX)
- MOVW R10, 2(AX)
- ADDQ $0x04, AX
- JMP lz4_s2_loop
-
-repeat_three_lz4_s2_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (AX)
- MOVB R10, 2(AX)
- ADDQ $0x03, AX
- JMP lz4_s2_loop
-
-repeat_two_lz4_s2_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-repeat_two_offset_lz4_s2_emit_copy_short_2b:
- XORQ R8, R8
- LEAL 1(R8)(R10*4), R10
- MOVB R9, 1(AX)
- SARL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R10
- MOVB R10, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-long_offset_short_lz4_s2:
- MOVB $0xee, (AX)
- MOVW R9, 1(AX)
- LEAL -60(R10), R10
- ADDQ $0x03, AX
-
- // emitRepeat
-emit_repeat_again_lz4_s2_emit_copy_short:
- MOVL R10, R8
- LEAL -4(R10), R10
- CMPL R8, $0x08
- JBE repeat_two_lz4_s2_emit_copy_short
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_lz4_s2_emit_copy_short
- CMPL R9, $0x00000800
- JB repeat_two_offset_lz4_s2_emit_copy_short
-
-cant_repeat_two_offset_lz4_s2_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_lz4_s2_emit_copy_short
- CMPL R10, $0x00010100
- JB repeat_four_lz4_s2_emit_copy_short
- CMPL R10, $0x0100ffff
- JB repeat_five_lz4_s2_emit_copy_short
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- JMP emit_repeat_again_lz4_s2_emit_copy_short
-
-repeat_five_lz4_s2_emit_copy_short:
- LEAL -65536(R10), R10
- MOVL R10, R9
- MOVW $0x001d, (AX)
- MOVW R10, 2(AX)
- SARL $0x10, R9
- MOVB R9, 4(AX)
- ADDQ $0x05, AX
- JMP lz4_s2_loop
-
-repeat_four_lz4_s2_emit_copy_short:
- LEAL -256(R10), R10
- MOVW $0x0019, (AX)
- MOVW R10, 2(AX)
- ADDQ $0x04, AX
- JMP lz4_s2_loop
-
-repeat_three_lz4_s2_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (AX)
- MOVB R10, 2(AX)
- ADDQ $0x03, AX
- JMP lz4_s2_loop
-
-repeat_two_lz4_s2_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-repeat_two_offset_lz4_s2_emit_copy_short:
- XORQ R8, R8
- LEAL 1(R8)(R10*4), R10
- MOVB R9, 1(AX)
- SARL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R10
- MOVB R10, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-two_byte_offset_short_lz4_s2:
- MOVL R10, R8
- SHLL $0x02, R8
- CMPL R10, $0x0c
- JAE emit_copy_three_lz4_s2
- CMPL R9, $0x00000800
- JAE emit_copy_three_lz4_s2
- LEAL -15(R8), R8
- MOVB R9, 1(AX)
- SHRL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R8
- MOVB R8, (AX)
- ADDQ $0x02, AX
- JMP lz4_s2_loop
-
-emit_copy_three_lz4_s2:
- LEAL -2(R8), R8
- MOVB R8, (AX)
- MOVW R9, 1(AX)
- ADDQ $0x03, AX
- JMP lz4_s2_loop
-
-lz4_s2_done:
- MOVQ dst_base+0(FP), CX
- SUBQ CX, AX
- MOVQ SI, uncompressed+48(FP)
- MOVQ AX, dstUsed+56(FP)
- RET
-
-lz4_s2_corrupt:
- XORQ AX, AX
- LEAQ -1(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-lz4_s2_dstfull:
- XORQ AX, AX
- LEAQ -2(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-// func cvtLZ4sBlockAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-// Requires: SSE2
-TEXT ·cvtLZ4sBlockAsm(SB), NOSPLIT, $0-64
- XORQ SI, SI
- MOVQ dst_base+0(FP), AX
- MOVQ dst_len+8(FP), CX
- MOVQ src_base+24(FP), DX
- MOVQ src_len+32(FP), BX
- LEAQ (DX)(BX*1), BX
- LEAQ -8(AX)(CX*1), CX
- XORQ DI, DI
-
-lz4s_s2_loop:
- CMPQ DX, BX
- JAE lz4s_s2_corrupt
- CMPQ AX, CX
- JAE lz4s_s2_dstfull
- MOVBQZX (DX), R8
- MOVQ R8, R9
- MOVQ R8, R10
- SHRQ $0x04, R9
- ANDQ $0x0f, R10
- CMPQ R8, $0xf0
- JB lz4s_s2_ll_end
-
-lz4s_s2_ll_loop:
- INCQ DX
- CMPQ DX, BX
- JAE lz4s_s2_corrupt
- MOVBQZX (DX), R8
- ADDQ R8, R9
- CMPQ R8, $0xff
- JEQ lz4s_s2_ll_loop
-
-lz4s_s2_ll_end:
- LEAQ (DX)(R9*1), R8
- ADDQ $0x03, R10
- CMPQ R8, BX
- JAE lz4s_s2_corrupt
- INCQ DX
- INCQ R8
- TESTQ R9, R9
- JZ lz4s_s2_lits_done
- LEAQ (AX)(R9*1), R11
- CMPQ R11, CX
- JAE lz4s_s2_dstfull
- ADDQ R9, SI
- LEAL -1(R9), R11
- CMPL R11, $0x3c
- JB one_byte_lz4s_s2
- CMPL R11, $0x00000100
- JB two_bytes_lz4s_s2
- CMPL R11, $0x00010000
- JB three_bytes_lz4s_s2
- CMPL R11, $0x01000000
- JB four_bytes_lz4s_s2
- MOVB $0xfc, (AX)
- MOVL R11, 1(AX)
- ADDQ $0x05, AX
- JMP memmove_long_lz4s_s2
-
-four_bytes_lz4s_s2:
- MOVL R11, R12
- SHRL $0x10, R12
- MOVB $0xf8, (AX)
- MOVW R11, 1(AX)
- MOVB R12, 3(AX)
- ADDQ $0x04, AX
- JMP memmove_long_lz4s_s2
-
-three_bytes_lz4s_s2:
- MOVB $0xf4, (AX)
- MOVW R11, 1(AX)
- ADDQ $0x03, AX
- JMP memmove_long_lz4s_s2
-
-two_bytes_lz4s_s2:
- MOVB $0xf0, (AX)
- MOVB R11, 1(AX)
- ADDQ $0x02, AX
- CMPL R11, $0x40
- JB memmove_lz4s_s2
- JMP memmove_long_lz4s_s2
-
-one_byte_lz4s_s2:
- SHLB $0x02, R11
- MOVB R11, (AX)
- ADDQ $0x01, AX
-
-memmove_lz4s_s2:
- LEAQ (AX)(R9*1), R11
-
- // genMemMoveShort
- CMPQ R9, $0x08
- JBE emit_lit_memmove_lz4s_s2_memmove_move_8
- CMPQ R9, $0x10
- JBE emit_lit_memmove_lz4s_s2_memmove_move_8through16
- CMPQ R9, $0x20
- JBE emit_lit_memmove_lz4s_s2_memmove_move_17through32
- JMP emit_lit_memmove_lz4s_s2_memmove_move_33through64
-
-emit_lit_memmove_lz4s_s2_memmove_move_8:
- MOVQ (DX), R12
- MOVQ R12, (AX)
- JMP memmove_end_copy_lz4s_s2
-
-emit_lit_memmove_lz4s_s2_memmove_move_8through16:
- MOVQ (DX), R12
- MOVQ -8(DX)(R9*1), DX
- MOVQ R12, (AX)
- MOVQ DX, -8(AX)(R9*1)
- JMP memmove_end_copy_lz4s_s2
-
-emit_lit_memmove_lz4s_s2_memmove_move_17through32:
- MOVOU (DX), X0
- MOVOU -16(DX)(R9*1), X1
- MOVOU X0, (AX)
- MOVOU X1, -16(AX)(R9*1)
- JMP memmove_end_copy_lz4s_s2
-
-emit_lit_memmove_lz4s_s2_memmove_move_33through64:
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R9*1), X2
- MOVOU -16(DX)(R9*1), X3
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R9*1)
- MOVOU X3, -16(AX)(R9*1)
-
-memmove_end_copy_lz4s_s2:
- MOVQ R11, AX
- JMP lz4s_s2_lits_emit_done
-
-memmove_long_lz4s_s2:
- LEAQ (AX)(R9*1), R11
-
- // genMemMoveLong
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R9*1), X2
- MOVOU -16(DX)(R9*1), X3
- MOVQ R9, R13
- SHRQ $0x05, R13
- MOVQ AX, R12
- ANDL $0x0000001f, R12
- MOVQ $0x00000040, R14
- SUBQ R12, R14
- DECQ R13
- JA emit_lit_memmove_long_lz4s_s2large_forward_sse_loop_32
- LEAQ -32(DX)(R14*1), R12
- LEAQ -32(AX)(R14*1), R15
-
-emit_lit_memmove_long_lz4s_s2large_big_loop_back:
- MOVOU (R12), X4
- MOVOU 16(R12), X5
- MOVOA X4, (R15)
- MOVOA X5, 16(R15)
- ADDQ $0x20, R15
- ADDQ $0x20, R12
- ADDQ $0x20, R14
- DECQ R13
- JNA emit_lit_memmove_long_lz4s_s2large_big_loop_back
-
-emit_lit_memmove_long_lz4s_s2large_forward_sse_loop_32:
- MOVOU -32(DX)(R14*1), X4
- MOVOU -16(DX)(R14*1), X5
- MOVOA X4, -32(AX)(R14*1)
- MOVOA X5, -16(AX)(R14*1)
- ADDQ $0x20, R14
- CMPQ R9, R14
- JAE emit_lit_memmove_long_lz4s_s2large_forward_sse_loop_32
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R9*1)
- MOVOU X3, -16(AX)(R9*1)
- MOVQ R11, AX
-
-lz4s_s2_lits_emit_done:
- MOVQ R8, DX
-
-lz4s_s2_lits_done:
- CMPQ DX, BX
- JNE lz4s_s2_match
- CMPQ R10, $0x03
- JEQ lz4s_s2_done
- JMP lz4s_s2_corrupt
-
-lz4s_s2_match:
- CMPQ R10, $0x03
- JEQ lz4s_s2_loop
- LEAQ 2(DX), R8
- CMPQ R8, BX
- JAE lz4s_s2_corrupt
- MOVWQZX (DX), R9
- MOVQ R8, DX
- TESTQ R9, R9
- JZ lz4s_s2_corrupt
- CMPQ R9, SI
- JA lz4s_s2_corrupt
- CMPQ R10, $0x12
- JNE lz4s_s2_ml_done
-
-lz4s_s2_ml_loop:
- MOVBQZX (DX), R8
- INCQ DX
- ADDQ R8, R10
- CMPQ DX, BX
- JAE lz4s_s2_corrupt
- CMPQ R8, $0xff
- JEQ lz4s_s2_ml_loop
-
-lz4s_s2_ml_done:
- ADDQ R10, SI
- CMPQ R9, DI
- JNE lz4s_s2_docopy
-
- // emitRepeat
-emit_repeat_again_lz4_s2:
- MOVL R10, R8
- LEAL -4(R10), R10
- CMPL R8, $0x08
- JBE repeat_two_lz4_s2
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_lz4_s2
- CMPL R9, $0x00000800
- JB repeat_two_offset_lz4_s2
-
-cant_repeat_two_offset_lz4_s2:
- CMPL R10, $0x00000104
- JB repeat_three_lz4_s2
- CMPL R10, $0x00010100
- JB repeat_four_lz4_s2
- CMPL R10, $0x0100ffff
- JB repeat_five_lz4_s2
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- JMP emit_repeat_again_lz4_s2
-
-repeat_five_lz4_s2:
- LEAL -65536(R10), R10
- MOVL R10, R9
- MOVW $0x001d, (AX)
- MOVW R10, 2(AX)
- SARL $0x10, R9
- MOVB R9, 4(AX)
- ADDQ $0x05, AX
- JMP lz4s_s2_loop
-
-repeat_four_lz4_s2:
- LEAL -256(R10), R10
- MOVW $0x0019, (AX)
- MOVW R10, 2(AX)
- ADDQ $0x04, AX
- JMP lz4s_s2_loop
-
-repeat_three_lz4_s2:
- LEAL -4(R10), R10
- MOVW $0x0015, (AX)
- MOVB R10, 2(AX)
- ADDQ $0x03, AX
- JMP lz4s_s2_loop
-
-repeat_two_lz4_s2:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-repeat_two_offset_lz4_s2:
- XORQ R8, R8
- LEAL 1(R8)(R10*4), R10
- MOVB R9, 1(AX)
- SARL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R10
- MOVB R10, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-lz4s_s2_docopy:
- MOVQ R9, DI
-
- // emitCopy
- CMPL R10, $0x40
- JBE two_byte_offset_short_lz4_s2
- CMPL R9, $0x00000800
- JAE long_offset_short_lz4_s2
- MOVL $0x00000001, R8
- LEAL 16(R8), R8
- MOVB R9, 1(AX)
- MOVL R9, R11
- SHRL $0x08, R11
- SHLL $0x05, R11
- ORL R11, R8
- MOVB R8, (AX)
- ADDQ $0x02, AX
- SUBL $0x08, R10
-
- // emitRepeat
- LEAL -4(R10), R10
- JMP cant_repeat_two_offset_lz4_s2_emit_copy_short_2b
-
-emit_repeat_again_lz4_s2_emit_copy_short_2b:
- MOVL R10, R8
- LEAL -4(R10), R10
- CMPL R8, $0x08
- JBE repeat_two_lz4_s2_emit_copy_short_2b
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_lz4_s2_emit_copy_short_2b
- CMPL R9, $0x00000800
- JB repeat_two_offset_lz4_s2_emit_copy_short_2b
-
-cant_repeat_two_offset_lz4_s2_emit_copy_short_2b:
- CMPL R10, $0x00000104
- JB repeat_three_lz4_s2_emit_copy_short_2b
- CMPL R10, $0x00010100
- JB repeat_four_lz4_s2_emit_copy_short_2b
- CMPL R10, $0x0100ffff
- JB repeat_five_lz4_s2_emit_copy_short_2b
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- JMP emit_repeat_again_lz4_s2_emit_copy_short_2b
-
-repeat_five_lz4_s2_emit_copy_short_2b:
- LEAL -65536(R10), R10
- MOVL R10, R9
- MOVW $0x001d, (AX)
- MOVW R10, 2(AX)
- SARL $0x10, R9
- MOVB R9, 4(AX)
- ADDQ $0x05, AX
- JMP lz4s_s2_loop
-
-repeat_four_lz4_s2_emit_copy_short_2b:
- LEAL -256(R10), R10
- MOVW $0x0019, (AX)
- MOVW R10, 2(AX)
- ADDQ $0x04, AX
- JMP lz4s_s2_loop
-
-repeat_three_lz4_s2_emit_copy_short_2b:
- LEAL -4(R10), R10
- MOVW $0x0015, (AX)
- MOVB R10, 2(AX)
- ADDQ $0x03, AX
- JMP lz4s_s2_loop
-
-repeat_two_lz4_s2_emit_copy_short_2b:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-repeat_two_offset_lz4_s2_emit_copy_short_2b:
- XORQ R8, R8
- LEAL 1(R8)(R10*4), R10
- MOVB R9, 1(AX)
- SARL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R10
- MOVB R10, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-long_offset_short_lz4_s2:
- MOVB $0xee, (AX)
- MOVW R9, 1(AX)
- LEAL -60(R10), R10
- ADDQ $0x03, AX
-
- // emitRepeat
-emit_repeat_again_lz4_s2_emit_copy_short:
- MOVL R10, R8
- LEAL -4(R10), R10
- CMPL R8, $0x08
- JBE repeat_two_lz4_s2_emit_copy_short
- CMPL R8, $0x0c
- JAE cant_repeat_two_offset_lz4_s2_emit_copy_short
- CMPL R9, $0x00000800
- JB repeat_two_offset_lz4_s2_emit_copy_short
-
-cant_repeat_two_offset_lz4_s2_emit_copy_short:
- CMPL R10, $0x00000104
- JB repeat_three_lz4_s2_emit_copy_short
- CMPL R10, $0x00010100
- JB repeat_four_lz4_s2_emit_copy_short
- CMPL R10, $0x0100ffff
- JB repeat_five_lz4_s2_emit_copy_short
- LEAL -16842747(R10), R10
- MOVL $0xfffb001d, (AX)
- MOVB $0xff, 4(AX)
- ADDQ $0x05, AX
- JMP emit_repeat_again_lz4_s2_emit_copy_short
-
-repeat_five_lz4_s2_emit_copy_short:
- LEAL -65536(R10), R10
- MOVL R10, R9
- MOVW $0x001d, (AX)
- MOVW R10, 2(AX)
- SARL $0x10, R9
- MOVB R9, 4(AX)
- ADDQ $0x05, AX
- JMP lz4s_s2_loop
-
-repeat_four_lz4_s2_emit_copy_short:
- LEAL -256(R10), R10
- MOVW $0x0019, (AX)
- MOVW R10, 2(AX)
- ADDQ $0x04, AX
- JMP lz4s_s2_loop
-
-repeat_three_lz4_s2_emit_copy_short:
- LEAL -4(R10), R10
- MOVW $0x0015, (AX)
- MOVB R10, 2(AX)
- ADDQ $0x03, AX
- JMP lz4s_s2_loop
-
-repeat_two_lz4_s2_emit_copy_short:
- SHLL $0x02, R10
- ORL $0x01, R10
- MOVW R10, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-repeat_two_offset_lz4_s2_emit_copy_short:
- XORQ R8, R8
- LEAL 1(R8)(R10*4), R10
- MOVB R9, 1(AX)
- SARL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R10
- MOVB R10, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-two_byte_offset_short_lz4_s2:
- MOVL R10, R8
- SHLL $0x02, R8
- CMPL R10, $0x0c
- JAE emit_copy_three_lz4_s2
- CMPL R9, $0x00000800
- JAE emit_copy_three_lz4_s2
- LEAL -15(R8), R8
- MOVB R9, 1(AX)
- SHRL $0x08, R9
- SHLL $0x05, R9
- ORL R9, R8
- MOVB R8, (AX)
- ADDQ $0x02, AX
- JMP lz4s_s2_loop
-
-emit_copy_three_lz4_s2:
- LEAL -2(R8), R8
- MOVB R8, (AX)
- MOVW R9, 1(AX)
- ADDQ $0x03, AX
- JMP lz4s_s2_loop
-
-lz4s_s2_done:
- MOVQ dst_base+0(FP), CX
- SUBQ CX, AX
- MOVQ SI, uncompressed+48(FP)
- MOVQ AX, dstUsed+56(FP)
- RET
-
-lz4s_s2_corrupt:
- XORQ AX, AX
- LEAQ -1(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-lz4s_s2_dstfull:
- XORQ AX, AX
- LEAQ -2(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-// func cvtLZ4BlockSnappyAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-// Requires: SSE2
-TEXT ·cvtLZ4BlockSnappyAsm(SB), NOSPLIT, $0-64
- XORQ SI, SI
- MOVQ dst_base+0(FP), AX
- MOVQ dst_len+8(FP), CX
- MOVQ src_base+24(FP), DX
- MOVQ src_len+32(FP), BX
- LEAQ (DX)(BX*1), BX
- LEAQ -8(AX)(CX*1), CX
-
-lz4_snappy_loop:
- CMPQ DX, BX
- JAE lz4_snappy_corrupt
- CMPQ AX, CX
- JAE lz4_snappy_dstfull
- MOVBQZX (DX), DI
- MOVQ DI, R8
- MOVQ DI, R9
- SHRQ $0x04, R8
- ANDQ $0x0f, R9
- CMPQ DI, $0xf0
- JB lz4_snappy_ll_end
-
-lz4_snappy_ll_loop:
- INCQ DX
- CMPQ DX, BX
- JAE lz4_snappy_corrupt
- MOVBQZX (DX), DI
- ADDQ DI, R8
- CMPQ DI, $0xff
- JEQ lz4_snappy_ll_loop
-
-lz4_snappy_ll_end:
- LEAQ (DX)(R8*1), DI
- ADDQ $0x04, R9
- CMPQ DI, BX
- JAE lz4_snappy_corrupt
- INCQ DX
- INCQ DI
- TESTQ R8, R8
- JZ lz4_snappy_lits_done
- LEAQ (AX)(R8*1), R10
- CMPQ R10, CX
- JAE lz4_snappy_dstfull
- ADDQ R8, SI
- LEAL -1(R8), R10
- CMPL R10, $0x3c
- JB one_byte_lz4_snappy
- CMPL R10, $0x00000100
- JB two_bytes_lz4_snappy
- CMPL R10, $0x00010000
- JB three_bytes_lz4_snappy
- CMPL R10, $0x01000000
- JB four_bytes_lz4_snappy
- MOVB $0xfc, (AX)
- MOVL R10, 1(AX)
- ADDQ $0x05, AX
- JMP memmove_long_lz4_snappy
-
-four_bytes_lz4_snappy:
- MOVL R10, R11
- SHRL $0x10, R11
- MOVB $0xf8, (AX)
- MOVW R10, 1(AX)
- MOVB R11, 3(AX)
- ADDQ $0x04, AX
- JMP memmove_long_lz4_snappy
-
-three_bytes_lz4_snappy:
- MOVB $0xf4, (AX)
- MOVW R10, 1(AX)
- ADDQ $0x03, AX
- JMP memmove_long_lz4_snappy
-
-two_bytes_lz4_snappy:
- MOVB $0xf0, (AX)
- MOVB R10, 1(AX)
- ADDQ $0x02, AX
- CMPL R10, $0x40
- JB memmove_lz4_snappy
- JMP memmove_long_lz4_snappy
-
-one_byte_lz4_snappy:
- SHLB $0x02, R10
- MOVB R10, (AX)
- ADDQ $0x01, AX
-
-memmove_lz4_snappy:
- LEAQ (AX)(R8*1), R10
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_lz4_snappy_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_lz4_snappy_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_lz4_snappy_memmove_move_17through32
- JMP emit_lit_memmove_lz4_snappy_memmove_move_33through64
-
-emit_lit_memmove_lz4_snappy_memmove_move_8:
- MOVQ (DX), R11
- MOVQ R11, (AX)
- JMP memmove_end_copy_lz4_snappy
-
-emit_lit_memmove_lz4_snappy_memmove_move_8through16:
- MOVQ (DX), R11
- MOVQ -8(DX)(R8*1), DX
- MOVQ R11, (AX)
- MOVQ DX, -8(AX)(R8*1)
- JMP memmove_end_copy_lz4_snappy
-
-emit_lit_memmove_lz4_snappy_memmove_move_17through32:
- MOVOU (DX), X0
- MOVOU -16(DX)(R8*1), X1
- MOVOU X0, (AX)
- MOVOU X1, -16(AX)(R8*1)
- JMP memmove_end_copy_lz4_snappy
-
-emit_lit_memmove_lz4_snappy_memmove_move_33through64:
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R8*1), X2
- MOVOU -16(DX)(R8*1), X3
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R8*1)
- MOVOU X3, -16(AX)(R8*1)
-
-memmove_end_copy_lz4_snappy:
- MOVQ R10, AX
- JMP lz4_snappy_lits_emit_done
-
-memmove_long_lz4_snappy:
- LEAQ (AX)(R8*1), R10
-
- // genMemMoveLong
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R8*1), X2
- MOVOU -16(DX)(R8*1), X3
- MOVQ R8, R12
- SHRQ $0x05, R12
- MOVQ AX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_lz4_snappylarge_forward_sse_loop_32
- LEAQ -32(DX)(R13*1), R11
- LEAQ -32(AX)(R13*1), R14
-
-emit_lit_memmove_long_lz4_snappylarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_lz4_snappylarge_big_loop_back
-
-emit_lit_memmove_long_lz4_snappylarge_forward_sse_loop_32:
- MOVOU -32(DX)(R13*1), X4
- MOVOU -16(DX)(R13*1), X5
- MOVOA X4, -32(AX)(R13*1)
- MOVOA X5, -16(AX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R8, R13
- JAE emit_lit_memmove_long_lz4_snappylarge_forward_sse_loop_32
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R8*1)
- MOVOU X3, -16(AX)(R8*1)
- MOVQ R10, AX
-
-lz4_snappy_lits_emit_done:
- MOVQ DI, DX
-
-lz4_snappy_lits_done:
- CMPQ DX, BX
- JNE lz4_snappy_match
- CMPQ R9, $0x04
- JEQ lz4_snappy_done
- JMP lz4_snappy_corrupt
-
-lz4_snappy_match:
- LEAQ 2(DX), DI
- CMPQ DI, BX
- JAE lz4_snappy_corrupt
- MOVWQZX (DX), R8
- MOVQ DI, DX
- TESTQ R8, R8
- JZ lz4_snappy_corrupt
- CMPQ R8, SI
- JA lz4_snappy_corrupt
- CMPQ R9, $0x13
- JNE lz4_snappy_ml_done
-
-lz4_snappy_ml_loop:
- MOVBQZX (DX), DI
- INCQ DX
- ADDQ DI, R9
- CMPQ DX, BX
- JAE lz4_snappy_corrupt
- CMPQ DI, $0xff
- JEQ lz4_snappy_ml_loop
-
-lz4_snappy_ml_done:
- ADDQ R9, SI
-
- // emitCopy
-two_byte_offset_lz4_s2:
- CMPL R9, $0x40
- JBE two_byte_offset_short_lz4_s2
- MOVB $0xee, (AX)
- MOVW R8, 1(AX)
- LEAL -60(R9), R9
- ADDQ $0x03, AX
- CMPQ AX, CX
- JAE lz4_snappy_loop
- JMP two_byte_offset_lz4_s2
-
-two_byte_offset_short_lz4_s2:
- MOVL R9, DI
- SHLL $0x02, DI
- CMPL R9, $0x0c
- JAE emit_copy_three_lz4_s2
- CMPL R8, $0x00000800
- JAE emit_copy_three_lz4_s2
- LEAL -15(DI), DI
- MOVB R8, 1(AX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, DI
- MOVB DI, (AX)
- ADDQ $0x02, AX
- JMP lz4_snappy_loop
-
-emit_copy_three_lz4_s2:
- LEAL -2(DI), DI
- MOVB DI, (AX)
- MOVW R8, 1(AX)
- ADDQ $0x03, AX
- JMP lz4_snappy_loop
-
-lz4_snappy_done:
- MOVQ dst_base+0(FP), CX
- SUBQ CX, AX
- MOVQ SI, uncompressed+48(FP)
- MOVQ AX, dstUsed+56(FP)
- RET
-
-lz4_snappy_corrupt:
- XORQ AX, AX
- LEAQ -1(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-lz4_snappy_dstfull:
- XORQ AX, AX
- LEAQ -2(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-// func cvtLZ4sBlockSnappyAsm(dst []byte, src []byte) (uncompressed int, dstUsed int)
-// Requires: SSE2
-TEXT ·cvtLZ4sBlockSnappyAsm(SB), NOSPLIT, $0-64
- XORQ SI, SI
- MOVQ dst_base+0(FP), AX
- MOVQ dst_len+8(FP), CX
- MOVQ src_base+24(FP), DX
- MOVQ src_len+32(FP), BX
- LEAQ (DX)(BX*1), BX
- LEAQ -8(AX)(CX*1), CX
-
-lz4s_snappy_loop:
- CMPQ DX, BX
- JAE lz4s_snappy_corrupt
- CMPQ AX, CX
- JAE lz4s_snappy_dstfull
- MOVBQZX (DX), DI
- MOVQ DI, R8
- MOVQ DI, R9
- SHRQ $0x04, R8
- ANDQ $0x0f, R9
- CMPQ DI, $0xf0
- JB lz4s_snappy_ll_end
-
-lz4s_snappy_ll_loop:
- INCQ DX
- CMPQ DX, BX
- JAE lz4s_snappy_corrupt
- MOVBQZX (DX), DI
- ADDQ DI, R8
- CMPQ DI, $0xff
- JEQ lz4s_snappy_ll_loop
-
-lz4s_snappy_ll_end:
- LEAQ (DX)(R8*1), DI
- ADDQ $0x03, R9
- CMPQ DI, BX
- JAE lz4s_snappy_corrupt
- INCQ DX
- INCQ DI
- TESTQ R8, R8
- JZ lz4s_snappy_lits_done
- LEAQ (AX)(R8*1), R10
- CMPQ R10, CX
- JAE lz4s_snappy_dstfull
- ADDQ R8, SI
- LEAL -1(R8), R10
- CMPL R10, $0x3c
- JB one_byte_lz4s_snappy
- CMPL R10, $0x00000100
- JB two_bytes_lz4s_snappy
- CMPL R10, $0x00010000
- JB three_bytes_lz4s_snappy
- CMPL R10, $0x01000000
- JB four_bytes_lz4s_snappy
- MOVB $0xfc, (AX)
- MOVL R10, 1(AX)
- ADDQ $0x05, AX
- JMP memmove_long_lz4s_snappy
-
-four_bytes_lz4s_snappy:
- MOVL R10, R11
- SHRL $0x10, R11
- MOVB $0xf8, (AX)
- MOVW R10, 1(AX)
- MOVB R11, 3(AX)
- ADDQ $0x04, AX
- JMP memmove_long_lz4s_snappy
-
-three_bytes_lz4s_snappy:
- MOVB $0xf4, (AX)
- MOVW R10, 1(AX)
- ADDQ $0x03, AX
- JMP memmove_long_lz4s_snappy
-
-two_bytes_lz4s_snappy:
- MOVB $0xf0, (AX)
- MOVB R10, 1(AX)
- ADDQ $0x02, AX
- CMPL R10, $0x40
- JB memmove_lz4s_snappy
- JMP memmove_long_lz4s_snappy
-
-one_byte_lz4s_snappy:
- SHLB $0x02, R10
- MOVB R10, (AX)
- ADDQ $0x01, AX
-
-memmove_lz4s_snappy:
- LEAQ (AX)(R8*1), R10
-
- // genMemMoveShort
- CMPQ R8, $0x08
- JBE emit_lit_memmove_lz4s_snappy_memmove_move_8
- CMPQ R8, $0x10
- JBE emit_lit_memmove_lz4s_snappy_memmove_move_8through16
- CMPQ R8, $0x20
- JBE emit_lit_memmove_lz4s_snappy_memmove_move_17through32
- JMP emit_lit_memmove_lz4s_snappy_memmove_move_33through64
-
-emit_lit_memmove_lz4s_snappy_memmove_move_8:
- MOVQ (DX), R11
- MOVQ R11, (AX)
- JMP memmove_end_copy_lz4s_snappy
-
-emit_lit_memmove_lz4s_snappy_memmove_move_8through16:
- MOVQ (DX), R11
- MOVQ -8(DX)(R8*1), DX
- MOVQ R11, (AX)
- MOVQ DX, -8(AX)(R8*1)
- JMP memmove_end_copy_lz4s_snappy
-
-emit_lit_memmove_lz4s_snappy_memmove_move_17through32:
- MOVOU (DX), X0
- MOVOU -16(DX)(R8*1), X1
- MOVOU X0, (AX)
- MOVOU X1, -16(AX)(R8*1)
- JMP memmove_end_copy_lz4s_snappy
-
-emit_lit_memmove_lz4s_snappy_memmove_move_33through64:
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R8*1), X2
- MOVOU -16(DX)(R8*1), X3
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R8*1)
- MOVOU X3, -16(AX)(R8*1)
-
-memmove_end_copy_lz4s_snappy:
- MOVQ R10, AX
- JMP lz4s_snappy_lits_emit_done
-
-memmove_long_lz4s_snappy:
- LEAQ (AX)(R8*1), R10
-
- // genMemMoveLong
- MOVOU (DX), X0
- MOVOU 16(DX), X1
- MOVOU -32(DX)(R8*1), X2
- MOVOU -16(DX)(R8*1), X3
- MOVQ R8, R12
- SHRQ $0x05, R12
- MOVQ AX, R11
- ANDL $0x0000001f, R11
- MOVQ $0x00000040, R13
- SUBQ R11, R13
- DECQ R12
- JA emit_lit_memmove_long_lz4s_snappylarge_forward_sse_loop_32
- LEAQ -32(DX)(R13*1), R11
- LEAQ -32(AX)(R13*1), R14
-
-emit_lit_memmove_long_lz4s_snappylarge_big_loop_back:
- MOVOU (R11), X4
- MOVOU 16(R11), X5
- MOVOA X4, (R14)
- MOVOA X5, 16(R14)
- ADDQ $0x20, R14
- ADDQ $0x20, R11
- ADDQ $0x20, R13
- DECQ R12
- JNA emit_lit_memmove_long_lz4s_snappylarge_big_loop_back
-
-emit_lit_memmove_long_lz4s_snappylarge_forward_sse_loop_32:
- MOVOU -32(DX)(R13*1), X4
- MOVOU -16(DX)(R13*1), X5
- MOVOA X4, -32(AX)(R13*1)
- MOVOA X5, -16(AX)(R13*1)
- ADDQ $0x20, R13
- CMPQ R8, R13
- JAE emit_lit_memmove_long_lz4s_snappylarge_forward_sse_loop_32
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, -32(AX)(R8*1)
- MOVOU X3, -16(AX)(R8*1)
- MOVQ R10, AX
-
-lz4s_snappy_lits_emit_done:
- MOVQ DI, DX
-
-lz4s_snappy_lits_done:
- CMPQ DX, BX
- JNE lz4s_snappy_match
- CMPQ R9, $0x03
- JEQ lz4s_snappy_done
- JMP lz4s_snappy_corrupt
-
-lz4s_snappy_match:
- CMPQ R9, $0x03
- JEQ lz4s_snappy_loop
- LEAQ 2(DX), DI
- CMPQ DI, BX
- JAE lz4s_snappy_corrupt
- MOVWQZX (DX), R8
- MOVQ DI, DX
- TESTQ R8, R8
- JZ lz4s_snappy_corrupt
- CMPQ R8, SI
- JA lz4s_snappy_corrupt
- CMPQ R9, $0x12
- JNE lz4s_snappy_ml_done
-
-lz4s_snappy_ml_loop:
- MOVBQZX (DX), DI
- INCQ DX
- ADDQ DI, R9
- CMPQ DX, BX
- JAE lz4s_snappy_corrupt
- CMPQ DI, $0xff
- JEQ lz4s_snappy_ml_loop
-
-lz4s_snappy_ml_done:
- ADDQ R9, SI
-
- // emitCopy
-two_byte_offset_lz4_s2:
- CMPL R9, $0x40
- JBE two_byte_offset_short_lz4_s2
- MOVB $0xee, (AX)
- MOVW R8, 1(AX)
- LEAL -60(R9), R9
- ADDQ $0x03, AX
- CMPQ AX, CX
- JAE lz4s_snappy_loop
- JMP two_byte_offset_lz4_s2
-
-two_byte_offset_short_lz4_s2:
- MOVL R9, DI
- SHLL $0x02, DI
- CMPL R9, $0x0c
- JAE emit_copy_three_lz4_s2
- CMPL R8, $0x00000800
- JAE emit_copy_three_lz4_s2
- LEAL -15(DI), DI
- MOVB R8, 1(AX)
- SHRL $0x08, R8
- SHLL $0x05, R8
- ORL R8, DI
- MOVB DI, (AX)
- ADDQ $0x02, AX
- JMP lz4s_snappy_loop
-
-emit_copy_three_lz4_s2:
- LEAL -2(DI), DI
- MOVB DI, (AX)
- MOVW R8, 1(AX)
- ADDQ $0x03, AX
- JMP lz4s_snappy_loop
-
-lz4s_snappy_done:
- MOVQ dst_base+0(FP), CX
- SUBQ CX, AX
- MOVQ SI, uncompressed+48(FP)
- MOVQ AX, dstUsed+56(FP)
- RET
-
-lz4s_snappy_corrupt:
- XORQ AX, AX
- LEAQ -1(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
-
-lz4s_snappy_dstfull:
- XORQ AX, AX
- LEAQ -2(AX), SI
- MOVQ SI, uncompressed+48(FP)
- RET
diff --git a/vendor/github.com/klauspost/compress/s2/index.go b/vendor/github.com/klauspost/compress/s2/index.go
deleted file mode 100644
index 4229957b9..000000000
--- a/vendor/github.com/klauspost/compress/s2/index.go
+++ /dev/null
@@ -1,602 +0,0 @@
-// Copyright (c) 2022+ Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "bytes"
- "encoding/binary"
- "encoding/json"
- "fmt"
- "io"
- "sort"
-)
-
-const (
- S2IndexHeader = "s2idx\x00"
- S2IndexTrailer = "\x00xdi2s"
- maxIndexEntries = 1 << 16
- // If distance is less than this, we do not add the entry.
- minIndexDist = 1 << 20
-)
-
-// Index represents an S2/Snappy index.
-type Index struct {
- TotalUncompressed int64 // Total Uncompressed size if known. Will be -1 if unknown.
- TotalCompressed int64 // Total Compressed size if known. Will be -1 if unknown.
- info []struct {
- compressedOffset int64
- uncompressedOffset int64
- }
- estBlockUncomp int64
-}
-
-func (i *Index) reset(maxBlock int) {
- i.estBlockUncomp = int64(maxBlock)
- i.TotalCompressed = -1
- i.TotalUncompressed = -1
- if len(i.info) > 0 {
- i.info = i.info[:0]
- }
-}
-
-// allocInfos will allocate an empty slice of infos.
-func (i *Index) allocInfos(n int) {
- if n > maxIndexEntries {
- panic("n > maxIndexEntries")
- }
- i.info = make([]struct {
- compressedOffset int64
- uncompressedOffset int64
- }, 0, n)
-}
-
-// add an uncompressed and compressed pair.
-// Entries must be sent in order.
-func (i *Index) add(compressedOffset, uncompressedOffset int64) error {
- if i == nil {
- return nil
- }
- lastIdx := len(i.info) - 1
- if lastIdx >= 0 {
- latest := i.info[lastIdx]
- if latest.uncompressedOffset == uncompressedOffset {
- // Uncompressed didn't change, don't add entry,
- // but update start index.
- latest.compressedOffset = compressedOffset
- i.info[lastIdx] = latest
- return nil
- }
- if latest.uncompressedOffset > uncompressedOffset {
- return fmt.Errorf("internal error: Earlier uncompressed received (%d > %d)", latest.uncompressedOffset, uncompressedOffset)
- }
- if latest.compressedOffset > compressedOffset {
- return fmt.Errorf("internal error: Earlier compressed received (%d > %d)", latest.uncompressedOffset, uncompressedOffset)
- }
- if latest.uncompressedOffset+minIndexDist > uncompressedOffset {
- // Only add entry if distance is large enough.
- return nil
- }
- }
- i.info = append(i.info, struct {
- compressedOffset int64
- uncompressedOffset int64
- }{compressedOffset: compressedOffset, uncompressedOffset: uncompressedOffset})
- return nil
-}
-
-// Find the offset at or before the wanted (uncompressed) offset.
-// If offset is 0 or positive it is the offset from the beginning of the file.
-// If the uncompressed size is known, the offset must be within the file.
-// If an offset outside the file is requested io.ErrUnexpectedEOF is returned.
-// If the offset is negative, it is interpreted as the distance from the end of the file,
-// where -1 represents the last byte.
-// If offset from the end of the file is requested, but size is unknown,
-// ErrUnsupported will be returned.
-func (i *Index) Find(offset int64) (compressedOff, uncompressedOff int64, err error) {
- if i.TotalUncompressed < 0 {
- return 0, 0, ErrCorrupt
- }
- if offset < 0 {
- offset = i.TotalUncompressed + offset
- if offset < 0 {
- return 0, 0, io.ErrUnexpectedEOF
- }
- }
- if offset > i.TotalUncompressed {
- return 0, 0, io.ErrUnexpectedEOF
- }
- if len(i.info) > 200 {
- n := sort.Search(len(i.info), func(n int) bool {
- return i.info[n].uncompressedOffset > offset
- })
- if n == 0 {
- n = 1
- }
- return i.info[n-1].compressedOffset, i.info[n-1].uncompressedOffset, nil
- }
- for _, info := range i.info {
- if info.uncompressedOffset > offset {
- break
- }
- compressedOff = info.compressedOffset
- uncompressedOff = info.uncompressedOffset
- }
- return compressedOff, uncompressedOff, nil
-}
-
-// reduce to stay below maxIndexEntries
-func (i *Index) reduce() {
- if len(i.info) < maxIndexEntries && i.estBlockUncomp >= minIndexDist {
- return
- }
-
- // Algorithm, keep 1, remove removeN entries...
- removeN := (len(i.info) + 1) / maxIndexEntries
- src := i.info
- j := 0
-
- // Each block should be at least 1MB, but don't reduce below 1000 entries.
- for i.estBlockUncomp*(int64(removeN)+1) < minIndexDist && len(i.info)/(removeN+1) > 1000 {
- removeN++
- }
- for idx := 0; idx < len(src); idx++ {
- i.info[j] = src[idx]
- j++
- idx += removeN
- }
- i.info = i.info[:j]
- // Update maxblock estimate.
- i.estBlockUncomp += i.estBlockUncomp * int64(removeN)
-}
-
-func (i *Index) appendTo(b []byte, uncompTotal, compTotal int64) []byte {
- i.reduce()
- var tmp [binary.MaxVarintLen64]byte
-
- initSize := len(b)
- // We make the start a skippable header+size.
- b = append(b, ChunkTypeIndex, 0, 0, 0)
- b = append(b, []byte(S2IndexHeader)...)
- // Total Uncompressed size
- n := binary.PutVarint(tmp[:], uncompTotal)
- b = append(b, tmp[:n]...)
- // Total Compressed size
- n = binary.PutVarint(tmp[:], compTotal)
- b = append(b, tmp[:n]...)
- // Put EstBlockUncomp size
- n = binary.PutVarint(tmp[:], i.estBlockUncomp)
- b = append(b, tmp[:n]...)
- // Put length
- n = binary.PutVarint(tmp[:], int64(len(i.info)))
- b = append(b, tmp[:n]...)
-
- // Check if we should add uncompressed offsets
- var hasUncompressed byte
- for idx, info := range i.info {
- if idx == 0 {
- if info.uncompressedOffset != 0 {
- hasUncompressed = 1
- break
- }
- continue
- }
- if info.uncompressedOffset != i.info[idx-1].uncompressedOffset+i.estBlockUncomp {
- hasUncompressed = 1
- break
- }
- }
- b = append(b, hasUncompressed)
-
- // Add each entry
- if hasUncompressed == 1 {
- for idx, info := range i.info {
- uOff := info.uncompressedOffset
- if idx > 0 {
- prev := i.info[idx-1]
- uOff -= prev.uncompressedOffset + (i.estBlockUncomp)
- }
- n = binary.PutVarint(tmp[:], uOff)
- b = append(b, tmp[:n]...)
- }
- }
-
- // Initial compressed size estimate.
- cPredict := i.estBlockUncomp / 2
-
- for idx, info := range i.info {
- cOff := info.compressedOffset
- if idx > 0 {
- prev := i.info[idx-1]
- cOff -= prev.compressedOffset + cPredict
- // Update compressed size prediction, with half the error.
- cPredict += cOff / 2
- }
- n = binary.PutVarint(tmp[:], cOff)
- b = append(b, tmp[:n]...)
- }
-
- // Add Total Size.
- // Stored as fixed size for easier reading.
- binary.LittleEndian.PutUint32(tmp[:], uint32(len(b)-initSize+4+len(S2IndexTrailer)))
- b = append(b, tmp[:4]...)
- // Trailer
- b = append(b, []byte(S2IndexTrailer)...)
-
- // Update size
- chunkLen := len(b) - initSize - skippableFrameHeader
- b[initSize+1] = uint8(chunkLen >> 0)
- b[initSize+2] = uint8(chunkLen >> 8)
- b[initSize+3] = uint8(chunkLen >> 16)
- //fmt.Printf("chunklen: 0x%x Uncomp:%d, Comp:%d\n", chunkLen, uncompTotal, compTotal)
- return b
-}
-
-// Load a binary index.
-// A zero value Index can be used or a previous one can be reused.
-func (i *Index) Load(b []byte) ([]byte, error) {
- if len(b) <= 4+len(S2IndexHeader)+len(S2IndexTrailer) {
- return b, io.ErrUnexpectedEOF
- }
- if b[0] != ChunkTypeIndex {
- return b, ErrCorrupt
- }
- chunkLen := int(b[1]) | int(b[2])<<8 | int(b[3])<<16
- b = b[4:]
-
- // Validate we have enough...
- if len(b) < chunkLen {
- return b, io.ErrUnexpectedEOF
- }
- if !bytes.Equal(b[:len(S2IndexHeader)], []byte(S2IndexHeader)) {
- return b, ErrUnsupported
- }
- b = b[len(S2IndexHeader):]
-
- // Total Uncompressed
- if v, n := binary.Varint(b); n <= 0 || v < 0 {
- return b, ErrCorrupt
- } else {
- i.TotalUncompressed = v
- b = b[n:]
- }
-
- // Total Compressed
- if v, n := binary.Varint(b); n <= 0 {
- return b, ErrCorrupt
- } else {
- i.TotalCompressed = v
- b = b[n:]
- }
-
- // Read EstBlockUncomp
- if v, n := binary.Varint(b); n <= 0 {
- return b, ErrCorrupt
- } else {
- if v < 0 {
- return b, ErrCorrupt
- }
- i.estBlockUncomp = v
- b = b[n:]
- }
-
- var entries int
- if v, n := binary.Varint(b); n <= 0 {
- return b, ErrCorrupt
- } else {
- if v < 0 || v > maxIndexEntries {
- return b, ErrCorrupt
- }
- entries = int(v)
- b = b[n:]
- }
- if cap(i.info) < entries {
- i.allocInfos(entries)
- }
- i.info = i.info[:entries]
-
- if len(b) < 1 {
- return b, io.ErrUnexpectedEOF
- }
- hasUncompressed := b[0]
- b = b[1:]
- if hasUncompressed&1 != hasUncompressed {
- return b, ErrCorrupt
- }
-
- // Add each uncompressed entry
- for idx := range i.info {
- var uOff int64
- if hasUncompressed != 0 {
- // Load delta
- if v, n := binary.Varint(b); n <= 0 {
- return b, ErrCorrupt
- } else {
- uOff = v
- b = b[n:]
- }
- }
-
- if idx > 0 {
- prev := i.info[idx-1].uncompressedOffset
- uOff += prev + (i.estBlockUncomp)
- if uOff <= prev {
- return b, ErrCorrupt
- }
- }
- if uOff < 0 {
- return b, ErrCorrupt
- }
- i.info[idx].uncompressedOffset = uOff
- }
-
- // Initial compressed size estimate.
- cPredict := i.estBlockUncomp / 2
-
- // Add each compressed entry
- for idx := range i.info {
- var cOff int64
- if v, n := binary.Varint(b); n <= 0 {
- return b, ErrCorrupt
- } else {
- cOff = v
- b = b[n:]
- }
-
- if idx > 0 {
- // Update compressed size prediction, with half the error.
- cPredictNew := cPredict + cOff/2
-
- prev := i.info[idx-1].compressedOffset
- cOff += prev + cPredict
- if cOff <= prev {
- return b, ErrCorrupt
- }
- cPredict = cPredictNew
- }
- if cOff < 0 {
- return b, ErrCorrupt
- }
- i.info[idx].compressedOffset = cOff
- }
- if len(b) < 4+len(S2IndexTrailer) {
- return b, io.ErrUnexpectedEOF
- }
- // Skip size...
- b = b[4:]
-
- // Check trailer...
- if !bytes.Equal(b[:len(S2IndexTrailer)], []byte(S2IndexTrailer)) {
- return b, ErrCorrupt
- }
- return b[len(S2IndexTrailer):], nil
-}
-
-// LoadStream will load an index from the end of the supplied stream.
-// ErrUnsupported will be returned if the signature cannot be found.
-// ErrCorrupt will be returned if unexpected values are found.
-// io.ErrUnexpectedEOF is returned if there are too few bytes.
-// IO errors are returned as-is.
-func (i *Index) LoadStream(rs io.ReadSeeker) error {
- // Go to end.
- _, err := rs.Seek(-10, io.SeekEnd)
- if err != nil {
- return err
- }
- var tmp [10]byte
- _, err = io.ReadFull(rs, tmp[:])
- if err != nil {
- return err
- }
- // Check trailer...
- if !bytes.Equal(tmp[4:4+len(S2IndexTrailer)], []byte(S2IndexTrailer)) {
- return ErrUnsupported
- }
- sz := binary.LittleEndian.Uint32(tmp[:4])
- if sz > maxChunkSize+skippableFrameHeader {
- return ErrCorrupt
- }
- _, err = rs.Seek(-int64(sz), io.SeekEnd)
- if err != nil {
- return err
- }
-
- // Read index.
- buf := make([]byte, sz)
- _, err = io.ReadFull(rs, buf)
- if err != nil {
- return err
- }
- _, err = i.Load(buf)
- return err
-}
-
-// IndexStream will return an index for a stream.
-// The stream structure will be checked, but
-// data within blocks is not verified.
-// The returned index can either be appended to the end of the stream
-// or stored separately.
-func IndexStream(r io.Reader) ([]byte, error) {
- var i Index
- var buf [maxChunkSize]byte
- var readHeader bool
- for {
- _, err := io.ReadFull(r, buf[:4])
- if err != nil {
- if err == io.EOF {
- return i.appendTo(nil, i.TotalUncompressed, i.TotalCompressed), nil
- }
- return nil, err
- }
- // Start of this chunk.
- startChunk := i.TotalCompressed
- i.TotalCompressed += 4
-
- chunkType := buf[0]
- if !readHeader {
- if chunkType != chunkTypeStreamIdentifier {
- return nil, ErrCorrupt
- }
- readHeader = true
- }
- chunkLen := int(buf[1]) | int(buf[2])<<8 | int(buf[3])<<16
- if chunkLen < checksumSize {
- return nil, ErrCorrupt
- }
-
- i.TotalCompressed += int64(chunkLen)
- _, err = io.ReadFull(r, buf[:chunkLen])
- if err != nil {
- return nil, io.ErrUnexpectedEOF
- }
- // The chunk types are specified at
- // https://github.com/google/snappy/blob/master/framing_format.txt
- switch chunkType {
- case chunkTypeCompressedData:
- // Section 4.2. Compressed data (chunk type 0x00).
- // Skip checksum.
- dLen, err := DecodedLen(buf[checksumSize:])
- if err != nil {
- return nil, err
- }
- if dLen > maxBlockSize {
- return nil, ErrCorrupt
- }
- if i.estBlockUncomp == 0 {
- // Use first block for estimate...
- i.estBlockUncomp = int64(dLen)
- }
- err = i.add(startChunk, i.TotalUncompressed)
- if err != nil {
- return nil, err
- }
- i.TotalUncompressed += int64(dLen)
- continue
- case chunkTypeUncompressedData:
- n2 := chunkLen - checksumSize
- if n2 > maxBlockSize {
- return nil, ErrCorrupt
- }
- if i.estBlockUncomp == 0 {
- // Use first block for estimate...
- i.estBlockUncomp = int64(n2)
- }
- err = i.add(startChunk, i.TotalUncompressed)
- if err != nil {
- return nil, err
- }
- i.TotalUncompressed += int64(n2)
- continue
- case chunkTypeStreamIdentifier:
- // Section 4.1. Stream identifier (chunk type 0xff).
- if chunkLen != len(magicBody) {
- return nil, ErrCorrupt
- }
-
- if string(buf[:len(magicBody)]) != magicBody {
- if string(buf[:len(magicBody)]) != magicBodySnappy {
- return nil, ErrCorrupt
- }
- }
-
- continue
- }
-
- if chunkType <= 0x7f {
- // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f).
- return nil, ErrUnsupported
- }
- if chunkLen > maxChunkSize {
- return nil, ErrUnsupported
- }
- // Section 4.4 Padding (chunk type 0xfe).
- // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
- }
-}
-
-// JSON returns the index as JSON text.
-func (i *Index) JSON() []byte {
- type offset struct {
- CompressedOffset int64 `json:"compressed"`
- UncompressedOffset int64 `json:"uncompressed"`
- }
- x := struct {
- TotalUncompressed int64 `json:"total_uncompressed"` // Total Uncompressed size if known. Will be -1 if unknown.
- TotalCompressed int64 `json:"total_compressed"` // Total Compressed size if known. Will be -1 if unknown.
- Offsets []offset `json:"offsets"`
- EstBlockUncomp int64 `json:"est_block_uncompressed"`
- }{
- TotalUncompressed: i.TotalUncompressed,
- TotalCompressed: i.TotalCompressed,
- EstBlockUncomp: i.estBlockUncomp,
- }
- for _, v := range i.info {
- x.Offsets = append(x.Offsets, offset{CompressedOffset: v.compressedOffset, UncompressedOffset: v.uncompressedOffset})
- }
- b, _ := json.MarshalIndent(x, "", " ")
- return b
-}
-
-// RemoveIndexHeaders will trim all headers and trailers from a given index.
-// This is expected to save 20 bytes.
-// These can be restored using RestoreIndexHeaders.
-// This removes a layer of security, but is the most compact representation.
-// Returns nil if headers contains errors.
-// The returned slice references the provided slice.
-func RemoveIndexHeaders(b []byte) []byte {
- const save = 4 + len(S2IndexHeader) + len(S2IndexTrailer) + 4
- if len(b) <= save {
- return nil
- }
- if b[0] != ChunkTypeIndex {
- return nil
- }
- chunkLen := int(b[1]) | int(b[2])<<8 | int(b[3])<<16
- b = b[4:]
-
- // Validate we have enough...
- if len(b) < chunkLen {
- return nil
- }
- b = b[:chunkLen]
-
- if !bytes.Equal(b[:len(S2IndexHeader)], []byte(S2IndexHeader)) {
- return nil
- }
- b = b[len(S2IndexHeader):]
- if !bytes.HasSuffix(b, []byte(S2IndexTrailer)) {
- return nil
- }
- b = bytes.TrimSuffix(b, []byte(S2IndexTrailer))
-
- if len(b) < 4 {
- return nil
- }
- return b[:len(b)-4]
-}
-
-// RestoreIndexHeaders will index restore headers removed by RemoveIndexHeaders.
-// No error checking is performed on the input.
-// If a 0 length slice is sent, it is returned without modification.
-func RestoreIndexHeaders(in []byte) []byte {
- if len(in) == 0 {
- return in
- }
- b := make([]byte, 0, 4+len(S2IndexHeader)+len(in)+len(S2IndexTrailer)+4)
- b = append(b, ChunkTypeIndex, 0, 0, 0)
- b = append(b, []byte(S2IndexHeader)...)
- b = append(b, in...)
-
- var tmp [4]byte
- binary.LittleEndian.PutUint32(tmp[:], uint32(len(b)+4+len(S2IndexTrailer)))
- b = append(b, tmp[:4]...)
- // Trailer
- b = append(b, []byte(S2IndexTrailer)...)
-
- chunkLen := len(b) - skippableFrameHeader
- b[1] = uint8(chunkLen >> 0)
- b[2] = uint8(chunkLen >> 8)
- b[3] = uint8(chunkLen >> 16)
- return b
-}
diff --git a/vendor/github.com/klauspost/compress/s2/lz4convert.go b/vendor/github.com/klauspost/compress/s2/lz4convert.go
deleted file mode 100644
index 46ed908e3..000000000
--- a/vendor/github.com/klauspost/compress/s2/lz4convert.go
+++ /dev/null
@@ -1,585 +0,0 @@
-// Copyright (c) 2022 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
-)
-
-// LZ4Converter provides conversion from LZ4 blocks as defined here:
-// https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md
-type LZ4Converter struct {
-}
-
-// ErrDstTooSmall is returned when provided destination is too small.
-var ErrDstTooSmall = errors.New("s2: destination too small")
-
-// ConvertBlock will convert an LZ4 block and append it as an S2
-// block without block length to dst.
-// The uncompressed size is returned as well.
-// dst must have capacity to contain the entire compressed block.
-func (l *LZ4Converter) ConvertBlock(dst, src []byte) ([]byte, int, error) {
- if len(src) == 0 {
- return dst, 0, nil
- }
- const debug = false
- const inline = true
- const lz4MinMatch = 4
-
- s, d := 0, len(dst)
- dst = dst[:cap(dst)]
- if !debug && hasAmd64Asm {
- res, sz := cvtLZ4BlockAsm(dst[d:], src)
- if res < 0 {
- const (
- errCorrupt = -1
- errDstTooSmall = -2
- )
- switch res {
- case errCorrupt:
- return nil, 0, ErrCorrupt
- case errDstTooSmall:
- return nil, 0, ErrDstTooSmall
- default:
- return nil, 0, fmt.Errorf("unexpected result: %d", res)
- }
- }
- if d+sz > len(dst) {
- return nil, 0, ErrDstTooSmall
- }
- return dst[:d+sz], res, nil
- }
-
- dLimit := len(dst) - 10
- var lastOffset uint16
- var uncompressed int
- if debug {
- fmt.Printf("convert block start: len(src): %d, len(dst):%d \n", len(src), len(dst))
- }
-
- for {
- if s >= len(src) {
- return dst[:d], 0, ErrCorrupt
- }
- // Read literal info
- token := src[s]
- ll := int(token >> 4)
- ml := int(lz4MinMatch + (token & 0xf))
-
- // If upper nibble is 15, literal length is extended
- if token >= 0xf0 {
- for {
- s++
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ll: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return dst[:d], 0, ErrCorrupt
- }
- val := src[s]
- ll += int(val)
- if val != 255 {
- break
- }
- }
- }
- // Skip past token
- if s+ll >= len(src) {
- if debug {
- fmt.Printf("error literals: s+ll (%d+%d) >= len(src) (%d)\n", s, ll, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- s++
- if ll > 0 {
- if d+ll > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- if debug {
- fmt.Printf("emit %d literals\n", ll)
- }
- d += emitLiteralGo(dst[d:], src[s:s+ll])
- s += ll
- uncompressed += ll
- }
-
- // Check if we are done...
- if s == len(src) && ml == lz4MinMatch {
- break
- }
- // 2 byte offset
- if s >= len(src)-2 {
- if debug {
- fmt.Printf("s (%d) >= len(src)-2 (%d)", s, len(src)-2)
- }
- return nil, 0, ErrCorrupt
- }
- offset := binary.LittleEndian.Uint16(src[s:])
- s += 2
- if offset == 0 {
- if debug {
- fmt.Printf("error: offset 0, ml: %d, len(src)-s: %d\n", ml, len(src)-s)
- }
- return nil, 0, ErrCorrupt
- }
- if int(offset) > uncompressed {
- if debug {
- fmt.Printf("error: offset (%d)> uncompressed (%d)\n", offset, uncompressed)
- }
- return nil, 0, ErrCorrupt
- }
-
- if ml == lz4MinMatch+15 {
- for {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- val := src[s]
- s++
- ml += int(val)
- if val != 255 {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- break
- }
- }
- }
- if offset == lastOffset {
- if debug {
- fmt.Printf("emit repeat, length: %d, offset: %d\n", ml, offset)
- }
- if !inline {
- d += emitRepeat16(dst[d:], offset, ml)
- } else {
- length := ml
- dst := dst[d:]
- for len(dst) > 5 {
- // Repeat offset, make length cheaper
- length -= 4
- if length <= 4 {
- dst[0] = uint8(length)<<2 | tagCopy1
- dst[1] = 0
- d += 2
- break
- }
- if length < 8 && offset < 2048 {
- // Encode WITH offset
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length)<<2 | tagCopy1
- d += 2
- break
- }
- if length < (1<<8)+4 {
- length -= 4
- dst[2] = uint8(length)
- dst[1] = 0
- dst[0] = 5<<2 | tagCopy1
- d += 3
- break
- }
- if length < (1<<16)+(1<<8) {
- length -= 1 << 8
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 6<<2 | tagCopy1
- d += 4
- break
- }
- const maxRepeat = (1 << 24) - 1
- length -= 1 << 16
- left := 0
- if length > maxRepeat {
- left = length - maxRepeat + 4
- length = maxRepeat - 4
- }
- dst[4] = uint8(length >> 16)
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 7<<2 | tagCopy1
- if left > 0 {
- d += 5 + emitRepeat16(dst[5:], offset, left)
- break
- }
- d += 5
- break
- }
- }
- } else {
- if debug {
- fmt.Printf("emit copy, length: %d, offset: %d\n", ml, offset)
- }
- if !inline {
- d += emitCopy16(dst[d:], offset, ml)
- } else {
- length := ml
- dst := dst[d:]
- for len(dst) > 5 {
- // Offset no more than 2 bytes.
- if length > 64 {
- off := 3
- if offset < 2048 {
- // emit 8 bytes as tagCopy1, rest as repeats.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(8-4)<<2 | tagCopy1
- length -= 8
- off = 2
- } else {
- // Emit a length 60 copy, encoded as 3 bytes.
- // Emit remaining as repeat value (minimum 4 bytes).
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 59<<2 | tagCopy2
- length -= 60
- }
- // Emit remaining as repeats, at least 4 bytes remain.
- d += off + emitRepeat16(dst[off:], offset, length)
- break
- }
- if length >= 12 || offset >= 2048 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = uint8(length-1)<<2 | tagCopy2
- d += 3
- break
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- d += 2
- break
- }
- }
- lastOffset = offset
- }
- uncompressed += ml
- if d > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- }
-
- return dst[:d], uncompressed, nil
-}
-
-// ConvertBlockSnappy will convert an LZ4 block and append it
-// as a Snappy block without block length to dst.
-// The uncompressed size is returned as well.
-// dst must have capacity to contain the entire compressed block.
-func (l *LZ4Converter) ConvertBlockSnappy(dst, src []byte) ([]byte, int, error) {
- if len(src) == 0 {
- return dst, 0, nil
- }
- const debug = false
- const lz4MinMatch = 4
-
- s, d := 0, len(dst)
- dst = dst[:cap(dst)]
- // Use assembly when possible
- if !debug && hasAmd64Asm {
- res, sz := cvtLZ4BlockSnappyAsm(dst[d:], src)
- if res < 0 {
- const (
- errCorrupt = -1
- errDstTooSmall = -2
- )
- switch res {
- case errCorrupt:
- return nil, 0, ErrCorrupt
- case errDstTooSmall:
- return nil, 0, ErrDstTooSmall
- default:
- return nil, 0, fmt.Errorf("unexpected result: %d", res)
- }
- }
- if d+sz > len(dst) {
- return nil, 0, ErrDstTooSmall
- }
- return dst[:d+sz], res, nil
- }
-
- dLimit := len(dst) - 10
- var uncompressed int
- if debug {
- fmt.Printf("convert block start: len(src): %d, len(dst):%d \n", len(src), len(dst))
- }
-
- for {
- if s >= len(src) {
- return nil, 0, ErrCorrupt
- }
- // Read literal info
- token := src[s]
- ll := int(token >> 4)
- ml := int(lz4MinMatch + (token & 0xf))
-
- // If upper nibble is 15, literal length is extended
- if token >= 0xf0 {
- for {
- s++
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ll: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- val := src[s]
- ll += int(val)
- if val != 255 {
- break
- }
- }
- }
- // Skip past token
- if s+ll >= len(src) {
- if debug {
- fmt.Printf("error literals: s+ll (%d+%d) >= len(src) (%d)\n", s, ll, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- s++
- if ll > 0 {
- if d+ll > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- if debug {
- fmt.Printf("emit %d literals\n", ll)
- }
- d += emitLiteralGo(dst[d:], src[s:s+ll])
- s += ll
- uncompressed += ll
- }
-
- // Check if we are done...
- if s == len(src) && ml == lz4MinMatch {
- break
- }
- // 2 byte offset
- if s >= len(src)-2 {
- if debug {
- fmt.Printf("s (%d) >= len(src)-2 (%d)", s, len(src)-2)
- }
- return nil, 0, ErrCorrupt
- }
- offset := binary.LittleEndian.Uint16(src[s:])
- s += 2
- if offset == 0 {
- if debug {
- fmt.Printf("error: offset 0, ml: %d, len(src)-s: %d\n", ml, len(src)-s)
- }
- return nil, 0, ErrCorrupt
- }
- if int(offset) > uncompressed {
- if debug {
- fmt.Printf("error: offset (%d)> uncompressed (%d)\n", offset, uncompressed)
- }
- return nil, 0, ErrCorrupt
- }
-
- if ml == lz4MinMatch+15 {
- for {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- val := src[s]
- s++
- ml += int(val)
- if val != 255 {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- break
- }
- }
- }
- if debug {
- fmt.Printf("emit copy, length: %d, offset: %d\n", ml, offset)
- }
- length := ml
- // d += emitCopyNoRepeat(dst[d:], int(offset), ml)
- for length > 0 {
- if d >= dLimit {
- return nil, 0, ErrDstTooSmall
- }
-
- // Offset no more than 2 bytes.
- if length > 64 {
- // Emit a length 64 copy, encoded as 3 bytes.
- dst[d+2] = uint8(offset >> 8)
- dst[d+1] = uint8(offset)
- dst[d+0] = 63<<2 | tagCopy2
- length -= 64
- d += 3
- continue
- }
- if length >= 12 || offset >= 2048 || length < 4 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[d+2] = uint8(offset >> 8)
- dst[d+1] = uint8(offset)
- dst[d+0] = uint8(length-1)<<2 | tagCopy2
- d += 3
- break
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[d+1] = uint8(offset)
- dst[d+0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- d += 2
- break
- }
- uncompressed += ml
- if d > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- }
-
- return dst[:d], uncompressed, nil
-}
-
-// emitRepeat writes a repeat chunk and returns the number of bytes written.
-// Length must be at least 4 and < 1<<24
-func emitRepeat16(dst []byte, offset uint16, length int) int {
- // Repeat offset, make length cheaper
- length -= 4
- if length <= 4 {
- dst[0] = uint8(length)<<2 | tagCopy1
- dst[1] = 0
- return 2
- }
- if length < 8 && offset < 2048 {
- // Encode WITH offset
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length)<<2 | tagCopy1
- return 2
- }
- if length < (1<<8)+4 {
- length -= 4
- dst[2] = uint8(length)
- dst[1] = 0
- dst[0] = 5<<2 | tagCopy1
- return 3
- }
- if length < (1<<16)+(1<<8) {
- length -= 1 << 8
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 6<<2 | tagCopy1
- return 4
- }
- const maxRepeat = (1 << 24) - 1
- length -= 1 << 16
- left := 0
- if length > maxRepeat {
- left = length - maxRepeat + 4
- length = maxRepeat - 4
- }
- dst[4] = uint8(length >> 16)
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 7<<2 | tagCopy1
- if left > 0 {
- return 5 + emitRepeat16(dst[5:], offset, left)
- }
- return 5
-}
-
-// emitCopy writes a copy chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 1 <= offset && offset <= math.MaxUint16
-// 4 <= length && length <= math.MaxUint32
-func emitCopy16(dst []byte, offset uint16, length int) int {
- // Offset no more than 2 bytes.
- if length > 64 {
- off := 3
- if offset < 2048 {
- // emit 8 bytes as tagCopy1, rest as repeats.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(8-4)<<2 | tagCopy1
- length -= 8
- off = 2
- } else {
- // Emit a length 60 copy, encoded as 3 bytes.
- // Emit remaining as repeat value (minimum 4 bytes).
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 59<<2 | tagCopy2
- length -= 60
- }
- // Emit remaining as repeats, at least 4 bytes remain.
- return off + emitRepeat16(dst[off:], offset, length)
- }
- if length >= 12 || offset >= 2048 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = uint8(length-1)<<2 | tagCopy2
- return 3
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- return 2
-}
-
-// emitLiteral writes a literal chunk and returns the number of bytes written.
-//
-// It assumes that:
-//
-// dst is long enough to hold the encoded bytes
-// 0 <= len(lit) && len(lit) <= math.MaxUint32
-func emitLiteralGo(dst, lit []byte) int {
- if len(lit) == 0 {
- return 0
- }
- i, n := 0, uint(len(lit)-1)
- switch {
- case n < 60:
- dst[0] = uint8(n)<<2 | tagLiteral
- i = 1
- case n < 1<<8:
- dst[1] = uint8(n)
- dst[0] = 60<<2 | tagLiteral
- i = 2
- case n < 1<<16:
- dst[2] = uint8(n >> 8)
- dst[1] = uint8(n)
- dst[0] = 61<<2 | tagLiteral
- i = 3
- case n < 1<<24:
- dst[3] = uint8(n >> 16)
- dst[2] = uint8(n >> 8)
- dst[1] = uint8(n)
- dst[0] = 62<<2 | tagLiteral
- i = 4
- default:
- dst[4] = uint8(n >> 24)
- dst[3] = uint8(n >> 16)
- dst[2] = uint8(n >> 8)
- dst[1] = uint8(n)
- dst[0] = 63<<2 | tagLiteral
- i = 5
- }
- return i + copy(dst[i:], lit)
-}
diff --git a/vendor/github.com/klauspost/compress/s2/lz4sconvert.go b/vendor/github.com/klauspost/compress/s2/lz4sconvert.go
deleted file mode 100644
index 000f39719..000000000
--- a/vendor/github.com/klauspost/compress/s2/lz4sconvert.go
+++ /dev/null
@@ -1,467 +0,0 @@
-// Copyright (c) 2022 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "encoding/binary"
- "fmt"
-)
-
-// LZ4sConverter provides conversion from LZ4s.
-// (Intel modified LZ4 Blocks)
-// https://cdrdv2-public.intel.com/743912/743912-qat-programmers-guide-v2.0.pdf
-// LZ4s is a variant of LZ4 block format. LZ4s should be considered as an intermediate compressed block format.
-// The LZ4s format is selected when the application sets the compType to CPA_DC_LZ4S in CpaDcSessionSetupData.
-// The LZ4s block returned by the Intel® QAT hardware can be used by an external
-// software post-processing to generate other compressed data formats.
-// The following table lists the differences between LZ4 and LZ4s block format. LZ4s block format uses
-// the same high-level formatting as LZ4 block format with the following encoding changes:
-// For Min Match of 4 bytes, Copy length value 1-15 means length 4-18 with 18 bytes adding an extra byte.
-// ONLY "Min match of 4 bytes" is supported.
-type LZ4sConverter struct {
-}
-
-// ConvertBlock will convert an LZ4s block and append it as an S2
-// block without block length to dst.
-// The uncompressed size is returned as well.
-// dst must have capacity to contain the entire compressed block.
-func (l *LZ4sConverter) ConvertBlock(dst, src []byte) ([]byte, int, error) {
- if len(src) == 0 {
- return dst, 0, nil
- }
- const debug = false
- const inline = true
- const lz4MinMatch = 3
-
- s, d := 0, len(dst)
- dst = dst[:cap(dst)]
- if !debug && hasAmd64Asm {
- res, sz := cvtLZ4sBlockAsm(dst[d:], src)
- if res < 0 {
- const (
- errCorrupt = -1
- errDstTooSmall = -2
- )
- switch res {
- case errCorrupt:
- return nil, 0, ErrCorrupt
- case errDstTooSmall:
- return nil, 0, ErrDstTooSmall
- default:
- return nil, 0, fmt.Errorf("unexpected result: %d", res)
- }
- }
- if d+sz > len(dst) {
- return nil, 0, ErrDstTooSmall
- }
- return dst[:d+sz], res, nil
- }
-
- dLimit := len(dst) - 10
- var lastOffset uint16
- var uncompressed int
- if debug {
- fmt.Printf("convert block start: len(src): %d, len(dst):%d \n", len(src), len(dst))
- }
-
- for {
- if s >= len(src) {
- return dst[:d], 0, ErrCorrupt
- }
- // Read literal info
- token := src[s]
- ll := int(token >> 4)
- ml := int(lz4MinMatch + (token & 0xf))
-
- // If upper nibble is 15, literal length is extended
- if token >= 0xf0 {
- for {
- s++
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ll: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return dst[:d], 0, ErrCorrupt
- }
- val := src[s]
- ll += int(val)
- if val != 255 {
- break
- }
- }
- }
- // Skip past token
- if s+ll >= len(src) {
- if debug {
- fmt.Printf("error literals: s+ll (%d+%d) >= len(src) (%d)\n", s, ll, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- s++
- if ll > 0 {
- if d+ll > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- if debug {
- fmt.Printf("emit %d literals\n", ll)
- }
- d += emitLiteralGo(dst[d:], src[s:s+ll])
- s += ll
- uncompressed += ll
- }
-
- // Check if we are done...
- if ml == lz4MinMatch {
- if s == len(src) {
- break
- }
- // 0 bytes.
- continue
- }
- // 2 byte offset
- if s >= len(src)-2 {
- if debug {
- fmt.Printf("s (%d) >= len(src)-2 (%d)", s, len(src)-2)
- }
- return nil, 0, ErrCorrupt
- }
- offset := binary.LittleEndian.Uint16(src[s:])
- s += 2
- if offset == 0 {
- if debug {
- fmt.Printf("error: offset 0, ml: %d, len(src)-s: %d\n", ml, len(src)-s)
- }
- return nil, 0, ErrCorrupt
- }
- if int(offset) > uncompressed {
- if debug {
- fmt.Printf("error: offset (%d)> uncompressed (%d)\n", offset, uncompressed)
- }
- return nil, 0, ErrCorrupt
- }
-
- if ml == lz4MinMatch+15 {
- for {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- val := src[s]
- s++
- ml += int(val)
- if val != 255 {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- break
- }
- }
- }
- if offset == lastOffset {
- if debug {
- fmt.Printf("emit repeat, length: %d, offset: %d\n", ml, offset)
- }
- if !inline {
- d += emitRepeat16(dst[d:], offset, ml)
- } else {
- length := ml
- dst := dst[d:]
- for len(dst) > 5 {
- // Repeat offset, make length cheaper
- length -= 4
- if length <= 4 {
- dst[0] = uint8(length)<<2 | tagCopy1
- dst[1] = 0
- d += 2
- break
- }
- if length < 8 && offset < 2048 {
- // Encode WITH offset
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length)<<2 | tagCopy1
- d += 2
- break
- }
- if length < (1<<8)+4 {
- length -= 4
- dst[2] = uint8(length)
- dst[1] = 0
- dst[0] = 5<<2 | tagCopy1
- d += 3
- break
- }
- if length < (1<<16)+(1<<8) {
- length -= 1 << 8
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 6<<2 | tagCopy1
- d += 4
- break
- }
- const maxRepeat = (1 << 24) - 1
- length -= 1 << 16
- left := 0
- if length > maxRepeat {
- left = length - maxRepeat + 4
- length = maxRepeat - 4
- }
- dst[4] = uint8(length >> 16)
- dst[3] = uint8(length >> 8)
- dst[2] = uint8(length >> 0)
- dst[1] = 0
- dst[0] = 7<<2 | tagCopy1
- if left > 0 {
- d += 5 + emitRepeat16(dst[5:], offset, left)
- break
- }
- d += 5
- break
- }
- }
- } else {
- if debug {
- fmt.Printf("emit copy, length: %d, offset: %d\n", ml, offset)
- }
- if !inline {
- d += emitCopy16(dst[d:], offset, ml)
- } else {
- length := ml
- dst := dst[d:]
- for len(dst) > 5 {
- // Offset no more than 2 bytes.
- if length > 64 {
- off := 3
- if offset < 2048 {
- // emit 8 bytes as tagCopy1, rest as repeats.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(8-4)<<2 | tagCopy1
- length -= 8
- off = 2
- } else {
- // Emit a length 60 copy, encoded as 3 bytes.
- // Emit remaining as repeat value (minimum 4 bytes).
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = 59<<2 | tagCopy2
- length -= 60
- }
- // Emit remaining as repeats, at least 4 bytes remain.
- d += off + emitRepeat16(dst[off:], offset, length)
- break
- }
- if length >= 12 || offset >= 2048 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[2] = uint8(offset >> 8)
- dst[1] = uint8(offset)
- dst[0] = uint8(length-1)<<2 | tagCopy2
- d += 3
- break
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[1] = uint8(offset)
- dst[0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- d += 2
- break
- }
- }
- lastOffset = offset
- }
- uncompressed += ml
- if d > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- }
-
- return dst[:d], uncompressed, nil
-}
-
-// ConvertBlockSnappy will convert an LZ4s block and append it
-// as a Snappy block without block length to dst.
-// The uncompressed size is returned as well.
-// dst must have capacity to contain the entire compressed block.
-func (l *LZ4sConverter) ConvertBlockSnappy(dst, src []byte) ([]byte, int, error) {
- if len(src) == 0 {
- return dst, 0, nil
- }
- const debug = false
- const lz4MinMatch = 3
-
- s, d := 0, len(dst)
- dst = dst[:cap(dst)]
- // Use assembly when possible
- if !debug && hasAmd64Asm {
- res, sz := cvtLZ4sBlockSnappyAsm(dst[d:], src)
- if res < 0 {
- const (
- errCorrupt = -1
- errDstTooSmall = -2
- )
- switch res {
- case errCorrupt:
- return nil, 0, ErrCorrupt
- case errDstTooSmall:
- return nil, 0, ErrDstTooSmall
- default:
- return nil, 0, fmt.Errorf("unexpected result: %d", res)
- }
- }
- if d+sz > len(dst) {
- return nil, 0, ErrDstTooSmall
- }
- return dst[:d+sz], res, nil
- }
-
- dLimit := len(dst) - 10
- var uncompressed int
- if debug {
- fmt.Printf("convert block start: len(src): %d, len(dst):%d \n", len(src), len(dst))
- }
-
- for {
- if s >= len(src) {
- return nil, 0, ErrCorrupt
- }
- // Read literal info
- token := src[s]
- ll := int(token >> 4)
- ml := int(lz4MinMatch + (token & 0xf))
-
- // If upper nibble is 15, literal length is extended
- if token >= 0xf0 {
- for {
- s++
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ll: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- val := src[s]
- ll += int(val)
- if val != 255 {
- break
- }
- }
- }
- // Skip past token
- if s+ll >= len(src) {
- if debug {
- fmt.Printf("error literals: s+ll (%d+%d) >= len(src) (%d)\n", s, ll, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- s++
- if ll > 0 {
- if d+ll > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- if debug {
- fmt.Printf("emit %d literals\n", ll)
- }
- d += emitLiteralGo(dst[d:], src[s:s+ll])
- s += ll
- uncompressed += ll
- }
-
- // Check if we are done...
- if ml == lz4MinMatch {
- if s == len(src) {
- break
- }
- // 0 bytes.
- continue
- }
- // 2 byte offset
- if s >= len(src)-2 {
- if debug {
- fmt.Printf("s (%d) >= len(src)-2 (%d)", s, len(src)-2)
- }
- return nil, 0, ErrCorrupt
- }
- offset := binary.LittleEndian.Uint16(src[s:])
- s += 2
- if offset == 0 {
- if debug {
- fmt.Printf("error: offset 0, ml: %d, len(src)-s: %d\n", ml, len(src)-s)
- }
- return nil, 0, ErrCorrupt
- }
- if int(offset) > uncompressed {
- if debug {
- fmt.Printf("error: offset (%d)> uncompressed (%d)\n", offset, uncompressed)
- }
- return nil, 0, ErrCorrupt
- }
-
- if ml == lz4MinMatch+15 {
- for {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- val := src[s]
- s++
- ml += int(val)
- if val != 255 {
- if s >= len(src) {
- if debug {
- fmt.Printf("error reading ml: s (%d) >= len(src) (%d)\n", s, len(src))
- }
- return nil, 0, ErrCorrupt
- }
- break
- }
- }
- }
- if debug {
- fmt.Printf("emit copy, length: %d, offset: %d\n", ml, offset)
- }
- length := ml
- // d += emitCopyNoRepeat(dst[d:], int(offset), ml)
- for length > 0 {
- if d >= dLimit {
- return nil, 0, ErrDstTooSmall
- }
-
- // Offset no more than 2 bytes.
- if length > 64 {
- // Emit a length 64 copy, encoded as 3 bytes.
- dst[d+2] = uint8(offset >> 8)
- dst[d+1] = uint8(offset)
- dst[d+0] = 63<<2 | tagCopy2
- length -= 64
- d += 3
- continue
- }
- if length >= 12 || offset >= 2048 || length < 4 {
- // Emit the remaining copy, encoded as 3 bytes.
- dst[d+2] = uint8(offset >> 8)
- dst[d+1] = uint8(offset)
- dst[d+0] = uint8(length-1)<<2 | tagCopy2
- d += 3
- break
- }
- // Emit the remaining copy, encoded as 2 bytes.
- dst[d+1] = uint8(offset)
- dst[d+0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1
- d += 2
- break
- }
- uncompressed += ml
- if d > dLimit {
- return nil, 0, ErrDstTooSmall
- }
- }
-
- return dst[:d], uncompressed, nil
-}
diff --git a/vendor/github.com/klauspost/compress/s2/reader.go b/vendor/github.com/klauspost/compress/s2/reader.go
deleted file mode 100644
index 8372d752f..000000000
--- a/vendor/github.com/klauspost/compress/s2/reader.go
+++ /dev/null
@@ -1,1075 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019+ Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "math"
- "runtime"
- "sync"
-)
-
-// ErrCantSeek is returned if the stream cannot be seeked.
-type ErrCantSeek struct {
- Reason string
-}
-
-// Error returns the error as string.
-func (e ErrCantSeek) Error() string {
- return fmt.Sprintf("s2: Can't seek because %s", e.Reason)
-}
-
-// NewReader returns a new Reader that decompresses from r, using the framing
-// format described at
-// https://github.com/google/snappy/blob/master/framing_format.txt with S2 changes.
-func NewReader(r io.Reader, opts ...ReaderOption) *Reader {
- nr := Reader{
- r: r,
- maxBlock: maxBlockSize,
- }
- for _, opt := range opts {
- if err := opt(&nr); err != nil {
- nr.err = err
- return &nr
- }
- }
- nr.maxBufSize = MaxEncodedLen(nr.maxBlock) + checksumSize
- if nr.lazyBuf > 0 {
- nr.buf = make([]byte, MaxEncodedLen(nr.lazyBuf)+checksumSize)
- } else {
- nr.buf = make([]byte, MaxEncodedLen(defaultBlockSize)+checksumSize)
- }
- nr.readHeader = nr.ignoreStreamID
- nr.paramsOK = true
- return &nr
-}
-
-// ReaderOption is an option for creating a decoder.
-type ReaderOption func(*Reader) error
-
-// ReaderMaxBlockSize allows to control allocations if the stream
-// has been compressed with a smaller WriterBlockSize, or with the default 1MB.
-// Blocks must be this size or smaller to decompress,
-// otherwise the decoder will return ErrUnsupported.
-//
-// For streams compressed with Snappy this can safely be set to 64KB (64 << 10).
-//
-// Default is the maximum limit of 4MB.
-func ReaderMaxBlockSize(blockSize int) ReaderOption {
- return func(r *Reader) error {
- if blockSize > maxBlockSize || blockSize <= 0 {
- return errors.New("s2: block size too large. Must be <= 4MB and > 0")
- }
- if r.lazyBuf == 0 && blockSize < defaultBlockSize {
- r.lazyBuf = blockSize
- }
- r.maxBlock = blockSize
- return nil
- }
-}
-
-// ReaderAllocBlock allows to control upfront stream allocations
-// and not allocate for frames bigger than this initially.
-// If frames bigger than this is seen a bigger buffer will be allocated.
-//
-// Default is 1MB, which is default output size.
-func ReaderAllocBlock(blockSize int) ReaderOption {
- return func(r *Reader) error {
- if blockSize > maxBlockSize || blockSize < 1024 {
- return errors.New("s2: invalid ReaderAllocBlock. Must be <= 4MB and >= 1024")
- }
- r.lazyBuf = blockSize
- return nil
- }
-}
-
-// ReaderIgnoreStreamIdentifier will make the reader skip the expected
-// stream identifier at the beginning of the stream.
-// This can be used when serving a stream that has been forwarded to a specific point.
-func ReaderIgnoreStreamIdentifier() ReaderOption {
- return func(r *Reader) error {
- r.ignoreStreamID = true
- return nil
- }
-}
-
-// ReaderSkippableCB will register a callback for chuncks with the specified ID.
-// ID must be a Reserved skippable chunks ID, 0x80-0xfd (inclusive).
-// For each chunk with the ID, the callback is called with the content.
-// Any returned non-nil error will abort decompression.
-// Only one callback per ID is supported, latest sent will be used.
-// You can peek the stream, triggering the callback, by doing a Read with a 0
-// byte buffer.
-func ReaderSkippableCB(id uint8, fn func(r io.Reader) error) ReaderOption {
- return func(r *Reader) error {
- if id < 0x80 || id > 0xfd {
- return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfd (inclusive)")
- }
- r.skippableCB[id-0x80] = fn
- return nil
- }
-}
-
-// ReaderIgnoreCRC will make the reader skip CRC calculation and checks.
-func ReaderIgnoreCRC() ReaderOption {
- return func(r *Reader) error {
- r.ignoreCRC = true
- return nil
- }
-}
-
-// Reader is an io.Reader that can read Snappy-compressed bytes.
-type Reader struct {
- r io.Reader
- err error
- decoded []byte
- buf []byte
- skippableCB [0xff - 0x80]func(r io.Reader) error
- blockStart int64 // Uncompressed offset at start of current.
- index *Index
-
- // decoded[i:j] contains decoded bytes that have not yet been passed on.
- i, j int
- // maximum block size allowed.
- maxBlock int
- // maximum expected buffer size.
- maxBufSize int
- // alloc a buffer this size if > 0.
- lazyBuf int
- readHeader bool
- paramsOK bool
- snappyFrame bool
- ignoreStreamID bool
- ignoreCRC bool
-}
-
-// GetBufferCapacity returns the capacity of the internal buffer.
-// This might be useful to know when reusing the same reader in combination
-// with the lazy buffer option.
-func (r *Reader) GetBufferCapacity() int {
- return cap(r.buf)
-}
-
-// ensureBufferSize will ensure that the buffer can take at least n bytes.
-// If false is returned the buffer exceeds maximum allowed size.
-func (r *Reader) ensureBufferSize(n int) bool {
- if n > r.maxBufSize {
- r.err = ErrCorrupt
- return false
- }
- if cap(r.buf) >= n {
- return true
- }
- // Realloc buffer.
- r.buf = make([]byte, n)
- return true
-}
-
-// Reset discards any buffered data, resets all state, and switches the Snappy
-// reader to read from r. This permits reusing a Reader rather than allocating
-// a new one.
-func (r *Reader) Reset(reader io.Reader) {
- if !r.paramsOK {
- return
- }
- r.index = nil
- r.r = reader
- r.err = nil
- r.i = 0
- r.j = 0
- r.blockStart = 0
- r.readHeader = r.ignoreStreamID
-}
-
-func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) {
- if _, r.err = io.ReadFull(r.r, p); r.err != nil {
- if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) {
- r.err = ErrCorrupt
- }
- return false
- }
- return true
-}
-
-// skippable will skip n bytes.
-// If the supplied reader supports seeking that is used.
-// tmp is used as a temporary buffer for reading.
-// The supplied slice does not need to be the size of the read.
-func (r *Reader) skippable(tmp []byte, n int, allowEOF bool, id uint8) (ok bool) {
- if id < 0x80 {
- r.err = fmt.Errorf("internal error: skippable id < 0x80")
- return false
- }
- if fn := r.skippableCB[id-0x80]; fn != nil {
- rd := io.LimitReader(r.r, int64(n))
- r.err = fn(rd)
- if r.err != nil {
- return false
- }
- _, r.err = io.CopyBuffer(ioutil.Discard, rd, tmp)
- return r.err == nil
- }
- if rs, ok := r.r.(io.ReadSeeker); ok {
- _, err := rs.Seek(int64(n), io.SeekCurrent)
- if err == nil {
- return true
- }
- if err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) {
- r.err = ErrCorrupt
- return false
- }
- }
- for n > 0 {
- if n < len(tmp) {
- tmp = tmp[:n]
- }
- if _, r.err = io.ReadFull(r.r, tmp); r.err != nil {
- if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) {
- r.err = ErrCorrupt
- }
- return false
- }
- n -= len(tmp)
- }
- return true
-}
-
-// Read satisfies the io.Reader interface.
-func (r *Reader) Read(p []byte) (int, error) {
- if r.err != nil {
- return 0, r.err
- }
- for {
- if r.i < r.j {
- n := copy(p, r.decoded[r.i:r.j])
- r.i += n
- return n, nil
- }
- if !r.readFull(r.buf[:4], true) {
- return 0, r.err
- }
- chunkType := r.buf[0]
- if !r.readHeader {
- if chunkType != chunkTypeStreamIdentifier {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.readHeader = true
- }
- chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16
-
- // The chunk types are specified at
- // https://github.com/google/snappy/blob/master/framing_format.txt
- switch chunkType {
- case chunkTypeCompressedData:
- r.blockStart += int64(r.j)
- // Section 4.2. Compressed data (chunk type 0x00).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if !r.ensureBufferSize(chunkLen) {
- if r.err == nil {
- r.err = ErrUnsupported
- }
- return 0, r.err
- }
- buf := r.buf[:chunkLen]
- if !r.readFull(buf, false) {
- return 0, r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- buf = buf[checksumSize:]
-
- n, err := DecodedLen(buf)
- if err != nil {
- r.err = err
- return 0, r.err
- }
- if r.snappyFrame && n > maxSnappyBlockSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
-
- if n > len(r.decoded) {
- if n > r.maxBlock {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.decoded = make([]byte, n)
- }
- if _, err := Decode(r.decoded, buf); err != nil {
- r.err = err
- return 0, r.err
- }
- if !r.ignoreCRC && crc(r.decoded[:n]) != checksum {
- r.err = ErrCRC
- return 0, r.err
- }
- r.i, r.j = 0, n
- continue
-
- case chunkTypeUncompressedData:
- r.blockStart += int64(r.j)
- // Section 4.3. Uncompressed data (chunk type 0x01).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if !r.ensureBufferSize(chunkLen) {
- if r.err == nil {
- r.err = ErrUnsupported
- }
- return 0, r.err
- }
- buf := r.buf[:checksumSize]
- if !r.readFull(buf, false) {
- return 0, r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- // Read directly into r.decoded instead of via r.buf.
- n := chunkLen - checksumSize
- if r.snappyFrame && n > maxSnappyBlockSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if n > len(r.decoded) {
- if n > r.maxBlock {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.decoded = make([]byte, n)
- }
- if !r.readFull(r.decoded[:n], false) {
- return 0, r.err
- }
- if !r.ignoreCRC && crc(r.decoded[:n]) != checksum {
- r.err = ErrCRC
- return 0, r.err
- }
- r.i, r.j = 0, n
- continue
-
- case chunkTypeStreamIdentifier:
- // Section 4.1. Stream identifier (chunk type 0xff).
- if chunkLen != len(magicBody) {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if !r.readFull(r.buf[:len(magicBody)], false) {
- return 0, r.err
- }
- if string(r.buf[:len(magicBody)]) != magicBody {
- if string(r.buf[:len(magicBody)]) != magicBodySnappy {
- r.err = ErrCorrupt
- return 0, r.err
- } else {
- r.snappyFrame = true
- }
- } else {
- r.snappyFrame = false
- }
- continue
- }
-
- if chunkType <= 0x7f {
- // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f).
- // fmt.Printf("ERR chunktype: 0x%x\n", chunkType)
- r.err = ErrUnsupported
- return 0, r.err
- }
- // Section 4.4 Padding (chunk type 0xfe).
- // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
- if chunkLen > maxChunkSize {
- // fmt.Printf("ERR chunkLen: 0x%x\n", chunkLen)
- r.err = ErrUnsupported
- return 0, r.err
- }
-
- // fmt.Printf("skippable: ID: 0x%x, len: 0x%x\n", chunkType, chunkLen)
- if !r.skippable(r.buf, chunkLen, false, chunkType) {
- return 0, r.err
- }
- }
-}
-
-// DecodeConcurrent will decode the full stream to w.
-// This function should not be combined with reading, seeking or other operations.
-// Up to 'concurrent' goroutines will be used.
-// If <= 0, runtime.NumCPU will be used.
-// On success the number of bytes decompressed nil and is returned.
-// This is mainly intended for bigger streams.
-func (r *Reader) DecodeConcurrent(w io.Writer, concurrent int) (written int64, err error) {
- if r.i > 0 || r.j > 0 || r.blockStart > 0 {
- return 0, errors.New("DecodeConcurrent called after ")
- }
- if concurrent <= 0 {
- concurrent = runtime.NumCPU()
- }
-
- // Write to output
- var errMu sync.Mutex
- var aErr error
- setErr := func(e error) (ok bool) {
- errMu.Lock()
- defer errMu.Unlock()
- if e == nil {
- return aErr == nil
- }
- if aErr == nil {
- aErr = e
- }
- return false
- }
- hasErr := func() (ok bool) {
- errMu.Lock()
- v := aErr != nil
- errMu.Unlock()
- return v
- }
-
- var aWritten int64
- toRead := make(chan []byte, concurrent)
- writtenBlocks := make(chan []byte, concurrent)
- queue := make(chan chan []byte, concurrent)
- reUse := make(chan chan []byte, concurrent)
- for i := 0; i < concurrent; i++ {
- toRead <- make([]byte, 0, r.maxBufSize)
- writtenBlocks <- make([]byte, 0, r.maxBufSize)
- reUse <- make(chan []byte, 1)
- }
- // Writer
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- defer wg.Done()
- for toWrite := range queue {
- entry := <-toWrite
- reUse <- toWrite
- if hasErr() || entry == nil {
- if entry != nil {
- writtenBlocks <- entry
- }
- continue
- }
- if hasErr() {
- writtenBlocks <- entry
- continue
- }
- n, err := w.Write(entry)
- want := len(entry)
- writtenBlocks <- entry
- if err != nil {
- setErr(err)
- continue
- }
- if n != want {
- setErr(io.ErrShortWrite)
- continue
- }
- aWritten += int64(n)
- }
- }()
-
- defer func() {
- if r.err != nil {
- setErr(r.err)
- } else if err != nil {
- setErr(err)
- }
- close(queue)
- wg.Wait()
- if err == nil {
- err = aErr
- }
- written = aWritten
- }()
-
- // Reader
- for !hasErr() {
- if !r.readFull(r.buf[:4], true) {
- if r.err == io.EOF {
- r.err = nil
- }
- return 0, r.err
- }
- chunkType := r.buf[0]
- if !r.readHeader {
- if chunkType != chunkTypeStreamIdentifier {
- r.err = ErrCorrupt
- return 0, r.err
- }
- r.readHeader = true
- }
- chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16
-
- // The chunk types are specified at
- // https://github.com/google/snappy/blob/master/framing_format.txt
- switch chunkType {
- case chunkTypeCompressedData:
- r.blockStart += int64(r.j)
- // Section 4.2. Compressed data (chunk type 0x00).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if chunkLen > r.maxBufSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- orgBuf := <-toRead
- buf := orgBuf[:chunkLen]
-
- if !r.readFull(buf, false) {
- return 0, r.err
- }
-
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- buf = buf[checksumSize:]
-
- n, err := DecodedLen(buf)
- if err != nil {
- r.err = err
- return 0, r.err
- }
- if r.snappyFrame && n > maxSnappyBlockSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
-
- if n > r.maxBlock {
- r.err = ErrCorrupt
- return 0, r.err
- }
- wg.Add(1)
-
- decoded := <-writtenBlocks
- entry := <-reUse
- queue <- entry
- go func() {
- defer wg.Done()
- decoded = decoded[:n]
- _, err := Decode(decoded, buf)
- toRead <- orgBuf
- if err != nil {
- writtenBlocks <- decoded
- setErr(err)
- entry <- nil
- return
- }
- if !r.ignoreCRC && crc(decoded) != checksum {
- writtenBlocks <- decoded
- setErr(ErrCRC)
- entry <- nil
- return
- }
- entry <- decoded
- }()
- continue
-
- case chunkTypeUncompressedData:
-
- // Section 4.3. Uncompressed data (chunk type 0x01).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if chunkLen > r.maxBufSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- // Grab write buffer
- orgBuf := <-writtenBlocks
- buf := orgBuf[:checksumSize]
- if !r.readFull(buf, false) {
- return 0, r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- // Read content.
- n := chunkLen - checksumSize
-
- if r.snappyFrame && n > maxSnappyBlockSize {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if n > r.maxBlock {
- r.err = ErrCorrupt
- return 0, r.err
- }
- // Read uncompressed
- buf = orgBuf[:n]
- if !r.readFull(buf, false) {
- return 0, r.err
- }
-
- if !r.ignoreCRC && crc(buf) != checksum {
- r.err = ErrCRC
- return 0, r.err
- }
- entry := <-reUse
- queue <- entry
- entry <- buf
- continue
-
- case chunkTypeStreamIdentifier:
- // Section 4.1. Stream identifier (chunk type 0xff).
- if chunkLen != len(magicBody) {
- r.err = ErrCorrupt
- return 0, r.err
- }
- if !r.readFull(r.buf[:len(magicBody)], false) {
- return 0, r.err
- }
- if string(r.buf[:len(magicBody)]) != magicBody {
- if string(r.buf[:len(magicBody)]) != magicBodySnappy {
- r.err = ErrCorrupt
- return 0, r.err
- } else {
- r.snappyFrame = true
- }
- } else {
- r.snappyFrame = false
- }
- continue
- }
-
- if chunkType <= 0x7f {
- // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f).
- // fmt.Printf("ERR chunktype: 0x%x\n", chunkType)
- r.err = ErrUnsupported
- return 0, r.err
- }
- // Section 4.4 Padding (chunk type 0xfe).
- // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
- if chunkLen > maxChunkSize {
- // fmt.Printf("ERR chunkLen: 0x%x\n", chunkLen)
- r.err = ErrUnsupported
- return 0, r.err
- }
-
- // fmt.Printf("skippable: ID: 0x%x, len: 0x%x\n", chunkType, chunkLen)
- if !r.skippable(r.buf, chunkLen, false, chunkType) {
- return 0, r.err
- }
- }
- return 0, r.err
-}
-
-// Skip will skip n bytes forward in the decompressed output.
-// For larger skips this consumes less CPU and is faster than reading output and discarding it.
-// CRC is not checked on skipped blocks.
-// io.ErrUnexpectedEOF is returned if the stream ends before all bytes have been skipped.
-// If a decoding error is encountered subsequent calls to Read will also fail.
-func (r *Reader) Skip(n int64) error {
- if n < 0 {
- return errors.New("attempted negative skip")
- }
- if r.err != nil {
- return r.err
- }
-
- for n > 0 {
- if r.i < r.j {
- // Skip in buffer.
- // decoded[i:j] contains decoded bytes that have not yet been passed on.
- left := int64(r.j - r.i)
- if left >= n {
- tmp := int64(r.i) + n
- if tmp > math.MaxInt32 {
- return errors.New("s2: internal overflow in skip")
- }
- r.i = int(tmp)
- return nil
- }
- n -= int64(r.j - r.i)
- r.i = r.j
- }
-
- // Buffer empty; read blocks until we have content.
- if !r.readFull(r.buf[:4], true) {
- if r.err == io.EOF {
- r.err = io.ErrUnexpectedEOF
- }
- return r.err
- }
- chunkType := r.buf[0]
- if !r.readHeader {
- if chunkType != chunkTypeStreamIdentifier {
- r.err = ErrCorrupt
- return r.err
- }
- r.readHeader = true
- }
- chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16
-
- // The chunk types are specified at
- // https://github.com/google/snappy/blob/master/framing_format.txt
- switch chunkType {
- case chunkTypeCompressedData:
- r.blockStart += int64(r.j)
- // Section 4.2. Compressed data (chunk type 0x00).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return r.err
- }
- if !r.ensureBufferSize(chunkLen) {
- if r.err == nil {
- r.err = ErrUnsupported
- }
- return r.err
- }
- buf := r.buf[:chunkLen]
- if !r.readFull(buf, false) {
- return r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- buf = buf[checksumSize:]
-
- dLen, err := DecodedLen(buf)
- if err != nil {
- r.err = err
- return r.err
- }
- if dLen > r.maxBlock {
- r.err = ErrCorrupt
- return r.err
- }
- // Check if destination is within this block
- if int64(dLen) > n {
- if len(r.decoded) < dLen {
- r.decoded = make([]byte, dLen)
- }
- if _, err := Decode(r.decoded, buf); err != nil {
- r.err = err
- return r.err
- }
- if crc(r.decoded[:dLen]) != checksum {
- r.err = ErrCorrupt
- return r.err
- }
- } else {
- // Skip block completely
- n -= int64(dLen)
- r.blockStart += int64(dLen)
- dLen = 0
- }
- r.i, r.j = 0, dLen
- continue
- case chunkTypeUncompressedData:
- r.blockStart += int64(r.j)
- // Section 4.3. Uncompressed data (chunk type 0x01).
- if chunkLen < checksumSize {
- r.err = ErrCorrupt
- return r.err
- }
- if !r.ensureBufferSize(chunkLen) {
- if r.err != nil {
- r.err = ErrUnsupported
- }
- return r.err
- }
- buf := r.buf[:checksumSize]
- if !r.readFull(buf, false) {
- return r.err
- }
- checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24
- // Read directly into r.decoded instead of via r.buf.
- n2 := chunkLen - checksumSize
- if n2 > len(r.decoded) {
- if n2 > r.maxBlock {
- r.err = ErrCorrupt
- return r.err
- }
- r.decoded = make([]byte, n2)
- }
- if !r.readFull(r.decoded[:n2], false) {
- return r.err
- }
- if int64(n2) < n {
- if crc(r.decoded[:n2]) != checksum {
- r.err = ErrCorrupt
- return r.err
- }
- }
- r.i, r.j = 0, n2
- continue
- case chunkTypeStreamIdentifier:
- // Section 4.1. Stream identifier (chunk type 0xff).
- if chunkLen != len(magicBody) {
- r.err = ErrCorrupt
- return r.err
- }
- if !r.readFull(r.buf[:len(magicBody)], false) {
- return r.err
- }
- if string(r.buf[:len(magicBody)]) != magicBody {
- if string(r.buf[:len(magicBody)]) != magicBodySnappy {
- r.err = ErrCorrupt
- return r.err
- }
- }
-
- continue
- }
-
- if chunkType <= 0x7f {
- // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f).
- r.err = ErrUnsupported
- return r.err
- }
- if chunkLen > maxChunkSize {
- r.err = ErrUnsupported
- return r.err
- }
- // Section 4.4 Padding (chunk type 0xfe).
- // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
- if !r.skippable(r.buf, chunkLen, false, chunkType) {
- return r.err
- }
- }
- return nil
-}
-
-// ReadSeeker provides random or forward seeking in compressed content.
-// See Reader.ReadSeeker
-type ReadSeeker struct {
- *Reader
- readAtMu sync.Mutex
-}
-
-// ReadSeeker will return an io.ReadSeeker and io.ReaderAt
-// compatible version of the reader.
-// If 'random' is specified the returned io.Seeker can be used for
-// random seeking, otherwise only forward seeking is supported.
-// Enabling random seeking requires the original input to support
-// the io.Seeker interface.
-// A custom index can be specified which will be used if supplied.
-// When using a custom index, it will not be read from the input stream.
-// The ReadAt position will affect regular reads and the current position of Seek.
-// So using Read after ReadAt will continue from where the ReadAt stopped.
-// No functions should be used concurrently.
-// The returned ReadSeeker contains a shallow reference to the existing Reader,
-// meaning changes performed to one is reflected in the other.
-func (r *Reader) ReadSeeker(random bool, index []byte) (*ReadSeeker, error) {
- // Read index if provided.
- if len(index) != 0 {
- if r.index == nil {
- r.index = &Index{}
- }
- if _, err := r.index.Load(index); err != nil {
- return nil, ErrCantSeek{Reason: "loading index returned: " + err.Error()}
- }
- }
-
- // Check if input is seekable
- rs, ok := r.r.(io.ReadSeeker)
- if !ok {
- if !random {
- return &ReadSeeker{Reader: r}, nil
- }
- return nil, ErrCantSeek{Reason: "input stream isn't seekable"}
- }
-
- if r.index != nil {
- // Seekable and index, ok...
- return &ReadSeeker{Reader: r}, nil
- }
-
- // Load from stream.
- r.index = &Index{}
-
- // Read current position.
- pos, err := rs.Seek(0, io.SeekCurrent)
- if err != nil {
- return nil, ErrCantSeek{Reason: "seeking input returned: " + err.Error()}
- }
- err = r.index.LoadStream(rs)
- if err != nil {
- if err == ErrUnsupported {
- // If we don't require random seeking, reset input and return.
- if !random {
- _, err = rs.Seek(pos, io.SeekStart)
- if err != nil {
- return nil, ErrCantSeek{Reason: "resetting stream returned: " + err.Error()}
- }
- r.index = nil
- return &ReadSeeker{Reader: r}, nil
- }
- return nil, ErrCantSeek{Reason: "input stream does not contain an index"}
- }
- return nil, ErrCantSeek{Reason: "reading index returned: " + err.Error()}
- }
-
- // reset position.
- _, err = rs.Seek(pos, io.SeekStart)
- if err != nil {
- return nil, ErrCantSeek{Reason: "seeking input returned: " + err.Error()}
- }
- return &ReadSeeker{Reader: r}, nil
-}
-
-// Seek allows seeking in compressed data.
-func (r *ReadSeeker) Seek(offset int64, whence int) (int64, error) {
- if r.err != nil {
- if !errors.Is(r.err, io.EOF) {
- return 0, r.err
- }
- // Reset on EOF
- r.err = nil
- }
-
- // Calculate absolute offset.
- absOffset := offset
-
- switch whence {
- case io.SeekStart:
- case io.SeekCurrent:
- absOffset = r.blockStart + int64(r.i) + offset
- case io.SeekEnd:
- if r.index == nil {
- return 0, ErrUnsupported
- }
- absOffset = r.index.TotalUncompressed + offset
- default:
- r.err = ErrUnsupported
- return 0, r.err
- }
-
- if absOffset < 0 {
- return 0, errors.New("seek before start of file")
- }
-
- if !r.readHeader {
- // Make sure we read the header.
- _, r.err = r.Read([]byte{})
- if r.err != nil {
- return 0, r.err
- }
- }
-
- // If we are inside current block no need to seek.
- // This includes no offset changes.
- if absOffset >= r.blockStart && absOffset < r.blockStart+int64(r.j) {
- r.i = int(absOffset - r.blockStart)
- return r.blockStart + int64(r.i), nil
- }
-
- rs, ok := r.r.(io.ReadSeeker)
- if r.index == nil || !ok {
- currOffset := r.blockStart + int64(r.i)
- if absOffset >= currOffset {
- err := r.Skip(absOffset - currOffset)
- return r.blockStart + int64(r.i), err
- }
- return 0, ErrUnsupported
- }
-
- // We can seek and we have an index.
- c, u, err := r.index.Find(absOffset)
- if err != nil {
- return r.blockStart + int64(r.i), err
- }
-
- // Seek to next block
- _, err = rs.Seek(c, io.SeekStart)
- if err != nil {
- return 0, err
- }
-
- r.i = r.j // Remove rest of current block.
- r.blockStart = u - int64(r.j) // Adjust current block start for accounting.
- if u < absOffset {
- // Forward inside block
- return absOffset, r.Skip(absOffset - u)
- }
- if u > absOffset {
- return 0, fmt.Errorf("s2 seek: (internal error) u (%d) > absOffset (%d)", u, absOffset)
- }
- return absOffset, nil
-}
-
-// ReadAt reads len(p) bytes into p starting at offset off in the
-// underlying input source. It returns the number of bytes
-// read (0 <= n <= len(p)) and any error encountered.
-//
-// When ReadAt returns n < len(p), it returns a non-nil error
-// explaining why more bytes were not returned. In this respect,
-// ReadAt is stricter than Read.
-//
-// Even if ReadAt returns n < len(p), it may use all of p as scratch
-// space during the call. If some data is available but not len(p) bytes,
-// ReadAt blocks until either all the data is available or an error occurs.
-// In this respect ReadAt is different from Read.
-//
-// If the n = len(p) bytes returned by ReadAt are at the end of the
-// input source, ReadAt may return either err == EOF or err == nil.
-//
-// If ReadAt is reading from an input source with a seek offset,
-// ReadAt should not affect nor be affected by the underlying
-// seek offset.
-//
-// Clients of ReadAt can execute parallel ReadAt calls on the
-// same input source. This is however not recommended.
-func (r *ReadSeeker) ReadAt(p []byte, offset int64) (int, error) {
- r.readAtMu.Lock()
- defer r.readAtMu.Unlock()
- _, err := r.Seek(offset, io.SeekStart)
- if err != nil {
- return 0, err
- }
- n := 0
- for n < len(p) {
- n2, err := r.Read(p[n:])
- if err != nil {
- // This will include io.EOF
- return n + n2, err
- }
- n += n2
- }
- return n, nil
-}
-
-// ReadByte satisfies the io.ByteReader interface.
-func (r *Reader) ReadByte() (byte, error) {
- if r.err != nil {
- return 0, r.err
- }
- if r.i < r.j {
- c := r.decoded[r.i]
- r.i++
- return c, nil
- }
- var tmp [1]byte
- for i := 0; i < 10; i++ {
- n, err := r.Read(tmp[:])
- if err != nil {
- return 0, err
- }
- if n == 1 {
- return tmp[0], nil
- }
- }
- return 0, io.ErrNoProgress
-}
-
-// SkippableCB will register a callback for chunks with the specified ID.
-// ID must be a Reserved skippable chunks ID, 0x80-0xfd (inclusive).
-// For each chunk with the ID, the callback is called with the content.
-// Any returned non-nil error will abort decompression.
-// Only one callback per ID is supported, latest sent will be used.
-// Sending a nil function will disable previous callbacks.
-// You can peek the stream, triggering the callback, by doing a Read with a 0
-// byte buffer.
-func (r *Reader) SkippableCB(id uint8, fn func(r io.Reader) error) error {
- if id < 0x80 || id >= chunkTypePadding {
- return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfe (inclusive)")
- }
- r.skippableCB[id-0x80] = fn
- return nil
-}
diff --git a/vendor/github.com/klauspost/compress/s2/s2.go b/vendor/github.com/klauspost/compress/s2/s2.go
deleted file mode 100644
index cbd1ed64d..000000000
--- a/vendor/github.com/klauspost/compress/s2/s2.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019 Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package s2 implements the S2 compression format.
-//
-// S2 is an extension of Snappy. Similar to Snappy S2 is aimed for high throughput,
-// which is why it features concurrent compression for bigger payloads.
-//
-// Decoding is compatible with Snappy compressed content,
-// but content compressed with S2 cannot be decompressed by Snappy.
-//
-// For more information on Snappy/S2 differences see README in: https://github.com/klauspost/compress/tree/master/s2
-//
-// There are actually two S2 formats: block and stream. They are related,
-// but different: trying to decompress block-compressed data as a S2 stream
-// will fail, and vice versa. The block format is the Decode and Encode
-// functions and the stream format is the Reader and Writer types.
-//
-// A "better" compression option is available. This will trade some compression
-// speed
-//
-// The block format, the more common case, is used when the complete size (the
-// number of bytes) of the original data is known upfront, at the time
-// compression starts. The stream format, also known as the framing format, is
-// for when that isn't always true.
-//
-// Blocks to not offer much data protection, so it is up to you to
-// add data validation of decompressed blocks.
-//
-// Streams perform CRC validation of the decompressed data.
-// Stream compression will also be performed on multiple CPU cores concurrently
-// significantly improving throughput.
-package s2
-
-import (
- "bytes"
- "hash/crc32"
-
- "github.com/klauspost/compress/internal/race"
-)
-
-/*
-Each encoded block begins with the varint-encoded length of the decoded data,
-followed by a sequence of chunks. Chunks begin and end on byte boundaries. The
-first byte of each chunk is broken into its 2 least and 6 most significant bits
-called l and m: l ranges in [0, 4) and m ranges in [0, 64). l is the chunk tag.
-Zero means a literal tag. All other values mean a copy tag.
-
-For literal tags:
- - If m < 60, the next 1 + m bytes are literal bytes.
- - Otherwise, let n be the little-endian unsigned integer denoted by the next
- m - 59 bytes. The next 1 + n bytes after that are literal bytes.
-
-For copy tags, length bytes are copied from offset bytes ago, in the style of
-Lempel-Ziv compression algorithms. In particular:
- - For l == 1, the offset ranges in [0, 1<<11) and the length in [4, 12).
- The length is 4 + the low 3 bits of m. The high 3 bits of m form bits 8-10
- of the offset. The next byte is bits 0-7 of the offset.
- - For l == 2, the offset ranges in [0, 1<<16) and the length in [1, 65).
- The length is 1 + m. The offset is the little-endian unsigned integer
- denoted by the next 2 bytes.
- - For l == 3, the offset ranges in [0, 1<<32) and the length in
- [1, 65). The length is 1 + m. The offset is the little-endian unsigned
- integer denoted by the next 4 bytes.
-*/
-const (
- tagLiteral = 0x00
- tagCopy1 = 0x01
- tagCopy2 = 0x02
- tagCopy4 = 0x03
-)
-
-const (
- checksumSize = 4
- chunkHeaderSize = 4
- magicChunk = "\xff\x06\x00\x00" + magicBody
- magicChunkSnappy = "\xff\x06\x00\x00" + magicBodySnappy
- magicBodySnappy = "sNaPpY"
- magicBody = "S2sTwO"
-
- // maxBlockSize is the maximum size of the input to encodeBlock.
- //
- // For the framing format (Writer type instead of Encode function),
- // this is the maximum uncompressed size of a block.
- maxBlockSize = 4 << 20
-
- // minBlockSize is the minimum size of block setting when creating a writer.
- minBlockSize = 4 << 10
-
- skippableFrameHeader = 4
- maxChunkSize = 1<<24 - 1 // 16777215
-
- // Default block size
- defaultBlockSize = 1 << 20
-
- // maxSnappyBlockSize is the maximum snappy block size.
- maxSnappyBlockSize = 1 << 16
-
- obufHeaderLen = checksumSize + chunkHeaderSize
-)
-
-const (
- chunkTypeCompressedData = 0x00
- chunkTypeUncompressedData = 0x01
- ChunkTypeIndex = 0x99
- chunkTypePadding = 0xfe
- chunkTypeStreamIdentifier = 0xff
-)
-
-var (
- crcTable = crc32.MakeTable(crc32.Castagnoli)
- magicChunkSnappyBytes = []byte(magicChunkSnappy) // Can be passed to functions where it escapes.
- magicChunkBytes = []byte(magicChunk) // Can be passed to functions where it escapes.
-)
-
-// crc implements the checksum specified in section 3 of
-// https://github.com/google/snappy/blob/master/framing_format.txt
-func crc(b []byte) uint32 {
- race.ReadSlice(b)
-
- c := crc32.Update(0, crcTable, b)
- return c>>15 | c<<17 + 0xa282ead8
-}
-
-// literalExtraSize returns the extra size of encoding n literals.
-// n should be >= 0 and <= math.MaxUint32.
-func literalExtraSize(n int64) int64 {
- if n == 0 {
- return 0
- }
- switch {
- case n < 60:
- return 1
- case n < 1<<8:
- return 2
- case n < 1<<16:
- return 3
- case n < 1<<24:
- return 4
- default:
- return 5
- }
-}
-
-type byter interface {
- Bytes() []byte
-}
-
-var _ byter = &bytes.Buffer{}
diff --git a/vendor/github.com/klauspost/compress/s2/writer.go b/vendor/github.com/klauspost/compress/s2/writer.go
deleted file mode 100644
index fd15078f7..000000000
--- a/vendor/github.com/klauspost/compress/s2/writer.go
+++ /dev/null
@@ -1,1064 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Copyright (c) 2019+ Klaus Post. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2
-
-import (
- "crypto/rand"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "runtime"
- "sync"
-
- "github.com/klauspost/compress/internal/race"
-)
-
-const (
- levelUncompressed = iota + 1
- levelFast
- levelBetter
- levelBest
-)
-
-// NewWriter returns a new Writer that compresses to w, using the
-// framing format described at
-// https://github.com/google/snappy/blob/master/framing_format.txt
-//
-// Users must call Close to guarantee all data has been forwarded to
-// the underlying io.Writer and that resources are released.
-// They may also call Flush zero or more times before calling Close.
-func NewWriter(w io.Writer, opts ...WriterOption) *Writer {
- w2 := Writer{
- blockSize: defaultBlockSize,
- concurrency: runtime.GOMAXPROCS(0),
- randSrc: rand.Reader,
- level: levelFast,
- }
- for _, opt := range opts {
- if err := opt(&w2); err != nil {
- w2.errState = err
- return &w2
- }
- }
- w2.obufLen = obufHeaderLen + MaxEncodedLen(w2.blockSize)
- w2.paramsOK = true
- w2.ibuf = make([]byte, 0, w2.blockSize)
- w2.buffers.New = func() interface{} {
- return make([]byte, w2.obufLen)
- }
- w2.Reset(w)
- return &w2
-}
-
-// Writer is an io.Writer that can write Snappy-compressed bytes.
-type Writer struct {
- errMu sync.Mutex
- errState error
-
- // ibuf is a buffer for the incoming (uncompressed) bytes.
- ibuf []byte
-
- blockSize int
- obufLen int
- concurrency int
- written int64
- uncompWritten int64 // Bytes sent to compression
- output chan chan result
- buffers sync.Pool
- pad int
-
- writer io.Writer
- randSrc io.Reader
- writerWg sync.WaitGroup
- index Index
- customEnc func(dst, src []byte) int
-
- // wroteStreamHeader is whether we have written the stream header.
- wroteStreamHeader bool
- paramsOK bool
- snappy bool
- flushOnWrite bool
- appendIndex bool
- bufferCB func([]byte)
- level uint8
-}
-
-type result struct {
- b []byte
- // return when writing
- ret []byte
- // Uncompressed start offset
- startOffset int64
-}
-
-// err returns the previously set error.
-// If no error has been set it is set to err if not nil.
-func (w *Writer) err(err error) error {
- w.errMu.Lock()
- errSet := w.errState
- if errSet == nil && err != nil {
- w.errState = err
- errSet = err
- }
- w.errMu.Unlock()
- return errSet
-}
-
-// Reset discards the writer's state and switches the Snappy writer to write to w.
-// This permits reusing a Writer rather than allocating a new one.
-func (w *Writer) Reset(writer io.Writer) {
- if !w.paramsOK {
- return
- }
- // Close previous writer, if any.
- if w.output != nil {
- close(w.output)
- w.writerWg.Wait()
- w.output = nil
- }
- w.errState = nil
- w.ibuf = w.ibuf[:0]
- w.wroteStreamHeader = false
- w.written = 0
- w.writer = writer
- w.uncompWritten = 0
- w.index.reset(w.blockSize)
-
- // If we didn't get a writer, stop here.
- if writer == nil {
- return
- }
- // If no concurrency requested, don't spin up writer goroutine.
- if w.concurrency == 1 {
- return
- }
-
- toWrite := make(chan chan result, w.concurrency)
- w.output = toWrite
- w.writerWg.Add(1)
-
- // Start a writer goroutine that will write all output in order.
- go func() {
- defer w.writerWg.Done()
-
- // Get a queued write.
- for write := range toWrite {
- // Wait for the data to be available.
- input := <-write
- if input.ret != nil && w.bufferCB != nil {
- w.bufferCB(input.ret)
- input.ret = nil
- }
- in := input.b
- if len(in) > 0 {
- if w.err(nil) == nil {
- // Don't expose data from previous buffers.
- toWrite := in[:len(in):len(in)]
- // Write to output.
- n, err := writer.Write(toWrite)
- if err == nil && n != len(toWrite) {
- err = io.ErrShortBuffer
- }
- _ = w.err(err)
- w.err(w.index.add(w.written, input.startOffset))
- w.written += int64(n)
- }
- }
- if cap(in) >= w.obufLen {
- w.buffers.Put(in)
- }
- // close the incoming write request.
- // This can be used for synchronizing flushes.
- close(write)
- }
- }()
-}
-
-// Write satisfies the io.Writer interface.
-func (w *Writer) Write(p []byte) (nRet int, errRet error) {
- if err := w.err(nil); err != nil {
- return 0, err
- }
- if w.flushOnWrite {
- return w.write(p)
- }
- // If we exceed the input buffer size, start writing
- for len(p) > (cap(w.ibuf)-len(w.ibuf)) && w.err(nil) == nil {
- var n int
- if len(w.ibuf) == 0 {
- // Large write, empty buffer.
- // Write directly from p to avoid copy.
- n, _ = w.write(p)
- } else {
- n = copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p)
- w.ibuf = w.ibuf[:len(w.ibuf)+n]
- w.write(w.ibuf)
- w.ibuf = w.ibuf[:0]
- }
- nRet += n
- p = p[n:]
- }
- if err := w.err(nil); err != nil {
- return nRet, err
- }
- // p should always be able to fit into w.ibuf now.
- n := copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p)
- w.ibuf = w.ibuf[:len(w.ibuf)+n]
- nRet += n
- return nRet, nil
-}
-
-// ReadFrom implements the io.ReaderFrom interface.
-// Using this is typically more efficient since it avoids a memory copy.
-// ReadFrom reads data from r until EOF or error.
-// The return value n is the number of bytes read.
-// Any error except io.EOF encountered during the read is also returned.
-func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) {
- if err := w.err(nil); err != nil {
- return 0, err
- }
- if len(w.ibuf) > 0 {
- err := w.AsyncFlush()
- if err != nil {
- return 0, err
- }
- }
- if br, ok := r.(byter); ok {
- buf := br.Bytes()
- if err := w.EncodeBuffer(buf); err != nil {
- return 0, err
- }
- return int64(len(buf)), w.AsyncFlush()
- }
- for {
- inbuf := w.buffers.Get().([]byte)[:w.blockSize+obufHeaderLen]
- n2, err := io.ReadFull(r, inbuf[obufHeaderLen:])
- if err != nil {
- if err == io.ErrUnexpectedEOF {
- err = io.EOF
- }
- if err != io.EOF {
- return n, w.err(err)
- }
- }
- if n2 == 0 {
- if cap(inbuf) >= w.obufLen {
- w.buffers.Put(inbuf)
- }
- break
- }
- n += int64(n2)
- err2 := w.writeFull(inbuf[:n2+obufHeaderLen])
- if w.err(err2) != nil {
- break
- }
-
- if err != nil {
- // We got EOF and wrote everything
- break
- }
- }
-
- return n, w.err(nil)
-}
-
-// AddSkippableBlock will add a skippable block to the stream.
-// The ID must be 0x80-0xfe (inclusive).
-// Length of the skippable block must be <= 16777215 bytes.
-func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) {
- if err := w.err(nil); err != nil {
- return err
- }
- if len(data) == 0 {
- return nil
- }
- if id < 0x80 || id > chunkTypePadding {
- return fmt.Errorf("invalid skippable block id %x", id)
- }
- if len(data) > maxChunkSize {
- return fmt.Errorf("skippable block excessed maximum size")
- }
- var header [4]byte
- chunkLen := len(data)
- header[0] = id
- header[1] = uint8(chunkLen >> 0)
- header[2] = uint8(chunkLen >> 8)
- header[3] = uint8(chunkLen >> 16)
- if w.concurrency == 1 {
- write := func(b []byte) error {
- n, err := w.writer.Write(b)
- if err = w.err(err); err != nil {
- return err
- }
- if n != len(b) {
- return w.err(io.ErrShortWrite)
- }
- w.written += int64(n)
- return w.err(nil)
- }
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- if w.snappy {
- if err := write([]byte(magicChunkSnappy)); err != nil {
- return err
- }
- } else {
- if err := write([]byte(magicChunk)); err != nil {
- return err
- }
- }
- }
- if err := write(header[:]); err != nil {
- return err
- }
- return write(data)
- }
-
- // Create output...
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- hWriter := make(chan result)
- w.output <- hWriter
- if w.snappy {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkSnappyBytes}
- } else {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkBytes}
- }
- }
-
- // Copy input.
- inbuf := w.buffers.Get().([]byte)[:4]
- copy(inbuf, header[:])
- inbuf = append(inbuf, data...)
-
- output := make(chan result, 1)
- // Queue output.
- w.output <- output
- output <- result{startOffset: w.uncompWritten, b: inbuf}
-
- return nil
-}
-
-// EncodeBuffer will add a buffer to the stream.
-// This is the fastest way to encode a stream,
-// but the input buffer cannot be written to by the caller
-// until Flush or Close has been called when concurrency != 1.
-//
-// Use the WriterBufferDone to receive a callback when the buffer is done
-// Processing.
-//
-// Note that input is not buffered.
-// This means that each write will result in discrete blocks being created.
-// For buffered writes, use the regular Write function.
-func (w *Writer) EncodeBuffer(buf []byte) (err error) {
- if err := w.err(nil); err != nil {
- return err
- }
-
- if w.flushOnWrite {
- _, err := w.write(buf)
- return err
- }
- // Flush queued data first.
- if len(w.ibuf) > 0 {
- err := w.AsyncFlush()
- if err != nil {
- return err
- }
- }
- if w.concurrency == 1 {
- _, err := w.writeSync(buf)
- if w.bufferCB != nil {
- w.bufferCB(buf)
- }
- return err
- }
-
- // Spawn goroutine and write block to output channel.
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- hWriter := make(chan result)
- w.output <- hWriter
- if w.snappy {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkSnappyBytes}
- } else {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkBytes}
- }
- }
- orgBuf := buf
- for len(buf) > 0 {
- // Cut input.
- uncompressed := buf
- if len(uncompressed) > w.blockSize {
- uncompressed = uncompressed[:w.blockSize]
- }
- buf = buf[len(uncompressed):]
- // Get an output buffer.
- obuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen]
- race.WriteSlice(obuf)
-
- output := make(chan result)
- // Queue output now, so we keep order.
- w.output <- output
- res := result{
- startOffset: w.uncompWritten,
- }
- w.uncompWritten += int64(len(uncompressed))
- if len(buf) == 0 && w.bufferCB != nil {
- res.ret = orgBuf
- }
- go func() {
- race.ReadSlice(uncompressed)
-
- checksum := crc(uncompressed)
-
- // Set to uncompressed.
- chunkType := uint8(chunkTypeUncompressedData)
- chunkLen := 4 + len(uncompressed)
-
- // Attempt compressing.
- n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed)))
- n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed)
-
- // Check if we should use this, or store as uncompressed instead.
- if n2 > 0 {
- chunkType = uint8(chunkTypeCompressedData)
- chunkLen = 4 + n + n2
- obuf = obuf[:obufHeaderLen+n+n2]
- } else {
- // copy uncompressed
- copy(obuf[obufHeaderLen:], uncompressed)
- }
-
- // Fill in the per-chunk header that comes before the body.
- obuf[0] = chunkType
- obuf[1] = uint8(chunkLen >> 0)
- obuf[2] = uint8(chunkLen >> 8)
- obuf[3] = uint8(chunkLen >> 16)
- obuf[4] = uint8(checksum >> 0)
- obuf[5] = uint8(checksum >> 8)
- obuf[6] = uint8(checksum >> 16)
- obuf[7] = uint8(checksum >> 24)
-
- // Queue final output.
- res.b = obuf
- output <- res
- }()
- }
- return nil
-}
-
-func (w *Writer) encodeBlock(obuf, uncompressed []byte) int {
- if w.customEnc != nil {
- if ret := w.customEnc(obuf, uncompressed); ret >= 0 {
- return ret
- }
- }
- if w.snappy {
- switch w.level {
- case levelFast:
- return encodeBlockSnappy(obuf, uncompressed)
- case levelBetter:
- return encodeBlockBetterSnappy(obuf, uncompressed)
- case levelBest:
- return encodeBlockBestSnappy(obuf, uncompressed)
- }
- return 0
- }
- switch w.level {
- case levelFast:
- return encodeBlock(obuf, uncompressed)
- case levelBetter:
- return encodeBlockBetter(obuf, uncompressed)
- case levelBest:
- return encodeBlockBest(obuf, uncompressed, nil)
- }
- return 0
-}
-
-func (w *Writer) write(p []byte) (nRet int, errRet error) {
- if err := w.err(nil); err != nil {
- return 0, err
- }
- if w.concurrency == 1 {
- return w.writeSync(p)
- }
-
- // Spawn goroutine and write block to output channel.
- for len(p) > 0 {
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- hWriter := make(chan result)
- w.output <- hWriter
- if w.snappy {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkSnappyBytes}
- } else {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkBytes}
- }
- }
-
- var uncompressed []byte
- if len(p) > w.blockSize {
- uncompressed, p = p[:w.blockSize], p[w.blockSize:]
- } else {
- uncompressed, p = p, nil
- }
-
- // Copy input.
- // If the block is incompressible, this is used for the result.
- inbuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen]
- obuf := w.buffers.Get().([]byte)[:w.obufLen]
- copy(inbuf[obufHeaderLen:], uncompressed)
- uncompressed = inbuf[obufHeaderLen:]
-
- output := make(chan result)
- // Queue output now, so we keep order.
- w.output <- output
- res := result{
- startOffset: w.uncompWritten,
- }
- w.uncompWritten += int64(len(uncompressed))
-
- go func() {
- checksum := crc(uncompressed)
-
- // Set to uncompressed.
- chunkType := uint8(chunkTypeUncompressedData)
- chunkLen := 4 + len(uncompressed)
-
- // Attempt compressing.
- n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed)))
- n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed)
-
- // Check if we should use this, or store as uncompressed instead.
- if n2 > 0 {
- chunkType = uint8(chunkTypeCompressedData)
- chunkLen = 4 + n + n2
- obuf = obuf[:obufHeaderLen+n+n2]
- } else {
- // Use input as output.
- obuf, inbuf = inbuf, obuf
- }
-
- // Fill in the per-chunk header that comes before the body.
- obuf[0] = chunkType
- obuf[1] = uint8(chunkLen >> 0)
- obuf[2] = uint8(chunkLen >> 8)
- obuf[3] = uint8(chunkLen >> 16)
- obuf[4] = uint8(checksum >> 0)
- obuf[5] = uint8(checksum >> 8)
- obuf[6] = uint8(checksum >> 16)
- obuf[7] = uint8(checksum >> 24)
-
- // Queue final output.
- res.b = obuf
- output <- res
-
- // Put unused buffer back in pool.
- w.buffers.Put(inbuf)
- }()
- nRet += len(uncompressed)
- }
- return nRet, nil
-}
-
-// writeFull is a special version of write that will always write the full buffer.
-// Data to be compressed should start at offset obufHeaderLen and fill the remainder of the buffer.
-// The data will be written as a single block.
-// The caller is not allowed to use inbuf after this function has been called.
-func (w *Writer) writeFull(inbuf []byte) (errRet error) {
- if err := w.err(nil); err != nil {
- return err
- }
-
- if w.concurrency == 1 {
- _, err := w.writeSync(inbuf[obufHeaderLen:])
- if cap(inbuf) >= w.obufLen {
- w.buffers.Put(inbuf)
- }
- return err
- }
-
- // Spawn goroutine and write block to output channel.
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- hWriter := make(chan result)
- w.output <- hWriter
- if w.snappy {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkSnappyBytes}
- } else {
- hWriter <- result{startOffset: w.uncompWritten, b: magicChunkBytes}
- }
- }
-
- // Get an output buffer.
- obuf := w.buffers.Get().([]byte)[:w.obufLen]
- uncompressed := inbuf[obufHeaderLen:]
-
- output := make(chan result)
- // Queue output now, so we keep order.
- w.output <- output
- res := result{
- startOffset: w.uncompWritten,
- }
- w.uncompWritten += int64(len(uncompressed))
-
- go func() {
- checksum := crc(uncompressed)
-
- // Set to uncompressed.
- chunkType := uint8(chunkTypeUncompressedData)
- chunkLen := 4 + len(uncompressed)
-
- // Attempt compressing.
- n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed)))
- n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed)
-
- // Check if we should use this, or store as uncompressed instead.
- if n2 > 0 {
- chunkType = uint8(chunkTypeCompressedData)
- chunkLen = 4 + n + n2
- obuf = obuf[:obufHeaderLen+n+n2]
- } else {
- // Use input as output.
- obuf, inbuf = inbuf, obuf
- }
-
- // Fill in the per-chunk header that comes before the body.
- obuf[0] = chunkType
- obuf[1] = uint8(chunkLen >> 0)
- obuf[2] = uint8(chunkLen >> 8)
- obuf[3] = uint8(chunkLen >> 16)
- obuf[4] = uint8(checksum >> 0)
- obuf[5] = uint8(checksum >> 8)
- obuf[6] = uint8(checksum >> 16)
- obuf[7] = uint8(checksum >> 24)
-
- // Queue final output.
- res.b = obuf
- output <- res
-
- // Put unused buffer back in pool.
- w.buffers.Put(inbuf)
- }()
- return nil
-}
-
-func (w *Writer) writeSync(p []byte) (nRet int, errRet error) {
- if err := w.err(nil); err != nil {
- return 0, err
- }
- if !w.wroteStreamHeader {
- w.wroteStreamHeader = true
- var n int
- var err error
- if w.snappy {
- n, err = w.writer.Write(magicChunkSnappyBytes)
- } else {
- n, err = w.writer.Write(magicChunkBytes)
- }
- if err != nil {
- return 0, w.err(err)
- }
- if n != len(magicChunk) {
- return 0, w.err(io.ErrShortWrite)
- }
- w.written += int64(n)
- }
-
- for len(p) > 0 {
- var uncompressed []byte
- if len(p) > w.blockSize {
- uncompressed, p = p[:w.blockSize], p[w.blockSize:]
- } else {
- uncompressed, p = p, nil
- }
-
- obuf := w.buffers.Get().([]byte)[:w.obufLen]
- checksum := crc(uncompressed)
-
- // Set to uncompressed.
- chunkType := uint8(chunkTypeUncompressedData)
- chunkLen := 4 + len(uncompressed)
-
- // Attempt compressing.
- n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed)))
- n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed)
-
- if n2 > 0 {
- chunkType = uint8(chunkTypeCompressedData)
- chunkLen = 4 + n + n2
- obuf = obuf[:obufHeaderLen+n+n2]
- } else {
- obuf = obuf[:8]
- }
-
- // Fill in the per-chunk header that comes before the body.
- obuf[0] = chunkType
- obuf[1] = uint8(chunkLen >> 0)
- obuf[2] = uint8(chunkLen >> 8)
- obuf[3] = uint8(chunkLen >> 16)
- obuf[4] = uint8(checksum >> 0)
- obuf[5] = uint8(checksum >> 8)
- obuf[6] = uint8(checksum >> 16)
- obuf[7] = uint8(checksum >> 24)
-
- n, err := w.writer.Write(obuf)
- if err != nil {
- return 0, w.err(err)
- }
- if n != len(obuf) {
- return 0, w.err(io.ErrShortWrite)
- }
- w.err(w.index.add(w.written, w.uncompWritten))
- w.written += int64(n)
- w.uncompWritten += int64(len(uncompressed))
-
- if chunkType == chunkTypeUncompressedData {
- // Write uncompressed data.
- n, err := w.writer.Write(uncompressed)
- if err != nil {
- return 0, w.err(err)
- }
- if n != len(uncompressed) {
- return 0, w.err(io.ErrShortWrite)
- }
- w.written += int64(n)
- }
- w.buffers.Put(obuf)
- // Queue final output.
- nRet += len(uncompressed)
- }
- return nRet, nil
-}
-
-// AsyncFlush writes any buffered bytes to a block and starts compressing it.
-// It does not wait for the output has been written as Flush() does.
-func (w *Writer) AsyncFlush() error {
- if err := w.err(nil); err != nil {
- return err
- }
-
- // Queue any data still in input buffer.
- if len(w.ibuf) != 0 {
- if !w.wroteStreamHeader {
- _, err := w.writeSync(w.ibuf)
- w.ibuf = w.ibuf[:0]
- return w.err(err)
- } else {
- _, err := w.write(w.ibuf)
- w.ibuf = w.ibuf[:0]
- err = w.err(err)
- if err != nil {
- return err
- }
- }
- }
- return w.err(nil)
-}
-
-// Flush flushes the Writer to its underlying io.Writer.
-// This does not apply padding.
-func (w *Writer) Flush() error {
- if err := w.AsyncFlush(); err != nil {
- return err
- }
- if w.output == nil {
- return w.err(nil)
- }
-
- // Send empty buffer
- res := make(chan result)
- w.output <- res
- // Block until this has been picked up.
- res <- result{b: nil, startOffset: w.uncompWritten}
- // When it is closed, we have flushed.
- <-res
- return w.err(nil)
-}
-
-// Close calls Flush and then closes the Writer.
-// Calling Close multiple times is ok,
-// but calling CloseIndex after this will make it not return the index.
-func (w *Writer) Close() error {
- _, err := w.closeIndex(w.appendIndex)
- return err
-}
-
-// CloseIndex calls Close and returns an index on first call.
-// This is not required if you are only adding index to a stream.
-func (w *Writer) CloseIndex() ([]byte, error) {
- return w.closeIndex(true)
-}
-
-func (w *Writer) closeIndex(idx bool) ([]byte, error) {
- err := w.Flush()
- if w.output != nil {
- close(w.output)
- w.writerWg.Wait()
- w.output = nil
- }
-
- var index []byte
- if w.err(err) == nil && w.writer != nil {
- // Create index.
- if idx {
- compSize := int64(-1)
- if w.pad <= 1 {
- compSize = w.written
- }
- index = w.index.appendTo(w.ibuf[:0], w.uncompWritten, compSize)
- // Count as written for padding.
- if w.appendIndex {
- w.written += int64(len(index))
- }
- }
-
- if w.pad > 1 {
- tmp := w.ibuf[:0]
- if len(index) > 0 {
- // Allocate another buffer.
- tmp = w.buffers.Get().([]byte)[:0]
- defer w.buffers.Put(tmp)
- }
- add := calcSkippableFrame(w.written, int64(w.pad))
- frame, err := skippableFrame(tmp, add, w.randSrc)
- if err = w.err(err); err != nil {
- return nil, err
- }
- n, err2 := w.writer.Write(frame)
- if err2 == nil && n != len(frame) {
- err2 = io.ErrShortWrite
- }
- _ = w.err(err2)
- }
- if len(index) > 0 && w.appendIndex {
- n, err2 := w.writer.Write(index)
- if err2 == nil && n != len(index) {
- err2 = io.ErrShortWrite
- }
- _ = w.err(err2)
- }
- }
- err = w.err(errClosed)
- if err == errClosed {
- return index, nil
- }
- return nil, err
-}
-
-// calcSkippableFrame will return a total size to be added for written
-// to be divisible by multiple.
-// The value will always be > skippableFrameHeader.
-// The function will panic if written < 0 or wantMultiple <= 0.
-func calcSkippableFrame(written, wantMultiple int64) int {
- if wantMultiple <= 0 {
- panic("wantMultiple <= 0")
- }
- if written < 0 {
- panic("written < 0")
- }
- leftOver := written % wantMultiple
- if leftOver == 0 {
- return 0
- }
- toAdd := wantMultiple - leftOver
- for toAdd < skippableFrameHeader {
- toAdd += wantMultiple
- }
- return int(toAdd)
-}
-
-// skippableFrame will add a skippable frame with a total size of bytes.
-// total should be >= skippableFrameHeader and < maxBlockSize + skippableFrameHeader
-func skippableFrame(dst []byte, total int, r io.Reader) ([]byte, error) {
- if total == 0 {
- return dst, nil
- }
- if total < skippableFrameHeader {
- return dst, fmt.Errorf("s2: requested skippable frame (%d) < 4", total)
- }
- if int64(total) >= maxBlockSize+skippableFrameHeader {
- return dst, fmt.Errorf("s2: requested skippable frame (%d) >= max 1<<24", total)
- }
- // Chunk type 0xfe "Section 4.4 Padding (chunk type 0xfe)"
- dst = append(dst, chunkTypePadding)
- f := uint32(total - skippableFrameHeader)
- // Add chunk length.
- dst = append(dst, uint8(f), uint8(f>>8), uint8(f>>16))
- // Add data
- start := len(dst)
- dst = append(dst, make([]byte, f)...)
- _, err := io.ReadFull(r, dst[start:])
- return dst, err
-}
-
-var errClosed = errors.New("s2: Writer is closed")
-
-// WriterOption is an option for creating a encoder.
-type WriterOption func(*Writer) error
-
-// WriterConcurrency will set the concurrency,
-// meaning the maximum number of decoders to run concurrently.
-// The value supplied must be at least 1.
-// By default this will be set to GOMAXPROCS.
-func WriterConcurrency(n int) WriterOption {
- return func(w *Writer) error {
- if n <= 0 {
- return errors.New("concurrency must be at least 1")
- }
- w.concurrency = n
- return nil
- }
-}
-
-// WriterAddIndex will append an index to the end of a stream
-// when it is closed.
-func WriterAddIndex() WriterOption {
- return func(w *Writer) error {
- w.appendIndex = true
- return nil
- }
-}
-
-// WriterBetterCompression will enable better compression.
-// EncodeBetter compresses better than Encode but typically with a
-// 10-40% speed decrease on both compression and decompression.
-func WriterBetterCompression() WriterOption {
- return func(w *Writer) error {
- w.level = levelBetter
- return nil
- }
-}
-
-// WriterBestCompression will enable better compression.
-// EncodeBest compresses better than Encode but typically with a
-// big speed decrease on compression.
-func WriterBestCompression() WriterOption {
- return func(w *Writer) error {
- w.level = levelBest
- return nil
- }
-}
-
-// WriterUncompressed will bypass compression.
-// The stream will be written as uncompressed blocks only.
-// If concurrency is > 1 CRC and output will still be done async.
-func WriterUncompressed() WriterOption {
- return func(w *Writer) error {
- w.level = levelUncompressed
- return nil
- }
-}
-
-// WriterBufferDone will perform a callback when EncodeBuffer has finished
-// writing a buffer to the output and the buffer can safely be reused.
-// If the buffer was split into several blocks, it will be sent after the last block.
-// Callbacks will not be done concurrently.
-func WriterBufferDone(fn func(b []byte)) WriterOption {
- return func(w *Writer) error {
- w.bufferCB = fn
- return nil
- }
-}
-
-// WriterBlockSize allows to override the default block size.
-// Blocks will be this size or smaller.
-// Minimum size is 4KB and maximum size is 4MB.
-//
-// Bigger blocks may give bigger throughput on systems with many cores,
-// and will increase compression slightly, but it will limit the possible
-// concurrency for smaller payloads for both encoding and decoding.
-// Default block size is 1MB.
-//
-// When writing Snappy compatible output using WriterSnappyCompat,
-// the maximum block size is 64KB.
-func WriterBlockSize(n int) WriterOption {
- return func(w *Writer) error {
- if w.snappy && n > maxSnappyBlockSize || n < minBlockSize {
- return errors.New("s2: block size too large. Must be <= 64K and >=4KB on for snappy compatible output")
- }
- if n > maxBlockSize || n < minBlockSize {
- return errors.New("s2: block size too large. Must be <= 4MB and >=4KB")
- }
- w.blockSize = n
- return nil
- }
-}
-
-// WriterPadding will add padding to all output so the size will be a multiple of n.
-// This can be used to obfuscate the exact output size or make blocks of a certain size.
-// The contents will be a skippable frame, so it will be invisible by the decoder.
-// n must be > 0 and <= 4MB.
-// The padded area will be filled with data from crypto/rand.Reader.
-// The padding will be applied whenever Close is called on the writer.
-func WriterPadding(n int) WriterOption {
- return func(w *Writer) error {
- if n <= 0 {
- return fmt.Errorf("s2: padding must be at least 1")
- }
- // No need to waste our time.
- if n == 1 {
- w.pad = 0
- }
- if n > maxBlockSize {
- return fmt.Errorf("s2: padding must less than 4MB")
- }
- w.pad = n
- return nil
- }
-}
-
-// WriterPaddingSrc will get random data for padding from the supplied source.
-// By default crypto/rand is used.
-func WriterPaddingSrc(reader io.Reader) WriterOption {
- return func(w *Writer) error {
- w.randSrc = reader
- return nil
- }
-}
-
-// WriterSnappyCompat will write snappy compatible output.
-// The output can be decompressed using either snappy or s2.
-// If block size is more than 64KB it is set to that.
-func WriterSnappyCompat() WriterOption {
- return func(w *Writer) error {
- w.snappy = true
- if w.blockSize > 64<<10 {
- // We choose 8 bytes less than 64K, since that will make literal emits slightly more effective.
- // And allows us to skip some size checks.
- w.blockSize = (64 << 10) - 8
- }
- return nil
- }
-}
-
-// WriterFlushOnWrite will compress blocks on each call to the Write function.
-//
-// This is quite inefficient as blocks size will depend on the write size.
-//
-// Use WriterConcurrency(1) to also make sure that output is flushed.
-// When Write calls return, otherwise they will be written when compression is done.
-func WriterFlushOnWrite() WriterOption {
- return func(w *Writer) error {
- w.flushOnWrite = true
- return nil
- }
-}
-
-// WriterCustomEncoder allows to override the encoder for blocks on the stream.
-// The function must compress 'src' into 'dst' and return the bytes used in dst as an integer.
-// Block size (initial varint) should not be added by the encoder.
-// Returning value 0 indicates the block could not be compressed.
-// Returning a negative value indicates that compression should be attempted.
-// The function should expect to be called concurrently.
-func WriterCustomEncoder(fn func(dst, src []byte) int) WriterOption {
- return func(w *Writer) error {
- w.customEnc = fn
- return nil
- }
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/.gitignore b/vendor/github.com/klauspost/cpuid/v2/.gitignore
deleted file mode 100644
index daf913b1b..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml b/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml
deleted file mode 100644
index 1b695b62c..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-version: 2
-
-builds:
- -
- id: "cpuid"
- binary: cpuid
- main: ./cmd/cpuid/main.go
- env:
- - CGO_ENABLED=0
- flags:
- - -ldflags=-s -w
- goos:
- - aix
- - linux
- - freebsd
- - netbsd
- - windows
- - darwin
- goarch:
- - 386
- - amd64
- - arm64
- goarm:
- - 7
-
-archives:
- -
- id: cpuid
- name_template: "cpuid-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
- format_overrides:
- - goos: windows
- format: zip
- files:
- - LICENSE
-checksum:
- name_template: 'checksums.txt'
-changelog:
- sort: asc
- filters:
- exclude:
- - '^doc:'
- - '^docs:'
- - '^test:'
- - '^tests:'
- - '^Update\sREADME.md'
-
-nfpms:
- -
- file_name_template: "cpuid_package_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
- vendor: Klaus Post
- homepage: https://github.com/klauspost/cpuid
- maintainer: Klaus Post <klauspost@gmail.com>
- description: CPUID Tool
- license: BSD 3-Clause
- formats:
- - deb
- - rpm
diff --git a/vendor/github.com/klauspost/cpuid/v2/CONTRIBUTING.txt b/vendor/github.com/klauspost/cpuid/v2/CONTRIBUTING.txt
deleted file mode 100644
index 2ef4714f7..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/CONTRIBUTING.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-Developer Certificate of Origin
-Version 1.1
-
-Copyright (C) 2015- Klaus Post & Contributors.
-Email: klauspost@gmail.com
-
-Everyone is permitted to copy and distribute verbatim copies of this
-license document, but changing it is not allowed.
-
-
-Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-(a) The contribution was created in whole or in part by me and I
- have the right to submit it under the open source license
- indicated in the file; or
-
-(b) The contribution is based upon previous work that, to the best
- of my knowledge, is covered under an appropriate open source
- license and I have the right under that license to submit that
- work with modifications, whether created in whole or in part
- by me, under the same open source license (unless I am
- permitted to submit under a different license), as indicated
- in the file; or
-
-(c) The contribution was provided directly to me by some other
- person who certified (a), (b) or (c) and I have not modified
- it.
-
-(d) I understand and agree that this project and the contribution
- are public and that a record of the contribution (including all
- personal information I submit with it, including my sign-off) is
- maintained indefinitely and may be redistributed consistent with
- this project or the open source license(s) involved.
diff --git a/vendor/github.com/klauspost/cpuid/v2/LICENSE b/vendor/github.com/klauspost/cpuid/v2/LICENSE
deleted file mode 100644
index 5cec7ee94..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Klaus Post
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/vendor/github.com/klauspost/cpuid/v2/README.md b/vendor/github.com/klauspost/cpuid/v2/README.md
deleted file mode 100644
index 88d68d528..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/README.md
+++ /dev/null
@@ -1,512 +0,0 @@
-# cpuid
-Package cpuid provides information about the CPU running the current program.
-
-CPU features are detected on startup, and kept for fast access through the life of the application.
-Currently x86 / x64 (AMD64/i386) and ARM (ARM64) is supported, and no external C (cgo) code is used, which should make the library very easy to use.
-
-You can access the CPU information by accessing the shared CPU variable of the cpuid library.
-
-Package home: https://github.com/klauspost/cpuid
-
-[![PkgGoDev](https://pkg.go.dev/badge/github.com/klauspost/cpuid)](https://pkg.go.dev/github.com/klauspost/cpuid/v2)
-[![Go](https://github.com/klauspost/cpuid/actions/workflows/go.yml/badge.svg)](https://github.com/klauspost/cpuid/actions/workflows/go.yml)
-
-## installing
-
-`go get -u github.com/klauspost/cpuid/v2` using modules.
-Drop `v2` for others.
-
-Installing binary:
-
-`go install github.com/klauspost/cpuid/v2/cmd/cpuid@latest`
-
-Or download binaries from release page: https://github.com/klauspost/cpuid/releases
-
-### Homebrew
-
-For macOS/Linux users, you can install via [brew](https://brew.sh/)
-
-```sh
-$ brew install cpuid
-```
-
-## example
-
-```Go
-package main
-
-import (
- "fmt"
- "strings"
-
- . "github.com/klauspost/cpuid/v2"
-)
-
-func main() {
- // Print basic CPU information:
- fmt.Println("Name:", CPU.BrandName)
- fmt.Println("PhysicalCores:", CPU.PhysicalCores)
- fmt.Println("ThreadsPerCore:", CPU.ThreadsPerCore)
- fmt.Println("LogicalCores:", CPU.LogicalCores)
- fmt.Println("Family", CPU.Family, "Model:", CPU.Model, "Vendor ID:", CPU.VendorID)
- fmt.Println("Features:", strings.Join(CPU.FeatureSet(), ","))
- fmt.Println("Cacheline bytes:", CPU.CacheLine)
- fmt.Println("L1 Data Cache:", CPU.Cache.L1D, "bytes")
- fmt.Println("L1 Instruction Cache:", CPU.Cache.L1I, "bytes")
- fmt.Println("L2 Cache:", CPU.Cache.L2, "bytes")
- fmt.Println("L3 Cache:", CPU.Cache.L3, "bytes")
- fmt.Println("Frequency", CPU.Hz, "hz")
-
- // Test if we have these specific features:
- if CPU.Supports(SSE, SSE2) {
- fmt.Println("We have Streaming SIMD 2 Extensions")
- }
-}
-```
-
-Sample output:
-```
->go run main.go
-Name: AMD Ryzen 9 3950X 16-Core Processor
-PhysicalCores: 16
-ThreadsPerCore: 2
-LogicalCores: 32
-Family 23 Model: 113 Vendor ID: AMD
-Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CLMUL,CMOV,CX16,F16C,FMA3,HTT,HYPERVISOR,LZCNT,MMX,MMXEXT,NX,POPCNT,RDRAND,RDSEED,RDTSCP,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSE4A,SSSE3
-Cacheline bytes: 64
-L1 Data Cache: 32768 bytes
-L1 Instruction Cache: 32768 bytes
-L2 Cache: 524288 bytes
-L3 Cache: 16777216 bytes
-Frequency 0 hz
-We have Streaming SIMD 2 Extensions
-```
-
-# usage
-
-The `cpuid.CPU` provides access to CPU features. Use `cpuid.CPU.Supports()` to check for CPU features.
-A faster `cpuid.CPU.Has()` is provided which will usually be inlined by the gc compiler.
-
-To test a larger number of features, they can be combined using `f := CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SYSCALL, SSE, SSE2)`, etc.
-This can be using with `cpuid.CPU.HasAll(f)` to quickly test if all features are supported.
-
-Note that for some cpu/os combinations some features will not be detected.
-`amd64` has rather good support and should work reliably on all platforms.
-
-Note that hypervisors may not pass through all CPU features through to the guest OS,
-so even if your host supports a feature it may not be visible on guests.
-
-## arm64 feature detection
-
-Not all operating systems provide ARM features directly
-and there is no safe way to do so for the rest.
-
-Currently `arm64/linux` and `arm64/freebsd` should be quite reliable.
-`arm64/darwin` adds features expected from the M1 processor, but a lot remains undetected.
-
-A `DetectARM()` can be used if you are able to control your deployment,
-it will detect CPU features, but may crash if the OS doesn't intercept the calls.
-A `-cpu.arm` flag for detecting unsafe ARM features can be added. See below.
-
-Note that currently only features are detected on ARM,
-no additional information is currently available.
-
-## flags
-
-It is possible to add flags that affects cpu detection.
-
-For this the `Flags()` command is provided.
-
-This must be called *before* `flag.Parse()` AND after the flags have been parsed `Detect()` must be called.
-
-This means that any detection used in `init()` functions will not contain these flags.
-
-Example:
-
-```Go
-package main
-
-import (
- "flag"
- "fmt"
- "strings"
-
- "github.com/klauspost/cpuid/v2"
-)
-
-func main() {
- cpuid.Flags()
- flag.Parse()
- cpuid.Detect()
-
- // Test if we have these specific features:
- if cpuid.CPU.Supports(cpuid.SSE, cpuid.SSE2) {
- fmt.Println("We have Streaming SIMD 2 Extensions")
- }
-}
-```
-
-## commandline
-
-Download as binary from: https://github.com/klauspost/cpuid/releases
-
-Install from source:
-
-`go install github.com/klauspost/cpuid/v2/cmd/cpuid@latest`
-
-### Example
-
-```
-λ cpuid
-Name: AMD Ryzen 9 3950X 16-Core Processor
-Vendor String: AuthenticAMD
-Vendor ID: AMD
-PhysicalCores: 16
-Threads Per Core: 2
-Logical Cores: 32
-CPU Family 23 Model: 113
-Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CLMUL,CLZERO,CMOV,CMPXCHG8,CPBOOST,CX16,F16C,FMA3,FXSR,FXSROPT,HTT,HYPERVISOR,LAHF,LZCNT,MCAOVERFLOW,MMX,MMXEXT,MOVBE,NX,OSXSAVE,POPCNT,RDRAND,RDSEED,RDTSCP,SCE,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSE4A,SSSE3,SUCCOR,X87,XSAVE
-Microarchitecture level: 3
-Cacheline bytes: 64
-L1 Instruction Cache: 32768 bytes
-L1 Data Cache: 32768 bytes
-L2 Cache: 524288 bytes
-L3 Cache: 16777216 bytes
-
-```
-### JSON Output:
-
-```
-λ cpuid --json
-{
- "BrandName": "AMD Ryzen 9 3950X 16-Core Processor",
- "VendorID": 2,
- "VendorString": "AuthenticAMD",
- "PhysicalCores": 16,
- "ThreadsPerCore": 2,
- "LogicalCores": 32,
- "Family": 23,
- "Model": 113,
- "CacheLine": 64,
- "Hz": 0,
- "BoostFreq": 0,
- "Cache": {
- "L1I": 32768,
- "L1D": 32768,
- "L2": 524288,
- "L3": 16777216
- },
- "SGX": {
- "Available": false,
- "LaunchControl": false,
- "SGX1Supported": false,
- "SGX2Supported": false,
- "MaxEnclaveSizeNot64": 0,
- "MaxEnclaveSize64": 0,
- "EPCSections": null
- },
- "Features": [
- "ADX",
- "AESNI",
- "AVX",
- "AVX2",
- "BMI1",
- "BMI2",
- "CLMUL",
- "CLZERO",
- "CMOV",
- "CMPXCHG8",
- "CPBOOST",
- "CX16",
- "F16C",
- "FMA3",
- "FXSR",
- "FXSROPT",
- "HTT",
- "HYPERVISOR",
- "LAHF",
- "LZCNT",
- "MCAOVERFLOW",
- "MMX",
- "MMXEXT",
- "MOVBE",
- "NX",
- "OSXSAVE",
- "POPCNT",
- "RDRAND",
- "RDSEED",
- "RDTSCP",
- "SCE",
- "SHA",
- "SSE",
- "SSE2",
- "SSE3",
- "SSE4",
- "SSE42",
- "SSE4A",
- "SSSE3",
- "SUCCOR",
- "X87",
- "XSAVE"
- ],
- "X64Level": 3
-}
-```
-
-### Check CPU microarch level
-
-```
-λ cpuid --check-level=3
-2022/03/18 17:04:40 AMD Ryzen 9 3950X 16-Core Processor
-2022/03/18 17:04:40 Microarchitecture level 3 is supported. Max level is 3.
-Exit Code 0
-
-λ cpuid --check-level=4
-2022/03/18 17:06:18 AMD Ryzen 9 3950X 16-Core Processor
-2022/03/18 17:06:18 Microarchitecture level 4 not supported. Max level is 3.
-Exit Code 1
-```
-
-
-## Available flags
-
-### x86 & amd64
-
-| Feature Flag | Description |
-|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| ADX | Intel ADX (Multi-Precision Add-Carry Instruction Extensions) |
-| AESNI | Advanced Encryption Standard New Instructions |
-| AMD3DNOW | AMD 3DNOW |
-| AMD3DNOWEXT | AMD 3DNowExt |
-| AMXBF16 | Tile computational operations on BFLOAT16 numbers |
-| AMXINT8 | Tile computational operations on 8-bit integers |
-| AMXFP16 | Tile computational operations on FP16 numbers |
-| AMXFP8 | Tile computational operations on FP8 numbers |
-| AMXCOMPLEX | Tile computational operations on complex numbers |
-| AMXTILE | Tile architecture |
-| AMXTF32 | Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile |
-| AMXTRANSPOSE | Tile multiply where the first operand is transposed |
-| APX_F | Intel APX |
-| AVX | AVX functions |
-| AVX10 | If set the Intel AVX10 Converged Vector ISA is supported |
-| AVX10_128 | If set indicates that AVX10 128-bit vector support is present |
-| AVX10_256 | If set indicates that AVX10 256-bit vector support is present |
-| AVX10_512 | If set indicates that AVX10 512-bit vector support is present |
-| AVX2 | AVX2 functions |
-| AVX512BF16 | AVX-512 BFLOAT16 Instructions |
-| AVX512BITALG | AVX-512 Bit Algorithms |
-| AVX512BW | AVX-512 Byte and Word Instructions |
-| AVX512CD | AVX-512 Conflict Detection Instructions |
-| AVX512DQ | AVX-512 Doubleword and Quadword Instructions |
-| AVX512ER | AVX-512 Exponential and Reciprocal Instructions |
-| AVX512F | AVX-512 Foundation |
-| AVX512FP16 | AVX-512 FP16 Instructions |
-| AVX512IFMA | AVX-512 Integer Fused Multiply-Add Instructions |
-| AVX512PF | AVX-512 Prefetch Instructions |
-| AVX512VBMI | AVX-512 Vector Bit Manipulation Instructions |
-| AVX512VBMI2 | AVX-512 Vector Bit Manipulation Instructions, Version 2 |
-| AVX512VL | AVX-512 Vector Length Extensions |
-| AVX512VNNI | AVX-512 Vector Neural Network Instructions |
-| AVX512VP2INTERSECT | AVX-512 Intersect for D/Q |
-| AVX512VPOPCNTDQ | AVX-512 Vector Population Count Doubleword and Quadword |
-| AVXIFMA | AVX-IFMA instructions |
-| AVXNECONVERT | AVX-NE-CONVERT instructions |
-| AVXSLOW | Indicates the CPU performs 2 128 bit operations instead of one |
-| AVXVNNI | AVX (VEX encoded) VNNI neural network instructions |
-| AVXVNNIINT8 | AVX-VNNI-INT8 instructions |
-| AVXVNNIINT16 | AVX-VNNI-INT16 instructions |
-| BHI_CTRL | Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598 |
-| BMI1 | Bit Manipulation Instruction Set 1 |
-| BMI2 | Bit Manipulation Instruction Set 2 |
-| CETIBT | Intel CET Indirect Branch Tracking |
-| CETSS | Intel CET Shadow Stack |
-| CLDEMOTE | Cache Line Demote |
-| CLMUL | Carry-less Multiplication |
-| CLZERO | CLZERO instruction supported |
-| CMOV | i686 CMOV |
-| CMPCCXADD | CMPCCXADD instructions |
-| CMPSB_SCADBS_SHORT | Fast short CMPSB and SCASB |
-| CMPXCHG8 | CMPXCHG8 instruction |
-| CPBOOST | Core Performance Boost |
-| CPPC | AMD: Collaborative Processor Performance Control |
-| CX16 | CMPXCHG16B Instruction |
-| EFER_LMSLE_UNS | AMD: =Core::X86::Msr::EFER[LMSLE] is not supported, and MBZ |
-| ENQCMD | Enqueue Command |
-| ERMS | Enhanced REP MOVSB/STOSB |
-| F16C | Half-precision floating-point conversion |
-| FLUSH_L1D | Flush L1D cache |
-| FMA3 | Intel FMA 3. Does not imply AVX. |
-| FMA4 | Bulldozer FMA4 functions |
-| FP128 | AMD: When set, the internal FP/SIMD execution datapath is 128-bits wide |
-| FP256 | AMD: When set, the internal FP/SIMD execution datapath is 256-bits wide |
-| FSRM | Fast Short Rep Mov |
-| FXSR | FXSAVE, FXRESTOR instructions, CR4 bit 9 |
-| FXSROPT | FXSAVE/FXRSTOR optimizations |
-| GFNI | Galois Field New Instructions. May require other features (AVX, AVX512VL,AVX512F) based on usage. |
-| HLE | Hardware Lock Elision |
-| HRESET | If set CPU supports history reset and the IA32_HRESET_ENABLE MSR |
-| HTT | Hyperthreading (enabled) |
-| HWA | Hardware assert supported. Indicates support for MSRC001_10 |
-| HYBRID_CPU | This part has CPUs of more than one type. |
-| HYPERVISOR | This bit has been reserved by Intel & AMD for use by hypervisors |
-| IA32_ARCH_CAP | IA32_ARCH_CAPABILITIES MSR (Intel) |
-| IA32_CORE_CAP | IA32_CORE_CAPABILITIES MSR |
-| IBPB | Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB) |
-| IBRS | AMD: Indirect Branch Restricted Speculation |
-| IBRS_PREFERRED | AMD: IBRS is preferred over software solution |
-| IBRS_PROVIDES_SMP | AMD: IBRS provides Same Mode Protection |
-| IBS | Instruction Based Sampling (AMD) |
-| IBSBRNTRGT | Instruction Based Sampling Feature (AMD) |
-| IBSFETCHSAM | Instruction Based Sampling Feature (AMD) |
-| IBSFFV | Instruction Based Sampling Feature (AMD) |
-| IBSOPCNT | Instruction Based Sampling Feature (AMD) |
-| IBSOPCNTEXT | Instruction Based Sampling Feature (AMD) |
-| IBSOPSAM | Instruction Based Sampling Feature (AMD) |
-| IBSRDWROPCNT | Instruction Based Sampling Feature (AMD) |
-| IBSRIPINVALIDCHK | Instruction Based Sampling Feature (AMD) |
-| IBS_FETCH_CTLX | AMD: IBS fetch control extended MSR supported |
-| IBS_OPDATA4 | AMD: IBS op data 4 MSR supported |
-| IBS_OPFUSE | AMD: Indicates support for IbsOpFuse |
-| IBS_PREVENTHOST | Disallowing IBS use by the host supported |
-| IBS_ZEN4 | Fetch and Op IBS support IBS extensions added with Zen4 |
-| IDPRED_CTRL | IPRED_DIS |
-| INT_WBINVD | WBINVD/WBNOINVD are interruptible. |
-| INVLPGB | NVLPGB and TLBSYNC instruction supported |
-| KEYLOCKER | Key locker |
-| KEYLOCKERW | Key locker wide |
-| LAHF | LAHF/SAHF in long mode |
-| LAM | If set, CPU supports Linear Address Masking |
-| LBRVIRT | LBR virtualization |
-| LZCNT | LZCNT instruction |
-| MCAOVERFLOW | MCA overflow recovery support. |
-| MCDT_NO | Processor do not exhibit MXCSR Configuration Dependent Timing behavior and do not need to mitigate it. |
-| MCOMMIT | MCOMMIT instruction supported |
-| MD_CLEAR | VERW clears CPU buffers |
-| MMX | standard MMX |
-| MMXEXT | SSE integer functions or AMD MMX ext |
-| MOVBE | MOVBE instruction (big-endian) |
-| MOVDIR64B | Move 64 Bytes as Direct Store |
-| MOVDIRI | Move Doubleword as Direct Store |
-| MOVSB_ZL | Fast Zero-Length MOVSB |
-| MPX | Intel MPX (Memory Protection Extensions) |
-| MOVU | MOVU SSE instructions are more efficient and should be preferred to SSE MOVL/MOVH. MOVUPS is more efficient than MOVLPS/MOVHPS. MOVUPD is more efficient than MOVLPD/MOVHPD |
-| MSRIRC | Instruction Retired Counter MSR available |
-| MSRLIST | Read/Write List of Model Specific Registers |
-| MSR_PAGEFLUSH | Page Flush MSR available |
-| NRIPS | Indicates support for NRIP save on VMEXIT |
-| NX | NX (No-Execute) bit |
-| OSXSAVE | XSAVE enabled by OS |
-| PCONFIG | PCONFIG for Intel Multi-Key Total Memory Encryption |
-| POPCNT | POPCNT instruction |
-| PPIN | AMD: Protected Processor Inventory Number support. Indicates that Protected Processor Inventory Number (PPIN) capability can be enabled |
-| PREFETCHI | PREFETCHIT0/1 instructions |
-| PSFD | Predictive Store Forward Disable |
-| RDPRU | RDPRU instruction supported |
-| RDRAND | RDRAND instruction is available |
-| RDSEED | RDSEED instruction is available |
-| RDTSCP | RDTSCP Instruction |
-| RRSBA_CTRL | Restricted RSB Alternate |
-| RTM | Restricted Transactional Memory |
-| RTM_ALWAYS_ABORT | Indicates that the loaded microcode is forcing RTM abort. |
-| SERIALIZE | Serialize Instruction Execution |
-| SEV | AMD Secure Encrypted Virtualization supported |
-| SEV_64BIT | AMD SEV guest execution only allowed from a 64-bit host |
-| SEV_ALTERNATIVE | AMD SEV Alternate Injection supported |
-| SEV_DEBUGSWAP | Full debug state swap supported for SEV-ES guests |
-| SEV_ES | AMD SEV Encrypted State supported |
-| SEV_RESTRICTED | AMD SEV Restricted Injection supported |
-| SEV_SNP | AMD SEV Secure Nested Paging supported |
-| SGX | Software Guard Extensions |
-| SGXLC | Software Guard Extensions Launch Control |
-| SGXPQC | Software Guard Extensions 256-bit Encryption |
-| SHA | Intel SHA Extensions |
-| SME | AMD Secure Memory Encryption supported |
-| SME_COHERENT | AMD Hardware cache coherency across encryption domains enforced |
-| SM3_X86 | SM3 instructions |
-| SM4_X86 | SM4 instructions |
-| SPEC_CTRL_SSBD | Speculative Store Bypass Disable |
-| SRBDS_CTRL | SRBDS mitigation MSR available |
-| SSE | SSE functions |
-| SSE2 | P4 SSE functions |
-| SSE3 | Prescott SSE3 functions |
-| SSE4 | Penryn SSE4.1 functions |
-| SSE42 | Nehalem SSE4.2 functions |
-| SSE4A | AMD Barcelona microarchitecture SSE4a instructions |
-| SSSE3 | Conroe SSSE3 functions |
-| STIBP | Single Thread Indirect Branch Predictors |
-| STIBP_ALWAYSON | AMD: Single Thread Indirect Branch Prediction Mode has Enhanced Performance and may be left Always On |
-| STOSB_SHORT | Fast short STOSB |
-| SUCCOR | Software uncorrectable error containment and recovery capability. |
-| SVM | AMD Secure Virtual Machine |
-| SVMDA | Indicates support for the SVM decode assists. |
-| SVMFBASID | SVM, Indicates that TLB flush events, including CR3 writes and CR4.PGE toggles, flush only the current ASID's TLB entries. Also indicates support for the extended VMCBTLB_Control |
-| SVML | AMD SVM lock. Indicates support for SVM-Lock. |
-| SVMNP | AMD SVM nested paging |
-| SVMPF | SVM pause intercept filter. Indicates support for the pause intercept filter |
-| SVMPFT | SVM PAUSE filter threshold. Indicates support for the PAUSE filter cycle count threshold |
-| SYSCALL | System-Call Extension (SCE): SYSCALL and SYSRET instructions. |
-| SYSEE | SYSENTER and SYSEXIT instructions |
-| TBM | AMD Trailing Bit Manipulation |
-| TDX_GUEST | Intel Trust Domain Extensions Guest |
-| TLB_FLUSH_NESTED | AMD: Flushing includes all the nested translations for guest translations |
-| TME | Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE. |
-| TOPEXT | TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX. |
-| TSA_L1_NO | AMD only: Not vulnerable to TSA-L1 |
-| TSA_SQ_NO | AMD only: Not vulnerable to TSA-SQ |
-| TSA_VERW_CLEAR | AMD: If set, the memory form of the VERW instruction may be used to help mitigate TSA |
-| TSCRATEMSR | MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104 |
-| TSXLDTRK | Intel TSX Suspend Load Address Tracking |
-| VAES | Vector AES. AVX(512) versions requires additional checks. |
-| VMCBCLEAN | VMCB clean bits. Indicates support for VMCB clean bits. |
-| VMPL | AMD VM Permission Levels supported |
-| VMSA_REGPROT | AMD VMSA Register Protection supported |
-| VMX | Virtual Machine Extensions |
-| VPCLMULQDQ | Carry-Less Multiplication Quadword. Requires AVX for 3 register versions. |
-| VTE | AMD Virtual Transparent Encryption supported |
-| WAITPKG | TPAUSE, UMONITOR, UMWAIT |
-| WBNOINVD | Write Back and Do Not Invalidate Cache |
-| WRMSRNS | Non-Serializing Write to Model Specific Register |
-| X87 | FPU |
-| XGETBV1 | Supports XGETBV with ECX = 1 |
-| XOP | Bulldozer XOP functions |
-| XSAVE | XSAVE, XRESTOR, XSETBV, XGETBV |
-| XSAVEC | Supports XSAVEC and the compacted form of XRSTOR. |
-| XSAVEOPT | XSAVEOPT available |
-| XSAVES | Supports XSAVES/XRSTORS and IA32_XSS |
-
-# ARM features:
-
-| Feature Flag | Description |
-|--------------|------------------------------------------------------------------|
-| AESARM | AES instructions |
-| ARMCPUID | Some CPU ID registers readable at user-level |
-| ASIMD | Advanced SIMD |
-| ASIMDDP | SIMD Dot Product |
-| ASIMDHP | Advanced SIMD half-precision floating point |
-| ASIMDRDM | Rounding Double Multiply Accumulate/Subtract (SQRDMLAH/SQRDMLSH) |
-| ATOMICS | Large System Extensions (LSE) |
-| CRC32 | CRC32/CRC32C instructions |
-| DCPOP | Data cache clean to Point of Persistence (DC CVAP) |
-| EVTSTRM | Generic timer |
-| FCMA | Floatin point complex number addition and multiplication |
-| FHM | FMLAL and FMLSL instructions |
-| FP | Single-precision and double-precision floating point |
-| FPHP | Half-precision floating point |
-| GPA | Generic Pointer Authentication |
-| JSCVT | Javascript-style double->int convert (FJCVTZS) |
-| LRCPC | Weaker release consistency (LDAPR, etc) |
-| PMULL | Polynomial Multiply instructions (PMULL/PMULL2) |
-| RNDR | Random Number instructions |
-| TLB | Outer Shareable and TLB range maintenance instructions |
-| TS | Flag manipulation instructions |
-| SHA1 | SHA-1 instructions (SHA1C, etc) |
-| SHA2 | SHA-2 instructions (SHA256H, etc) |
-| SHA3 | SHA-3 instructions (EOR3, RAXI, XAR, BCAX) |
-| SHA512 | SHA512 instructions |
-| SM3 | SM3 instructions |
-| SM4 | SM4 instructions |
-| SVE | Scalable Vector Extension |
-
-# license
-
-This code is published under an MIT license. See LICENSE file for more information.
diff --git a/vendor/github.com/klauspost/cpuid/v2/cpuid.go b/vendor/github.com/klauspost/cpuid/v2/cpuid.go
deleted file mode 100644
index 9cf7738a9..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/cpuid.go
+++ /dev/null
@@ -1,1679 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-// Package cpuid provides information about the CPU running the current program.
-//
-// CPU features are detected on startup, and kept for fast access through the life of the application.
-// Currently x86 / x64 (AMD64) as well as arm64 is supported.
-//
-// You can access the CPU information by accessing the shared CPU variable of the cpuid library.
-//
-// Package home: https://github.com/klauspost/cpuid
-package cpuid
-
-import (
- "flag"
- "fmt"
- "math"
- "math/bits"
- "os"
- "runtime"
- "strings"
-)
-
-// AMD refererence: https://www.amd.com/system/files/TechDocs/25481.pdf
-// and Processor Programming Reference (PPR)
-
-// Vendor is a representation of a CPU vendor.
-type Vendor int
-
-const (
- VendorUnknown Vendor = iota
- Intel
- AMD
- VIA
- Transmeta
- NSC
- KVM // Kernel-based Virtual Machine
- MSVM // Microsoft Hyper-V or Windows Virtual PC
- VMware
- XenHVM
- Bhyve
- Hygon
- SiS
- RDC
-
- Ampere
- ARM
- Broadcom
- Cavium
- DEC
- Fujitsu
- Infineon
- Motorola
- NVIDIA
- AMCC
- Qualcomm
- Marvell
-
- QEMU
- QNX
- ACRN
- SRE
- Apple
-
- lastVendor
-)
-
-//go:generate stringer -type=FeatureID,Vendor
-
-// FeatureID is the ID of a specific cpu feature.
-type FeatureID int
-
-const (
- // Keep index -1 as unknown
- UNKNOWN = -1
-
- // x86 features
- ADX FeatureID = iota // Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
- AESNI // Advanced Encryption Standard New Instructions
- AMD3DNOW // AMD 3DNOW
- AMD3DNOWEXT // AMD 3DNowExt
- AMXBF16 // Tile computational operations on BFLOAT16 numbers
- AMXFP16 // Tile computational operations on FP16 numbers
- AMXINT8 // Tile computational operations on 8-bit integers
- AMXFP8 // Tile computational operations on FP8 numbers
- AMXTILE // Tile architecture
- AMXTF32 // Tile architecture
- AMXCOMPLEX // Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile
- AMXTRANSPOSE // Tile multiply where the first operand is transposed
- APX_F // Intel APX
- AVX // AVX functions
- AVX10 // If set the Intel AVX10 Converged Vector ISA is supported
- AVX10_128 // If set indicates that AVX10 128-bit vector support is present
- AVX10_256 // If set indicates that AVX10 256-bit vector support is present
- AVX10_512 // If set indicates that AVX10 512-bit vector support is present
- AVX2 // AVX2 functions
- AVX512BF16 // AVX-512 BFLOAT16 Instructions
- AVX512BITALG // AVX-512 Bit Algorithms
- AVX512BW // AVX-512 Byte and Word Instructions
- AVX512CD // AVX-512 Conflict Detection Instructions
- AVX512DQ // AVX-512 Doubleword and Quadword Instructions
- AVX512ER // AVX-512 Exponential and Reciprocal Instructions
- AVX512F // AVX-512 Foundation
- AVX512FP16 // AVX-512 FP16 Instructions
- AVX512IFMA // AVX-512 Integer Fused Multiply-Add Instructions
- AVX512PF // AVX-512 Prefetch Instructions
- AVX512VBMI // AVX-512 Vector Bit Manipulation Instructions
- AVX512VBMI2 // AVX-512 Vector Bit Manipulation Instructions, Version 2
- AVX512VL // AVX-512 Vector Length Extensions
- AVX512VNNI // AVX-512 Vector Neural Network Instructions
- AVX512VP2INTERSECT // AVX-512 Intersect for D/Q
- AVX512VPOPCNTDQ // AVX-512 Vector Population Count Doubleword and Quadword
- AVXIFMA // AVX-IFMA instructions
- AVXNECONVERT // AVX-NE-CONVERT instructions
- AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one
- AVXVNNI // AVX (VEX encoded) VNNI neural network instructions
- AVXVNNIINT8 // AVX-VNNI-INT8 instructions
- AVXVNNIINT16 // AVX-VNNI-INT16 instructions
- BHI_CTRL // Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598
- BMI1 // Bit Manipulation Instruction Set 1
- BMI2 // Bit Manipulation Instruction Set 2
- CETIBT // Intel CET Indirect Branch Tracking
- CETSS // Intel CET Shadow Stack
- CLDEMOTE // Cache Line Demote
- CLMUL // Carry-less Multiplication
- CLZERO // CLZERO instruction supported
- CMOV // i686 CMOV
- CMPCCXADD // CMPCCXADD instructions
- CMPSB_SCADBS_SHORT // Fast short CMPSB and SCASB
- CMPXCHG8 // CMPXCHG8 instruction
- CPBOOST // Core Performance Boost
- CPPC // AMD: Collaborative Processor Performance Control
- CX16 // CMPXCHG16B Instruction
- EFER_LMSLE_UNS // AMD: =Core::X86::Msr::EFER[LMSLE] is not supported, and MBZ
- ENQCMD // Enqueue Command
- ERMS // Enhanced REP MOVSB/STOSB
- F16C // Half-precision floating-point conversion
- FLUSH_L1D // Flush L1D cache
- FMA3 // Intel FMA 3. Does not imply AVX.
- FMA4 // Bulldozer FMA4 functions
- FP128 // AMD: When set, the internal FP/SIMD execution datapath is no more than 128-bits wide
- FP256 // AMD: When set, the internal FP/SIMD execution datapath is no more than 256-bits wide
- FSRM // Fast Short Rep Mov
- FXSR // FXSAVE, FXRESTOR instructions, CR4 bit 9
- FXSROPT // FXSAVE/FXRSTOR optimizations
- GFNI // Galois Field New Instructions. May require other features (AVX, AVX512VL,AVX512F) based on usage.
- HLE // Hardware Lock Elision
- HRESET // If set CPU supports history reset and the IA32_HRESET_ENABLE MSR
- HTT // Hyperthreading (enabled)
- HWA // Hardware assert supported. Indicates support for MSRC001_10
- HYBRID_CPU // This part has CPUs of more than one type.
- HYPERVISOR // This bit has been reserved by Intel & AMD for use by hypervisors
- IA32_ARCH_CAP // IA32_ARCH_CAPABILITIES MSR (Intel)
- IA32_CORE_CAP // IA32_CORE_CAPABILITIES MSR
- IBPB // Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB)
- IBPB_BRTYPE // Indicates that MSR 49h (PRED_CMD) bit 0 (IBPB) flushes all branch type predictions from the CPU branch predictor
- IBRS // AMD: Indirect Branch Restricted Speculation
- IBRS_PREFERRED // AMD: IBRS is preferred over software solution
- IBRS_PROVIDES_SMP // AMD: IBRS provides Same Mode Protection
- IBS // Instruction Based Sampling (AMD)
- IBSBRNTRGT // Instruction Based Sampling Feature (AMD)
- IBSFETCHSAM // Instruction Based Sampling Feature (AMD)
- IBSFFV // Instruction Based Sampling Feature (AMD)
- IBSOPCNT // Instruction Based Sampling Feature (AMD)
- IBSOPCNTEXT // Instruction Based Sampling Feature (AMD)
- IBSOPSAM // Instruction Based Sampling Feature (AMD)
- IBSRDWROPCNT // Instruction Based Sampling Feature (AMD)
- IBSRIPINVALIDCHK // Instruction Based Sampling Feature (AMD)
- IBS_FETCH_CTLX // AMD: IBS fetch control extended MSR supported
- IBS_OPDATA4 // AMD: IBS op data 4 MSR supported
- IBS_OPFUSE // AMD: Indicates support for IbsOpFuse
- IBS_PREVENTHOST // Disallowing IBS use by the host supported
- IBS_ZEN4 // AMD: Fetch and Op IBS support IBS extensions added with Zen4
- IDPRED_CTRL // IPRED_DIS
- INT_WBINVD // WBINVD/WBNOINVD are interruptible.
- INVLPGB // NVLPGB and TLBSYNC instruction supported
- KEYLOCKER // Key locker
- KEYLOCKERW // Key locker wide
- LAHF // LAHF/SAHF in long mode
- LAM // If set, CPU supports Linear Address Masking
- LBRVIRT // LBR virtualization
- LZCNT // LZCNT instruction
- MCAOVERFLOW // MCA overflow recovery support.
- MCDT_NO // Processor do not exhibit MXCSR Configuration Dependent Timing behavior and do not need to mitigate it.
- MCOMMIT // MCOMMIT instruction supported
- MD_CLEAR // VERW clears CPU buffers
- MMX // standard MMX
- MMXEXT // SSE integer functions or AMD MMX ext
- MOVBE // MOVBE instruction (big-endian)
- MOVDIR64B // Move 64 Bytes as Direct Store
- MOVDIRI // Move Doubleword as Direct Store
- MOVSB_ZL // Fast Zero-Length MOVSB
- MOVU // AMD: MOVU SSE instructions are more efficient and should be preferred to SSE MOVL/MOVH. MOVUPS is more efficient than MOVLPS/MOVHPS. MOVUPD is more efficient than MOVLPD/MOVHPD
- MPX // Intel MPX (Memory Protection Extensions)
- MSRIRC // Instruction Retired Counter MSR available
- MSRLIST // Read/Write List of Model Specific Registers
- MSR_PAGEFLUSH // Page Flush MSR available
- NRIPS // Indicates support for NRIP save on VMEXIT
- NX // NX (No-Execute) bit
- OSXSAVE // XSAVE enabled by OS
- PCONFIG // PCONFIG for Intel Multi-Key Total Memory Encryption
- POPCNT // POPCNT instruction
- PPIN // AMD: Protected Processor Inventory Number support. Indicates that Protected Processor Inventory Number (PPIN) capability can be enabled
- PREFETCHI // PREFETCHIT0/1 instructions
- PSFD // Predictive Store Forward Disable
- RDPRU // RDPRU instruction supported
- RDRAND // RDRAND instruction is available
- RDSEED // RDSEED instruction is available
- RDTSCP // RDTSCP Instruction
- RRSBA_CTRL // Restricted RSB Alternate
- RTM // Restricted Transactional Memory
- RTM_ALWAYS_ABORT // Indicates that the loaded microcode is forcing RTM abort.
- SBPB // Indicates support for the Selective Branch Predictor Barrier
- SERIALIZE // Serialize Instruction Execution
- SEV // AMD Secure Encrypted Virtualization supported
- SEV_64BIT // AMD SEV guest execution only allowed from a 64-bit host
- SEV_ALTERNATIVE // AMD SEV Alternate Injection supported
- SEV_DEBUGSWAP // Full debug state swap supported for SEV-ES guests
- SEV_ES // AMD SEV Encrypted State supported
- SEV_RESTRICTED // AMD SEV Restricted Injection supported
- SEV_SNP // AMD SEV Secure Nested Paging supported
- SGX // Software Guard Extensions
- SGXLC // Software Guard Extensions Launch Control
- SGXPQC // Software Guard Extensions 256-bit Encryption
- SHA // Intel SHA Extensions
- SME // AMD Secure Memory Encryption supported
- SME_COHERENT // AMD Hardware cache coherency across encryption domains enforced
- SM3_X86 // SM3 instructions
- SM4_X86 // SM4 instructions
- SPEC_CTRL_SSBD // Speculative Store Bypass Disable
- SRBDS_CTRL // SRBDS mitigation MSR available
- SRSO_MSR_FIX // Indicates that software may use MSR BP_CFG[BpSpecReduce] to mitigate SRSO.
- SRSO_NO // Indicates the CPU is not subject to the SRSO vulnerability
- SRSO_USER_KERNEL_NO // Indicates the CPU is not subject to the SRSO vulnerability across user/kernel boundaries
- SSE // SSE functions
- SSE2 // P4 SSE functions
- SSE3 // Prescott SSE3 functions
- SSE4 // Penryn SSE4.1 functions
- SSE42 // Nehalem SSE4.2 functions
- SSE4A // AMD Barcelona microarchitecture SSE4a instructions
- SSSE3 // Conroe SSSE3 functions
- STIBP // Single Thread Indirect Branch Predictors
- STIBP_ALWAYSON // AMD: Single Thread Indirect Branch Prediction Mode has Enhanced Performance and may be left Always On
- STOSB_SHORT // Fast short STOSB
- SUCCOR // Software uncorrectable error containment and recovery capability.
- SVM // AMD Secure Virtual Machine
- SVMDA // Indicates support for the SVM decode assists.
- SVMFBASID // SVM, Indicates that TLB flush events, including CR3 writes and CR4.PGE toggles, flush only the current ASID's TLB entries. Also indicates support for the extended VMCBTLB_Control
- SVML // AMD SVM lock. Indicates support for SVM-Lock.
- SVMNP // AMD SVM nested paging
- SVMPF // SVM pause intercept filter. Indicates support for the pause intercept filter
- SVMPFT // SVM PAUSE filter threshold. Indicates support for the PAUSE filter cycle count threshold
- SYSCALL // System-Call Extension (SCE): SYSCALL and SYSRET instructions.
- SYSEE // SYSENTER and SYSEXIT instructions
- TBM // AMD Trailing Bit Manipulation
- TDX_GUEST // Intel Trust Domain Extensions Guest
- TLB_FLUSH_NESTED // AMD: Flushing includes all the nested translations for guest translations
- TME // Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE.
- TOPEXT // TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX.
- TSA_L1_NO // AMD only: Not vulnerable to TSA-L1
- TSA_SQ_NO // AM onlyD: Not vulnerable to TSA-SQ
- TSA_VERW_CLEAR // If set, the memory form of the VERW instruction may be used to help mitigate TSA
- TSCRATEMSR // MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104
- TSXLDTRK // Intel TSX Suspend Load Address Tracking
- VAES // Vector AES. AVX(512) versions requires additional checks.
- VMCBCLEAN // VMCB clean bits. Indicates support for VMCB clean bits.
- VMPL // AMD VM Permission Levels supported
- VMSA_REGPROT // AMD VMSA Register Protection supported
- VMX // Virtual Machine Extensions
- VPCLMULQDQ // Carry-Less Multiplication Quadword. Requires AVX for 3 register versions.
- VTE // AMD Virtual Transparent Encryption supported
- WAITPKG // TPAUSE, UMONITOR, UMWAIT
- WBNOINVD // Write Back and Do Not Invalidate Cache
- WRMSRNS // Non-Serializing Write to Model Specific Register
- X87 // FPU
- XGETBV1 // Supports XGETBV with ECX = 1
- XOP // Bulldozer XOP functions
- XSAVE // XSAVE, XRESTOR, XSETBV, XGETBV
- XSAVEC // Supports XSAVEC and the compacted form of XRSTOR.
- XSAVEOPT // XSAVEOPT available
- XSAVES // Supports XSAVES/XRSTORS and IA32_XSS
-
- // ARM features:
- AESARM // AES instructions
- ARMCPUID // Some CPU ID registers readable at user-level
- ASIMD // Advanced SIMD
- ASIMDDP // SIMD Dot Product
- ASIMDHP // Advanced SIMD half-precision floating point
- ASIMDRDM // Rounding Double Multiply Accumulate/Subtract (SQRDMLAH/SQRDMLSH)
- ATOMICS // Large System Extensions (LSE)
- CRC32 // CRC32/CRC32C instructions
- DCPOP // Data cache clean to Point of Persistence (DC CVAP)
- EVTSTRM // Generic timer
- FCMA // Floating point complex number addition and multiplication
- FHM // FMLAL and FMLSL instructions
- FP // Single-precision and double-precision floating point
- FPHP // Half-precision floating point
- GPA // Generic Pointer Authentication
- JSCVT // Javascript-style double->int convert (FJCVTZS)
- LRCPC // Weaker release consistency (LDAPR, etc)
- PMULL // Polynomial Multiply instructions (PMULL/PMULL2)
- RNDR // Random Number instructions
- TLB // Outer Shareable and TLB range maintenance instructions
- TS // Flag manipulation instructions
- SHA1 // SHA-1 instructions (SHA1C, etc)
- SHA2 // SHA-2 instructions (SHA256H, etc)
- SHA3 // SHA-3 instructions (EOR3, RAXI, XAR, BCAX)
- SHA512 // SHA512 instructions
- SM3 // SM3 instructions
- SM4 // SM4 instructions
- SVE // Scalable Vector Extension
-
- // PMU
- PMU_FIXEDCOUNTER_CYCLES
- PMU_FIXEDCOUNTER_REFCYCLES
- PMU_FIXEDCOUNTER_INSTRUCTIONS
- PMU_FIXEDCOUNTER_TOPDOWN_SLOTS
-
- // Keep it last. It automatically defines the size of []flagSet
- lastID
-
- firstID FeatureID = UNKNOWN + 1
-)
-
-// CPUInfo contains information about the detected system CPU.
-type CPUInfo struct {
- BrandName string // Brand name reported by the CPU
- VendorID Vendor // Comparable CPU vendor ID
- VendorString string // Raw vendor string.
- HypervisorVendorID Vendor // Hypervisor vendor
- HypervisorVendorString string // Raw hypervisor vendor string
- featureSet flagSet // Features of the CPU
- PhysicalCores int // Number of physical processor cores in your CPU. Will be 0 if undetectable.
- ThreadsPerCore int // Number of threads per physical core. Will be 1 if undetectable.
- LogicalCores int // Number of physical cores times threads that can run on each core through the use of hyperthreading. Will be 0 if undetectable.
- Family int // CPU family number
- Model int // CPU model number
- Stepping int // CPU stepping info
- CacheLine int // Cache line size in bytes. Will be 0 if undetectable.
- Hz int64 // Clock speed, if known, 0 otherwise. Will attempt to contain base clock speed.
- BoostFreq int64 // Max clock speed, if known, 0 otherwise
- Cache struct {
- L1I int // L1 Instruction Cache (per core or shared). Will be -1 if undetected
- L1D int // L1 Data Cache (per core or shared). Will be -1 if undetected
- L2 int // L2 Cache (per core or shared). Will be -1 if undetected
- L3 int // L3 Cache (per core, per ccx or shared). Will be -1 if undetected
- }
- SGX SGXSupport
- AMDMemEncryption AMDMemEncryptionSupport
- AVX10Level uint8
- PMU PerformanceMonitoringInfo // holds information about the PMU
-
- maxFunc uint32
- maxExFunc uint32
-}
-
-// PerformanceMonitoringInfo holds information about CPU performance monitoring capabilities.
-// This is primarily populated from CPUID leaf 0xAh on x86
-type PerformanceMonitoringInfo struct {
- // VersionID (x86 only): Version ID of architectural performance monitoring.
- // A value of 0 means architectural performance monitoring is not supported or information is unavailable.
- VersionID uint8
- // NumGPPMC: Number of General-Purpose Performance Monitoring Counters per logical processor.
- // On ARM, this is derived from PMCR_EL0.N (number of event counters).
- NumGPCounters uint8
- // GPPMCWidth: Bit width of General-Purpose Performance Monitoring Counters.
- // On ARM, typically 64 for PMU event counters.
- GPPMCWidth uint8
- // NumFixedPMC: Number of Fixed-Function Performance Counters.
- // Valid on x86 if VersionID > 1. On ARM, this typically includes at least the cycle counter (PMCCNTR_EL0).
- NumFixedPMC uint8
- // FixedPMCWidth: Bit width of Fixed-Function Performance Counters.
- // Valid on x86 if VersionID > 1. On ARM, the cycle counter (PMCCNTR_EL0) is 64-bit.
- FixedPMCWidth uint8
- // Raw register output from CPUID leaf 0xAh.
- RawEBX uint32
- RawEAX uint32
- RawEDX uint32
-}
-
-var cpuid func(op uint32) (eax, ebx, ecx, edx uint32)
-var cpuidex func(op, op2 uint32) (eax, ebx, ecx, edx uint32)
-var xgetbv func(index uint32) (eax, edx uint32)
-var rdtscpAsm func() (eax, ebx, ecx, edx uint32)
-var darwinHasAVX512 = func() bool { return false }
-
-// CPU contains information about the CPU as detected on startup,
-// or when Detect last was called.
-//
-// Use this as the primary entry point to you data.
-var CPU CPUInfo
-
-func init() {
- initCPU()
- Detect()
-}
-
-// Detect will re-detect current CPU info.
-// This will replace the content of the exported CPU variable.
-//
-// Unless you expect the CPU to change while you are running your program
-// you should not need to call this function.
-// If you call this, you must ensure that no other goroutine is accessing the
-// exported CPU variable.
-func Detect() {
- // Set defaults
- CPU.ThreadsPerCore = 1
- CPU.Cache.L1I = -1
- CPU.Cache.L1D = -1
- CPU.Cache.L2 = -1
- CPU.Cache.L3 = -1
- safe := true
- if detectArmFlag != nil {
- safe = !*detectArmFlag
- }
- addInfo(&CPU, safe)
- if displayFeats != nil && *displayFeats {
- fmt.Println("cpu features:", strings.Join(CPU.FeatureSet(), ","))
- // Exit with non-zero so tests will print value.
- os.Exit(1)
- }
- if disableFlag != nil {
- s := strings.Split(*disableFlag, ",")
- for _, feat := range s {
- feat := ParseFeature(strings.TrimSpace(feat))
- if feat != UNKNOWN {
- CPU.featureSet.unset(feat)
- }
- }
- }
-}
-
-// DetectARM will detect ARM64 features.
-// This is NOT done automatically since it can potentially crash
-// if the OS does not handle the command.
-// If in the future this can be done safely this function may not
-// do anything.
-func DetectARM() {
- addInfo(&CPU, false)
-}
-
-var detectArmFlag *bool
-var displayFeats *bool
-var disableFlag *string
-
-// Flags will enable flags.
-// This must be called *before* flag.Parse AND
-// Detect must be called after the flags have been parsed.
-// Note that this means that any detection used in init() functions
-// will not contain these flags.
-func Flags() {
- disableFlag = flag.String("cpu.disable", "", "disable cpu features; comma separated list")
- displayFeats = flag.Bool("cpu.features", false, "lists cpu features and exits")
- detectArmFlag = flag.Bool("cpu.arm", false, "allow ARM features to be detected; can potentially crash")
-}
-
-// Supports returns whether the CPU supports all of the requested features.
-func (c CPUInfo) Supports(ids ...FeatureID) bool {
- for _, id := range ids {
- if !c.featureSet.inSet(id) {
- return false
- }
- }
- return true
-}
-
-// Has allows for checking a single feature.
-// Should be inlined by the compiler.
-func (c *CPUInfo) Has(id FeatureID) bool {
- return c.featureSet.inSet(id)
-}
-
-// AnyOf returns whether the CPU supports one or more of the requested features.
-func (c CPUInfo) AnyOf(ids ...FeatureID) bool {
- for _, id := range ids {
- if c.featureSet.inSet(id) {
- return true
- }
- }
- return false
-}
-
-// Features contains several features combined for a fast check using
-// CpuInfo.HasAll
-type Features *flagSet
-
-// CombineFeatures allows to combine several features for a close to constant time lookup.
-func CombineFeatures(ids ...FeatureID) Features {
- var v flagSet
- for _, id := range ids {
- v.set(id)
- }
- return &v
-}
-
-func (c *CPUInfo) HasAll(f Features) bool {
- return c.featureSet.hasSetP(f)
-}
-
-// https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
-var oneOfLevel = CombineFeatures(SYSEE, SYSCALL)
-var level1Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2)
-var level2Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3)
-var level3Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3, AVX, AVX2, BMI1, BMI2, F16C, FMA3, LZCNT, MOVBE, OSXSAVE)
-var level4Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3, AVX, AVX2, BMI1, BMI2, F16C, FMA3, LZCNT, MOVBE, OSXSAVE, AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL)
-
-// X64Level returns the microarchitecture level detected on the CPU.
-// If features are lacking or non x64 mode, 0 is returned.
-// See https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
-func (c CPUInfo) X64Level() int {
- if !c.featureSet.hasOneOf(oneOfLevel) {
- return 0
- }
- if c.featureSet.hasSetP(level4Features) {
- return 4
- }
- if c.featureSet.hasSetP(level3Features) {
- return 3
- }
- if c.featureSet.hasSetP(level2Features) {
- return 2
- }
- if c.featureSet.hasSetP(level1Features) {
- return 1
- }
- return 0
-}
-
-// Disable will disable one or several features.
-func (c *CPUInfo) Disable(ids ...FeatureID) bool {
- for _, id := range ids {
- c.featureSet.unset(id)
- }
- return true
-}
-
-// Enable will disable one or several features even if they were undetected.
-// This is of course not recommended for obvious reasons.
-func (c *CPUInfo) Enable(ids ...FeatureID) bool {
- for _, id := range ids {
- c.featureSet.set(id)
- }
- return true
-}
-
-// IsVendor returns true if vendor is recognized as Intel
-func (c CPUInfo) IsVendor(v Vendor) bool {
- return c.VendorID == v
-}
-
-// FeatureSet returns all available features as strings.
-func (c CPUInfo) FeatureSet() []string {
- s := make([]string, 0, c.featureSet.nEnabled())
- s = append(s, c.featureSet.Strings()...)
- return s
-}
-
-// RTCounter returns the 64-bit time-stamp counter
-// Uses the RDTSCP instruction. The value 0 is returned
-// if the CPU does not support the instruction.
-func (c CPUInfo) RTCounter() uint64 {
- if !c.Has(RDTSCP) {
- return 0
- }
- a, _, _, d := rdtscpAsm()
- return uint64(a) | (uint64(d) << 32)
-}
-
-// Ia32TscAux returns the IA32_TSC_AUX part of the RDTSCP.
-// This variable is OS dependent, but on Linux contains information
-// about the current cpu/core the code is running on.
-// If the RDTSCP instruction isn't supported on the CPU, the value 0 is returned.
-func (c CPUInfo) Ia32TscAux() uint32 {
- if !c.Has(RDTSCP) {
- return 0
- }
- _, _, ecx, _ := rdtscpAsm()
- return ecx
-}
-
-// SveLengths returns arm SVE vector and predicate lengths in bits.
-// Will return 0, 0 if SVE is not enabled or otherwise unable to detect.
-func (c CPUInfo) SveLengths() (vl, pl uint64) {
- if !c.Has(SVE) {
- return 0, 0
- }
- return getVectorLength()
-}
-
-// LogicalCPU will return the Logical CPU the code is currently executing on.
-// This is likely to change when the OS re-schedules the running thread
-// to another CPU.
-// If the current core cannot be detected, -1 will be returned.
-func (c CPUInfo) LogicalCPU() int {
- if c.maxFunc < 1 {
- return -1
- }
- _, ebx, _, _ := cpuid(1)
- return int(ebx >> 24)
-}
-
-// frequencies tries to compute the clock speed of the CPU. If leaf 15 is
-// supported, use it, otherwise parse the brand string. Yes, really.
-func (c *CPUInfo) frequencies() {
- c.Hz, c.BoostFreq = 0, 0
- mfi := maxFunctionID()
- if mfi >= 0x15 {
- eax, ebx, ecx, _ := cpuid(0x15)
- if eax != 0 && ebx != 0 && ecx != 0 {
- c.Hz = (int64(ecx) * int64(ebx)) / int64(eax)
- }
- }
- if mfi >= 0x16 {
- a, b, _, _ := cpuid(0x16)
- // Base...
- if a&0xffff > 0 {
- c.Hz = int64(a&0xffff) * 1_000_000
- }
- // Boost...
- if b&0xffff > 0 {
- c.BoostFreq = int64(b&0xffff) * 1_000_000
- }
- }
- if c.Hz > 0 {
- return
- }
-
- // computeHz determines the official rated speed of a CPU from its brand
- // string. This insanity is *actually the official documented way to do
- // this according to Intel*, prior to leaf 0x15 existing. The official
- // documentation only shows this working for exactly `x.xx` or `xxxx`
- // cases, e.g., `2.50GHz` or `1300MHz`; this parser will accept other
- // sizes.
- model := c.BrandName
- hz := strings.LastIndex(model, "Hz")
- if hz < 3 {
- return
- }
- var multiplier int64
- switch model[hz-1] {
- case 'M':
- multiplier = 1000 * 1000
- case 'G':
- multiplier = 1000 * 1000 * 1000
- case 'T':
- multiplier = 1000 * 1000 * 1000 * 1000
- }
- if multiplier == 0 {
- return
- }
- freq := int64(0)
- divisor := int64(0)
- decimalShift := int64(1)
- var i int
- for i = hz - 2; i >= 0 && model[i] != ' '; i-- {
- if model[i] >= '0' && model[i] <= '9' {
- freq += int64(model[i]-'0') * decimalShift
- decimalShift *= 10
- } else if model[i] == '.' {
- if divisor != 0 {
- return
- }
- divisor = decimalShift
- } else {
- return
- }
- }
- // we didn't find a space
- if i < 0 {
- return
- }
- if divisor != 0 {
- c.Hz = (freq * multiplier) / divisor
- return
- }
- c.Hz = freq * multiplier
-}
-
-// VM Will return true if the cpu id indicates we are in
-// a virtual machine.
-func (c CPUInfo) VM() bool {
- return CPU.featureSet.inSet(HYPERVISOR)
-}
-
-// flags contains detected cpu features and characteristics
-type flags uint64
-
-// log2(bits_in_uint64)
-const flagBitsLog2 = 6
-const flagBits = 1 << flagBitsLog2
-const flagMask = flagBits - 1
-
-// flagSet contains detected cpu features and characteristics in an array of flags
-type flagSet [(lastID + flagMask) / flagBits]flags
-
-func (s *flagSet) inSet(feat FeatureID) bool {
- return s[feat>>flagBitsLog2]&(1<<(feat&flagMask)) != 0
-}
-
-func (s *flagSet) set(feat FeatureID) {
- s[feat>>flagBitsLog2] |= 1 << (feat & flagMask)
-}
-
-// setIf will set a feature if boolean is true.
-func (s *flagSet) setIf(cond bool, features ...FeatureID) {
- if cond {
- for _, offset := range features {
- s[offset>>flagBitsLog2] |= 1 << (offset & flagMask)
- }
- }
-}
-
-func (s *flagSet) unset(offset FeatureID) {
- bit := flags(1 << (offset & flagMask))
- s[offset>>flagBitsLog2] = s[offset>>flagBitsLog2] & ^bit
-}
-
-// or with another flagset.
-func (s *flagSet) or(other flagSet) {
- for i, v := range other[:] {
- s[i] |= v
- }
-}
-
-// hasSet returns whether all features are present.
-func (s *flagSet) hasSet(other flagSet) bool {
- for i, v := range other[:] {
- if s[i]&v != v {
- return false
- }
- }
- return true
-}
-
-// hasSet returns whether all features are present.
-func (s *flagSet) hasSetP(other *flagSet) bool {
- for i, v := range other[:] {
- if s[i]&v != v {
- return false
- }
- }
- return true
-}
-
-// hasOneOf returns whether one or more features are present.
-func (s *flagSet) hasOneOf(other *flagSet) bool {
- for i, v := range other[:] {
- if s[i]&v != 0 {
- return true
- }
- }
- return false
-}
-
-// nEnabled will return the number of enabled flags.
-func (s *flagSet) nEnabled() (n int) {
- for _, v := range s[:] {
- n += bits.OnesCount64(uint64(v))
- }
- return n
-}
-
-func flagSetWith(feat ...FeatureID) flagSet {
- var res flagSet
- for _, f := range feat {
- res.set(f)
- }
- return res
-}
-
-// ParseFeature will parse the string and return the ID of the matching feature.
-// Will return UNKNOWN if not found.
-func ParseFeature(s string) FeatureID {
- s = strings.ToUpper(s)
- for i := firstID; i < lastID; i++ {
- if i.String() == s {
- return i
- }
- }
- return UNKNOWN
-}
-
-// Strings returns an array of the detected features for FlagsSet.
-func (s flagSet) Strings() []string {
- if len(s) == 0 {
- return []string{""}
- }
- r := make([]string, 0)
- for i := firstID; i < lastID; i++ {
- if s.inSet(i) {
- r = append(r, i.String())
- }
- }
- return r
-}
-
-func maxExtendedFunction() uint32 {
- eax, _, _, _ := cpuid(0x80000000)
- return eax
-}
-
-func maxFunctionID() uint32 {
- a, _, _, _ := cpuid(0)
- return a
-}
-
-func brandName() string {
- if maxExtendedFunction() >= 0x80000004 {
- v := make([]uint32, 0, 48)
- for i := uint32(0); i < 3; i++ {
- a, b, c, d := cpuid(0x80000002 + i)
- v = append(v, a, b, c, d)
- }
- return strings.Trim(string(valAsString(v...)), " ")
- }
- return "unknown"
-}
-
-func threadsPerCore() int {
- mfi := maxFunctionID()
- vend, _ := vendorID()
-
- if mfi < 0x4 || (vend != Intel && vend != AMD) {
- return 1
- }
-
- if mfi < 0xb {
- if vend != Intel {
- return 1
- }
- _, b, _, d := cpuid(1)
- if (d & (1 << 28)) != 0 {
- // v will contain logical core count
- v := (b >> 16) & 255
- if v > 1 {
- a4, _, _, _ := cpuid(4)
- // physical cores
- v2 := (a4 >> 26) + 1
- if v2 > 0 {
- return int(v) / int(v2)
- }
- }
- }
- return 1
- }
- _, b, _, _ := cpuidex(0xb, 0)
- if b&0xffff == 0 {
- if vend == AMD {
- // if >= Zen 2 0x8000001e EBX 15-8 bits means threads per core.
- // The number of threads per core is ThreadsPerCore+1
- // See PPR for AMD Family 17h Models 00h-0Fh (page 82)
- fam, _, _ := familyModel()
- _, _, _, d := cpuid(1)
- if (d&(1<<28)) != 0 && fam >= 23 {
- if maxExtendedFunction() >= 0x8000001e {
- _, b, _, _ := cpuid(0x8000001e)
- return int((b>>8)&0xff) + 1
- }
- return 2
- }
- }
- return 1
- }
- return int(b & 0xffff)
-}
-
-func logicalCores() int {
- mfi := maxFunctionID()
- v, _ := vendorID()
- switch v {
- case Intel:
- // Use this on old Intel processors
- if mfi < 0xb {
- if mfi < 1 {
- return 0
- }
- // CPUID.1:EBX[23:16] represents the maximum number of addressable IDs (initial APIC ID)
- // that can be assigned to logical processors in a physical package.
- // The value may not be the same as the number of logical processors that are present in the hardware of a physical package.
- _, ebx, _, _ := cpuid(1)
- logical := (ebx >> 16) & 0xff
- return int(logical)
- }
- _, b, _, _ := cpuidex(0xb, 1)
- return int(b & 0xffff)
- case AMD, Hygon:
- _, b, _, _ := cpuid(1)
- return int((b >> 16) & 0xff)
- default:
- return 0
- }
-}
-
-func familyModel() (family, model, stepping int) {
- if maxFunctionID() < 0x1 {
- return 0, 0, 0
- }
- eax, _, _, _ := cpuid(1)
- // If BaseFamily[3:0] is less than Fh then ExtendedFamily[7:0] is reserved and Family is equal to BaseFamily[3:0].
- family = int((eax >> 8) & 0xf)
- extFam := family == 0x6 // Intel is 0x6, needs extended model.
- if family == 0xf {
- // Add ExtFamily
- family += int((eax >> 20) & 0xff)
- extFam = true
- }
- // If BaseFamily[3:0] is less than 0Fh then ExtendedModel[3:0] is reserved and Model is equal to BaseModel[3:0].
- model = int((eax >> 4) & 0xf)
- if extFam {
- // Add ExtModel
- model += int((eax >> 12) & 0xf0)
- }
- stepping = int(eax & 0xf)
- return family, model, stepping
-}
-
-func physicalCores() int {
- v, _ := vendorID()
- switch v {
- case Intel:
- lc := logicalCores()
- tpc := threadsPerCore()
- if lc > 0 && tpc > 0 {
- return lc / tpc
- }
- return 0
- case AMD, Hygon:
- lc := logicalCores()
- tpc := threadsPerCore()
- if lc > 0 && tpc > 0 {
- return lc / tpc
- }
-
- // The following is inaccurate on AMD EPYC 7742 64-Core Processor
- if maxExtendedFunction() >= 0x80000008 {
- _, _, c, _ := cpuid(0x80000008)
- if c&0xff > 0 {
- return int(c&0xff) + 1
- }
- }
- }
- return 0
-}
-
-// Except from http://en.wikipedia.org/wiki/CPUID#EAX.3D0:_Get_vendor_ID
-var vendorMapping = map[string]Vendor{
- "AMDisbetter!": AMD,
- "AuthenticAMD": AMD,
- "CentaurHauls": VIA,
- "GenuineIntel": Intel,
- "TransmetaCPU": Transmeta,
- "GenuineTMx86": Transmeta,
- "Geode by NSC": NSC,
- "VIA VIA VIA ": VIA,
- "KVMKVMKVM": KVM,
- "Linux KVM Hv": KVM,
- "TCGTCGTCGTCG": QEMU,
- "Microsoft Hv": MSVM,
- "VMwareVMware": VMware,
- "XenVMMXenVMM": XenHVM,
- "bhyve bhyve ": Bhyve,
- "HygonGenuine": Hygon,
- "Vortex86 SoC": SiS,
- "SiS SiS SiS ": SiS,
- "RiseRiseRise": SiS,
- "Genuine RDC": RDC,
- "QNXQVMBSQG": QNX,
- "ACRNACRNACRN": ACRN,
- "SRESRESRESRE": SRE,
- "Apple VZ": Apple,
-}
-
-func vendorID() (Vendor, string) {
- _, b, c, d := cpuid(0)
- v := string(valAsString(b, d, c))
- vend, ok := vendorMapping[v]
- if !ok {
- return VendorUnknown, v
- }
- return vend, v
-}
-
-func hypervisorVendorID() (Vendor, string) {
- // https://lwn.net/Articles/301888/
- _, b, c, d := cpuid(0x40000000)
- v := string(valAsString(b, c, d))
- vend, ok := vendorMapping[v]
- if !ok {
- return VendorUnknown, v
- }
- return vend, v
-}
-
-func cacheLine() int {
- if maxFunctionID() < 0x1 {
- return 0
- }
-
- _, ebx, _, _ := cpuid(1)
- cache := (ebx & 0xff00) >> 5 // cflush size
- if cache == 0 && maxExtendedFunction() >= 0x80000006 {
- _, _, ecx, _ := cpuid(0x80000006)
- cache = ecx & 0xff // cacheline size
- }
- // TODO: Read from Cache and TLB Information
- return int(cache)
-}
-
-func (c *CPUInfo) cacheSize() {
- c.Cache.L1D = -1
- c.Cache.L1I = -1
- c.Cache.L2 = -1
- c.Cache.L3 = -1
- vendor, _ := vendorID()
- switch vendor {
- case Intel:
- if maxFunctionID() < 4 {
- return
- }
- c.Cache.L1I, c.Cache.L1D, c.Cache.L2, c.Cache.L3 = 0, 0, 0, 0
- for i := uint32(0); ; i++ {
- eax, ebx, ecx, _ := cpuidex(4, i)
- cacheType := eax & 15
- if cacheType == 0 {
- break
- }
- cacheLevel := (eax >> 5) & 7
- coherency := int(ebx&0xfff) + 1
- partitions := int((ebx>>12)&0x3ff) + 1
- associativity := int((ebx>>22)&0x3ff) + 1
- sets := int(ecx) + 1
- size := associativity * partitions * coherency * sets
- switch cacheLevel {
- case 1:
- if cacheType == 1 {
- // 1 = Data Cache
- c.Cache.L1D = size
- } else if cacheType == 2 {
- // 2 = Instruction Cache
- c.Cache.L1I = size
- } else {
- if c.Cache.L1D < 0 {
- c.Cache.L1I = size
- }
- if c.Cache.L1I < 0 {
- c.Cache.L1I = size
- }
- }
- case 2:
- c.Cache.L2 = size
- case 3:
- c.Cache.L3 = size
- }
- }
- case AMD, Hygon:
- // Untested.
- if maxExtendedFunction() < 0x80000005 {
- return
- }
- _, _, ecx, edx := cpuid(0x80000005)
- c.Cache.L1D = int(((ecx >> 24) & 0xFF) * 1024)
- c.Cache.L1I = int(((edx >> 24) & 0xFF) * 1024)
-
- if maxExtendedFunction() < 0x80000006 {
- return
- }
- _, _, ecx, _ = cpuid(0x80000006)
- c.Cache.L2 = int(((ecx >> 16) & 0xFFFF) * 1024)
-
- // CPUID Fn8000_001D_EAX_x[N:0] Cache Properties
- if maxExtendedFunction() < 0x8000001D || !c.Has(TOPEXT) {
- return
- }
-
- // Xen Hypervisor is buggy and returns the same entry no matter ECX value.
- // Hack: When we encounter the same entry 100 times we break.
- nSame := 0
- var last uint32
- for i := uint32(0); i < math.MaxUint32; i++ {
- eax, ebx, ecx, _ := cpuidex(0x8000001D, i)
-
- level := (eax >> 5) & 7
- cacheNumSets := ecx + 1
- cacheLineSize := 1 + (ebx & 2047)
- cachePhysPartitions := 1 + ((ebx >> 12) & 511)
- cacheNumWays := 1 + ((ebx >> 22) & 511)
-
- typ := eax & 15
- size := int(cacheNumSets * cacheLineSize * cachePhysPartitions * cacheNumWays)
- if typ == 0 {
- return
- }
-
- // Check for the same value repeated.
- comb := eax ^ ebx ^ ecx
- if comb == last {
- nSame++
- if nSame == 100 {
- return
- }
- }
- last = comb
-
- switch level {
- case 1:
- switch typ {
- case 1:
- // Data cache
- c.Cache.L1D = size
- case 2:
- // Inst cache
- c.Cache.L1I = size
- default:
- if c.Cache.L1D < 0 {
- c.Cache.L1I = size
- }
- if c.Cache.L1I < 0 {
- c.Cache.L1I = size
- }
- }
- case 2:
- c.Cache.L2 = size
- case 3:
- c.Cache.L3 = size
- }
- }
- }
-}
-
-type SGXEPCSection struct {
- BaseAddress uint64
- EPCSize uint64
-}
-
-type SGXSupport struct {
- Available bool
- LaunchControl bool
- SGX1Supported bool
- SGX2Supported bool
- MaxEnclaveSizeNot64 int64
- MaxEnclaveSize64 int64
- EPCSections []SGXEPCSection
-}
-
-func hasSGX(available, lc bool) (rval SGXSupport) {
- rval.Available = available
-
- if !available {
- return
- }
-
- rval.LaunchControl = lc
-
- a, _, _, d := cpuidex(0x12, 0)
- rval.SGX1Supported = a&0x01 != 0
- rval.SGX2Supported = a&0x02 != 0
- rval.MaxEnclaveSizeNot64 = 1 << (d & 0xFF) // pow 2
- rval.MaxEnclaveSize64 = 1 << ((d >> 8) & 0xFF) // pow 2
- rval.EPCSections = make([]SGXEPCSection, 0)
-
- for subleaf := uint32(2); subleaf < 2+8; subleaf++ {
- eax, ebx, ecx, edx := cpuidex(0x12, subleaf)
- leafType := eax & 0xf
-
- if leafType == 0 {
- // Invalid subleaf, stop iterating
- break
- } else if leafType == 1 {
- // EPC Section subleaf
- baseAddress := uint64(eax&0xfffff000) + (uint64(ebx&0x000fffff) << 32)
- size := uint64(ecx&0xfffff000) + (uint64(edx&0x000fffff) << 32)
-
- section := SGXEPCSection{BaseAddress: baseAddress, EPCSize: size}
- rval.EPCSections = append(rval.EPCSections, section)
- }
- }
-
- return
-}
-
-type AMDMemEncryptionSupport struct {
- Available bool
- CBitPossition uint32
- NumVMPL uint32
- PhysAddrReduction uint32
- NumEntryptedGuests uint32
- MinSevNoEsAsid uint32
-}
-
-func hasAMDMemEncryption(available bool) (rval AMDMemEncryptionSupport) {
- rval.Available = available
- if !available {
- return
- }
-
- _, b, c, d := cpuidex(0x8000001f, 0)
-
- rval.CBitPossition = b & 0x3f
- rval.PhysAddrReduction = (b >> 6) & 0x3F
- rval.NumVMPL = (b >> 12) & 0xf
- rval.NumEntryptedGuests = c
- rval.MinSevNoEsAsid = d
-
- return
-}
-
-func support() flagSet {
- var fs flagSet
- mfi := maxFunctionID()
- vend, _ := vendorID()
- if mfi < 0x1 {
- return fs
- }
- family, model, _ := familyModel()
-
- _, _, c, d := cpuid(1)
- fs.setIf((d&(1<<0)) != 0, X87)
- fs.setIf((d&(1<<8)) != 0, CMPXCHG8)
- fs.setIf((d&(1<<11)) != 0, SYSEE)
- fs.setIf((d&(1<<15)) != 0, CMOV)
- fs.setIf((d&(1<<23)) != 0, MMX)
- fs.setIf((d&(1<<24)) != 0, FXSR)
- fs.setIf((d&(1<<25)) != 0, FXSROPT)
- fs.setIf((d&(1<<25)) != 0, SSE)
- fs.setIf((d&(1<<26)) != 0, SSE2)
- fs.setIf((c&1) != 0, SSE3)
- fs.setIf((c&(1<<5)) != 0, VMX)
- fs.setIf((c&(1<<9)) != 0, SSSE3)
- fs.setIf((c&(1<<19)) != 0, SSE4)
- fs.setIf((c&(1<<20)) != 0, SSE42)
- fs.setIf((c&(1<<25)) != 0, AESNI)
- fs.setIf((c&(1<<1)) != 0, CLMUL)
- fs.setIf(c&(1<<22) != 0, MOVBE)
- fs.setIf(c&(1<<23) != 0, POPCNT)
- fs.setIf(c&(1<<30) != 0, RDRAND)
-
- // This bit has been reserved by Intel & AMD for use by hypervisors,
- // and indicates the presence of a hypervisor.
- fs.setIf(c&(1<<31) != 0, HYPERVISOR)
- fs.setIf(c&(1<<29) != 0, F16C)
- fs.setIf(c&(1<<13) != 0, CX16)
-
- if vend == Intel && (d&(1<<28)) != 0 && mfi >= 4 {
- fs.setIf(threadsPerCore() > 1, HTT)
- }
- if vend == AMD && (d&(1<<28)) != 0 && mfi >= 4 {
- fs.setIf(threadsPerCore() > 1, HTT)
- }
- fs.setIf(c&1<<26 != 0, XSAVE)
- fs.setIf(c&1<<27 != 0, OSXSAVE)
- // Check XGETBV/XSAVE (26), OXSAVE (27) and AVX (28) bits
- const avxCheck = 1<<26 | 1<<27 | 1<<28
- if c&avxCheck == avxCheck {
- // Check for OS support
- eax, _ := xgetbv(0)
- if (eax & 0x6) == 0x6 {
- fs.set(AVX)
- switch vend {
- case Intel:
- // Older than Haswell.
- fs.setIf(family == 6 && model < 60, AVXSLOW)
- case AMD:
- // Older than Zen 2
- fs.setIf(family < 23 || (family == 23 && model < 49), AVXSLOW)
- }
- }
- }
- // FMA3 can be used with SSE registers, so no OS support is strictly needed.
- // fma3 and OSXSAVE needed.
- const fma3Check = 1<<12 | 1<<27
- fs.setIf(c&fma3Check == fma3Check, FMA3)
-
- // Check AVX2, AVX2 requires OS support, but BMI1/2 don't.
- if mfi >= 7 {
- _, ebx, ecx, edx := cpuidex(7, 0)
- if fs.inSet(AVX) && (ebx&0x00000020) != 0 {
- fs.set(AVX2)
- }
- // CPUID.(EAX=7, ECX=0).EBX
- if (ebx & 0x00000008) != 0 {
- fs.set(BMI1)
- fs.setIf((ebx&0x00000100) != 0, BMI2)
- }
- fs.setIf(ebx&(1<<2) != 0, SGX)
- fs.setIf(ebx&(1<<4) != 0, HLE)
- fs.setIf(ebx&(1<<9) != 0, ERMS)
- fs.setIf(ebx&(1<<11) != 0, RTM)
- fs.setIf(ebx&(1<<14) != 0, MPX)
- fs.setIf(ebx&(1<<18) != 0, RDSEED)
- fs.setIf(ebx&(1<<19) != 0, ADX)
- fs.setIf(ebx&(1<<29) != 0, SHA)
-
- // CPUID.(EAX=7, ECX=0).ECX
- fs.setIf(ecx&(1<<5) != 0, WAITPKG)
- fs.setIf(ecx&(1<<7) != 0, CETSS)
- fs.setIf(ecx&(1<<8) != 0, GFNI)
- fs.setIf(ecx&(1<<9) != 0, VAES)
- fs.setIf(ecx&(1<<10) != 0, VPCLMULQDQ)
- fs.setIf(ecx&(1<<13) != 0, TME)
- fs.setIf(ecx&(1<<25) != 0, CLDEMOTE)
- fs.setIf(ecx&(1<<23) != 0, KEYLOCKER)
- fs.setIf(ecx&(1<<27) != 0, MOVDIRI)
- fs.setIf(ecx&(1<<28) != 0, MOVDIR64B)
- fs.setIf(ecx&(1<<29) != 0, ENQCMD)
- fs.setIf(ecx&(1<<30) != 0, SGXLC)
-
- // CPUID.(EAX=7, ECX=0).EDX
- fs.setIf(edx&(1<<4) != 0, FSRM)
- fs.setIf(edx&(1<<9) != 0, SRBDS_CTRL)
- fs.setIf(edx&(1<<10) != 0, MD_CLEAR)
- fs.setIf(edx&(1<<11) != 0, RTM_ALWAYS_ABORT)
- fs.setIf(edx&(1<<14) != 0, SERIALIZE)
- fs.setIf(edx&(1<<15) != 0, HYBRID_CPU)
- fs.setIf(edx&(1<<16) != 0, TSXLDTRK)
- fs.setIf(edx&(1<<18) != 0, PCONFIG)
- fs.setIf(edx&(1<<20) != 0, CETIBT)
- fs.setIf(edx&(1<<26) != 0, IBPB)
- fs.setIf(edx&(1<<27) != 0, STIBP)
- fs.setIf(edx&(1<<28) != 0, FLUSH_L1D)
- fs.setIf(edx&(1<<29) != 0, IA32_ARCH_CAP)
- fs.setIf(edx&(1<<30) != 0, IA32_CORE_CAP)
- fs.setIf(edx&(1<<31) != 0, SPEC_CTRL_SSBD)
-
- // CPUID.(EAX=7, ECX=1).EAX
- eax1, _, _, edx1 := cpuidex(7, 1)
- fs.setIf(fs.inSet(AVX) && eax1&(1<<4) != 0, AVXVNNI)
- fs.setIf(eax1&(1<<1) != 0, SM3_X86)
- fs.setIf(eax1&(1<<2) != 0, SM4_X86)
- fs.setIf(eax1&(1<<7) != 0, CMPCCXADD)
- fs.setIf(eax1&(1<<10) != 0, MOVSB_ZL)
- fs.setIf(eax1&(1<<11) != 0, STOSB_SHORT)
- fs.setIf(eax1&(1<<12) != 0, CMPSB_SCADBS_SHORT)
- fs.setIf(eax1&(1<<22) != 0, HRESET)
- fs.setIf(eax1&(1<<23) != 0, AVXIFMA)
- fs.setIf(eax1&(1<<26) != 0, LAM)
-
- // CPUID.(EAX=7, ECX=1).EDX
- fs.setIf(edx1&(1<<4) != 0, AVXVNNIINT8)
- fs.setIf(edx1&(1<<5) != 0, AVXNECONVERT)
- fs.setIf(edx1&(1<<6) != 0, AMXTRANSPOSE)
- fs.setIf(edx1&(1<<7) != 0, AMXTF32)
- fs.setIf(edx1&(1<<8) != 0, AMXCOMPLEX)
- fs.setIf(edx1&(1<<10) != 0, AVXVNNIINT16)
- fs.setIf(edx1&(1<<14) != 0, PREFETCHI)
- fs.setIf(edx1&(1<<19) != 0, AVX10)
- fs.setIf(edx1&(1<<21) != 0, APX_F)
-
- // Only detect AVX-512 features if XGETBV is supported
- if c&((1<<26)|(1<<27)) == (1<<26)|(1<<27) {
- // Check for OS support
- eax, _ := xgetbv(0)
-
- // Verify that XCR0[7:5] = ‘111b’ (OPMASK state, upper 256-bit of ZMM0-ZMM15 and
- // ZMM16-ZMM31 state are enabled by OS)
- /// and that XCR0[2:1] = ‘11b’ (XMM state and YMM state are enabled by OS).
- hasAVX512 := (eax>>5)&7 == 7 && (eax>>1)&3 == 3
- if runtime.GOOS == "darwin" {
- hasAVX512 = fs.inSet(AVX) && darwinHasAVX512()
- }
- if hasAVX512 {
- fs.setIf(ebx&(1<<16) != 0, AVX512F)
- fs.setIf(ebx&(1<<17) != 0, AVX512DQ)
- fs.setIf(ebx&(1<<21) != 0, AVX512IFMA)
- fs.setIf(ebx&(1<<26) != 0, AVX512PF)
- fs.setIf(ebx&(1<<27) != 0, AVX512ER)
- fs.setIf(ebx&(1<<28) != 0, AVX512CD)
- fs.setIf(ebx&(1<<30) != 0, AVX512BW)
- fs.setIf(ebx&(1<<31) != 0, AVX512VL)
- // ecx
- fs.setIf(ecx&(1<<1) != 0, AVX512VBMI)
- fs.setIf(ecx&(1<<3) != 0, AMXFP8)
- fs.setIf(ecx&(1<<6) != 0, AVX512VBMI2)
- fs.setIf(ecx&(1<<11) != 0, AVX512VNNI)
- fs.setIf(ecx&(1<<12) != 0, AVX512BITALG)
- fs.setIf(ecx&(1<<14) != 0, AVX512VPOPCNTDQ)
- // edx
- fs.setIf(edx&(1<<8) != 0, AVX512VP2INTERSECT)
- fs.setIf(edx&(1<<22) != 0, AMXBF16)
- fs.setIf(edx&(1<<23) != 0, AVX512FP16)
- fs.setIf(edx&(1<<24) != 0, AMXTILE)
- fs.setIf(edx&(1<<25) != 0, AMXINT8)
- // eax1 = CPUID.(EAX=7, ECX=1).EAX
- fs.setIf(eax1&(1<<5) != 0, AVX512BF16)
- fs.setIf(eax1&(1<<19) != 0, WRMSRNS)
- fs.setIf(eax1&(1<<21) != 0, AMXFP16)
- fs.setIf(eax1&(1<<27) != 0, MSRLIST)
- }
- }
-
- // CPUID.(EAX=7, ECX=2)
- _, _, _, edx = cpuidex(7, 2)
- fs.setIf(edx&(1<<0) != 0, PSFD)
- fs.setIf(edx&(1<<1) != 0, IDPRED_CTRL)
- fs.setIf(edx&(1<<2) != 0, RRSBA_CTRL)
- fs.setIf(edx&(1<<4) != 0, BHI_CTRL)
- fs.setIf(edx&(1<<5) != 0, MCDT_NO)
-
- if fs.inSet(SGX) {
- eax, _, _, _ := cpuidex(0x12, 0)
- fs.setIf(eax&(1<<12) != 0, SGXPQC)
- }
-
- // Add keylocker features.
- if fs.inSet(KEYLOCKER) && mfi >= 0x19 {
- _, ebx, _, _ := cpuidex(0x19, 0)
- fs.setIf(ebx&5 == 5, KEYLOCKERW) // Bit 0 and 2 (1+4)
- }
-
- // Add AVX10 features.
- if fs.inSet(AVX10) && mfi >= 0x24 {
- _, ebx, _, _ := cpuidex(0x24, 0)
- fs.setIf(ebx&(1<<16) != 0, AVX10_128)
- fs.setIf(ebx&(1<<17) != 0, AVX10_256)
- fs.setIf(ebx&(1<<18) != 0, AVX10_512)
- }
-
- }
-
- // Processor Extended State Enumeration Sub-leaf (EAX = 0DH, ECX = 1)
- // EAX
- // Bit 00: XSAVEOPT is available.
- // Bit 01: Supports XSAVEC and the compacted form of XRSTOR if set.
- // Bit 02: Supports XGETBV with ECX = 1 if set.
- // Bit 03: Supports XSAVES/XRSTORS and IA32_XSS if set.
- // Bits 31 - 04: Reserved.
- // EBX
- // Bits 31 - 00: The size in bytes of the XSAVE area containing all states enabled by XCRO | IA32_XSS.
- // ECX
- // Bits 31 - 00: Reports the supported bits of the lower 32 bits of the IA32_XSS MSR. IA32_XSS[n] can be set to 1 only if ECX[n] is 1.
- // EDX?
- // Bits 07 - 00: Used for XCR0. Bit 08: PT state. Bit 09: Used for XCR0. Bits 12 - 10: Reserved. Bit 13: HWP state. Bits 31 - 14: Reserved.
- if mfi >= 0xd {
- if fs.inSet(XSAVE) {
- eax, _, _, _ := cpuidex(0xd, 1)
- fs.setIf(eax&(1<<0) != 0, XSAVEOPT)
- fs.setIf(eax&(1<<1) != 0, XSAVEC)
- fs.setIf(eax&(1<<2) != 0, XGETBV1)
- fs.setIf(eax&(1<<3) != 0, XSAVES)
- }
- }
- if maxExtendedFunction() >= 0x80000001 {
- _, _, c, d := cpuid(0x80000001)
- if (c & (1 << 5)) != 0 {
- fs.set(LZCNT)
- fs.set(POPCNT)
- }
- // ECX
- fs.setIf((c&(1<<0)) != 0, LAHF)
- fs.setIf((c&(1<<2)) != 0, SVM)
- fs.setIf((c&(1<<6)) != 0, SSE4A)
- fs.setIf((c&(1<<10)) != 0, IBS)
- fs.setIf((c&(1<<22)) != 0, TOPEXT)
-
- // EDX
- fs.setIf(d&(1<<11) != 0, SYSCALL)
- fs.setIf(d&(1<<20) != 0, NX)
- fs.setIf(d&(1<<22) != 0, MMXEXT)
- fs.setIf(d&(1<<23) != 0, MMX)
- fs.setIf(d&(1<<24) != 0, FXSR)
- fs.setIf(d&(1<<25) != 0, FXSROPT)
- fs.setIf(d&(1<<27) != 0, RDTSCP)
- fs.setIf(d&(1<<30) != 0, AMD3DNOWEXT)
- fs.setIf(d&(1<<31) != 0, AMD3DNOW)
-
- /* XOP and FMA4 use the AVX instruction coding scheme, so they can't be
- * used unless the OS has AVX support. */
- if fs.inSet(AVX) {
- fs.setIf((c&(1<<11)) != 0, XOP)
- fs.setIf((c&(1<<16)) != 0, FMA4)
- }
-
- }
- if maxExtendedFunction() >= 0x80000007 {
- _, b, _, d := cpuid(0x80000007)
- fs.setIf((b&(1<<0)) != 0, MCAOVERFLOW)
- fs.setIf((b&(1<<1)) != 0, SUCCOR)
- fs.setIf((b&(1<<2)) != 0, HWA)
- fs.setIf((d&(1<<9)) != 0, CPBOOST)
- }
-
- if maxExtendedFunction() >= 0x80000008 {
- _, b, _, _ := cpuid(0x80000008)
- fs.setIf(b&(1<<28) != 0, PSFD)
- fs.setIf(b&(1<<27) != 0, CPPC)
- fs.setIf(b&(1<<24) != 0, SPEC_CTRL_SSBD)
- fs.setIf(b&(1<<23) != 0, PPIN)
- fs.setIf(b&(1<<21) != 0, TLB_FLUSH_NESTED)
- fs.setIf(b&(1<<20) != 0, EFER_LMSLE_UNS)
- fs.setIf(b&(1<<19) != 0, IBRS_PROVIDES_SMP)
- fs.setIf(b&(1<<18) != 0, IBRS_PREFERRED)
- fs.setIf(b&(1<<17) != 0, STIBP_ALWAYSON)
- fs.setIf(b&(1<<15) != 0, STIBP)
- fs.setIf(b&(1<<14) != 0, IBRS)
- fs.setIf((b&(1<<13)) != 0, INT_WBINVD)
- fs.setIf(b&(1<<12) != 0, IBPB)
- fs.setIf((b&(1<<9)) != 0, WBNOINVD)
- fs.setIf((b&(1<<8)) != 0, MCOMMIT)
- fs.setIf((b&(1<<4)) != 0, RDPRU)
- fs.setIf((b&(1<<3)) != 0, INVLPGB)
- fs.setIf((b&(1<<1)) != 0, MSRIRC)
- fs.setIf((b&(1<<0)) != 0, CLZERO)
- }
-
- if fs.inSet(SVM) && maxExtendedFunction() >= 0x8000000A {
- _, _, _, edx := cpuid(0x8000000A)
- fs.setIf((edx>>0)&1 == 1, SVMNP)
- fs.setIf((edx>>1)&1 == 1, LBRVIRT)
- fs.setIf((edx>>2)&1 == 1, SVML)
- fs.setIf((edx>>3)&1 == 1, NRIPS)
- fs.setIf((edx>>4)&1 == 1, TSCRATEMSR)
- fs.setIf((edx>>5)&1 == 1, VMCBCLEAN)
- fs.setIf((edx>>6)&1 == 1, SVMFBASID)
- fs.setIf((edx>>7)&1 == 1, SVMDA)
- fs.setIf((edx>>10)&1 == 1, SVMPF)
- fs.setIf((edx>>12)&1 == 1, SVMPFT)
- }
-
- if maxExtendedFunction() >= 0x8000001a {
- eax, _, _, _ := cpuid(0x8000001a)
- fs.setIf((eax>>0)&1 == 1, FP128)
- fs.setIf((eax>>1)&1 == 1, MOVU)
- fs.setIf((eax>>2)&1 == 1, FP256)
- }
-
- if maxExtendedFunction() >= 0x8000001b && fs.inSet(IBS) {
- eax, _, _, _ := cpuid(0x8000001b)
- fs.setIf((eax>>0)&1 == 1, IBSFFV)
- fs.setIf((eax>>1)&1 == 1, IBSFETCHSAM)
- fs.setIf((eax>>2)&1 == 1, IBSOPSAM)
- fs.setIf((eax>>3)&1 == 1, IBSRDWROPCNT)
- fs.setIf((eax>>4)&1 == 1, IBSOPCNT)
- fs.setIf((eax>>5)&1 == 1, IBSBRNTRGT)
- fs.setIf((eax>>6)&1 == 1, IBSOPCNTEXT)
- fs.setIf((eax>>7)&1 == 1, IBSRIPINVALIDCHK)
- fs.setIf((eax>>8)&1 == 1, IBS_OPFUSE)
- fs.setIf((eax>>9)&1 == 1, IBS_FETCH_CTLX)
- fs.setIf((eax>>10)&1 == 1, IBS_OPDATA4) // Doc says "Fixed,0. IBS op data 4 MSR supported", but assuming they mean 1.
- fs.setIf((eax>>11)&1 == 1, IBS_ZEN4)
- }
-
- if maxExtendedFunction() >= 0x8000001f && vend == AMD {
- a, _, _, _ := cpuid(0x8000001f)
- fs.setIf((a>>0)&1 == 1, SME)
- fs.setIf((a>>1)&1 == 1, SEV)
- fs.setIf((a>>2)&1 == 1, MSR_PAGEFLUSH)
- fs.setIf((a>>3)&1 == 1, SEV_ES)
- fs.setIf((a>>4)&1 == 1, SEV_SNP)
- fs.setIf((a>>5)&1 == 1, VMPL)
- fs.setIf((a>>10)&1 == 1, SME_COHERENT)
- fs.setIf((a>>11)&1 == 1, SEV_64BIT)
- fs.setIf((a>>12)&1 == 1, SEV_RESTRICTED)
- fs.setIf((a>>13)&1 == 1, SEV_ALTERNATIVE)
- fs.setIf((a>>14)&1 == 1, SEV_DEBUGSWAP)
- fs.setIf((a>>15)&1 == 1, IBS_PREVENTHOST)
- fs.setIf((a>>16)&1 == 1, VTE)
- fs.setIf((a>>24)&1 == 1, VMSA_REGPROT)
- }
-
- if maxExtendedFunction() >= 0x80000021 && vend == AMD {
- a, _, c, _ := cpuid(0x80000021)
- fs.setIf((a>>31)&1 == 1, SRSO_MSR_FIX)
- fs.setIf((a>>30)&1 == 1, SRSO_USER_KERNEL_NO)
- fs.setIf((a>>29)&1 == 1, SRSO_NO)
- fs.setIf((a>>28)&1 == 1, IBPB_BRTYPE)
- fs.setIf((a>>27)&1 == 1, SBPB)
- fs.setIf((c>>1)&1 == 1, TSA_L1_NO)
- fs.setIf((c>>2)&1 == 1, TSA_SQ_NO)
- fs.setIf((a>>5)&1 == 1, TSA_VERW_CLEAR)
- }
- if vend == AMD {
- if family < 0x19 {
- // AMD CPUs that are older than Family 19h are not vulnerable to TSA but do not set TSA_L1_NO or TSA_SQ_NO.
- // Source: https://www.amd.com/content/dam/amd/en/documents/resources/bulletin/technical-guidance-for-mitigating-transient-scheduler-attacks.pdf
- fs.set(TSA_L1_NO)
- fs.set(TSA_SQ_NO)
- } else if family == 0x1a {
- // AMD Family 1Ah models 00h-4Fh and 60h-7Fh are also not vulnerable to TSA but do not set TSA_L1_NO or TSA_SQ_NO.
- // Future AMD CPUs will set these CPUID bits if appropriate. CPUs will be designed to set these CPUID bits if appropriate.
- notVuln := model <= 0x4f || (model >= 0x60 && model <= 0x7f)
- fs.setIf(notVuln, TSA_L1_NO, TSA_SQ_NO)
- }
- }
-
- if mfi >= 0x20 {
- // Microsoft has decided to purposefully hide the information
- // of the guest TEE when VMs are being created using Hyper-V.
- //
- // This leads us to check for the Hyper-V cpuid features
- // (0x4000000C), and then for the `ebx` value set.
- //
- // For Intel TDX, `ebx` is set as `0xbe3`, being 3 the part
- // we're mostly interested about,according to:
- // https://github.com/torvalds/linux/blob/d2f51b3516dade79269ff45eae2a7668ae711b25/arch/x86/include/asm/hyperv-tlfs.h#L169-L174
- _, ebx, _, _ := cpuid(0x4000000C)
- fs.setIf(ebx == 0xbe3, TDX_GUEST)
- }
-
- if mfi >= 0x21 {
- // Intel Trusted Domain Extensions Guests have their own cpuid leaf (0x21).
- _, ebx, ecx, edx := cpuid(0x21)
- identity := string(valAsString(ebx, edx, ecx))
- fs.setIf(identity == "IntelTDX ", TDX_GUEST)
- }
-
- return fs
-}
-
-func (c *CPUInfo) supportAVX10() uint8 {
- if c.maxFunc >= 0x24 && c.featureSet.inSet(AVX10) {
- _, ebx, _, _ := cpuidex(0x24, 0)
- return uint8(ebx)
- }
- return 0
-}
-
-func valAsString(values ...uint32) []byte {
- r := make([]byte, 4*len(values))
- for i, v := range values {
- dst := r[i*4:]
- dst[0] = byte(v & 0xff)
- dst[1] = byte((v >> 8) & 0xff)
- dst[2] = byte((v >> 16) & 0xff)
- dst[3] = byte((v >> 24) & 0xff)
- switch {
- case dst[0] == 0:
- return r[:i*4]
- case dst[1] == 0:
- return r[:i*4+1]
- case dst[2] == 0:
- return r[:i*4+2]
- case dst[3] == 0:
- return r[:i*4+3]
- }
- }
- return r
-}
-
-func parseLeaf0AH(c *CPUInfo, eax, ebx, edx uint32) (info PerformanceMonitoringInfo) {
- info.VersionID = uint8(eax & 0xFF)
- info.NumGPCounters = uint8((eax >> 8) & 0xFF)
- info.GPPMCWidth = uint8((eax >> 16) & 0xFF)
-
- info.RawEBX = ebx
- info.RawEAX = eax
- info.RawEDX = edx
-
- if info.VersionID > 1 { // This information is only valid if VersionID > 1
- info.NumFixedPMC = uint8(edx & 0x1F) // Bits 4:0
- info.FixedPMCWidth = uint8((edx >> 5) & 0xFF) // Bits 12:5
- }
- if info.VersionID > 0 {
- // first 4 fixed events are always instructions retired, cycles, ref cycles and topdown slots
- if ebx == 0x0 && info.NumFixedPMC == 3 {
- c.featureSet.set(PMU_FIXEDCOUNTER_INSTRUCTIONS)
- c.featureSet.set(PMU_FIXEDCOUNTER_CYCLES)
- c.featureSet.set(PMU_FIXEDCOUNTER_REFCYCLES)
- }
- if ebx == 0x0 && info.NumFixedPMC == 4 {
- c.featureSet.set(PMU_FIXEDCOUNTER_INSTRUCTIONS)
- c.featureSet.set(PMU_FIXEDCOUNTER_CYCLES)
- c.featureSet.set(PMU_FIXEDCOUNTER_REFCYCLES)
- c.featureSet.set(PMU_FIXEDCOUNTER_TOPDOWN_SLOTS)
- }
- if ebx != 0x0 {
- if ((ebx >> 0) & 1) == 0 {
- c.featureSet.set(PMU_FIXEDCOUNTER_INSTRUCTIONS)
- }
- if ((ebx >> 1) & 1) == 0 {
- c.featureSet.set(PMU_FIXEDCOUNTER_CYCLES)
- }
- if ((ebx >> 2) & 1) == 0 {
- c.featureSet.set(PMU_FIXEDCOUNTER_REFCYCLES)
- }
- if ((ebx >> 3) & 1) == 0 {
- c.featureSet.set(PMU_FIXEDCOUNTER_TOPDOWN_SLOTS)
- }
- }
- }
- return info
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/cpuid_386.s b/vendor/github.com/klauspost/cpuid/v2/cpuid_386.s
deleted file mode 100644
index 8587c3a1f..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/cpuid_386.s
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-//+build 386,!gccgo,!noasm,!appengine
-
-// func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
-TEXT ·asmCpuid(SB), 7, $0
- XORL CX, CX
- MOVL op+0(FP), AX
- CPUID
- MOVL AX, eax+4(FP)
- MOVL BX, ebx+8(FP)
- MOVL CX, ecx+12(FP)
- MOVL DX, edx+16(FP)
- RET
-
-// func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
-TEXT ·asmCpuidex(SB), 7, $0
- MOVL op+0(FP), AX
- MOVL op2+4(FP), CX
- CPUID
- MOVL AX, eax+8(FP)
- MOVL BX, ebx+12(FP)
- MOVL CX, ecx+16(FP)
- MOVL DX, edx+20(FP)
- RET
-
-// func xgetbv(index uint32) (eax, edx uint32)
-TEXT ·asmXgetbv(SB), 7, $0
- MOVL index+0(FP), CX
- BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV
- MOVL AX, eax+4(FP)
- MOVL DX, edx+8(FP)
- RET
-
-// func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
-TEXT ·asmRdtscpAsm(SB), 7, $0
- BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP
- MOVL AX, eax+0(FP)
- MOVL BX, ebx+4(FP)
- MOVL CX, ecx+8(FP)
- MOVL DX, edx+12(FP)
- RET
-
-// func asmDarwinHasAVX512() bool
-TEXT ·asmDarwinHasAVX512(SB), 7, $0
- MOVL $0, eax+0(FP)
- RET
diff --git a/vendor/github.com/klauspost/cpuid/v2/cpuid_amd64.s b/vendor/github.com/klauspost/cpuid/v2/cpuid_amd64.s
deleted file mode 100644
index bc11f8942..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/cpuid_amd64.s
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-//+build amd64,!gccgo,!noasm,!appengine
-
-// func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
-TEXT ·asmCpuid(SB), 7, $0
- XORQ CX, CX
- MOVL op+0(FP), AX
- CPUID
- MOVL AX, eax+8(FP)
- MOVL BX, ebx+12(FP)
- MOVL CX, ecx+16(FP)
- MOVL DX, edx+20(FP)
- RET
-
-// func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
-TEXT ·asmCpuidex(SB), 7, $0
- MOVL op+0(FP), AX
- MOVL op2+4(FP), CX
- CPUID
- MOVL AX, eax+8(FP)
- MOVL BX, ebx+12(FP)
- MOVL CX, ecx+16(FP)
- MOVL DX, edx+20(FP)
- RET
-
-// func asmXgetbv(index uint32) (eax, edx uint32)
-TEXT ·asmXgetbv(SB), 7, $0
- MOVL index+0(FP), CX
- BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV
- MOVL AX, eax+8(FP)
- MOVL DX, edx+12(FP)
- RET
-
-// func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
-TEXT ·asmRdtscpAsm(SB), 7, $0
- BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP
- MOVL AX, eax+0(FP)
- MOVL BX, ebx+4(FP)
- MOVL CX, ecx+8(FP)
- MOVL DX, edx+12(FP)
- RET
-
-// From https://go-review.googlesource.com/c/sys/+/285572/
-// func asmDarwinHasAVX512() bool
-TEXT ·asmDarwinHasAVX512(SB), 7, $0-1
- MOVB $0, ret+0(FP) // default to false
-
-#ifdef GOOS_darwin // return if not darwin
-#ifdef GOARCH_amd64 // return if not amd64
-// These values from:
-// https://github.com/apple/darwin-xnu/blob/xnu-4570.1.46/osfmk/i386/cpu_capabilities.h
-#define commpage64_base_address 0x00007fffffe00000
-#define commpage64_cpu_capabilities64 (commpage64_base_address+0x010)
-#define commpage64_version (commpage64_base_address+0x01E)
-#define hasAVX512F 0x0000004000000000
- MOVQ $commpage64_version, BX
- MOVW (BX), AX
- CMPW AX, $13 // versions < 13 do not support AVX512
- JL no_avx512
- MOVQ $commpage64_cpu_capabilities64, BX
- MOVQ (BX), AX
- MOVQ $hasAVX512F, CX
- ANDQ CX, AX
- JZ no_avx512
- MOVB $1, ret+0(FP)
-
-no_avx512:
-#endif
-#endif
- RET
-
diff --git a/vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s b/vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s
deleted file mode 100644
index b196f78eb..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-//+build arm64,!gccgo,!noasm,!appengine
-
-// See https://www.kernel.org/doc/Documentation/arm64/cpu-feature-registers.txt
-
-// func getMidr
-TEXT ·getMidr(SB), 7, $0
- WORD $0xd5380000 // mrs x0, midr_el1 /* Main ID Register */
- MOVD R0, midr+0(FP)
- RET
-
-// func getProcFeatures
-TEXT ·getProcFeatures(SB), 7, $0
- WORD $0xd5380400 // mrs x0, id_aa64pfr0_el1 /* Processor Feature Register 0 */
- MOVD R0, procFeatures+0(FP)
- RET
-
-// func getInstAttributes
-TEXT ·getInstAttributes(SB), 7, $0
- WORD $0xd5380600 // mrs x0, id_aa64isar0_el1 /* Instruction Set Attribute Register 0 */
- WORD $0xd5380621 // mrs x1, id_aa64isar1_el1 /* Instruction Set Attribute Register 1 */
- MOVD R0, instAttrReg0+0(FP)
- MOVD R1, instAttrReg1+8(FP)
- RET
-
-TEXT ·getVectorLength(SB), 7, $0
- WORD $0xd2800002 // mov x2, #0
- WORD $0x04225022 // addvl x2, x2, #1
- WORD $0xd37df042 // lsl x2, x2, #3
- WORD $0xd2800003 // mov x3, #0
- WORD $0x04635023 // addpl x3, x3, #1
- WORD $0xd37df063 // lsl x3, x3, #3
- MOVD R2, vl+0(FP)
- MOVD R3, pl+8(FP)
- RET
diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go b/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go
deleted file mode 100644
index 9ae32d607..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-//go:build arm64 && !gccgo && !noasm && !appengine
-// +build arm64,!gccgo,!noasm,!appengine
-
-package cpuid
-
-import "runtime"
-
-func getMidr() (midr uint64)
-func getProcFeatures() (procFeatures uint64)
-func getInstAttributes() (instAttrReg0, instAttrReg1 uint64)
-func getVectorLength() (vl, pl uint64)
-
-func initCPU() {
- cpuid = func(uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
- cpuidex = func(x, y uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
- xgetbv = func(uint32) (a, b uint32) { return 0, 0 }
- rdtscpAsm = func() (a, b, c, d uint32) { return 0, 0, 0, 0 }
-}
-
-func addInfo(c *CPUInfo, safe bool) {
- // Seems to be safe to assume on ARM64
- c.CacheLine = 64
- detectOS(c)
-
- // ARM64 disabled since it may crash if interrupt is not intercepted by OS.
- if safe && !c.Has(ARMCPUID) && runtime.GOOS != "freebsd" {
- return
- }
- midr := getMidr()
-
- // MIDR_EL1 - Main ID Register
- // https://developer.arm.com/docs/ddi0595/h/aarch64-system-registers/midr_el1
- // x--------------------------------------------------x
- // | Name | bits | visible |
- // |--------------------------------------------------|
- // | Implementer | [31-24] | y |
- // |--------------------------------------------------|
- // | Variant | [23-20] | y |
- // |--------------------------------------------------|
- // | Architecture | [19-16] | y |
- // |--------------------------------------------------|
- // | PartNum | [15-4] | y |
- // |--------------------------------------------------|
- // | Revision | [3-0] | y |
- // x--------------------------------------------------x
-
- switch (midr >> 24) & 0xff {
- case 0xC0:
- c.VendorString = "Ampere Computing"
- c.VendorID = Ampere
- case 0x41:
- c.VendorString = "Arm Limited"
- c.VendorID = ARM
- case 0x42:
- c.VendorString = "Broadcom Corporation"
- c.VendorID = Broadcom
- case 0x43:
- c.VendorString = "Cavium Inc"
- c.VendorID = Cavium
- case 0x44:
- c.VendorString = "Digital Equipment Corporation"
- c.VendorID = DEC
- case 0x46:
- c.VendorString = "Fujitsu Ltd"
- c.VendorID = Fujitsu
- case 0x49:
- c.VendorString = "Infineon Technologies AG"
- c.VendorID = Infineon
- case 0x4D:
- c.VendorString = "Motorola or Freescale Semiconductor Inc"
- c.VendorID = Motorola
- case 0x4E:
- c.VendorString = "NVIDIA Corporation"
- c.VendorID = NVIDIA
- case 0x50:
- c.VendorString = "Applied Micro Circuits Corporation"
- c.VendorID = AMCC
- case 0x51:
- c.VendorString = "Qualcomm Inc"
- c.VendorID = Qualcomm
- case 0x56:
- c.VendorString = "Marvell International Ltd"
- c.VendorID = Marvell
- case 0x69:
- c.VendorString = "Intel Corporation"
- c.VendorID = Intel
- }
-
- // Lower 4 bits: Architecture
- // Architecture Meaning
- // 0b0001 Armv4.
- // 0b0010 Armv4T.
- // 0b0011 Armv5 (obsolete).
- // 0b0100 Armv5T.
- // 0b0101 Armv5TE.
- // 0b0110 Armv5TEJ.
- // 0b0111 Armv6.
- // 0b1111 Architectural features are individually identified in the ID_* registers, see 'ID registers'.
- // Upper 4 bit: Variant
- // An IMPLEMENTATION DEFINED variant number.
- // Typically, this field is used to distinguish between different product variants, or major revisions of a product.
- c.Family = int(midr>>16) & 0xff
-
- // PartNum, bits [15:4]
- // An IMPLEMENTATION DEFINED primary part number for the device.
- // On processors implemented by Arm, if the top four bits of the primary
- // part number are 0x0 or 0x7, the variant and architecture are encoded differently.
- // Revision, bits [3:0]
- // An IMPLEMENTATION DEFINED revision number for the device.
- c.Model = int(midr) & 0xffff
-
- procFeatures := getProcFeatures()
-
- // ID_AA64PFR0_EL1 - Processor Feature Register 0
- // x--------------------------------------------------x
- // | Name | bits | visible |
- // |--------------------------------------------------|
- // | DIT | [51-48] | y |
- // |--------------------------------------------------|
- // | SVE | [35-32] | y |
- // |--------------------------------------------------|
- // | GIC | [27-24] | n |
- // |--------------------------------------------------|
- // | AdvSIMD | [23-20] | y |
- // |--------------------------------------------------|
- // | FP | [19-16] | y |
- // |--------------------------------------------------|
- // | EL3 | [15-12] | n |
- // |--------------------------------------------------|
- // | EL2 | [11-8] | n |
- // |--------------------------------------------------|
- // | EL1 | [7-4] | n |
- // |--------------------------------------------------|
- // | EL0 | [3-0] | n |
- // x--------------------------------------------------x
-
- var f flagSet
- // if procFeatures&(0xf<<48) != 0 {
- // fmt.Println("DIT")
- // }
- f.setIf(procFeatures&(0xf<<32) != 0, SVE)
- if procFeatures&(0xf<<20) != 15<<20 {
- f.set(ASIMD)
- // https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64pfr0_el1
- // 0b0001 --> As for 0b0000, and also includes support for half-precision floating-point arithmetic.
- f.setIf(procFeatures&(0xf<<20) == 1<<20, FPHP, ASIMDHP)
- }
- f.setIf(procFeatures&(0xf<<16) != 0, FP)
-
- instAttrReg0, instAttrReg1 := getInstAttributes()
-
- // https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar0_el1
- //
- // ID_AA64ISAR0_EL1 - Instruction Set Attribute Register 0
- // x--------------------------------------------------x
- // | Name | bits | visible |
- // |--------------------------------------------------|
- // | RNDR | [63-60] | y |
- // |--------------------------------------------------|
- // | TLB | [59-56] | y |
- // |--------------------------------------------------|
- // | TS | [55-52] | y |
- // |--------------------------------------------------|
- // | FHM | [51-48] | y |
- // |--------------------------------------------------|
- // | DP | [47-44] | y |
- // |--------------------------------------------------|
- // | SM4 | [43-40] | y |
- // |--------------------------------------------------|
- // | SM3 | [39-36] | y |
- // |--------------------------------------------------|
- // | SHA3 | [35-32] | y |
- // |--------------------------------------------------|
- // | RDM | [31-28] | y |
- // |--------------------------------------------------|
- // | ATOMICS | [23-20] | y |
- // |--------------------------------------------------|
- // | CRC32 | [19-16] | y |
- // |--------------------------------------------------|
- // | SHA2 | [15-12] | y |
- // |--------------------------------------------------|
- // | SHA1 | [11-8] | y |
- // |--------------------------------------------------|
- // | AES | [7-4] | y |
- // x--------------------------------------------------x
-
- f.setIf(instAttrReg0&(0xf<<60) != 0, RNDR)
- f.setIf(instAttrReg0&(0xf<<56) != 0, TLB)
- f.setIf(instAttrReg0&(0xf<<52) != 0, TS)
- f.setIf(instAttrReg0&(0xf<<48) != 0, FHM)
- f.setIf(instAttrReg0&(0xf<<44) != 0, ASIMDDP)
- f.setIf(instAttrReg0&(0xf<<40) != 0, SM4)
- f.setIf(instAttrReg0&(0xf<<36) != 0, SM3)
- f.setIf(instAttrReg0&(0xf<<32) != 0, SHA3)
- f.setIf(instAttrReg0&(0xf<<28) != 0, ASIMDRDM)
- f.setIf(instAttrReg0&(0xf<<20) != 0, ATOMICS)
- f.setIf(instAttrReg0&(0xf<<16) != 0, CRC32)
- f.setIf(instAttrReg0&(0xf<<12) != 0, SHA2)
- // https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar0_el1
- // 0b0010 --> As 0b0001, plus SHA512H, SHA512H2, SHA512SU0, and SHA512SU1 instructions implemented.
- f.setIf(instAttrReg0&(0xf<<12) == 2<<12, SHA512)
- f.setIf(instAttrReg0&(0xf<<8) != 0, SHA1)
- f.setIf(instAttrReg0&(0xf<<4) != 0, AESARM)
- // https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar0_el1
- // 0b0010 --> As for 0b0001, plus PMULL/PMULL2 instructions operating on 64-bit data quantities.
- f.setIf(instAttrReg0&(0xf<<4) == 2<<4, PMULL)
-
- // https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar1_el1
- //
- // ID_AA64ISAR1_EL1 - Instruction set attribute register 1
- // x--------------------------------------------------x
- // | Name | bits | visible |
- // |--------------------------------------------------|
- // | GPI | [31-28] | y |
- // |--------------------------------------------------|
- // | GPA | [27-24] | y |
- // |--------------------------------------------------|
- // | LRCPC | [23-20] | y |
- // |--------------------------------------------------|
- // | FCMA | [19-16] | y |
- // |--------------------------------------------------|
- // | JSCVT | [15-12] | y |
- // |--------------------------------------------------|
- // | API | [11-8] | y |
- // |--------------------------------------------------|
- // | APA | [7-4] | y |
- // |--------------------------------------------------|
- // | DPB | [3-0] | y |
- // x--------------------------------------------------x
-
- // if instAttrReg1&(0xf<<28) != 0 {
- // fmt.Println("GPI")
- // }
- f.setIf(instAttrReg1&(0xf<<28) != 24, GPA)
- f.setIf(instAttrReg1&(0xf<<20) != 0, LRCPC)
- f.setIf(instAttrReg1&(0xf<<16) != 0, FCMA)
- f.setIf(instAttrReg1&(0xf<<12) != 0, JSCVT)
- // if instAttrReg1&(0xf<<8) != 0 {
- // fmt.Println("API")
- // }
- // if instAttrReg1&(0xf<<4) != 0 {
- // fmt.Println("APA")
- // }
- f.setIf(instAttrReg1&(0xf<<0) != 0, DCPOP)
-
- // Store
- c.featureSet.or(f)
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_ref.go b/vendor/github.com/klauspost/cpuid/v2/detect_ref.go
deleted file mode 100644
index 574f9389c..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/detect_ref.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-//go:build (!amd64 && !386 && !arm64) || gccgo || noasm || appengine
-// +build !amd64,!386,!arm64 gccgo noasm appengine
-
-package cpuid
-
-func initCPU() {
- cpuid = func(uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
- cpuidex = func(x, y uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
- xgetbv = func(uint32) (a, b uint32) { return 0, 0 }
- rdtscpAsm = func() (a, b, c, d uint32) { return 0, 0, 0, 0 }
-
-}
-
-func addInfo(info *CPUInfo, safe bool) {}
-func getVectorLength() (vl, pl uint64) { return 0, 0 }
diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_x86.go b/vendor/github.com/klauspost/cpuid/v2/detect_x86.go
deleted file mode 100644
index 14a56b930..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/detect_x86.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
-
-//go:build (386 && !gccgo && !noasm && !appengine) || (amd64 && !gccgo && !noasm && !appengine)
-// +build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine
-
-package cpuid
-
-func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
-func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
-func asmXgetbv(index uint32) (eax, edx uint32)
-func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
-func asmDarwinHasAVX512() bool
-
-func initCPU() {
- cpuid = asmCpuid
- cpuidex = asmCpuidex
- xgetbv = asmXgetbv
- rdtscpAsm = asmRdtscpAsm
- darwinHasAVX512 = asmDarwinHasAVX512
-}
-
-func addInfo(c *CPUInfo, safe bool) {
- c.maxFunc = maxFunctionID()
- c.maxExFunc = maxExtendedFunction()
- c.BrandName = brandName()
- c.CacheLine = cacheLine()
- c.Family, c.Model, c.Stepping = familyModel()
- c.featureSet = support()
- c.SGX = hasSGX(c.featureSet.inSet(SGX), c.featureSet.inSet(SGXLC))
- c.AMDMemEncryption = hasAMDMemEncryption(c.featureSet.inSet(SME) || c.featureSet.inSet(SEV))
- c.ThreadsPerCore = threadsPerCore()
- c.LogicalCores = logicalCores()
- c.PhysicalCores = physicalCores()
- c.VendorID, c.VendorString = vendorID()
- c.HypervisorVendorID, c.HypervisorVendorString = hypervisorVendorID()
- c.AVX10Level = c.supportAVX10()
- c.cacheSize()
- c.frequencies()
- if c.maxFunc >= 0x0A {
- eax, ebx, _, edx := cpuid(0x0A)
- c.PMU = parseLeaf0AH(c, eax, ebx, edx)
- }
-}
-
-func getVectorLength() (vl, pl uint64) { return 0, 0 }
diff --git a/vendor/github.com/klauspost/cpuid/v2/featureid_string.go b/vendor/github.com/klauspost/cpuid/v2/featureid_string.go
deleted file mode 100644
index 2888bae8f..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/featureid_string.go
+++ /dev/null
@@ -1,308 +0,0 @@
-// Code generated by "stringer -type=FeatureID,Vendor"; DO NOT EDIT.
-
-package cpuid
-
-import "strconv"
-
-func _() {
- // An "invalid array index" compiler error signifies that the constant values have changed.
- // Re-run the stringer command to generate them again.
- var x [1]struct{}
- _ = x[ADX-1]
- _ = x[AESNI-2]
- _ = x[AMD3DNOW-3]
- _ = x[AMD3DNOWEXT-4]
- _ = x[AMXBF16-5]
- _ = x[AMXFP16-6]
- _ = x[AMXINT8-7]
- _ = x[AMXFP8-8]
- _ = x[AMXTILE-9]
- _ = x[AMXTF32-10]
- _ = x[AMXCOMPLEX-11]
- _ = x[AMXTRANSPOSE-12]
- _ = x[APX_F-13]
- _ = x[AVX-14]
- _ = x[AVX10-15]
- _ = x[AVX10_128-16]
- _ = x[AVX10_256-17]
- _ = x[AVX10_512-18]
- _ = x[AVX2-19]
- _ = x[AVX512BF16-20]
- _ = x[AVX512BITALG-21]
- _ = x[AVX512BW-22]
- _ = x[AVX512CD-23]
- _ = x[AVX512DQ-24]
- _ = x[AVX512ER-25]
- _ = x[AVX512F-26]
- _ = x[AVX512FP16-27]
- _ = x[AVX512IFMA-28]
- _ = x[AVX512PF-29]
- _ = x[AVX512VBMI-30]
- _ = x[AVX512VBMI2-31]
- _ = x[AVX512VL-32]
- _ = x[AVX512VNNI-33]
- _ = x[AVX512VP2INTERSECT-34]
- _ = x[AVX512VPOPCNTDQ-35]
- _ = x[AVXIFMA-36]
- _ = x[AVXNECONVERT-37]
- _ = x[AVXSLOW-38]
- _ = x[AVXVNNI-39]
- _ = x[AVXVNNIINT8-40]
- _ = x[AVXVNNIINT16-41]
- _ = x[BHI_CTRL-42]
- _ = x[BMI1-43]
- _ = x[BMI2-44]
- _ = x[CETIBT-45]
- _ = x[CETSS-46]
- _ = x[CLDEMOTE-47]
- _ = x[CLMUL-48]
- _ = x[CLZERO-49]
- _ = x[CMOV-50]
- _ = x[CMPCCXADD-51]
- _ = x[CMPSB_SCADBS_SHORT-52]
- _ = x[CMPXCHG8-53]
- _ = x[CPBOOST-54]
- _ = x[CPPC-55]
- _ = x[CX16-56]
- _ = x[EFER_LMSLE_UNS-57]
- _ = x[ENQCMD-58]
- _ = x[ERMS-59]
- _ = x[F16C-60]
- _ = x[FLUSH_L1D-61]
- _ = x[FMA3-62]
- _ = x[FMA4-63]
- _ = x[FP128-64]
- _ = x[FP256-65]
- _ = x[FSRM-66]
- _ = x[FXSR-67]
- _ = x[FXSROPT-68]
- _ = x[GFNI-69]
- _ = x[HLE-70]
- _ = x[HRESET-71]
- _ = x[HTT-72]
- _ = x[HWA-73]
- _ = x[HYBRID_CPU-74]
- _ = x[HYPERVISOR-75]
- _ = x[IA32_ARCH_CAP-76]
- _ = x[IA32_CORE_CAP-77]
- _ = x[IBPB-78]
- _ = x[IBPB_BRTYPE-79]
- _ = x[IBRS-80]
- _ = x[IBRS_PREFERRED-81]
- _ = x[IBRS_PROVIDES_SMP-82]
- _ = x[IBS-83]
- _ = x[IBSBRNTRGT-84]
- _ = x[IBSFETCHSAM-85]
- _ = x[IBSFFV-86]
- _ = x[IBSOPCNT-87]
- _ = x[IBSOPCNTEXT-88]
- _ = x[IBSOPSAM-89]
- _ = x[IBSRDWROPCNT-90]
- _ = x[IBSRIPINVALIDCHK-91]
- _ = x[IBS_FETCH_CTLX-92]
- _ = x[IBS_OPDATA4-93]
- _ = x[IBS_OPFUSE-94]
- _ = x[IBS_PREVENTHOST-95]
- _ = x[IBS_ZEN4-96]
- _ = x[IDPRED_CTRL-97]
- _ = x[INT_WBINVD-98]
- _ = x[INVLPGB-99]
- _ = x[KEYLOCKER-100]
- _ = x[KEYLOCKERW-101]
- _ = x[LAHF-102]
- _ = x[LAM-103]
- _ = x[LBRVIRT-104]
- _ = x[LZCNT-105]
- _ = x[MCAOVERFLOW-106]
- _ = x[MCDT_NO-107]
- _ = x[MCOMMIT-108]
- _ = x[MD_CLEAR-109]
- _ = x[MMX-110]
- _ = x[MMXEXT-111]
- _ = x[MOVBE-112]
- _ = x[MOVDIR64B-113]
- _ = x[MOVDIRI-114]
- _ = x[MOVSB_ZL-115]
- _ = x[MOVU-116]
- _ = x[MPX-117]
- _ = x[MSRIRC-118]
- _ = x[MSRLIST-119]
- _ = x[MSR_PAGEFLUSH-120]
- _ = x[NRIPS-121]
- _ = x[NX-122]
- _ = x[OSXSAVE-123]
- _ = x[PCONFIG-124]
- _ = x[POPCNT-125]
- _ = x[PPIN-126]
- _ = x[PREFETCHI-127]
- _ = x[PSFD-128]
- _ = x[RDPRU-129]
- _ = x[RDRAND-130]
- _ = x[RDSEED-131]
- _ = x[RDTSCP-132]
- _ = x[RRSBA_CTRL-133]
- _ = x[RTM-134]
- _ = x[RTM_ALWAYS_ABORT-135]
- _ = x[SBPB-136]
- _ = x[SERIALIZE-137]
- _ = x[SEV-138]
- _ = x[SEV_64BIT-139]
- _ = x[SEV_ALTERNATIVE-140]
- _ = x[SEV_DEBUGSWAP-141]
- _ = x[SEV_ES-142]
- _ = x[SEV_RESTRICTED-143]
- _ = x[SEV_SNP-144]
- _ = x[SGX-145]
- _ = x[SGXLC-146]
- _ = x[SGXPQC-147]
- _ = x[SHA-148]
- _ = x[SME-149]
- _ = x[SME_COHERENT-150]
- _ = x[SM3_X86-151]
- _ = x[SM4_X86-152]
- _ = x[SPEC_CTRL_SSBD-153]
- _ = x[SRBDS_CTRL-154]
- _ = x[SRSO_MSR_FIX-155]
- _ = x[SRSO_NO-156]
- _ = x[SRSO_USER_KERNEL_NO-157]
- _ = x[SSE-158]
- _ = x[SSE2-159]
- _ = x[SSE3-160]
- _ = x[SSE4-161]
- _ = x[SSE42-162]
- _ = x[SSE4A-163]
- _ = x[SSSE3-164]
- _ = x[STIBP-165]
- _ = x[STIBP_ALWAYSON-166]
- _ = x[STOSB_SHORT-167]
- _ = x[SUCCOR-168]
- _ = x[SVM-169]
- _ = x[SVMDA-170]
- _ = x[SVMFBASID-171]
- _ = x[SVML-172]
- _ = x[SVMNP-173]
- _ = x[SVMPF-174]
- _ = x[SVMPFT-175]
- _ = x[SYSCALL-176]
- _ = x[SYSEE-177]
- _ = x[TBM-178]
- _ = x[TDX_GUEST-179]
- _ = x[TLB_FLUSH_NESTED-180]
- _ = x[TME-181]
- _ = x[TOPEXT-182]
- _ = x[TSA_L1_NO-183]
- _ = x[TSA_SQ_NO-184]
- _ = x[TSA_VERW_CLEAR-185]
- _ = x[TSCRATEMSR-186]
- _ = x[TSXLDTRK-187]
- _ = x[VAES-188]
- _ = x[VMCBCLEAN-189]
- _ = x[VMPL-190]
- _ = x[VMSA_REGPROT-191]
- _ = x[VMX-192]
- _ = x[VPCLMULQDQ-193]
- _ = x[VTE-194]
- _ = x[WAITPKG-195]
- _ = x[WBNOINVD-196]
- _ = x[WRMSRNS-197]
- _ = x[X87-198]
- _ = x[XGETBV1-199]
- _ = x[XOP-200]
- _ = x[XSAVE-201]
- _ = x[XSAVEC-202]
- _ = x[XSAVEOPT-203]
- _ = x[XSAVES-204]
- _ = x[AESARM-205]
- _ = x[ARMCPUID-206]
- _ = x[ASIMD-207]
- _ = x[ASIMDDP-208]
- _ = x[ASIMDHP-209]
- _ = x[ASIMDRDM-210]
- _ = x[ATOMICS-211]
- _ = x[CRC32-212]
- _ = x[DCPOP-213]
- _ = x[EVTSTRM-214]
- _ = x[FCMA-215]
- _ = x[FHM-216]
- _ = x[FP-217]
- _ = x[FPHP-218]
- _ = x[GPA-219]
- _ = x[JSCVT-220]
- _ = x[LRCPC-221]
- _ = x[PMULL-222]
- _ = x[RNDR-223]
- _ = x[TLB-224]
- _ = x[TS-225]
- _ = x[SHA1-226]
- _ = x[SHA2-227]
- _ = x[SHA3-228]
- _ = x[SHA512-229]
- _ = x[SM3-230]
- _ = x[SM4-231]
- _ = x[SVE-232]
- _ = x[PMU_FIXEDCOUNTER_CYCLES-233]
- _ = x[PMU_FIXEDCOUNTER_REFCYCLES-234]
- _ = x[PMU_FIXEDCOUNTER_INSTRUCTIONS-235]
- _ = x[PMU_FIXEDCOUNTER_TOPDOWN_SLOTS-236]
- _ = x[lastID-237]
- _ = x[firstID-0]
-}
-
-const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXFP8AMXTILEAMXTF32AMXCOMPLEXAMXTRANSPOSEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8AVXVNNIINT16BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSGXPQCSHASMESME_COHERENTSM3_X86SM4_X86SPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSA_L1_NOTSA_SQ_NOTSA_VERW_CLEARTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFHMFPFPHPGPAJSCVTLRCPCPMULLRNDRTLBTSSHA1SHA2SHA3SHA512SM3SM4SVEPMU_FIXEDCOUNTER_CYCLESPMU_FIXEDCOUNTER_REFCYCLESPMU_FIXEDCOUNTER_INSTRUCTIONSPMU_FIXEDCOUNTER_TOPDOWN_SLOTSlastID"
-
-var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 61, 68, 75, 85, 97, 102, 105, 110, 119, 128, 137, 141, 151, 163, 171, 179, 187, 195, 202, 212, 222, 230, 240, 251, 259, 269, 287, 302, 309, 321, 328, 335, 346, 358, 366, 370, 374, 380, 385, 393, 398, 404, 408, 417, 435, 443, 450, 454, 458, 472, 478, 482, 486, 495, 499, 503, 508, 513, 517, 521, 528, 532, 535, 541, 544, 547, 557, 567, 580, 593, 597, 608, 612, 626, 643, 646, 656, 667, 673, 681, 692, 700, 712, 728, 742, 753, 763, 778, 786, 797, 807, 814, 823, 833, 837, 840, 847, 852, 863, 870, 877, 885, 888, 894, 899, 908, 915, 923, 927, 930, 936, 943, 956, 961, 963, 970, 977, 983, 987, 996, 1000, 1005, 1011, 1017, 1023, 1033, 1036, 1052, 1056, 1065, 1068, 1077, 1092, 1105, 1111, 1125, 1132, 1135, 1140, 1146, 1149, 1152, 1164, 1171, 1178, 1192, 1202, 1214, 1221, 1240, 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1289, 1300, 1306, 1309, 1314, 1323, 1327, 1332, 1337, 1343, 1350, 1355, 1358, 1367, 1383, 1386, 1392, 1401, 1410, 1424, 1434, 1442, 1446, 1455, 1459, 1471, 1474, 1484, 1487, 1494, 1502, 1509, 1512, 1519, 1522, 1527, 1533, 1541, 1547, 1553, 1561, 1566, 1573, 1580, 1588, 1595, 1600, 1605, 1612, 1616, 1619, 1621, 1625, 1628, 1633, 1638, 1643, 1647, 1650, 1652, 1656, 1660, 1664, 1670, 1673, 1676, 1679, 1702, 1728, 1757, 1787, 1793}
-
-func (i FeatureID) String() string {
- if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
- return "FeatureID(" + strconv.FormatInt(int64(i), 10) + ")"
- }
- return _FeatureID_name[_FeatureID_index[i]:_FeatureID_index[i+1]]
-}
-func _() {
- // An "invalid array index" compiler error signifies that the constant values have changed.
- // Re-run the stringer command to generate them again.
- var x [1]struct{}
- _ = x[VendorUnknown-0]
- _ = x[Intel-1]
- _ = x[AMD-2]
- _ = x[VIA-3]
- _ = x[Transmeta-4]
- _ = x[NSC-5]
- _ = x[KVM-6]
- _ = x[MSVM-7]
- _ = x[VMware-8]
- _ = x[XenHVM-9]
- _ = x[Bhyve-10]
- _ = x[Hygon-11]
- _ = x[SiS-12]
- _ = x[RDC-13]
- _ = x[Ampere-14]
- _ = x[ARM-15]
- _ = x[Broadcom-16]
- _ = x[Cavium-17]
- _ = x[DEC-18]
- _ = x[Fujitsu-19]
- _ = x[Infineon-20]
- _ = x[Motorola-21]
- _ = x[NVIDIA-22]
- _ = x[AMCC-23]
- _ = x[Qualcomm-24]
- _ = x[Marvell-25]
- _ = x[QEMU-26]
- _ = x[QNX-27]
- _ = x[ACRN-28]
- _ = x[SRE-29]
- _ = x[Apple-30]
- _ = x[lastVendor-31]
-}
-
-const _Vendor_name = "VendorUnknownIntelAMDVIATransmetaNSCKVMMSVMVMwareXenHVMBhyveHygonSiSRDCAmpereARMBroadcomCaviumDECFujitsuInfineonMotorolaNVIDIAAMCCQualcommMarvellQEMUQNXACRNSREApplelastVendor"
-
-var _Vendor_index = [...]uint8{0, 13, 18, 21, 24, 33, 36, 39, 43, 49, 55, 60, 65, 68, 71, 77, 80, 88, 94, 97, 104, 112, 120, 126, 130, 138, 145, 149, 152, 156, 159, 164, 174}
-
-func (i Vendor) String() string {
- if i < 0 || i >= Vendor(len(_Vendor_index)-1) {
- return "Vendor(" + strconv.FormatInt(int64(i), 10) + ")"
- }
- return _Vendor_name[_Vendor_index[i]:_Vendor_index[i+1]]
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go
deleted file mode 100644
index da07522e7..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
-
-package cpuid
-
-import (
- "runtime"
- "strings"
-
- "golang.org/x/sys/unix"
-)
-
-func detectOS(c *CPUInfo) bool {
- if runtime.GOOS != "ios" {
- tryToFillCPUInfoFomSysctl(c)
- }
- // There are no hw.optional sysctl values for the below features on Mac OS 11.0
- // to detect their supported state dynamically. Assume the CPU features that
- // Apple Silicon M1 supports to be available as a minimal set of features
- // to all Go programs running on darwin/arm64.
- // TODO: Add more if we know them.
- c.featureSet.setIf(runtime.GOOS != "ios", AESARM, PMULL, SHA1, SHA2)
-
- return true
-}
-
-func sysctlGetBool(name string) bool {
- value, err := unix.SysctlUint32(name)
- if err != nil {
- return false
- }
- return value != 0
-}
-
-func sysctlGetString(name string) string {
- value, err := unix.Sysctl(name)
- if err != nil {
- return ""
- }
- return value
-}
-
-func sysctlGetInt(unknown int, names ...string) int {
- for _, name := range names {
- value, err := unix.SysctlUint32(name)
- if err != nil {
- continue
- }
- if value != 0 {
- return int(value)
- }
- }
- return unknown
-}
-
-func sysctlGetInt64(unknown int, names ...string) int {
- for _, name := range names {
- value64, err := unix.SysctlUint64(name)
- if err != nil {
- continue
- }
- if int(value64) != unknown {
- return int(value64)
- }
- }
- return unknown
-}
-
-func setFeature(c *CPUInfo, feature FeatureID, aliases ...string) {
- for _, alias := range aliases {
- set := sysctlGetBool(alias)
- c.featureSet.setIf(set, feature)
- if set {
- break
- }
- }
-}
-
-func tryToFillCPUInfoFomSysctl(c *CPUInfo) {
- c.BrandName = sysctlGetString("machdep.cpu.brand_string")
-
- if len(c.BrandName) != 0 {
- c.VendorString = strings.Fields(c.BrandName)[0]
- }
-
- c.PhysicalCores = sysctlGetInt(runtime.NumCPU(), "hw.physicalcpu")
- c.ThreadsPerCore = sysctlGetInt(1, "machdep.cpu.thread_count", "kern.num_threads") /
- sysctlGetInt(1, "hw.physicalcpu")
- c.LogicalCores = sysctlGetInt(runtime.NumCPU(), "machdep.cpu.core_count")
- c.Family = sysctlGetInt(0, "machdep.cpu.family", "hw.cpufamily")
- c.Model = sysctlGetInt(0, "machdep.cpu.model")
- c.CacheLine = sysctlGetInt64(0, "hw.cachelinesize")
- c.Cache.L1I = sysctlGetInt64(-1, "hw.l1icachesize")
- c.Cache.L1D = sysctlGetInt64(-1, "hw.l1dcachesize")
- c.Cache.L2 = sysctlGetInt64(-1, "hw.l2cachesize")
- c.Cache.L3 = sysctlGetInt64(-1, "hw.l3cachesize")
-
- // ARM features:
- //
- // Note: On some Apple Silicon system, some feats have aliases. See:
- // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
- // When so, we look at all aliases and consider a feature available when at least one identifier matches.
- setFeature(c, AESARM, "hw.optional.arm.FEAT_AES") // AES instructions
- setFeature(c, ASIMD, "hw.optional.arm.AdvSIMD", "hw.optional.neon") // Advanced SIMD
- setFeature(c, ASIMDDP, "hw.optional.arm.FEAT_DotProd") // SIMD Dot Product
- setFeature(c, ASIMDHP, "hw.optional.arm.AdvSIMD_HPFPCvt", "hw.optional.neon_hpfp") // Advanced SIMD half-precision floating point
- setFeature(c, ASIMDRDM, "hw.optional.arm.FEAT_RDM") // Rounding Double Multiply Accumulate/Subtract
- setFeature(c, ATOMICS, "hw.optional.arm.FEAT_LSE", "hw.optional.armv8_1_atomics") // Large System Extensions (LSE)
- setFeature(c, CRC32, "hw.optional.arm.FEAT_CRC32", "hw.optional.armv8_crc32") // CRC32/CRC32C instructions
- setFeature(c, DCPOP, "hw.optional.arm.FEAT_DPB") // Data cache clean to Point of Persistence (DC CVAP)
- setFeature(c, EVTSTRM, "hw.optional.arm.FEAT_ECV") // Generic timer
- setFeature(c, FCMA, "hw.optional.arm.FEAT_FCMA", "hw.optional.armv8_3_compnum") // Floating point complex number addition and multiplication
- setFeature(c, FHM, "hw.optional.armv8_2_fhm", "hw.optional.arm.FEAT_FHM") // FMLAL and FMLSL instructions
- setFeature(c, FP, "hw.optional.floatingpoint") // Single-precision and double-precision floating point
- setFeature(c, FPHP, "hw.optional.arm.FEAT_FP16", "hw.optional.neon_fp16") // Half-precision floating point
- setFeature(c, GPA, "hw.optional.arm.FEAT_PAuth") // Generic Pointer Authentication
- setFeature(c, JSCVT, "hw.optional.arm.FEAT_JSCVT") // Javascript-style double->int convert (FJCVTZS)
- setFeature(c, LRCPC, "hw.optional.arm.FEAT_LRCPC") // Weaker release consistency (LDAPR, etc)
- setFeature(c, PMULL, "hw.optional.arm.FEAT_PMULL") // Polynomial Multiply instructions (PMULL/PMULL2)
- setFeature(c, RNDR, "hw.optional.arm.FEAT_RNG") // Random Number instructions
- setFeature(c, TLB, "hw.optional.arm.FEAT_TLBIOS", "hw.optional.arm.FEAT_TLBIRANGE") // Outer Shareable and TLB range maintenance instructions
- setFeature(c, TS, "hw.optional.arm.FEAT_FlagM", "hw.optional.arm.FEAT_FlagM2") // Flag manipulation instructions
- setFeature(c, SHA1, "hw.optional.arm.FEAT_SHA1") // SHA-1 instructions (SHA1C, etc)
- setFeature(c, SHA2, "hw.optional.arm.FEAT_SHA256") // SHA-2 instructions (SHA256H, etc)
- setFeature(c, SHA3, "hw.optional.arm.FEAT_SHA3") // SHA-3 instructions (EOR3, RAXI, XAR, BCAX)
- setFeature(c, SHA512, "hw.optional.arm.FEAT_SHA512") // SHA512 instructions
- setFeature(c, SM3, "hw.optional.arm.FEAT_SM3") // SM3 instructions
- setFeature(c, SM4, "hw.optional.arm.FEAT_SM4") // SM4 instructions
- setFeature(c, SVE, "hw.optional.arm.FEAT_SVE") // Scalable Vector Extension
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go
deleted file mode 100644
index d96d24438..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
-
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file located
-// here https://github.com/golang/sys/blob/master/LICENSE
-
-package cpuid
-
-import (
- "encoding/binary"
- "io/ioutil"
- "runtime"
-)
-
-// HWCAP bits.
-const (
- hwcap_FP = 1 << 0
- hwcap_ASIMD = 1 << 1
- hwcap_EVTSTRM = 1 << 2
- hwcap_AES = 1 << 3
- hwcap_PMULL = 1 << 4
- hwcap_SHA1 = 1 << 5
- hwcap_SHA2 = 1 << 6
- hwcap_CRC32 = 1 << 7
- hwcap_ATOMICS = 1 << 8
- hwcap_FPHP = 1 << 9
- hwcap_ASIMDHP = 1 << 10
- hwcap_CPUID = 1 << 11
- hwcap_ASIMDRDM = 1 << 12
- hwcap_JSCVT = 1 << 13
- hwcap_FCMA = 1 << 14
- hwcap_LRCPC = 1 << 15
- hwcap_DCPOP = 1 << 16
- hwcap_SHA3 = 1 << 17
- hwcap_SM3 = 1 << 18
- hwcap_SM4 = 1 << 19
- hwcap_ASIMDDP = 1 << 20
- hwcap_SHA512 = 1 << 21
- hwcap_SVE = 1 << 22
- hwcap_ASIMDFHM = 1 << 23
- hwcap_DIT = 1 << 24
- hwcap_USCAT = 1 << 25
- hwcap_ILRCPC = 1 << 26
- hwcap_FLAGM = 1 << 27
- hwcap_SSBS = 1 << 28
- hwcap_SB = 1 << 29
- hwcap_PACA = 1 << 30
- hwcap_PACG = 1 << 31
- hwcap_GCS = 1 << 32
-
- hwcap2_DCPODP = 1 << 0
- hwcap2_SVE2 = 1 << 1
- hwcap2_SVEAES = 1 << 2
- hwcap2_SVEPMULL = 1 << 3
- hwcap2_SVEBITPERM = 1 << 4
- hwcap2_SVESHA3 = 1 << 5
- hwcap2_SVESM4 = 1 << 6
- hwcap2_FLAGM2 = 1 << 7
- hwcap2_FRINT = 1 << 8
- hwcap2_SVEI8MM = 1 << 9
- hwcap2_SVEF32MM = 1 << 10
- hwcap2_SVEF64MM = 1 << 11
- hwcap2_SVEBF16 = 1 << 12
- hwcap2_I8MM = 1 << 13
- hwcap2_BF16 = 1 << 14
- hwcap2_DGH = 1 << 15
- hwcap2_RNG = 1 << 16
- hwcap2_BTI = 1 << 17
- hwcap2_MTE = 1 << 18
- hwcap2_ECV = 1 << 19
- hwcap2_AFP = 1 << 20
- hwcap2_RPRES = 1 << 21
- hwcap2_MTE3 = 1 << 22
- hwcap2_SME = 1 << 23
- hwcap2_SME_I16I64 = 1 << 24
- hwcap2_SME_F64F64 = 1 << 25
- hwcap2_SME_I8I32 = 1 << 26
- hwcap2_SME_F16F32 = 1 << 27
- hwcap2_SME_B16F32 = 1 << 28
- hwcap2_SME_F32F32 = 1 << 29
- hwcap2_SME_FA64 = 1 << 30
- hwcap2_WFXT = 1 << 31
- hwcap2_EBF16 = 1 << 32
- hwcap2_SVE_EBF16 = 1 << 33
- hwcap2_CSSC = 1 << 34
- hwcap2_RPRFM = 1 << 35
- hwcap2_SVE2P1 = 1 << 36
- hwcap2_SME2 = 1 << 37
- hwcap2_SME2P1 = 1 << 38
- hwcap2_SME_I16I32 = 1 << 39
- hwcap2_SME_BI32I32 = 1 << 40
- hwcap2_SME_B16B16 = 1 << 41
- hwcap2_SME_F16F16 = 1 << 42
- hwcap2_MOPS = 1 << 43
- hwcap2_HBC = 1 << 44
- hwcap2_SVE_B16B16 = 1 << 45
- hwcap2_LRCPC3 = 1 << 46
- hwcap2_LSE128 = 1 << 47
- hwcap2_FPMR = 1 << 48
- hwcap2_LUT = 1 << 49
- hwcap2_FAMINMAX = 1 << 50
- hwcap2_F8CVT = 1 << 51
- hwcap2_F8FMA = 1 << 52
- hwcap2_F8DP4 = 1 << 53
- hwcap2_F8DP2 = 1 << 54
- hwcap2_F8E4M3 = 1 << 55
- hwcap2_F8E5M2 = 1 << 56
- hwcap2_SME_LUTV2 = 1 << 57
- hwcap2_SME_F8F16 = 1 << 58
- hwcap2_SME_F8F32 = 1 << 59
- hwcap2_SME_SF8FMA = 1 << 60
- hwcap2_SME_SF8DP4 = 1 << 61
- hwcap2_SME_SF8DP2 = 1 << 62
- hwcap2_POE = 1 << 63
-)
-
-func detectOS(c *CPUInfo) bool {
- // For now assuming no hyperthreading is reasonable.
- c.LogicalCores = runtime.NumCPU()
- c.PhysicalCores = c.LogicalCores
- c.ThreadsPerCore = 1
- if hwcap == 0 {
- // We did not get values from the runtime.
- // Try reading /proc/self/auxv
-
- // From https://github.com/golang/sys
- const (
- _AT_HWCAP = 16
- _AT_HWCAP2 = 26
-
- uintSize = int(32 << (^uint(0) >> 63))
- )
-
- buf, err := ioutil.ReadFile("/proc/self/auxv")
- if err != nil {
- // e.g. on android /proc/self/auxv is not accessible, so silently
- // ignore the error and leave Initialized = false. On some
- // architectures (e.g. arm64) doinit() implements a fallback
- // readout and will set Initialized = true again.
- return false
- }
- bo := binary.LittleEndian
- for len(buf) >= 2*(uintSize/8) {
- var tag, val uint
- switch uintSize {
- case 32:
- tag = uint(bo.Uint32(buf[0:]))
- val = uint(bo.Uint32(buf[4:]))
- buf = buf[8:]
- case 64:
- tag = uint(bo.Uint64(buf[0:]))
- val = uint(bo.Uint64(buf[8:]))
- buf = buf[16:]
- }
- switch tag {
- case _AT_HWCAP:
- hwcap = val
- case _AT_HWCAP2:
- // Not used
- }
- }
- if hwcap == 0 {
- return false
- }
- }
-
- // HWCap was populated by the runtime from the auxiliary vector.
- // Use HWCap information since reading aarch64 system registers
- // is not supported in user space on older linux kernels.
- c.featureSet.setIf(isSet(hwcap, hwcap_AES), AESARM)
- c.featureSet.setIf(isSet(hwcap, hwcap_ASIMD), ASIMD)
- c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDDP), ASIMDDP)
- c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDHP), ASIMDHP)
- c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDRDM), ASIMDRDM)
- c.featureSet.setIf(isSet(hwcap, hwcap_CPUID), ARMCPUID)
- c.featureSet.setIf(isSet(hwcap, hwcap_CRC32), CRC32)
- c.featureSet.setIf(isSet(hwcap, hwcap_DCPOP), DCPOP)
- c.featureSet.setIf(isSet(hwcap, hwcap_EVTSTRM), EVTSTRM)
- c.featureSet.setIf(isSet(hwcap, hwcap_FCMA), FCMA)
- c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDFHM), FHM)
- c.featureSet.setIf(isSet(hwcap, hwcap_FP), FP)
- c.featureSet.setIf(isSet(hwcap, hwcap_FPHP), FPHP)
- c.featureSet.setIf(isSet(hwcap, hwcap_JSCVT), JSCVT)
- c.featureSet.setIf(isSet(hwcap, hwcap_LRCPC), LRCPC)
- c.featureSet.setIf(isSet(hwcap, hwcap_PMULL), PMULL)
- c.featureSet.setIf(isSet(hwcap, hwcap2_RNG), RNDR)
- // c.featureSet.setIf(isSet(hwcap, hwcap_), TLB)
- // c.featureSet.setIf(isSet(hwcap, hwcap_), TS)
- c.featureSet.setIf(isSet(hwcap, hwcap_SHA1), SHA1)
- c.featureSet.setIf(isSet(hwcap, hwcap_SHA2), SHA2)
- c.featureSet.setIf(isSet(hwcap, hwcap_SHA3), SHA3)
- c.featureSet.setIf(isSet(hwcap, hwcap_SHA512), SHA512)
- c.featureSet.setIf(isSet(hwcap, hwcap_SM3), SM3)
- c.featureSet.setIf(isSet(hwcap, hwcap_SM4), SM4)
- c.featureSet.setIf(isSet(hwcap, hwcap_SVE), SVE)
-
- // The Samsung S9+ kernel reports support for atomics, but not all cores
- // actually support them, resulting in SIGILL. See issue #28431.
- // TODO(elias.naur): Only disable the optimization on bad chipsets on android.
- c.featureSet.setIf(isSet(hwcap, hwcap_ATOMICS) && runtime.GOOS != "android", ATOMICS)
-
- return true
-}
-
-func isSet(hwc uint, value uint) bool {
- return hwc&value != 0
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go
deleted file mode 100644
index 8733ba343..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
-
-//go:build arm64 && !linux && !darwin
-// +build arm64,!linux,!darwin
-
-package cpuid
-
-import "runtime"
-
-func detectOS(c *CPUInfo) bool {
- c.PhysicalCores = runtime.NumCPU()
- // For now assuming 1 thread per core...
- c.ThreadsPerCore = 1
- c.LogicalCores = c.PhysicalCores
- return false
-}
diff --git a/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go
deleted file mode 100644
index f8f201b5f..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
-
-//go:build nounsafe
-// +build nounsafe
-
-package cpuid
-
-var hwcap uint
diff --git a/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go
deleted file mode 100644
index 92af622eb..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
-
-//go:build !nounsafe
-// +build !nounsafe
-
-package cpuid
-
-import _ "unsafe" // needed for go:linkname
-
-//go:linkname hwcap internal/cpu.HWCap
-var hwcap uint
diff --git a/vendor/github.com/klauspost/cpuid/v2/test-architectures.sh b/vendor/github.com/klauspost/cpuid/v2/test-architectures.sh
deleted file mode 100644
index 471d986d2..000000000
--- a/vendor/github.com/klauspost/cpuid/v2/test-architectures.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-set -e
-
-go tool dist list | while IFS=/ read os arch; do
- echo "Checking $os/$arch..."
- echo " normal"
- GOARCH=$arch GOOS=$os go build -o /dev/null .
- echo " noasm"
- GOARCH=$arch GOOS=$os go build -tags noasm -o /dev/null .
- echo " appengine"
- GOARCH=$arch GOOS=$os go build -tags appengine -o /dev/null .
- echo " noasm,appengine"
- GOARCH=$arch GOOS=$os go build -tags 'appengine noasm' -o /dev/null .
-done
diff --git a/vendor/github.com/klauspost/crc32/.gitignore b/vendor/github.com/klauspost/crc32/.gitignore
deleted file mode 100644
index daf913b1b..000000000
--- a/vendor/github.com/klauspost/crc32/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/klauspost/crc32/LICENSE b/vendor/github.com/klauspost/crc32/LICENSE
deleted file mode 100644
index 744875676..000000000
--- a/vendor/github.com/klauspost/crc32/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/klauspost/crc32/README.md b/vendor/github.com/klauspost/crc32/README.md
deleted file mode 100644
index febeba5eb..000000000
--- a/vendor/github.com/klauspost/crc32/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# 2025 revival
-
-For IEEE checksums AVX512 can be used to speed up CRC32 checksums by approximately 2x.
-
-Castagnoli checksums (CRC32C) can also be computer with AVX512,
-but the performance gain is not as significant enough for the downsides of using it at this point.
-
-# crc32
-
-This package is a drop-in replacement for the standard library `hash/crc32` package,
-that features AVX 512 optimizations on x64 platforms, for a 2x speedup for IEEE CRC32 checksums.
-
-# usage
-
-Install using `go get github.com/klauspost/crc32`. This library is based on Go 1.24
-
-Replace `import "hash/crc32"` with `import "github.com/klauspost/crc32"` and you are good to go.
-
-# changes
-* 2025: Revived and updated to Go 1.24, with AVX 512 optimizations.
-
-# performance
-
-AVX512 are enabled above 1KB input size. This rather high limit is due to AVX512 may be slower to ramp up than
-the regular SSE4 implementation for smaller inputs. This is not reflected in the benchmarks below.
-
-| Benchmark | Old MB/s | New MB/s | Speedup |
-|-----------------------------------------------|----------|----------|---------|
-| BenchmarkCRC32/poly=IEEE/size=512/align=0-32 | 17996.39 | 17969.94 | 1.00x |
-| BenchmarkCRC32/poly=IEEE/size=512/align=1-32 | 18021.48 | 17945.55 | 1.00x |
-| BenchmarkCRC32/poly=IEEE/size=1kB/align=0-32 | 19921.70 | 45613.77 | 2.29x |
-| BenchmarkCRC32/poly=IEEE/size=1kB/align=1-32 | 19946.60 | 46819.09 | 2.35x |
-| BenchmarkCRC32/poly=IEEE/size=4kB/align=0-32 | 21538.65 | 48600.93 | 2.26x |
-| BenchmarkCRC32/poly=IEEE/size=4kB/align=1-32 | 21449.20 | 48477.84 | 2.26x |
-| BenchmarkCRC32/poly=IEEE/size=32kB/align=0-32 | 21785.49 | 46013.10 | 2.11x |
-| BenchmarkCRC32/poly=IEEE/size=32kB/align=1-32 | 21946.47 | 45954.10 | 2.09x |
-
-cpu: AMD Ryzen 9 9950X 16-Core Processor
-
-# license
-
-Standard Go license. See [LICENSE](LICENSE) for details.
diff --git a/vendor/github.com/klauspost/crc32/crc32.go b/vendor/github.com/klauspost/crc32/crc32.go
deleted file mode 100644
index 1de0bb3a4..000000000
--- a/vendor/github.com/klauspost/crc32/crc32.go
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32,
-// checksum. See https://en.wikipedia.org/wiki/Cyclic_redundancy_check for
-// information.
-//
-// Polynomials are represented in LSB-first form also known as reversed representation.
-//
-// See https://en.wikipedia.org/wiki/Mathematics_of_cyclic_redundancy_checks#Reversed_representations_and_reciprocal_polynomials
-// for information.
-package crc32
-
-import (
- "encoding/binary"
- "errors"
- "hash"
- "sync"
- "sync/atomic"
-)
-
-// The size of a CRC-32 checksum in bytes.
-const Size = 4
-
-// Predefined polynomials.
-const (
- // IEEE is by far and away the most common CRC-32 polynomial.
- // Used by ethernet (IEEE 802.3), v.42, fddi, gzip, zip, png, ...
- IEEE = 0xedb88320
-
- // Castagnoli's polynomial, used in iSCSI.
- // Has better error detection characteristics than IEEE.
- // https://dx.doi.org/10.1109/26.231911
- Castagnoli = 0x82f63b78
-
- // Koopman's polynomial.
- // Also has better error detection characteristics than IEEE.
- // https://dx.doi.org/10.1109/DSN.2002.1028931
- Koopman = 0xeb31d82e
-)
-
-// Table is a 256-word table representing the polynomial for efficient processing.
-type Table [256]uint32
-
-// This file makes use of functions implemented in architecture-specific files.
-// The interface that they implement is as follows:
-//
-// // archAvailableIEEE reports whether an architecture-specific CRC32-IEEE
-// // algorithm is available.
-// archAvailableIEEE() bool
-//
-// // archInitIEEE initializes the architecture-specific CRC3-IEEE algorithm.
-// // It can only be called if archAvailableIEEE() returns true.
-// archInitIEEE()
-//
-// // archUpdateIEEE updates the given CRC32-IEEE. It can only be called if
-// // archInitIEEE() was previously called.
-// archUpdateIEEE(crc uint32, p []byte) uint32
-//
-// // archAvailableCastagnoli reports whether an architecture-specific
-// // CRC32-C algorithm is available.
-// archAvailableCastagnoli() bool
-//
-// // archInitCastagnoli initializes the architecture-specific CRC32-C
-// // algorithm. It can only be called if archAvailableCastagnoli() returns
-// // true.
-// archInitCastagnoli()
-//
-// // archUpdateCastagnoli updates the given CRC32-C. It can only be called
-// // if archInitCastagnoli() was previously called.
-// archUpdateCastagnoli(crc uint32, p []byte) uint32
-
-// castagnoliTable points to a lazily initialized Table for the Castagnoli
-// polynomial. MakeTable will always return this value when asked to make a
-// Castagnoli table so we can compare against it to find when the caller is
-// using this polynomial.
-var castagnoliTable *Table
-var castagnoliTable8 *slicing8Table
-var updateCastagnoli func(crc uint32, p []byte) uint32
-var haveCastagnoli atomic.Bool
-
-var castagnoliInitOnce = sync.OnceFunc(func() {
- castagnoliTable = simpleMakeTable(Castagnoli)
-
- if archAvailableCastagnoli() {
- archInitCastagnoli()
- updateCastagnoli = archUpdateCastagnoli
- } else {
- // Initialize the slicing-by-8 table.
- castagnoliTable8 = slicingMakeTable(Castagnoli)
- updateCastagnoli = func(crc uint32, p []byte) uint32 {
- return slicingUpdate(crc, castagnoliTable8, p)
- }
- }
-
- haveCastagnoli.Store(true)
-})
-
-// IEEETable is the table for the [IEEE] polynomial.
-var IEEETable = simpleMakeTable(IEEE)
-
-// ieeeTable8 is the slicing8Table for IEEE
-var ieeeTable8 *slicing8Table
-var updateIEEE func(crc uint32, p []byte) uint32
-
-var ieeeInitOnce = sync.OnceFunc(func() {
- if archAvailableIEEE() {
- archInitIEEE()
- updateIEEE = archUpdateIEEE
- } else {
- // Initialize the slicing-by-8 table.
- ieeeTable8 = slicingMakeTable(IEEE)
- updateIEEE = func(crc uint32, p []byte) uint32 {
- return slicingUpdate(crc, ieeeTable8, p)
- }
- }
-})
-
-// MakeTable returns a [Table] constructed from the specified polynomial.
-// The contents of this [Table] must not be modified.
-func MakeTable(poly uint32) *Table {
- switch poly {
- case IEEE:
- ieeeInitOnce()
- return IEEETable
- case Castagnoli:
- castagnoliInitOnce()
- return castagnoliTable
- default:
- return simpleMakeTable(poly)
- }
-}
-
-// digest represents the partial evaluation of a checksum.
-type digest struct {
- crc uint32
- tab *Table
-}
-
-// New creates a new [hash.Hash32] computing the CRC-32 checksum using the
-// polynomial represented by the [Table]. Its Sum method will lay the
-// value out in big-endian byte order. The returned Hash32 also
-// implements [encoding.BinaryMarshaler] and [encoding.BinaryUnmarshaler] to
-// marshal and unmarshal the internal state of the hash.
-func New(tab *Table) hash.Hash32 {
- if tab == IEEETable {
- ieeeInitOnce()
- }
- return &digest{0, tab}
-}
-
-// NewIEEE creates a new [hash.Hash32] computing the CRC-32 checksum using
-// the [IEEE] polynomial. Its Sum method will lay the value out in
-// big-endian byte order. The returned Hash32 also implements
-// [encoding.BinaryMarshaler] and [encoding.BinaryUnmarshaler] to marshal
-// and unmarshal the internal state of the hash.
-func NewIEEE() hash.Hash32 { return New(IEEETable) }
-
-func (d *digest) Size() int { return Size }
-
-func (d *digest) BlockSize() int { return 1 }
-
-func (d *digest) Reset() { d.crc = 0 }
-
-const (
- magic = "crc\x01"
- marshaledSize = len(magic) + 4 + 4
-)
-
-func (d *digest) AppendBinary(b []byte) ([]byte, error) {
- b = append(b, magic...)
- b = binary.BigEndian.AppendUint32(b, tableSum(d.tab))
- b = binary.BigEndian.AppendUint32(b, d.crc)
- return b, nil
-}
-
-func (d *digest) MarshalBinary() ([]byte, error) {
- return d.AppendBinary(make([]byte, 0, marshaledSize))
-
-}
-
-func (d *digest) UnmarshalBinary(b []byte) error {
- if len(b) < len(magic) || string(b[:len(magic)]) != magic {
- return errors.New("hash/crc32: invalid hash state identifier")
- }
- if len(b) != marshaledSize {
- return errors.New("hash/crc32: invalid hash state size")
- }
- if tableSum(d.tab) != binary.BigEndian.Uint32(b[4:]) {
- return errors.New("hash/crc32: tables do not match")
- }
- d.crc = binary.BigEndian.Uint32(b[8:])
- return nil
-}
-
-func update(crc uint32, tab *Table, p []byte, checkInitIEEE bool) uint32 {
- switch {
- case haveCastagnoli.Load() && tab == castagnoliTable:
- return updateCastagnoli(crc, p)
- case tab == IEEETable:
- if checkInitIEEE {
- ieeeInitOnce()
- }
- return updateIEEE(crc, p)
- default:
- return simpleUpdate(crc, tab, p)
- }
-}
-
-// Update returns the result of adding the bytes in p to the crc.
-func Update(crc uint32, tab *Table, p []byte) uint32 {
- // Unfortunately, because IEEETable is exported, IEEE may be used without a
- // call to MakeTable. We have to make sure it gets initialized in that case.
- return update(crc, tab, p, true)
-}
-
-func (d *digest) Write(p []byte) (n int, err error) {
- // We only create digest objects through New() which takes care of
- // initialization in this case.
- d.crc = update(d.crc, d.tab, p, false)
- return len(p), nil
-}
-
-func (d *digest) Sum32() uint32 { return d.crc }
-
-func (d *digest) Sum(in []byte) []byte {
- s := d.Sum32()
- return append(in, byte(s>>24), byte(s>>16), byte(s>>8), byte(s))
-}
-
-// Checksum returns the CRC-32 checksum of data
-// using the polynomial represented by the [Table].
-func Checksum(data []byte, tab *Table) uint32 { return Update(0, tab, data) }
-
-// ChecksumIEEE returns the CRC-32 checksum of data
-// using the [IEEE] polynomial.
-func ChecksumIEEE(data []byte) uint32 {
- ieeeInitOnce()
- return updateIEEE(0, data)
-}
-
-// tableSum returns the IEEE checksum of table t.
-func tableSum(t *Table) uint32 {
- var a [1024]byte
- b := a[:0]
- if t != nil {
- for _, x := range t {
- b = binary.BigEndian.AppendUint32(b, x)
- }
- }
- return ChecksumIEEE(b)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_amd64.go b/vendor/github.com/klauspost/crc32/crc32_amd64.go
deleted file mode 100644
index c6d30b25c..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_amd64.go
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// AMD64-specific hardware-assisted CRC32 algorithms. See crc32.go for a
-// description of the interface that each architecture-specific file
-// implements.
-
-package crc32
-
-import (
- "unsafe"
-
- "golang.org/x/sys/cpu"
-)
-
-// This file contains the code to call the SSE 4.2 version of the Castagnoli
-// and IEEE CRC.
-
-// castagnoliSSE42 is defined in crc32_amd64.s and uses the SSE 4.2 CRC32
-// instruction.
-//
-//go:noescape
-func castagnoliSSE42(crc uint32, p []byte) uint32
-
-// castagnoliSSE42Triple is defined in crc32_amd64.s and uses the SSE 4.2 CRC32
-// instruction.
-//
-//go:noescape
-func castagnoliSSE42Triple(
- crcA, crcB, crcC uint32,
- a, b, c []byte,
- rounds uint32,
-) (retA uint32, retB uint32, retC uint32)
-
-// ieeeCLMUL is defined in crc_amd64.s and uses the PCLMULQDQ
-// instruction as well as SSE 4.1.
-//
-//go:noescape
-func ieeeCLMUL(crc uint32, p []byte) uint32
-
-// castagnoliCLMULAvx512 is defined in crc_amd64.s and uses the PCLMULQDQ
-// instruction as well as SSE 4.1.
-//
-//go:noescape
-func castagnoliCLMULAvx512(crc uint32, p []byte) uint32
-
-// ieeeCLMUL is defined in crc_amd64.s and uses the PCLMULQDQ
-// instruction as well as SSE 4.1.
-//
-//go:noescape
-func ieeeCLMULAvx512(crc uint32, p []byte) uint32
-
-const castagnoliK1 = 168
-const castagnoliK2 = 1344
-
-type sse42Table [4]Table
-
-var castagnoliSSE42TableK1 *sse42Table
-var castagnoliSSE42TableK2 *sse42Table
-
-func archAvailableCastagnoli() bool {
- return cpu.X86.HasSSE42
-}
-
-func archInitCastagnoli() {
- if !cpu.X86.HasSSE42 {
- panic("arch-specific Castagnoli not available")
- }
- castagnoliSSE42TableK1 = new(sse42Table)
- castagnoliSSE42TableK2 = new(sse42Table)
- // See description in updateCastagnoli.
- // t[0][i] = CRC(i000, O)
- // t[1][i] = CRC(0i00, O)
- // t[2][i] = CRC(00i0, O)
- // t[3][i] = CRC(000i, O)
- // where O is a sequence of K zeros.
- var tmp [castagnoliK2]byte
- for b := 0; b < 4; b++ {
- for i := 0; i < 256; i++ {
- val := uint32(i) << uint32(b*8)
- castagnoliSSE42TableK1[b][i] = castagnoliSSE42(val, tmp[:castagnoliK1])
- castagnoliSSE42TableK2[b][i] = castagnoliSSE42(val, tmp[:])
- }
- }
-}
-
-// castagnoliShift computes the CRC32-C of K1 or K2 zeroes (depending on the
-// table given) with the given initial crc value. This corresponds to
-// CRC(crc, O) in the description in updateCastagnoli.
-func castagnoliShift(table *sse42Table, crc uint32) uint32 {
- return table[3][crc>>24] ^
- table[2][(crc>>16)&0xFF] ^
- table[1][(crc>>8)&0xFF] ^
- table[0][crc&0xFF]
-}
-
-func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
- if !cpu.X86.HasSSE42 {
- panic("not available")
- }
-
- // This method is inspired from the algorithm in Intel's white paper:
- // "Fast CRC Computation for iSCSI Polynomial Using CRC32 Instruction"
- // The same strategy of splitting the buffer in three is used but the
- // combining calculation is different; the complete derivation is explained
- // below.
- //
- // -- The basic idea --
- //
- // The CRC32 instruction (available in SSE4.2) can process 8 bytes at a
- // time. In recent Intel architectures the instruction takes 3 cycles;
- // however the processor can pipeline up to three instructions if they
- // don't depend on each other.
- //
- // Roughly this means that we can process three buffers in about the same
- // time we can process one buffer.
- //
- // The idea is then to split the buffer in three, CRC the three pieces
- // separately and then combine the results.
- //
- // Combining the results requires precomputed tables, so we must choose a
- // fixed buffer length to optimize. The longer the length, the faster; but
- // only buffers longer than this length will use the optimization. We choose
- // two cutoffs and compute tables for both:
- // - one around 512: 168*3=504
- // - one around 4KB: 1344*3=4032
- //
- // -- The nitty gritty --
- //
- // Let CRC(I, X) be the non-inverted CRC32-C of the sequence X (with
- // initial non-inverted CRC I). This function has the following properties:
- // (a) CRC(I, AB) = CRC(CRC(I, A), B)
- // (b) CRC(I, A xor B) = CRC(I, A) xor CRC(0, B)
- //
- // Say we want to compute CRC(I, ABC) where A, B, C are three sequences of
- // K bytes each, where K is a fixed constant. Let O be the sequence of K zero
- // bytes.
- //
- // CRC(I, ABC) = CRC(I, ABO xor C)
- // = CRC(I, ABO) xor CRC(0, C)
- // = CRC(CRC(I, AB), O) xor CRC(0, C)
- // = CRC(CRC(I, AO xor B), O) xor CRC(0, C)
- // = CRC(CRC(I, AO) xor CRC(0, B), O) xor CRC(0, C)
- // = CRC(CRC(CRC(I, A), O) xor CRC(0, B), O) xor CRC(0, C)
- //
- // The castagnoliSSE42Triple function can compute CRC(I, A), CRC(0, B),
- // and CRC(0, C) efficiently. We just need to find a way to quickly compute
- // CRC(uvwx, O) given a 4-byte initial value uvwx. We can precompute these
- // values; since we can't have a 32-bit table, we break it up into four
- // 8-bit tables:
- //
- // CRC(uvwx, O) = CRC(u000, O) xor
- // CRC(0v00, O) xor
- // CRC(00w0, O) xor
- // CRC(000x, O)
- //
- // We can compute tables corresponding to the four terms for all 8-bit
- // values.
-
- crc = ^crc
-
- // Disabled, since it is not significantly faster than the SSE 4.2 version, even on Zen 5.
- if false && len(p) >= 2048 && cpu.X86.HasAVX512F && cpu.X86.HasAVX512VL && cpu.X86.HasAVX512VPCLMULQDQ && cpu.X86.HasPCLMULQDQ {
- left := len(p) & 15
- do := len(p) - left
- crc = castagnoliCLMULAvx512(crc, p[:do])
- return ^castagnoliSSE42(crc, p[do:])
- }
-
- // If a buffer is long enough to use the optimization, process the first few
- // bytes to align the buffer to an 8 byte boundary (if necessary).
- if len(p) >= castagnoliK1*3 {
- delta := int(uintptr(unsafe.Pointer(&p[0])) & 7)
- if delta != 0 {
- delta = 8 - delta
- crc = castagnoliSSE42(crc, p[:delta])
- p = p[delta:]
- }
- }
-
- // Process 3*K2 at a time.
- for len(p) >= castagnoliK2*3 {
- // Compute CRC(I, A), CRC(0, B), and CRC(0, C).
- crcA, crcB, crcC := castagnoliSSE42Triple(
- crc, 0, 0,
- p, p[castagnoliK2:], p[castagnoliK2*2:],
- castagnoliK2/24)
-
- // CRC(I, AB) = CRC(CRC(I, A), O) xor CRC(0, B)
- crcAB := castagnoliShift(castagnoliSSE42TableK2, crcA) ^ crcB
- // CRC(I, ABC) = CRC(CRC(I, AB), O) xor CRC(0, C)
- crc = castagnoliShift(castagnoliSSE42TableK2, crcAB) ^ crcC
- p = p[castagnoliK2*3:]
- }
-
- // Process 3*K1 at a time.
- for len(p) >= castagnoliK1*3 {
- // Compute CRC(I, A), CRC(0, B), and CRC(0, C).
- crcA, crcB, crcC := castagnoliSSE42Triple(
- crc, 0, 0,
- p, p[castagnoliK1:], p[castagnoliK1*2:],
- castagnoliK1/24)
-
- // CRC(I, AB) = CRC(CRC(I, A), O) xor CRC(0, B)
- crcAB := castagnoliShift(castagnoliSSE42TableK1, crcA) ^ crcB
- // CRC(I, ABC) = CRC(CRC(I, AB), O) xor CRC(0, C)
- crc = castagnoliShift(castagnoliSSE42TableK1, crcAB) ^ crcC
- p = p[castagnoliK1*3:]
- }
-
- // Use the simple implementation for what's left.
- crc = castagnoliSSE42(crc, p)
- return ^crc
-}
-
-func archAvailableIEEE() bool {
- return cpu.X86.HasPCLMULQDQ && cpu.X86.HasSSE41
-}
-
-var archIeeeTable8 *slicing8Table
-
-func archInitIEEE() {
- if !cpu.X86.HasPCLMULQDQ || !cpu.X86.HasSSE41 {
- panic("not available")
- }
- // We still use slicing-by-8 for small buffers.
- archIeeeTable8 = slicingMakeTable(IEEE)
-}
-
-func archUpdateIEEE(crc uint32, p []byte) uint32 {
- if !cpu.X86.HasPCLMULQDQ || !cpu.X86.HasSSE41 {
- panic("not available")
- }
-
- if len(p) >= 64 {
- if len(p) >= 1024 && cpu.X86.HasAVX512F && cpu.X86.HasAVX512VL && cpu.X86.HasAVX512VPCLMULQDQ && cpu.X86.HasPCLMULQDQ {
- left := len(p) & 15
- do := len(p) - left
- crc = ^ieeeCLMULAvx512(^crc, p[:do])
- p = p[do:]
- } else {
- left := len(p) & 15
- do := len(p) - left
- crc = ^ieeeCLMUL(^crc, p[:do])
- p = p[do:]
- }
- }
- if len(p) == 0 {
- return crc
- }
- return slicingUpdate(crc, archIeeeTable8, p)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_amd64.s b/vendor/github.com/klauspost/crc32/crc32_amd64.s
deleted file mode 100644
index e2de3a5cb..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_amd64.s
+++ /dev/null
@@ -1,527 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-// castagnoliSSE42 updates the (non-inverted) crc with the given buffer.
-//
-// func castagnoliSSE42(crc uint32, p []byte) uint32
-TEXT ·castagnoliSSE42(SB), NOSPLIT, $0
- MOVL crc+0(FP), AX // CRC value
- MOVQ p+8(FP), SI // data pointer
- MOVQ p_len+16(FP), CX // len(p)
-
- // If there are fewer than 8 bytes to process, skip alignment.
- CMPQ CX, $8
- JL less_than_8
-
- MOVQ SI, BX
- ANDQ $7, BX
- JZ aligned
-
- // Process the first few bytes to 8-byte align the input.
-
- // BX = 8 - BX. We need to process this many bytes to align.
- SUBQ $1, BX
- XORQ $7, BX
-
- BTQ $0, BX
- JNC align_2
-
- CRC32B (SI), AX
- DECQ CX
- INCQ SI
-
-align_2:
- BTQ $1, BX
- JNC align_4
-
- CRC32W (SI), AX
-
- SUBQ $2, CX
- ADDQ $2, SI
-
-align_4:
- BTQ $2, BX
- JNC aligned
-
- CRC32L (SI), AX
-
- SUBQ $4, CX
- ADDQ $4, SI
-
-aligned:
- // The input is now 8-byte aligned and we can process 8-byte chunks.
- CMPQ CX, $8
- JL less_than_8
-
- CRC32Q (SI), AX
- ADDQ $8, SI
- SUBQ $8, CX
- JMP aligned
-
-less_than_8:
- // We may have some bytes left over; process 4 bytes, then 2, then 1.
- BTQ $2, CX
- JNC less_than_4
-
- CRC32L (SI), AX
- ADDQ $4, SI
-
-less_than_4:
- BTQ $1, CX
- JNC less_than_2
-
- CRC32W (SI), AX
- ADDQ $2, SI
-
-less_than_2:
- BTQ $0, CX
- JNC done
-
- CRC32B (SI), AX
-
-done:
- MOVL AX, ret+32(FP)
- RET
-
-// castagnoliSSE42Triple updates three (non-inverted) crcs with (24*rounds)
-// bytes from each buffer.
-//
-// func castagnoliSSE42Triple(
-// crc1, crc2, crc3 uint32,
-// a, b, c []byte,
-// rounds uint32,
-// ) (retA uint32, retB uint32, retC uint32)
-TEXT ·castagnoliSSE42Triple(SB), NOSPLIT, $0
- MOVL crcA+0(FP), AX
- MOVL crcB+4(FP), CX
- MOVL crcC+8(FP), DX
-
- MOVQ a+16(FP), R8 // data pointer
- MOVQ b+40(FP), R9 // data pointer
- MOVQ c+64(FP), R10 // data pointer
-
- MOVL rounds+88(FP), R11
-
-loop:
- CRC32Q (R8), AX
- CRC32Q (R9), CX
- CRC32Q (R10), DX
-
- CRC32Q 8(R8), AX
- CRC32Q 8(R9), CX
- CRC32Q 8(R10), DX
-
- CRC32Q 16(R8), AX
- CRC32Q 16(R9), CX
- CRC32Q 16(R10), DX
-
- ADDQ $24, R8
- ADDQ $24, R9
- ADDQ $24, R10
-
- DECQ R11
- JNZ loop
-
- MOVL AX, retA+96(FP)
- MOVL CX, retB+100(FP)
- MOVL DX, retC+104(FP)
- RET
-
-// CRC32 polynomial data
-//
-// These constants are lifted from the
-// Linux kernel, since they avoid the costly
-// PSHUFB 16 byte reversal proposed in the
-// original Intel paper.
-DATA r2r1<>+0(SB)/8, $0x154442bd4
-DATA r2r1<>+8(SB)/8, $0x1c6e41596
-DATA r4r3<>+0(SB)/8, $0x1751997d0
-DATA r4r3<>+8(SB)/8, $0x0ccaa009e
-DATA rupoly<>+0(SB)/8, $0x1db710641
-DATA rupoly<>+8(SB)/8, $0x1f7011641
-DATA r5<>+0(SB)/8, $0x163cd6124
-
-GLOBL r2r1<>(SB), RODATA, $16
-GLOBL r4r3<>(SB), RODATA, $16
-GLOBL rupoly<>(SB), RODATA, $16
-GLOBL r5<>(SB), RODATA, $8
-
-// Based on https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
-// len(p) must be at least 64, and must be a multiple of 16.
-
-// func ieeeCLMUL(crc uint32, p []byte) uint32
-TEXT ·ieeeCLMUL(SB), NOSPLIT, $0
- MOVL crc+0(FP), X0 // Initial CRC value
- MOVQ p+8(FP), SI // data pointer
- MOVQ p_len+16(FP), CX // len(p)
-
- MOVOU (SI), X1
- MOVOU 16(SI), X2
- MOVOU 32(SI), X3
- MOVOU 48(SI), X4
- PXOR X0, X1
- ADDQ $64, SI // buf+=64
- SUBQ $64, CX // len-=64
- CMPQ CX, $64 // Less than 64 bytes left
- JB remain64
-
- MOVOA r2r1<>+0(SB), X0
-
-loopback64:
- MOVOA X1, X5
- MOVOA X2, X6
- MOVOA X3, X7
- MOVOA X4, X8
-
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0, X0, X2
- PCLMULQDQ $0, X0, X3
- PCLMULQDQ $0, X0, X4
-
- // Load next early
- MOVOU (SI), X11
- MOVOU 16(SI), X12
- MOVOU 32(SI), X13
- MOVOU 48(SI), X14
-
- PCLMULQDQ $0x11, X0, X5
- PCLMULQDQ $0x11, X0, X6
- PCLMULQDQ $0x11, X0, X7
- PCLMULQDQ $0x11, X0, X8
-
- PXOR X5, X1
- PXOR X6, X2
- PXOR X7, X3
- PXOR X8, X4
-
- PXOR X11, X1
- PXOR X12, X2
- PXOR X13, X3
- PXOR X14, X4
-
- ADDQ $0x40, DI
- ADDQ $64, SI // buf+=64
- SUBQ $64, CX // len-=64
- CMPQ CX, $64 // Less than 64 bytes left?
- JGE loopback64
-
- // Fold result into a single register (X1)
-remain64:
- MOVOA r4r3<>+0(SB), X0
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X2, X1
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X3, X1
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X4, X1
-
- // If there is less than 16 bytes left we are done
- CMPQ CX, $16
- JB finish
-
- // Encode 16 bytes
-remain16:
- MOVOU (SI), X10
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X10, X1
- SUBQ $16, CX
- ADDQ $16, SI
- CMPQ CX, $16
- JGE remain16
-
-finish:
- // Fold final result into 32 bits and return it
- PCMPEQB X3, X3
- PCLMULQDQ $1, X1, X0
- PSRLDQ $8, X1
- PXOR X0, X1
-
- MOVOA X1, X2
- MOVQ r5<>+0(SB), X0
-
- // Creates 32 bit mask. Note that we don't care about upper half.
- PSRLQ $32, X3
-
- PSRLDQ $4, X2
- PAND X3, X1
- PCLMULQDQ $0, X0, X1
- PXOR X2, X1
-
- MOVOA rupoly<>+0(SB), X0
-
- MOVOA X1, X2
- PAND X3, X1
- PCLMULQDQ $0x10, X0, X1
- PAND X3, X1
- PCLMULQDQ $0, X0, X1
- PXOR X2, X1
-
- PEXTRD $1, X1, AX
- MOVL AX, ret+32(FP)
-
- RET
-
-DATA r2r1X<>+0(SB)/8, $0x154442bd4
-DATA r2r1X<>+8(SB)/8, $0x1c6e41596
-DATA r2r1X<>+16(SB)/8, $0x154442bd4
-DATA r2r1X<>+24(SB)/8, $0x1c6e41596
-DATA r2r1X<>+32(SB)/8, $0x154442bd4
-DATA r2r1X<>+40(SB)/8, $0x1c6e41596
-DATA r2r1X<>+48(SB)/8, $0x154442bd4
-DATA r2r1X<>+56(SB)/8, $0x1c6e41596
-GLOBL r2r1X<>(SB), RODATA, $64
-
-// Based on https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
-// len(p) must be at least 128, and must be a multiple of 16.
-
-// func ieeeCLMULAvx512(crc uint32, p []byte) uint32
-TEXT ·ieeeCLMULAvx512(SB), NOSPLIT, $0
- MOVL crc+0(FP), AX // Initial CRC value
- MOVQ p+8(FP), SI // data pointer
- MOVQ p_len+16(FP), CX // len(p)
-
- VPXORQ Z0, Z0, Z0
- VMOVDQU64 (SI), Z1
- VMOVQ AX, X0
- VPXORQ Z0, Z1, Z1 // Merge initial CRC value into Z1
- ADDQ $64, SI // buf+=64
- SUBQ $64, CX // len-=64
-
- VMOVDQU64 r2r1X<>+0(SB), Z0
-
-loopback64:
- // Load next early
- VMOVDQU64 (SI), Z11
-
- VPCLMULQDQ $0x11, Z0, Z1, Z5
- VPCLMULQDQ $0, Z0, Z1, Z1
-
- VPTERNLOGD $0x96, Z11, Z5, Z1 // Combine results with xor into Z1
-
- ADDQ $0x40, DI
- ADDQ $64, SI // buf+=64
- SUBQ $64, CX // len-=64
- CMPQ CX, $64 // Less than 64 bytes left?
- JGE loopback64
-
- // Fold result into a single register (X1)
-remain64:
- VEXTRACTF32X4 $1, Z1, X2 // X2: Second 128-bit lane
- VEXTRACTF32X4 $2, Z1, X3 // X3: Third 128-bit lane
- VEXTRACTF32X4 $3, Z1, X4 // X4: Fourth 128-bit lane
-
- MOVOA r4r3<>+0(SB), X0
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X2, X1
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X3, X1
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X4, X1
-
- // If there is less than 16 bytes left we are done
- CMPQ CX, $16
- JB finish
-
- // Encode 16 bytes
-remain16:
- MOVOU (SI), X10
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X10, X1
- SUBQ $16, CX
- ADDQ $16, SI
- CMPQ CX, $16
- JGE remain16
-
-finish:
- // Fold final result into 32 bits and return it
- PCMPEQB X3, X3
- PCLMULQDQ $1, X1, X0
- PSRLDQ $8, X1
- PXOR X0, X1
-
- MOVOA X1, X2
- MOVQ r5<>+0(SB), X0
-
- // Creates 32 bit mask. Note that we don't care about upper half.
- PSRLQ $32, X3
-
- PSRLDQ $4, X2
- PAND X3, X1
- PCLMULQDQ $0, X0, X1
- PXOR X2, X1
-
- MOVOA rupoly<>+0(SB), X0
-
- MOVOA X1, X2
- PAND X3, X1
- PCLMULQDQ $0x10, X0, X1
- PAND X3, X1
- PCLMULQDQ $0, X0, X1
- PXOR X2, X1
-
- PEXTRD $1, X1, AX
- MOVL AX, ret+32(FP)
- VZEROUPPER
- RET
-
-// Castagonli Polynomial constants
-DATA r2r1C<>+0(SB)/8, $0x0740eef02
-DATA r2r1C<>+8(SB)/8, $0x09e4addf8
-DATA r2r1C<>+16(SB)/8, $0x0740eef02
-DATA r2r1C<>+24(SB)/8, $0x09e4addf8
-DATA r2r1C<>+32(SB)/8, $0x0740eef02
-DATA r2r1C<>+40(SB)/8, $0x09e4addf8
-DATA r2r1C<>+48(SB)/8, $0x0740eef02
-DATA r2r1C<>+56(SB)/8, $0x09e4addf8
-GLOBL r2r1C<>(SB), RODATA, $64
-
-DATA r4r3C<>+0(SB)/8, $0xf20c0dfe
-DATA r4r3C<>+8(SB)/8, $0x14cd00bd6
-DATA rupolyC<>+0(SB)/8, $0x105ec76f0
-DATA rupolyC<>+8(SB)/8, $0xdea713f1
-DATA r5C<>+0(SB)/8, $0xdd45aab8
-
-GLOBL r4r3C<>(SB), RODATA, $16
-GLOBL rupolyC<>(SB), RODATA, $16
-GLOBL r5C<>(SB), RODATA, $8
-
-// Based on https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
-// len(p) must be at least 128, and must be a multiple of 16.
-
-// func castagnoliCLMULAvx512(crc uint32, p []byte) uint32
-TEXT ·castagnoliCLMULAvx512(SB), NOSPLIT, $0
- MOVL crc+0(FP), AX // Initial CRC value
- MOVQ p+8(FP), SI // data pointer
- MOVQ p_len+16(FP), CX // len(p)
-
- VPXORQ Z0, Z0, Z0
- VMOVDQU64 (SI), Z1
- VMOVQ AX, X0
- VPXORQ Z0, Z1, Z1 // Merge initial CRC value into Z1
- ADDQ $64, SI // buf+=64
- SUBQ $64, CX // len-=64
-
- VMOVDQU64 r2r1C<>+0(SB), Z0
-
-loopback64:
- // Load next early
- VMOVDQU64 (SI), Z11
-
- VPCLMULQDQ $0x11, Z0, Z1, Z5
- VPCLMULQDQ $0, Z0, Z1, Z1
-
- VPTERNLOGD $0x96, Z11, Z5, Z1 // Combine results with xor into Z1
-
- ADDQ $0x40, DI
- ADDQ $64, SI // buf+=64
- SUBQ $64, CX // len-=64
- CMPQ CX, $64 // Less than 64 bytes left?
- JGE loopback64
-
- // Fold result into a single register (X1)
-remain64:
- VEXTRACTF32X4 $1, Z1, X2 // X2: Second 128-bit lane
- VEXTRACTF32X4 $2, Z1, X3 // X3: Third 128-bit lane
- VEXTRACTF32X4 $3, Z1, X4 // X4: Fourth 128-bit lane
-
- MOVOA r4r3C<>+0(SB), X0
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X2, X1
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X3, X1
-
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X4, X1
-
- // If there is less than 16 bytes left we are done
- CMPQ CX, $16
- JB finish
-
- // Encode 16 bytes
-remain16:
- MOVOU (SI), X10
- MOVOA X1, X5
- PCLMULQDQ $0, X0, X1
- PCLMULQDQ $0x11, X0, X5
- PXOR X5, X1
- PXOR X10, X1
- SUBQ $16, CX
- ADDQ $16, SI
- CMPQ CX, $16
- JGE remain16
-
-finish:
- // Fold final result into 32 bits and return it
- PCMPEQB X3, X3
- PCLMULQDQ $1, X1, X0
- PSRLDQ $8, X1
- PXOR X0, X1
-
- MOVOA X1, X2
- MOVQ r5C<>+0(SB), X0
-
- // Creates 32 bit mask. Note that we don't care about upper half.
- PSRLQ $32, X3
-
- PSRLDQ $4, X2
- PAND X3, X1
- PCLMULQDQ $0, X0, X1
- PXOR X2, X1
-
- MOVOA rupolyC<>+0(SB), X0
-
- MOVOA X1, X2
- PAND X3, X1
- PCLMULQDQ $0x10, X0, X1
- PAND X3, X1
- PCLMULQDQ $0, X0, X1
- PXOR X2, X1
-
- PEXTRD $1, X1, AX
- MOVL AX, ret+32(FP)
- VZEROUPPER
- RET
diff --git a/vendor/github.com/klauspost/crc32/crc32_arm64.go b/vendor/github.com/klauspost/crc32/crc32_arm64.go
deleted file mode 100644
index 7e9ac5539..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_arm64.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// ARM64-specific hardware-assisted CRC32 algorithms. See crc32.go for a
-// description of the interface that each architecture-specific file
-// implements.
-
-package crc32
-
-import "golang.org/x/sys/cpu"
-
-func castagnoliUpdate(crc uint32, p []byte) uint32
-func ieeeUpdate(crc uint32, p []byte) uint32
-
-func archAvailableCastagnoli() bool {
- return cpu.ARM64.HasCRC32
-}
-
-func archInitCastagnoli() {
- if !cpu.ARM64.HasCRC32 {
- panic("arch-specific crc32 instruction for Castagnoli not available")
- }
-}
-
-func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
- if !cpu.ARM64.HasCRC32 {
- panic("arch-specific crc32 instruction for Castagnoli not available")
- }
-
- return ^castagnoliUpdate(^crc, p)
-}
-
-func archAvailableIEEE() bool {
- return cpu.ARM64.HasCRC32
-}
-
-func archInitIEEE() {
- if !cpu.ARM64.HasCRC32 {
- panic("arch-specific crc32 instruction for IEEE not available")
- }
-}
-
-func archUpdateIEEE(crc uint32, p []byte) uint32 {
- if !cpu.ARM64.HasCRC32 {
- panic("arch-specific crc32 instruction for IEEE not available")
- }
-
- return ^ieeeUpdate(^crc, p)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_arm64.s b/vendor/github.com/klauspost/crc32/crc32_arm64.s
deleted file mode 100644
index e82778f7b..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_arm64.s
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-// castagnoliUpdate updates the non-inverted crc with the given data.
-
-// func castagnoliUpdate(crc uint32, p []byte) uint32
-TEXT ·castagnoliUpdate(SB), NOSPLIT, $0-36
- MOVWU crc+0(FP), R9 // CRC value
- MOVD p+8(FP), R13 // data pointer
- MOVD p_len+16(FP), R11 // len(p)
-
-update:
- CMP $16, R11
- BLT less_than_16
- LDP.P 16(R13), (R8, R10)
- CRC32CX R8, R9
- CRC32CX R10, R9
- SUB $16, R11
-
- JMP update
-
-less_than_16:
- TBZ $3, R11, less_than_8
-
- MOVD.P 8(R13), R10
- CRC32CX R10, R9
-
-less_than_8:
- TBZ $2, R11, less_than_4
-
- MOVWU.P 4(R13), R10
- CRC32CW R10, R9
-
-less_than_4:
- TBZ $1, R11, less_than_2
-
- MOVHU.P 2(R13), R10
- CRC32CH R10, R9
-
-less_than_2:
- TBZ $0, R11, done
-
- MOVBU (R13), R10
- CRC32CB R10, R9
-
-done:
- MOVWU R9, ret+32(FP)
- RET
-
-// ieeeUpdate updates the non-inverted crc with the given data.
-
-// func ieeeUpdate(crc uint32, p []byte) uint32
-TEXT ·ieeeUpdate(SB), NOSPLIT, $0-36
- MOVWU crc+0(FP), R9 // CRC value
- MOVD p+8(FP), R13 // data pointer
- MOVD p_len+16(FP), R11 // len(p)
-
-update:
- CMP $16, R11
- BLT less_than_16
- LDP.P 16(R13), (R8, R10)
- CRC32X R8, R9
- CRC32X R10, R9
- SUB $16, R11
-
- JMP update
-
-less_than_16:
- TBZ $3, R11, less_than_8
-
- MOVD.P 8(R13), R10
- CRC32X R10, R9
-
-less_than_8:
- TBZ $2, R11, less_than_4
-
- MOVWU.P 4(R13), R10
- CRC32W R10, R9
-
-less_than_4:
- TBZ $1, R11, less_than_2
-
- MOVHU.P 2(R13), R10
- CRC32H R10, R9
-
-less_than_2:
- TBZ $0, R11, done
-
- MOVBU (R13), R10
- CRC32B R10, R9
-
-done:
- MOVWU R9, ret+32(FP)
- RET
diff --git a/vendor/github.com/klauspost/crc32/crc32_generic.go b/vendor/github.com/klauspost/crc32/crc32_generic.go
deleted file mode 100644
index d1cf69cf4..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_generic.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This file contains CRC32 algorithms that are not specific to any architecture
-// and don't use hardware acceleration.
-//
-// The simple (and slow) CRC32 implementation only uses a 256*4 bytes table.
-//
-// The slicing-by-8 algorithm is a faster implementation that uses a bigger
-// table (8*256*4 bytes).
-
-package crc32
-
-import "encoding/binary"
-
-// simpleMakeTable allocates and constructs a Table for the specified
-// polynomial. The table is suitable for use with the simple algorithm
-// (simpleUpdate).
-func simpleMakeTable(poly uint32) *Table {
- t := new(Table)
- simplePopulateTable(poly, t)
- return t
-}
-
-// simplePopulateTable constructs a Table for the specified polynomial, suitable
-// for use with simpleUpdate.
-func simplePopulateTable(poly uint32, t *Table) {
- for i := 0; i < 256; i++ {
- crc := uint32(i)
- for j := 0; j < 8; j++ {
- if crc&1 == 1 {
- crc = (crc >> 1) ^ poly
- } else {
- crc >>= 1
- }
- }
- t[i] = crc
- }
-}
-
-// simpleUpdate uses the simple algorithm to update the CRC, given a table that
-// was previously computed using simpleMakeTable.
-func simpleUpdate(crc uint32, tab *Table, p []byte) uint32 {
- crc = ^crc
- for _, v := range p {
- crc = tab[byte(crc)^v] ^ (crc >> 8)
- }
- return ^crc
-}
-
-// Use slicing-by-8 when payload >= this value.
-const slicing8Cutoff = 16
-
-// slicing8Table is array of 8 Tables, used by the slicing-by-8 algorithm.
-type slicing8Table [8]Table
-
-// slicingMakeTable constructs a slicing8Table for the specified polynomial. The
-// table is suitable for use with the slicing-by-8 algorithm (slicingUpdate).
-func slicingMakeTable(poly uint32) *slicing8Table {
- t := new(slicing8Table)
- simplePopulateTable(poly, &t[0])
- for i := 0; i < 256; i++ {
- crc := t[0][i]
- for j := 1; j < 8; j++ {
- crc = t[0][crc&0xFF] ^ (crc >> 8)
- t[j][i] = crc
- }
- }
- return t
-}
-
-// slicingUpdate uses the slicing-by-8 algorithm to update the CRC, given a
-// table that was previously computed using slicingMakeTable.
-func slicingUpdate(crc uint32, tab *slicing8Table, p []byte) uint32 {
- if len(p) >= slicing8Cutoff {
- crc = ^crc
- for len(p) > 8 {
- crc ^= binary.LittleEndian.Uint32(p)
- crc = tab[0][p[7]] ^ tab[1][p[6]] ^ tab[2][p[5]] ^ tab[3][p[4]] ^
- tab[4][crc>>24] ^ tab[5][(crc>>16)&0xFF] ^
- tab[6][(crc>>8)&0xFF] ^ tab[7][crc&0xFF]
- p = p[8:]
- }
- crc = ^crc
- }
- if len(p) == 0 {
- return crc
- }
- return simpleUpdate(crc, &tab[0], p)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_loong64.go b/vendor/github.com/klauspost/crc32/crc32_loong64.go
deleted file mode 100644
index 3e0fd9778..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_loong64.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// LoongArch64-specific hardware-assisted CRC32 algorithms. See crc32.go for a
-// description of the interface that each architecture-specific file
-// implements.
-
-package crc32
-
-import "golang.org/x/sys/cpu"
-
-func castagnoliUpdate(crc uint32, p []byte) uint32
-func ieeeUpdate(crc uint32, p []byte) uint32
-
-func archAvailableCastagnoli() bool {
- return cpu.Loong64.HasCRC32
-}
-
-func archInitCastagnoli() {
- if !cpu.Loong64.HasCRC32 {
- panic("arch-specific crc32 instruction for Castagnoli not available")
- }
-}
-
-func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
- if !cpu.Loong64.HasCRC32 {
- panic("arch-specific crc32 instruction for Castagnoli not available")
- }
-
- return ^castagnoliUpdate(^crc, p)
-}
-
-func archAvailableIEEE() bool {
- return cpu.Loong64.HasCRC32
-}
-
-func archInitIEEE() {
- if !cpu.Loong64.HasCRC32 {
- panic("arch-specific crc32 instruction for IEEE not available")
- }
-}
-
-func archUpdateIEEE(crc uint32, p []byte) uint32 {
- if !cpu.Loong64.HasCRC32 {
- panic("arch-specific crc32 instruction for IEEE not available")
- }
-
- return ^ieeeUpdate(^crc, p)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_loong64.s b/vendor/github.com/klauspost/crc32/crc32_loong64.s
deleted file mode 100644
index 7165714dc..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_loong64.s
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-// castagnoliUpdate updates the non-inverted crc with the given data.
-
-// func castagnoliUpdate(crc uint32, p []byte) uint32
-TEXT ·castagnoliUpdate(SB), NOSPLIT, $0-36
- MOVWU crc+0(FP), R4 // a0 = CRC value
- MOVV p+8(FP), R5 // a1 = data pointer
- MOVV p_len+16(FP), R6 // a2 = len(p)
-
- SGT $8, R6, R12
- BNE R12, less_than_8
- AND $7, R5, R12
- BEQ R12, aligned
-
- // Process the first few bytes to 8-byte align the input.
- // t0 = 8 - t0. We need to process this many bytes to align.
- SUB $1, R12
- XOR $7, R12
-
- AND $1, R12, R13
- BEQ R13, align_2
- MOVB (R5), R13
- CRCCWBW R4, R13, R4
- ADDV $1, R5
- ADDV $-1, R6
-
-align_2:
- AND $2, R12, R13
- BEQ R13, align_4
- MOVH (R5), R13
- CRCCWHW R4, R13, R4
- ADDV $2, R5
- ADDV $-2, R6
-
-align_4:
- AND $4, R12, R13
- BEQ R13, aligned
- MOVW (R5), R13
- CRCCWWW R4, R13, R4
- ADDV $4, R5
- ADDV $-4, R6
-
-aligned:
- // The input is now 8-byte aligned and we can process 8-byte chunks.
- SGT $8, R6, R12
- BNE R12, less_than_8
- MOVV (R5), R13
- CRCCWVW R4, R13, R4
- ADDV $8, R5
- ADDV $-8, R6
- JMP aligned
-
-less_than_8:
- // We may have some bytes left over; process 4 bytes, then 2, then 1.
- AND $4, R6, R12
- BEQ R12, less_than_4
- MOVW (R5), R13
- CRCCWWW R4, R13, R4
- ADDV $4, R5
- ADDV $-4, R6
-
-less_than_4:
- AND $2, R6, R12
- BEQ R12, less_than_2
- MOVH (R5), R13
- CRCCWHW R4, R13, R4
- ADDV $2, R5
- ADDV $-2, R6
-
-less_than_2:
- BEQ R6, done
- MOVB (R5), R13
- CRCCWBW R4, R13, R4
-
-done:
- MOVW R4, ret+32(FP)
- RET
-
-// ieeeUpdate updates the non-inverted crc with the given data.
-
-// func ieeeUpdate(crc uint32, p []byte) uint32
-TEXT ·ieeeUpdate(SB), NOSPLIT, $0-36
- MOVWU crc+0(FP), R4 // a0 = CRC value
- MOVV p+8(FP), R5 // a1 = data pointer
- MOVV p_len+16(FP), R6 // a2 = len(p)
-
- SGT $8, R6, R12
- BNE R12, less_than_8
- AND $7, R5, R12
- BEQ R12, aligned
-
- // Process the first few bytes to 8-byte align the input.
- // t0 = 8 - t0. We need to process this many bytes to align.
- SUB $1, R12
- XOR $7, R12
-
- AND $1, R12, R13
- BEQ R13, align_2
- MOVB (R5), R13
- CRCWBW R4, R13, R4
- ADDV $1, R5
- ADDV $-1, R6
-
-align_2:
- AND $2, R12, R13
- BEQ R13, align_4
- MOVH (R5), R13
- CRCWHW R4, R13, R4
- ADDV $2, R5
- ADDV $-2, R6
-
-align_4:
- AND $4, R12, R13
- BEQ R13, aligned
- MOVW (R5), R13
- CRCWWW R4, R13, R4
- ADDV $4, R5
- ADDV $-4, R6
-
-aligned:
- // The input is now 8-byte aligned and we can process 8-byte chunks.
- SGT $8, R6, R12
- BNE R12, less_than_8
- MOVV (R5), R13
- CRCWVW R4, R13, R4
- ADDV $8, R5
- ADDV $-8, R6
- JMP aligned
-
-less_than_8:
- // We may have some bytes left over; process 4 bytes, then 2, then 1.
- AND $4, R6, R12
- BEQ R12, less_than_4
- MOVW (R5), R13
- CRCWWW R4, R13, R4
- ADDV $4, R5
- ADDV $-4, R6
-
-less_than_4:
- AND $2, R6, R12
- BEQ R12, less_than_2
- MOVH (R5), R13
- CRCWHW R4, R13, R4
- ADDV $2, R5
- ADDV $-2, R6
-
-less_than_2:
- BEQ R6, done
- MOVB (R5), R13
- CRCWBW R4, R13, R4
-
-done:
- MOVW R4, ret+32(FP)
- RET
-
diff --git a/vendor/github.com/klauspost/crc32/crc32_otherarch.go b/vendor/github.com/klauspost/crc32/crc32_otherarch.go
deleted file mode 100644
index f900968ad..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_otherarch.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !amd64 && !s390x && !ppc64le && !arm64 && !loong64
-
-package crc32
-
-func archAvailableIEEE() bool { return false }
-func archInitIEEE() { panic("not available") }
-func archUpdateIEEE(crc uint32, p []byte) uint32 { panic("not available") }
-
-func archAvailableCastagnoli() bool { return false }
-func archInitCastagnoli() { panic("not available") }
-func archUpdateCastagnoli(crc uint32, p []byte) uint32 { panic("not available") }
diff --git a/vendor/github.com/klauspost/crc32/crc32_ppc64le.go b/vendor/github.com/klauspost/crc32/crc32_ppc64le.go
deleted file mode 100644
index c22e38e00..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_ppc64le.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package crc32
-
-import (
- "unsafe"
-)
-
-const (
- vecMinLen = 16
- vecAlignMask = 15 // align to 16 bytes
- crcIEEE = 1
- crcCast = 2
-)
-
-//go:noescape
-func ppc64SlicingUpdateBy8(crc uint32, table8 *slicing8Table, p []byte) uint32
-
-// this function requires the buffer to be 16 byte aligned and > 16 bytes long.
-//
-//go:noescape
-func vectorCrc32(crc uint32, poly uint32, p []byte) uint32
-
-var archCastagnoliTable8 *slicing8Table
-
-func archInitCastagnoli() {
- archCastagnoliTable8 = slicingMakeTable(Castagnoli)
-}
-
-func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
- if len(p) >= 4*vecMinLen {
- // If not aligned then process the initial unaligned bytes
-
- if uint64(uintptr(unsafe.Pointer(&p[0])))&uint64(vecAlignMask) != 0 {
- align := uint64(uintptr(unsafe.Pointer(&p[0]))) & uint64(vecAlignMask)
- newlen := vecMinLen - align
- crc = ppc64SlicingUpdateBy8(crc, archCastagnoliTable8, p[:newlen])
- p = p[newlen:]
- }
- // p should be aligned now
- aligned := len(p) & ^vecAlignMask
- crc = vectorCrc32(crc, crcCast, p[:aligned])
- p = p[aligned:]
- }
- if len(p) == 0 {
- return crc
- }
- return ppc64SlicingUpdateBy8(crc, archCastagnoliTable8, p)
-}
-
-func archAvailableIEEE() bool {
- return true
-}
-func archAvailableCastagnoli() bool {
- return true
-}
-
-var archIeeeTable8 *slicing8Table
-
-func archInitIEEE() {
- // We still use slicing-by-8 for small buffers.
- archIeeeTable8 = slicingMakeTable(IEEE)
-}
-
-// archUpdateIEEE calculates the checksum of p using vectorizedIEEE.
-func archUpdateIEEE(crc uint32, p []byte) uint32 {
-
- // Check if vector code should be used. If not aligned, then handle those
- // first up to the aligned bytes.
-
- if len(p) >= 4*vecMinLen {
- if uint64(uintptr(unsafe.Pointer(&p[0])))&uint64(vecAlignMask) != 0 {
- align := uint64(uintptr(unsafe.Pointer(&p[0]))) & uint64(vecAlignMask)
- newlen := vecMinLen - align
- crc = ppc64SlicingUpdateBy8(crc, archIeeeTable8, p[:newlen])
- p = p[newlen:]
- }
- aligned := len(p) & ^vecAlignMask
- crc = vectorCrc32(crc, crcIEEE, p[:aligned])
- p = p[aligned:]
- }
- if len(p) == 0 {
- return crc
- }
- return ppc64SlicingUpdateBy8(crc, archIeeeTable8, p)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_ppc64le.s b/vendor/github.com/klauspost/crc32/crc32_ppc64le.s
deleted file mode 100644
index 87edef705..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_ppc64le.s
+++ /dev/null
@@ -1,736 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// The vectorized implementation found below is a derived work
-// from code written by Anton Blanchard <anton@au.ibm.com> found
-// at https://github.com/antonblanchard/crc32-vpmsum. The original
-// is dual licensed under GPL and Apache 2. As the copyright holder
-// for the work, IBM has contributed this new work under
-// the golang license.
-
-// Changes include porting to Go assembler with modifications for
-// the Go ABI for ppc64le.
-
-#include "textflag.h"
-
-#define POWER8_OFFSET 132
-
-#define off16 R16
-#define off32 R17
-#define off48 R18
-#define off64 R19
-#define off80 R20
-#define off96 R21
-#define off112 R22
-
-#define const1 V24
-#define const2 V25
-
-#define byteswap V26
-#define mask_32bit V27
-#define mask_64bit V28
-#define zeroes V29
-
-#define MAX_SIZE 32*1024
-#define REFLECT
-
-TEXT ·ppc64SlicingUpdateBy8(SB), NOSPLIT|NOFRAME, $0-44
- MOVWZ crc+0(FP), R3 // incoming crc
- MOVD table8+8(FP), R4 // *Table
- MOVD p+16(FP), R5
- MOVD p_len+24(FP), R6 // p len
-
- CMP $0, R6 // len == 0?
- BNE start
- MOVW R3, ret+40(FP) // return crc
- RET
-
-start:
- NOR R3, R3, R7 // ^crc
- MOVWZ R7, R7 // 32 bits
- CMP R6, $16
- MOVD R6, CTR
- BLT short
- SRAD $3, R6, R8 // 8 byte chunks
- MOVD R8, CTR
-
-loop:
- MOVWZ 0(R5), R8 // 0-3 bytes of p ?Endian?
- MOVWZ 4(R5), R9 // 4-7 bytes of p
- MOVD R4, R10 // &tab[0]
- XOR R7, R8, R7 // crc ^= byte[0:3]
- RLDICL $40, R9, $56, R17 // p[7]
- SLD $2, R17, R17 // p[7]*4
- RLDICL $40, R7, $56, R8 // crc>>24
- SLD $2, R8, R8 // crc>>24*4
- RLDICL $48, R9, $56, R18 // p[6]
- SLD $2, R18, R18 // p[6]*4
- MOVWZ (R10)(R17), R21 // tab[0][p[7]]
- ADD $1024, R10, R10 // tab[1]
- RLDICL $56, R9, $56, R19 // p[5]
- SLD $2, R19, R19 // p[5]*4:1
- MOVWZ (R10)(R18), R22 // tab[1][p[6]]
- ADD $1024, R10, R10 // tab[2]
- XOR R21, R22, R21 // xor done R22
- CLRLSLDI $56, R9, $2, R20
- MOVWZ (R10)(R19), R23 // tab[2][p[5]]
- ADD $1024, R10, R10 // &tab[3]
- XOR R21, R23, R21 // xor done R23
- MOVWZ (R10)(R20), R24 // tab[3][p[4]]
- ADD $1024, R10, R10 // &tab[4]
- XOR R21, R24, R21 // xor done R24
- MOVWZ (R10)(R8), R25 // tab[4][crc>>24]
- RLDICL $48, R7, $56, R24 // crc>>16&0xFF
- XOR R21, R25, R21 // xor done R25
- ADD $1024, R10, R10 // &tab[5]
- SLD $2, R24, R24 // crc>>16&0xFF*4
- MOVWZ (R10)(R24), R26 // tab[5][crc>>16&0xFF]
- XOR R21, R26, R21 // xor done R26
- RLDICL $56, R7, $56, R25 // crc>>8
- ADD $1024, R10, R10 // &tab[6]
- SLD $2, R25, R25 // crc>>8&FF*2
- MOVBZ R7, R26 // crc&0xFF
- MOVWZ (R10)(R25), R27 // tab[6][crc>>8&0xFF]
- ADD $1024, R10, R10 // &tab[7]
- SLD $2, R26, R26 // crc&0xFF*2
- XOR R21, R27, R21 // xor done R27
- ADD $8, R5 // p = p[8:]
- MOVWZ (R10)(R26), R28 // tab[7][crc&0xFF]
- XOR R21, R28, R21 // xor done R28
- MOVWZ R21, R7 // crc for next round
- BDNZ loop
- ANDCC $7, R6, R8 // any leftover bytes
- BEQ done // none --> done
- MOVD R8, CTR // byte count
- PCALIGN $16 // align short loop
-
-short:
- MOVBZ 0(R5), R8 // get v
- XOR R8, R7, R8 // byte(crc)^v -> R8
- RLDIC $2, R8, $54, R8 // rldicl r8,r8,2,22
- SRD $8, R7, R14 // crc>>8
- MOVWZ (R4)(R8), R10
- ADD $1, R5
- XOR R10, R14, R7 // loop crc in R7
- BDNZ short
-
-done:
- NOR R7, R7, R7 // ^crc
- MOVW R7, ret+40(FP) // return crc
- RET
-
-#ifdef BYTESWAP_DATA
-DATA ·byteswapcons+0(SB)/8, $0x0706050403020100
-DATA ·byteswapcons+8(SB)/8, $0x0f0e0d0c0b0a0908
-
-GLOBL ·byteswapcons+0(SB), RODATA, $16
-#endif
-
-TEXT ·vectorCrc32(SB), NOSPLIT|NOFRAME, $0-36
- MOVWZ crc+0(FP), R3 // incoming crc
- MOVWZ ctab+4(FP), R14 // crc poly id
- MOVD p+8(FP), R4
- MOVD p_len+16(FP), R5 // p len
-
- // R3 = incoming crc
- // R14 = constant table identifier
- // R5 = address of bytes
- // R6 = length of bytes
-
- // defines for index loads
-
- MOVD $16, off16
- MOVD $32, off32
- MOVD $48, off48
- MOVD $64, off64
- MOVD $80, off80
- MOVD $96, off96
- MOVD $112, off112
- MOVD $0, R15
-
- MOVD R3, R10 // save initial crc
-
- NOR R3, R3, R3 // ^crc
- MOVWZ R3, R3 // 32 bits
- VXOR zeroes, zeroes, zeroes // clear the V reg
- VSPLTISW $-1, V0
- VSLDOI $4, V29, V0, mask_32bit
- VSLDOI $8, V29, V0, mask_64bit
-
- VXOR V8, V8, V8
- MTVSRD R3, VS40 // crc initial value VS40 = V8
-
-#ifdef REFLECT
- VSLDOI $8, zeroes, V8, V8 // or: VSLDOI V29,V8,V27,4 for top 32 bits?
-
-#else
- VSLDOI $4, V8, zeroes, V8
-
-#endif
-
-#ifdef BYTESWAP_DATA
- MOVD $·byteswapcons(SB), R3
- LVX (R3), byteswap
-
-#endif
-
- CMPU R5, $256 // length of bytes
- BLT short
-
- RLDICR $0, R5, $56, R6 // chunk to process
-
- // First step for larger sizes
-l1:
- MOVD $32768, R7
- MOVD R7, R9
- CMP R6, R7 // compare R6, R7 (MAX SIZE)
- BGT top // less than MAX, just do remainder
- MOVD R6, R7
-
-top:
- SUB R7, R6, R6
-
- // mainloop does 128 bytes at a time
- SRD $7, R7
-
- // determine the offset into the constants table to start with.
- // Each constant is 128 bytes, used against 16 bytes of data.
- SLD $4, R7, R8
- SRD $3, R9, R9
- SUB R8, R9, R8
-
- // The last iteration is reduced in a separate step
- ADD $-1, R7
- MOVD R7, CTR
-
- // Determine which constant table (depends on poly)
- CMP R14, $1
- BNE castTable
- MOVD $·IEEEConst(SB), R3
- BR startConst
-
-castTable:
- MOVD $·CastConst(SB), R3
-
-startConst:
- ADD R3, R8, R3 // starting point in constants table
-
- VXOR V0, V0, V0 // clear the V regs
- VXOR V1, V1, V1
- VXOR V2, V2, V2
- VXOR V3, V3, V3
- VXOR V4, V4, V4
- VXOR V5, V5, V5
- VXOR V6, V6, V6
- VXOR V7, V7, V7
-
- LVX (R3), const1 // loading constant values
-
- CMP R15, $1 // Identify warm up pass
- BEQ next
-
- // First warm up pass: load the bytes to process
- LVX (R4), V16
- LVX (R4+off16), V17
- LVX (R4+off32), V18
- LVX (R4+off48), V19
- LVX (R4+off64), V20
- LVX (R4+off80), V21
- LVX (R4+off96), V22
- LVX (R4+off112), V23
- ADD $128, R4 // bump up to next 128 bytes in buffer
-
- VXOR V16, V8, V16 // xor in initial CRC in V8
-
-next:
- BC 18, 0, first_warm_up_done
-
- ADD $16, R3 // bump up to next constants
- LVX (R3), const2 // table values
-
- VPMSUMD V16, const1, V8 // second warm up pass
- LVX (R4), V16 // load from buffer
- OR $0, R2, R2
-
- VPMSUMD V17, const1, V9 // vpmsumd with constants
- LVX (R4+off16), V17 // load next from buffer
- OR $0, R2, R2
-
- VPMSUMD V18, const1, V10 // vpmsumd with constants
- LVX (R4+off32), V18 // load next from buffer
- OR $0, R2, R2
-
- VPMSUMD V19, const1, V11 // vpmsumd with constants
- LVX (R4+off48), V19 // load next from buffer
- OR $0, R2, R2
-
- VPMSUMD V20, const1, V12 // vpmsumd with constants
- LVX (R4+off64), V20 // load next from buffer
- OR $0, R2, R2
-
- VPMSUMD V21, const1, V13 // vpmsumd with constants
- LVX (R4+off80), V21 // load next from buffer
- OR $0, R2, R2
-
- VPMSUMD V22, const1, V14 // vpmsumd with constants
- LVX (R4+off96), V22 // load next from buffer
- OR $0, R2, R2
-
- VPMSUMD V23, const1, V15 // vpmsumd with constants
- LVX (R4+off112), V23 // load next from buffer
-
- ADD $128, R4 // bump up to next 128 bytes in buffer
-
- BC 18, 0, first_cool_down
-
-cool_top:
- LVX (R3), const1 // constants
- ADD $16, R3 // inc to next constants
- OR $0, R2, R2
-
- VXOR V0, V8, V0 // xor in previous vpmsumd
- VPMSUMD V16, const2, V8 // vpmsumd with constants
- LVX (R4), V16 // buffer
- OR $0, R2, R2
-
- VXOR V1, V9, V1 // xor in previous
- VPMSUMD V17, const2, V9 // vpmsumd with constants
- LVX (R4+off16), V17 // next in buffer
- OR $0, R2, R2
-
- VXOR V2, V10, V2 // xor in previous
- VPMSUMD V18, const2, V10 // vpmsumd with constants
- LVX (R4+off32), V18 // next in buffer
- OR $0, R2, R2
-
- VXOR V3, V11, V3 // xor in previous
- VPMSUMD V19, const2, V11 // vpmsumd with constants
- LVX (R4+off48), V19 // next in buffer
- LVX (R3), const2 // get next constant
- OR $0, R2, R2
-
- VXOR V4, V12, V4 // xor in previous
- VPMSUMD V20, const1, V12 // vpmsumd with constants
- LVX (R4+off64), V20 // next in buffer
- OR $0, R2, R2
-
- VXOR V5, V13, V5 // xor in previous
- VPMSUMD V21, const1, V13 // vpmsumd with constants
- LVX (R4+off80), V21 // next in buffer
- OR $0, R2, R2
-
- VXOR V6, V14, V6 // xor in previous
- VPMSUMD V22, const1, V14 // vpmsumd with constants
- LVX (R4+off96), V22 // next in buffer
- OR $0, R2, R2
-
- VXOR V7, V15, V7 // xor in previous
- VPMSUMD V23, const1, V15 // vpmsumd with constants
- LVX (R4+off112), V23 // next in buffer
-
- ADD $128, R4 // bump up buffer pointer
- BDNZ cool_top // are we done?
-
-first_cool_down:
-
- // load the constants
- // xor in the previous value
- // vpmsumd the result with constants
-
- LVX (R3), const1
- ADD $16, R3
-
- VXOR V0, V8, V0
- VPMSUMD V16, const1, V8
- OR $0, R2, R2
-
- VXOR V1, V9, V1
- VPMSUMD V17, const1, V9
- OR $0, R2, R2
-
- VXOR V2, V10, V2
- VPMSUMD V18, const1, V10
- OR $0, R2, R2
-
- VXOR V3, V11, V3
- VPMSUMD V19, const1, V11
- OR $0, R2, R2
-
- VXOR V4, V12, V4
- VPMSUMD V20, const1, V12
- OR $0, R2, R2
-
- VXOR V5, V13, V5
- VPMSUMD V21, const1, V13
- OR $0, R2, R2
-
- VXOR V6, V14, V6
- VPMSUMD V22, const1, V14
- OR $0, R2, R2
-
- VXOR V7, V15, V7
- VPMSUMD V23, const1, V15
- OR $0, R2, R2
-
-second_cool_down:
-
- VXOR V0, V8, V0
- VXOR V1, V9, V1
- VXOR V2, V10, V2
- VXOR V3, V11, V3
- VXOR V4, V12, V4
- VXOR V5, V13, V5
- VXOR V6, V14, V6
- VXOR V7, V15, V7
-
-#ifdef REFLECT
- VSLDOI $4, V0, zeroes, V0
- VSLDOI $4, V1, zeroes, V1
- VSLDOI $4, V2, zeroes, V2
- VSLDOI $4, V3, zeroes, V3
- VSLDOI $4, V4, zeroes, V4
- VSLDOI $4, V5, zeroes, V5
- VSLDOI $4, V6, zeroes, V6
- VSLDOI $4, V7, zeroes, V7
-
-#endif
-
- LVX (R4), V8
- LVX (R4+off16), V9
- LVX (R4+off32), V10
- LVX (R4+off48), V11
- LVX (R4+off64), V12
- LVX (R4+off80), V13
- LVX (R4+off96), V14
- LVX (R4+off112), V15
-
- ADD $128, R4
-
- VXOR V0, V8, V16
- VXOR V1, V9, V17
- VXOR V2, V10, V18
- VXOR V3, V11, V19
- VXOR V4, V12, V20
- VXOR V5, V13, V21
- VXOR V6, V14, V22
- VXOR V7, V15, V23
-
- MOVD $1, R15
- CMP $0, R6
- ADD $128, R6
-
- BNE l1
- ANDCC $127, R5
- SUBC R5, $128, R6
- ADD R3, R6, R3
-
- SRD $4, R5, R7
- MOVD R7, CTR
- LVX (R3), V0
- LVX (R3+off16), V1
- LVX (R3+off32), V2
- LVX (R3+off48), V3
- LVX (R3+off64), V4
- LVX (R3+off80), V5
- LVX (R3+off96), V6
- LVX (R3+off112), V7
-
- ADD $128, R3
-
- VPMSUMW V16, V0, V0
- VPMSUMW V17, V1, V1
- VPMSUMW V18, V2, V2
- VPMSUMW V19, V3, V3
- VPMSUMW V20, V4, V4
- VPMSUMW V21, V5, V5
- VPMSUMW V22, V6, V6
- VPMSUMW V23, V7, V7
-
- // now reduce the tail
-
- CMP $0, R7
- BEQ next1
-
- LVX (R4), V16
- LVX (R3), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
- BC 18, 0, next1
-
- LVX (R4+off16), V16
- LVX (R3+off16), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
- BC 18, 0, next1
-
- LVX (R4+off32), V16
- LVX (R3+off32), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
- BC 18, 0, next1
-
- LVX (R4+off48), V16
- LVX (R3+off48), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
- BC 18, 0, next1
-
- LVX (R4+off64), V16
- LVX (R3+off64), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
- BC 18, 0, next1
-
- LVX (R4+off80), V16
- LVX (R3+off80), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
- BC 18, 0, next1
-
- LVX (R4+off96), V16
- LVX (R3+off96), V17
- VPMSUMW V16, V17, V16
- VXOR V0, V16, V0
-
-next1:
- VXOR V0, V1, V0
- VXOR V2, V3, V2
- VXOR V4, V5, V4
- VXOR V6, V7, V6
- VXOR V0, V2, V0
- VXOR V4, V6, V4
- VXOR V0, V4, V0
-
-barrett_reduction:
-
- CMP R14, $1
- BNE barcstTable
- MOVD $·IEEEBarConst(SB), R3
- BR startbarConst
-
-barcstTable:
- MOVD $·CastBarConst(SB), R3
-
-startbarConst:
- LVX (R3), const1
- LVX (R3+off16), const2
-
- VSLDOI $8, V0, V0, V1
- VXOR V0, V1, V0
-
-#ifdef REFLECT
- VSPLTISB $1, V1
- VSL V0, V1, V0
-
-#endif
-
- VAND V0, mask_64bit, V0
-
-#ifndef REFLECT
-
- VPMSUMD V0, const1, V1
- VSLDOI $8, zeroes, V1, V1
- VPMSUMD V1, const2, V1
- VXOR V0, V1, V0
- VSLDOI $8, V0, zeroes, V0
-
-#else
-
- VAND V0, mask_32bit, V1
- VPMSUMD V1, const1, V1
- VAND V1, mask_32bit, V1
- VPMSUMD V1, const2, V1
- VXOR V0, V1, V0
- VSLDOI $4, V0, zeroes, V0
-
-#endif
-
- MFVSRD VS32, R3 // VS32 = V0
-
- NOR R3, R3, R3 // return ^crc
- MOVW R3, ret+32(FP)
- RET
-
-first_warm_up_done:
-
- LVX (R3), const1
- ADD $16, R3
-
- VPMSUMD V16, const1, V8
- VPMSUMD V17, const1, V9
- VPMSUMD V18, const1, V10
- VPMSUMD V19, const1, V11
- VPMSUMD V20, const1, V12
- VPMSUMD V21, const1, V13
- VPMSUMD V22, const1, V14
- VPMSUMD V23, const1, V15
-
- BR second_cool_down
-
-short:
- CMP $0, R5
- BEQ zero
-
- // compute short constants
-
- CMP R14, $1
- BNE castshTable
- MOVD $·IEEEConst(SB), R3
- ADD $4080, R3
- BR startshConst
-
-castshTable:
- MOVD $·CastConst(SB), R3
- ADD $4080, R3
-
-startshConst:
- SUBC R5, $256, R6 // sub from 256
- ADD R3, R6, R3
-
- // calculate where to start
-
- SRD $4, R5, R7
- MOVD R7, CTR
-
- VXOR V19, V19, V19
- VXOR V20, V20, V20
-
- LVX (R4), V0
- LVX (R3), V16
- VXOR V0, V8, V0
- VPMSUMW V0, V16, V0
- BC 18, 0, v0
-
- LVX (R4+off16), V1
- LVX (R3+off16), V17
- VPMSUMW V1, V17, V1
- BC 18, 0, v1
-
- LVX (R4+off32), V2
- LVX (R3+off32), V16
- VPMSUMW V2, V16, V2
- BC 18, 0, v2
-
- LVX (R4+off48), V3
- LVX (R3+off48), V17
- VPMSUMW V3, V17, V3
- BC 18, 0, v3
-
- LVX (R4+off64), V4
- LVX (R3+off64), V16
- VPMSUMW V4, V16, V4
- BC 18, 0, v4
-
- LVX (R4+off80), V5
- LVX (R3+off80), V17
- VPMSUMW V5, V17, V5
- BC 18, 0, v5
-
- LVX (R4+off96), V6
- LVX (R3+off96), V16
- VPMSUMW V6, V16, V6
- BC 18, 0, v6
-
- LVX (R4+off112), V7
- LVX (R3+off112), V17
- VPMSUMW V7, V17, V7
- BC 18, 0, v7
-
- ADD $128, R3
- ADD $128, R4
-
- LVX (R4), V8
- LVX (R3), V16
- VPMSUMW V8, V16, V8
- BC 18, 0, v8
-
- LVX (R4+off16), V9
- LVX (R3+off16), V17
- VPMSUMW V9, V17, V9
- BC 18, 0, v9
-
- LVX (R4+off32), V10
- LVX (R3+off32), V16
- VPMSUMW V10, V16, V10
- BC 18, 0, v10
-
- LVX (R4+off48), V11
- LVX (R3+off48), V17
- VPMSUMW V11, V17, V11
- BC 18, 0, v11
-
- LVX (R4+off64), V12
- LVX (R3+off64), V16
- VPMSUMW V12, V16, V12
- BC 18, 0, v12
-
- LVX (R4+off80), V13
- LVX (R3+off80), V17
- VPMSUMW V13, V17, V13
- BC 18, 0, v13
-
- LVX (R4+off96), V14
- LVX (R3+off96), V16
- VPMSUMW V14, V16, V14
- BC 18, 0, v14
-
- LVX (R4+off112), V15
- LVX (R3+off112), V17
- VPMSUMW V15, V17, V15
-
- VXOR V19, V15, V19
-
-v14:
- VXOR V20, V14, V20
-
-v13:
- VXOR V19, V13, V19
-
-v12:
- VXOR V20, V12, V20
-
-v11:
- VXOR V19, V11, V19
-
-v10:
- VXOR V20, V10, V20
-
-v9:
- VXOR V19, V9, V19
-
-v8:
- VXOR V20, V8, V20
-
-v7:
- VXOR V19, V7, V19
-
-v6:
- VXOR V20, V6, V20
-
-v5:
- VXOR V19, V5, V19
-
-v4:
- VXOR V20, V4, V20
-
-v3:
- VXOR V19, V3, V19
-
-v2:
- VXOR V20, V2, V20
-
-v1:
- VXOR V19, V1, V19
-
-v0:
- VXOR V20, V0, V20
-
- VXOR V19, V20, V0
-
- BR barrett_reduction
-
-zero:
- // This case is the original crc, so just return it
- MOVW R10, ret+32(FP)
- RET
diff --git a/vendor/github.com/klauspost/crc32/crc32_s390x.go b/vendor/github.com/klauspost/crc32/crc32_s390x.go
deleted file mode 100644
index 67b4ea7d9..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_s390x.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package crc32
-
-import "golang.org/x/sys/cpu"
-
-const (
- vxMinLen = 64
- vxAlignMask = 15 // align to 16 bytes
-)
-
-// hasVX reports whether the machine has the z/Architecture
-// vector facility installed and enabled.
-var hasVX = cpu.S390X.HasVX
-
-// vectorizedCastagnoli implements CRC32 using vector instructions.
-// It is defined in crc32_s390x.s.
-//
-//go:noescape
-func vectorizedCastagnoli(crc uint32, p []byte) uint32
-
-// vectorizedIEEE implements CRC32 using vector instructions.
-// It is defined in crc32_s390x.s.
-//
-//go:noescape
-func vectorizedIEEE(crc uint32, p []byte) uint32
-
-func archAvailableCastagnoli() bool {
- return hasVX
-}
-
-var archCastagnoliTable8 *slicing8Table
-
-func archInitCastagnoli() {
- if !hasVX {
- panic("not available")
- }
- // We still use slicing-by-8 for small buffers.
- archCastagnoliTable8 = slicingMakeTable(Castagnoli)
-}
-
-// archUpdateCastagnoli calculates the checksum of p using
-// vectorizedCastagnoli.
-func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
- if !hasVX {
- panic("not available")
- }
- // Use vectorized function if data length is above threshold.
- if len(p) >= vxMinLen {
- aligned := len(p) & ^vxAlignMask
- crc = vectorizedCastagnoli(crc, p[:aligned])
- p = p[aligned:]
- }
- if len(p) == 0 {
- return crc
- }
- return slicingUpdate(crc, archCastagnoliTable8, p)
-}
-
-func archAvailableIEEE() bool {
- return hasVX
-}
-
-var archIeeeTable8 *slicing8Table
-
-func archInitIEEE() {
- if !hasVX {
- panic("not available")
- }
- // We still use slicing-by-8 for small buffers.
- archIeeeTable8 = slicingMakeTable(IEEE)
-}
-
-// archUpdateIEEE calculates the checksum of p using vectorizedIEEE.
-func archUpdateIEEE(crc uint32, p []byte) uint32 {
- if !hasVX {
- panic("not available")
- }
- // Use vectorized function if data length is above threshold.
- if len(p) >= vxMinLen {
- aligned := len(p) & ^vxAlignMask
- crc = vectorizedIEEE(crc, p[:aligned])
- p = p[aligned:]
- }
- if len(p) == 0 {
- return crc
- }
- return slicingUpdate(crc, archIeeeTable8, p)
-}
diff --git a/vendor/github.com/klauspost/crc32/crc32_s390x.s b/vendor/github.com/klauspost/crc32/crc32_s390x.s
deleted file mode 100644
index aefda50e1..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_s390x.s
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-// Vector register range containing CRC-32 constants
-
-#define CONST_PERM_LE2BE V9
-#define CONST_R2R1 V10
-#define CONST_R4R3 V11
-#define CONST_R5 V12
-#define CONST_RU_POLY V13
-#define CONST_CRC_POLY V14
-
-// The CRC-32 constant block contains reduction constants to fold and
-// process particular chunks of the input data stream in parallel.
-//
-// Note that the constant definitions below are extended in order to compute
-// intermediate results with a single VECTOR GALOIS FIELD MULTIPLY instruction.
-// The rightmost doubleword can be 0 to prevent contribution to the result or
-// can be multiplied by 1 to perform an XOR without the need for a separate
-// VECTOR EXCLUSIVE OR instruction.
-//
-// The polynomials used are bit-reflected:
-//
-// IEEE: P'(x) = 0x0edb88320
-// Castagnoli: P'(x) = 0x082f63b78
-
-// IEEE polynomial constants
-DATA ·crclecons+0(SB)/8, $0x0F0E0D0C0B0A0908 // LE-to-BE mask
-DATA ·crclecons+8(SB)/8, $0x0706050403020100
-DATA ·crclecons+16(SB)/8, $0x00000001c6e41596 // R2
-DATA ·crclecons+24(SB)/8, $0x0000000154442bd4 // R1
-DATA ·crclecons+32(SB)/8, $0x00000000ccaa009e // R4
-DATA ·crclecons+40(SB)/8, $0x00000001751997d0 // R3
-DATA ·crclecons+48(SB)/8, $0x0000000000000000
-DATA ·crclecons+56(SB)/8, $0x0000000163cd6124 // R5
-DATA ·crclecons+64(SB)/8, $0x0000000000000000
-DATA ·crclecons+72(SB)/8, $0x00000001F7011641 // u'
-DATA ·crclecons+80(SB)/8, $0x0000000000000000
-DATA ·crclecons+88(SB)/8, $0x00000001DB710641 // P'(x) << 1
-
-GLOBL ·crclecons(SB), RODATA, $144
-
-// Castagonli Polynomial constants
-DATA ·crcclecons+0(SB)/8, $0x0F0E0D0C0B0A0908 // LE-to-BE mask
-DATA ·crcclecons+8(SB)/8, $0x0706050403020100
-DATA ·crcclecons+16(SB)/8, $0x000000009e4addf8 // R2
-DATA ·crcclecons+24(SB)/8, $0x00000000740eef02 // R1
-DATA ·crcclecons+32(SB)/8, $0x000000014cd00bd6 // R4
-DATA ·crcclecons+40(SB)/8, $0x00000000f20c0dfe // R3
-DATA ·crcclecons+48(SB)/8, $0x0000000000000000
-DATA ·crcclecons+56(SB)/8, $0x00000000dd45aab8 // R5
-DATA ·crcclecons+64(SB)/8, $0x0000000000000000
-DATA ·crcclecons+72(SB)/8, $0x00000000dea713f1 // u'
-DATA ·crcclecons+80(SB)/8, $0x0000000000000000
-DATA ·crcclecons+88(SB)/8, $0x0000000105ec76f0 // P'(x) << 1
-
-GLOBL ·crcclecons(SB), RODATA, $144
-
-// The CRC-32 function(s) use these calling conventions:
-//
-// Parameters:
-//
-// R2: Initial CRC value, typically ~0; and final CRC (return) value.
-// R3: Input buffer pointer, performance might be improved if the
-// buffer is on a doubleword boundary.
-// R4: Length of the buffer, must be 64 bytes or greater.
-//
-// Register usage:
-//
-// R5: CRC-32 constant pool base pointer.
-// V0: Initial CRC value and intermediate constants and results.
-// V1..V4: Data for CRC computation.
-// V5..V8: Next data chunks that are fetched from the input buffer.
-//
-// V9..V14: CRC-32 constants.
-
-// func vectorizedIEEE(crc uint32, p []byte) uint32
-TEXT ·vectorizedIEEE(SB), NOSPLIT, $0
- MOVWZ crc+0(FP), R2 // R2 stores the CRC value
- MOVD p+8(FP), R3 // data pointer
- MOVD p_len+16(FP), R4 // len(p)
-
- MOVD $·crclecons(SB), R5
- BR vectorizedBody<>(SB)
-
-// func vectorizedCastagnoli(crc uint32, p []byte) uint32
-TEXT ·vectorizedCastagnoli(SB), NOSPLIT, $0
- MOVWZ crc+0(FP), R2 // R2 stores the CRC value
- MOVD p+8(FP), R3 // data pointer
- MOVD p_len+16(FP), R4 // len(p)
-
- // R5: crc-32 constant pool base pointer, constant is used to reduce crc
- MOVD $·crcclecons(SB), R5
- BR vectorizedBody<>(SB)
-
-TEXT vectorizedBody<>(SB), NOSPLIT, $0
- XOR $0xffffffff, R2 // NOTW R2
- VLM 0(R5), CONST_PERM_LE2BE, CONST_CRC_POLY
-
- // Load the initial CRC value into the rightmost word of V0
- VZERO V0
- VLVGF $3, R2, V0
-
- // Crash if the input size is less than 64-bytes.
- CMP R4, $64
- BLT crash
-
- // Load a 64-byte data chunk and XOR with CRC
- VLM 0(R3), V1, V4 // 64-bytes into V1..V4
-
- // Reflect the data if the CRC operation is in the bit-reflected domain
- VPERM V1, V1, CONST_PERM_LE2BE, V1
- VPERM V2, V2, CONST_PERM_LE2BE, V2
- VPERM V3, V3, CONST_PERM_LE2BE, V3
- VPERM V4, V4, CONST_PERM_LE2BE, V4
-
- VX V0, V1, V1 // V1 ^= CRC
- ADD $64, R3 // BUF = BUF + 64
- ADD $(-64), R4
-
- // Check remaining buffer size and jump to proper folding method
- CMP R4, $64
- BLT less_than_64bytes
-
-fold_64bytes_loop:
- // Load the next 64-byte data chunk into V5 to V8
- VLM 0(R3), V5, V8
- VPERM V5, V5, CONST_PERM_LE2BE, V5
- VPERM V6, V6, CONST_PERM_LE2BE, V6
- VPERM V7, V7, CONST_PERM_LE2BE, V7
- VPERM V8, V8, CONST_PERM_LE2BE, V8
-
- // Perform a GF(2) multiplication of the doublewords in V1 with
- // the reduction constants in V0. The intermediate result is
- // then folded (accumulated) with the next data chunk in V5 and
- // stored in V1. Repeat this step for the register contents
- // in V2, V3, and V4 respectively.
-
- VGFMAG CONST_R2R1, V1, V5, V1
- VGFMAG CONST_R2R1, V2, V6, V2
- VGFMAG CONST_R2R1, V3, V7, V3
- VGFMAG CONST_R2R1, V4, V8, V4
-
- // Adjust buffer pointer and length for next loop
- ADD $64, R3 // BUF = BUF + 64
- ADD $(-64), R4 // LEN = LEN - 64
-
- CMP R4, $64
- BGE fold_64bytes_loop
-
-less_than_64bytes:
- // Fold V1 to V4 into a single 128-bit value in V1
- VGFMAG CONST_R4R3, V1, V2, V1
- VGFMAG CONST_R4R3, V1, V3, V1
- VGFMAG CONST_R4R3, V1, V4, V1
-
- // Check whether to continue with 64-bit folding
- CMP R4, $16
- BLT final_fold
-
-fold_16bytes_loop:
- VL 0(R3), V2 // Load next data chunk
- VPERM V2, V2, CONST_PERM_LE2BE, V2
-
- VGFMAG CONST_R4R3, V1, V2, V1 // Fold next data chunk
-
- // Adjust buffer pointer and size for folding next data chunk
- ADD $16, R3
- ADD $-16, R4
-
- // Process remaining data chunks
- CMP R4, $16
- BGE fold_16bytes_loop
-
-final_fold:
- VLEIB $7, $0x40, V9
- VSRLB V9, CONST_R4R3, V0
- VLEIG $0, $1, V0
-
- VGFMG V0, V1, V1
-
- VLEIB $7, $0x20, V9 // Shift by words
- VSRLB V9, V1, V2 // Store remaining bits in V2
- VUPLLF V1, V1 // Split rightmost doubleword
- VGFMAG CONST_R5, V1, V2, V1 // V1 = (V1 * R5) XOR V2
-
- // The input values to the Barret reduction are the degree-63 polynomial
- // in V1 (R(x)), degree-32 generator polynomial, and the reduction
- // constant u. The Barret reduction result is the CRC value of R(x) mod
- // P(x).
- //
- // The Barret reduction algorithm is defined as:
- //
- // 1. T1(x) = floor( R(x) / x^32 ) GF2MUL u
- // 2. T2(x) = floor( T1(x) / x^32 ) GF2MUL P(x)
- // 3. C(x) = R(x) XOR T2(x) mod x^32
- //
- // Note: To compensate the division by x^32, use the vector unpack
- // instruction to move the leftmost word into the leftmost doubleword
- // of the vector register. The rightmost doubleword is multiplied
- // with zero to not contribute to the intermediate results.
-
- // T1(x) = floor( R(x) / x^32 ) GF2MUL u
- VUPLLF V1, V2
- VGFMG CONST_RU_POLY, V2, V2
-
- // Compute the GF(2) product of the CRC polynomial in VO with T1(x) in
- // V2 and XOR the intermediate result, T2(x), with the value in V1.
- // The final result is in the rightmost word of V2.
-
- VUPLLF V2, V2
- VGFMAG CONST_CRC_POLY, V2, V1, V2
-
-done:
- VLGVF $2, V2, R2
- XOR $0xffffffff, R2 // NOTW R2
- MOVWZ R2, ret + 32(FP)
- RET
-
-crash:
- MOVD $0, (R0) // input size is less than 64-bytes
-
diff --git a/vendor/github.com/klauspost/crc32/crc32_table_ppc64le.s b/vendor/github.com/klauspost/crc32/crc32_table_ppc64le.s
deleted file mode 100644
index 1f3c1efda..000000000
--- a/vendor/github.com/klauspost/crc32/crc32_table_ppc64le.s
+++ /dev/null
@@ -1,3285 +0,0 @@
-// Code generated by "go run gen_const_ppc64le.go"; DO NOT EDIT.
-
-#include "textflag.h"
-
-// Reduce 262144 kbits to 1024 bits
-// x^261184 mod p(x), x^261120 mod p(x)
-DATA ·IEEEConst+0(SB)/8, $0x0000000099ea94a8
-DATA ·IEEEConst+8(SB)/8, $0x00000001651797d2
-
-// x^260160 mod p(x), x^260096 mod p(x)
-DATA ·IEEEConst+16(SB)/8, $0x00000000945a8420
-DATA ·IEEEConst+24(SB)/8, $0x0000000021e0d56c
-
-// x^259136 mod p(x), x^259072 mod p(x)
-DATA ·IEEEConst+32(SB)/8, $0x0000000030762706
-DATA ·IEEEConst+40(SB)/8, $0x000000000f95ecaa
-
-// x^258112 mod p(x), x^258048 mod p(x)
-DATA ·IEEEConst+48(SB)/8, $0x00000001a52fc582
-DATA ·IEEEConst+56(SB)/8, $0x00000001ebd224ac
-
-// x^257088 mod p(x), x^257024 mod p(x)
-DATA ·IEEEConst+64(SB)/8, $0x00000001a4a7167a
-DATA ·IEEEConst+72(SB)/8, $0x000000000ccb97ca
-
-// x^256064 mod p(x), x^256000 mod p(x)
-DATA ·IEEEConst+80(SB)/8, $0x000000000c18249a
-DATA ·IEEEConst+88(SB)/8, $0x00000001006ec8a8
-
-// x^255040 mod p(x), x^254976 mod p(x)
-DATA ·IEEEConst+96(SB)/8, $0x00000000a924ae7c
-DATA ·IEEEConst+104(SB)/8, $0x000000014f58f196
-
-// x^254016 mod p(x), x^253952 mod p(x)
-DATA ·IEEEConst+112(SB)/8, $0x00000001e12ccc12
-DATA ·IEEEConst+120(SB)/8, $0x00000001a7192ca6
-
-// x^252992 mod p(x), x^252928 mod p(x)
-DATA ·IEEEConst+128(SB)/8, $0x00000000a0b9d4ac
-DATA ·IEEEConst+136(SB)/8, $0x000000019a64bab2
-
-// x^251968 mod p(x), x^251904 mod p(x)
-DATA ·IEEEConst+144(SB)/8, $0x0000000095e8ddfe
-DATA ·IEEEConst+152(SB)/8, $0x0000000014f4ed2e
-
-// x^250944 mod p(x), x^250880 mod p(x)
-DATA ·IEEEConst+160(SB)/8, $0x00000000233fddc4
-DATA ·IEEEConst+168(SB)/8, $0x000000011092b6a2
-
-// x^249920 mod p(x), x^249856 mod p(x)
-DATA ·IEEEConst+176(SB)/8, $0x00000001b4529b62
-DATA ·IEEEConst+184(SB)/8, $0x00000000c8a1629c
-
-// x^248896 mod p(x), x^248832 mod p(x)
-DATA ·IEEEConst+192(SB)/8, $0x00000001a7fa0e64
-DATA ·IEEEConst+200(SB)/8, $0x000000017bf32e8e
-
-// x^247872 mod p(x), x^247808 mod p(x)
-DATA ·IEEEConst+208(SB)/8, $0x00000001b5334592
-DATA ·IEEEConst+216(SB)/8, $0x00000001f8cc6582
-
-// x^246848 mod p(x), x^246784 mod p(x)
-DATA ·IEEEConst+224(SB)/8, $0x000000011f8ee1b4
-DATA ·IEEEConst+232(SB)/8, $0x000000008631ddf0
-
-// x^245824 mod p(x), x^245760 mod p(x)
-DATA ·IEEEConst+240(SB)/8, $0x000000006252e632
-DATA ·IEEEConst+248(SB)/8, $0x000000007e5a76d0
-
-// x^244800 mod p(x), x^244736 mod p(x)
-DATA ·IEEEConst+256(SB)/8, $0x00000000ab973e84
-DATA ·IEEEConst+264(SB)/8, $0x000000002b09b31c
-
-// x^243776 mod p(x), x^243712 mod p(x)
-DATA ·IEEEConst+272(SB)/8, $0x000000007734f5ec
-DATA ·IEEEConst+280(SB)/8, $0x00000001b2df1f84
-
-// x^242752 mod p(x), x^242688 mod p(x)
-DATA ·IEEEConst+288(SB)/8, $0x000000007c547798
-DATA ·IEEEConst+296(SB)/8, $0x00000001d6f56afc
-
-// x^241728 mod p(x), x^241664 mod p(x)
-DATA ·IEEEConst+304(SB)/8, $0x000000007ec40210
-DATA ·IEEEConst+312(SB)/8, $0x00000001b9b5e70c
-
-// x^240704 mod p(x), x^240640 mod p(x)
-DATA ·IEEEConst+320(SB)/8, $0x00000001ab1695a8
-DATA ·IEEEConst+328(SB)/8, $0x0000000034b626d2
-
-// x^239680 mod p(x), x^239616 mod p(x)
-DATA ·IEEEConst+336(SB)/8, $0x0000000090494bba
-DATA ·IEEEConst+344(SB)/8, $0x000000014c53479a
-
-// x^238656 mod p(x), x^238592 mod p(x)
-DATA ·IEEEConst+352(SB)/8, $0x00000001123fb816
-DATA ·IEEEConst+360(SB)/8, $0x00000001a6d179a4
-
-// x^237632 mod p(x), x^237568 mod p(x)
-DATA ·IEEEConst+368(SB)/8, $0x00000001e188c74c
-DATA ·IEEEConst+376(SB)/8, $0x000000015abd16b4
-
-// x^236608 mod p(x), x^236544 mod p(x)
-DATA ·IEEEConst+384(SB)/8, $0x00000001c2d3451c
-DATA ·IEEEConst+392(SB)/8, $0x00000000018f9852
-
-// x^235584 mod p(x), x^235520 mod p(x)
-DATA ·IEEEConst+400(SB)/8, $0x00000000f55cf1ca
-DATA ·IEEEConst+408(SB)/8, $0x000000001fb3084a
-
-// x^234560 mod p(x), x^234496 mod p(x)
-DATA ·IEEEConst+416(SB)/8, $0x00000001a0531540
-DATA ·IEEEConst+424(SB)/8, $0x00000000c53dfb04
-
-// x^233536 mod p(x), x^233472 mod p(x)
-DATA ·IEEEConst+432(SB)/8, $0x0000000132cd7ebc
-DATA ·IEEEConst+440(SB)/8, $0x00000000e10c9ad6
-
-// x^232512 mod p(x), x^232448 mod p(x)
-DATA ·IEEEConst+448(SB)/8, $0x0000000073ab7f36
-DATA ·IEEEConst+456(SB)/8, $0x0000000025aa994a
-
-// x^231488 mod p(x), x^231424 mod p(x)
-DATA ·IEEEConst+464(SB)/8, $0x0000000041aed1c2
-DATA ·IEEEConst+472(SB)/8, $0x00000000fa3a74c4
-
-// x^230464 mod p(x), x^230400 mod p(x)
-DATA ·IEEEConst+480(SB)/8, $0x0000000136c53800
-DATA ·IEEEConst+488(SB)/8, $0x0000000033eb3f40
-
-// x^229440 mod p(x), x^229376 mod p(x)
-DATA ·IEEEConst+496(SB)/8, $0x0000000126835a30
-DATA ·IEEEConst+504(SB)/8, $0x000000017193f296
-
-// x^228416 mod p(x), x^228352 mod p(x)
-DATA ·IEEEConst+512(SB)/8, $0x000000006241b502
-DATA ·IEEEConst+520(SB)/8, $0x0000000043f6c86a
-
-// x^227392 mod p(x), x^227328 mod p(x)
-DATA ·IEEEConst+528(SB)/8, $0x00000000d5196ad4
-DATA ·IEEEConst+536(SB)/8, $0x000000016b513ec6
-
-// x^226368 mod p(x), x^226304 mod p(x)
-DATA ·IEEEConst+544(SB)/8, $0x000000009cfa769a
-DATA ·IEEEConst+552(SB)/8, $0x00000000c8f25b4e
-
-// x^225344 mod p(x), x^225280 mod p(x)
-DATA ·IEEEConst+560(SB)/8, $0x00000000920e5df4
-DATA ·IEEEConst+568(SB)/8, $0x00000001a45048ec
-
-// x^224320 mod p(x), x^224256 mod p(x)
-DATA ·IEEEConst+576(SB)/8, $0x0000000169dc310e
-DATA ·IEEEConst+584(SB)/8, $0x000000000c441004
-
-// x^223296 mod p(x), x^223232 mod p(x)
-DATA ·IEEEConst+592(SB)/8, $0x0000000009fc331c
-DATA ·IEEEConst+600(SB)/8, $0x000000000e17cad6
-
-// x^222272 mod p(x), x^222208 mod p(x)
-DATA ·IEEEConst+608(SB)/8, $0x000000010d94a81e
-DATA ·IEEEConst+616(SB)/8, $0x00000001253ae964
-
-// x^221248 mod p(x), x^221184 mod p(x)
-DATA ·IEEEConst+624(SB)/8, $0x0000000027a20ab2
-DATA ·IEEEConst+632(SB)/8, $0x00000001d7c88ebc
-
-// x^220224 mod p(x), x^220160 mod p(x)
-DATA ·IEEEConst+640(SB)/8, $0x0000000114f87504
-DATA ·IEEEConst+648(SB)/8, $0x00000001e7ca913a
-
-// x^219200 mod p(x), x^219136 mod p(x)
-DATA ·IEEEConst+656(SB)/8, $0x000000004b076d96
-DATA ·IEEEConst+664(SB)/8, $0x0000000033ed078a
-
-// x^218176 mod p(x), x^218112 mod p(x)
-DATA ·IEEEConst+672(SB)/8, $0x00000000da4d1e74
-DATA ·IEEEConst+680(SB)/8, $0x00000000e1839c78
-
-// x^217152 mod p(x), x^217088 mod p(x)
-DATA ·IEEEConst+688(SB)/8, $0x000000001b81f672
-DATA ·IEEEConst+696(SB)/8, $0x00000001322b267e
-
-// x^216128 mod p(x), x^216064 mod p(x)
-DATA ·IEEEConst+704(SB)/8, $0x000000009367c988
-DATA ·IEEEConst+712(SB)/8, $0x00000000638231b6
-
-// x^215104 mod p(x), x^215040 mod p(x)
-DATA ·IEEEConst+720(SB)/8, $0x00000001717214ca
-DATA ·IEEEConst+728(SB)/8, $0x00000001ee7f16f4
-
-// x^214080 mod p(x), x^214016 mod p(x)
-DATA ·IEEEConst+736(SB)/8, $0x000000009f47d820
-DATA ·IEEEConst+744(SB)/8, $0x0000000117d9924a
-
-// x^213056 mod p(x), x^212992 mod p(x)
-DATA ·IEEEConst+752(SB)/8, $0x000000010d9a47d2
-DATA ·IEEEConst+760(SB)/8, $0x00000000e1a9e0c4
-
-// x^212032 mod p(x), x^211968 mod p(x)
-DATA ·IEEEConst+768(SB)/8, $0x00000000a696c58c
-DATA ·IEEEConst+776(SB)/8, $0x00000001403731dc
-
-// x^211008 mod p(x), x^210944 mod p(x)
-DATA ·IEEEConst+784(SB)/8, $0x000000002aa28ec6
-DATA ·IEEEConst+792(SB)/8, $0x00000001a5ea9682
-
-// x^209984 mod p(x), x^209920 mod p(x)
-DATA ·IEEEConst+800(SB)/8, $0x00000001fe18fd9a
-DATA ·IEEEConst+808(SB)/8, $0x0000000101c5c578
-
-// x^208960 mod p(x), x^208896 mod p(x)
-DATA ·IEEEConst+816(SB)/8, $0x000000019d4fc1ae
-DATA ·IEEEConst+824(SB)/8, $0x00000000dddf6494
-
-// x^207936 mod p(x), x^207872 mod p(x)
-DATA ·IEEEConst+832(SB)/8, $0x00000001ba0e3dea
-DATA ·IEEEConst+840(SB)/8, $0x00000000f1c3db28
-
-// x^206912 mod p(x), x^206848 mod p(x)
-DATA ·IEEEConst+848(SB)/8, $0x0000000074b59a5e
-DATA ·IEEEConst+856(SB)/8, $0x000000013112fb9c
-
-// x^205888 mod p(x), x^205824 mod p(x)
-DATA ·IEEEConst+864(SB)/8, $0x00000000f2b5ea98
-DATA ·IEEEConst+872(SB)/8, $0x00000000b680b906
-
-// x^204864 mod p(x), x^204800 mod p(x)
-DATA ·IEEEConst+880(SB)/8, $0x0000000187132676
-DATA ·IEEEConst+888(SB)/8, $0x000000001a282932
-
-// x^203840 mod p(x), x^203776 mod p(x)
-DATA ·IEEEConst+896(SB)/8, $0x000000010a8c6ad4
-DATA ·IEEEConst+904(SB)/8, $0x0000000089406e7e
-
-// x^202816 mod p(x), x^202752 mod p(x)
-DATA ·IEEEConst+912(SB)/8, $0x00000001e21dfe70
-DATA ·IEEEConst+920(SB)/8, $0x00000001def6be8c
-
-// x^201792 mod p(x), x^201728 mod p(x)
-DATA ·IEEEConst+928(SB)/8, $0x00000001da0050e4
-DATA ·IEEEConst+936(SB)/8, $0x0000000075258728
-
-// x^200768 mod p(x), x^200704 mod p(x)
-DATA ·IEEEConst+944(SB)/8, $0x00000000772172ae
-DATA ·IEEEConst+952(SB)/8, $0x000000019536090a
-
-// x^199744 mod p(x), x^199680 mod p(x)
-DATA ·IEEEConst+960(SB)/8, $0x00000000e47724aa
-DATA ·IEEEConst+968(SB)/8, $0x00000000f2455bfc
-
-// x^198720 mod p(x), x^198656 mod p(x)
-DATA ·IEEEConst+976(SB)/8, $0x000000003cd63ac4
-DATA ·IEEEConst+984(SB)/8, $0x000000018c40baf4
-
-// x^197696 mod p(x), x^197632 mod p(x)
-DATA ·IEEEConst+992(SB)/8, $0x00000001bf47d352
-DATA ·IEEEConst+1000(SB)/8, $0x000000004cd390d4
-
-// x^196672 mod p(x), x^196608 mod p(x)
-DATA ·IEEEConst+1008(SB)/8, $0x000000018dc1d708
-DATA ·IEEEConst+1016(SB)/8, $0x00000001e4ece95a
-
-// x^195648 mod p(x), x^195584 mod p(x)
-DATA ·IEEEConst+1024(SB)/8, $0x000000002d4620a4
-DATA ·IEEEConst+1032(SB)/8, $0x000000001a3ee918
-
-// x^194624 mod p(x), x^194560 mod p(x)
-DATA ·IEEEConst+1040(SB)/8, $0x0000000058fd1740
-DATA ·IEEEConst+1048(SB)/8, $0x000000007c652fb8
-
-// x^193600 mod p(x), x^193536 mod p(x)
-DATA ·IEEEConst+1056(SB)/8, $0x00000000dadd9bfc
-DATA ·IEEEConst+1064(SB)/8, $0x000000011c67842c
-
-// x^192576 mod p(x), x^192512 mod p(x)
-DATA ·IEEEConst+1072(SB)/8, $0x00000001ea2140be
-DATA ·IEEEConst+1080(SB)/8, $0x00000000254f759c
-
-// x^191552 mod p(x), x^191488 mod p(x)
-DATA ·IEEEConst+1088(SB)/8, $0x000000009de128ba
-DATA ·IEEEConst+1096(SB)/8, $0x000000007ece94ca
-
-// x^190528 mod p(x), x^190464 mod p(x)
-DATA ·IEEEConst+1104(SB)/8, $0x000000013ac3aa8e
-DATA ·IEEEConst+1112(SB)/8, $0x0000000038f258c2
-
-// x^189504 mod p(x), x^189440 mod p(x)
-DATA ·IEEEConst+1120(SB)/8, $0x0000000099980562
-DATA ·IEEEConst+1128(SB)/8, $0x00000001cdf17b00
-
-// x^188480 mod p(x), x^188416 mod p(x)
-DATA ·IEEEConst+1136(SB)/8, $0x00000001c1579c86
-DATA ·IEEEConst+1144(SB)/8, $0x000000011f882c16
-
-// x^187456 mod p(x), x^187392 mod p(x)
-DATA ·IEEEConst+1152(SB)/8, $0x0000000068dbbf94
-DATA ·IEEEConst+1160(SB)/8, $0x0000000100093fc8
-
-// x^186432 mod p(x), x^186368 mod p(x)
-DATA ·IEEEConst+1168(SB)/8, $0x000000004509fb04
-DATA ·IEEEConst+1176(SB)/8, $0x00000001cd684f16
-
-// x^185408 mod p(x), x^185344 mod p(x)
-DATA ·IEEEConst+1184(SB)/8, $0x00000001202f6398
-DATA ·IEEEConst+1192(SB)/8, $0x000000004bc6a70a
-
-// x^184384 mod p(x), x^184320 mod p(x)
-DATA ·IEEEConst+1200(SB)/8, $0x000000013aea243e
-DATA ·IEEEConst+1208(SB)/8, $0x000000004fc7e8e4
-
-// x^183360 mod p(x), x^183296 mod p(x)
-DATA ·IEEEConst+1216(SB)/8, $0x00000001b4052ae6
-DATA ·IEEEConst+1224(SB)/8, $0x0000000130103f1c
-
-// x^182336 mod p(x), x^182272 mod p(x)
-DATA ·IEEEConst+1232(SB)/8, $0x00000001cd2a0ae8
-DATA ·IEEEConst+1240(SB)/8, $0x0000000111b0024c
-
-// x^181312 mod p(x), x^181248 mod p(x)
-DATA ·IEEEConst+1248(SB)/8, $0x00000001fe4aa8b4
-DATA ·IEEEConst+1256(SB)/8, $0x000000010b3079da
-
-// x^180288 mod p(x), x^180224 mod p(x)
-DATA ·IEEEConst+1264(SB)/8, $0x00000001d1559a42
-DATA ·IEEEConst+1272(SB)/8, $0x000000010192bcc2
-
-// x^179264 mod p(x), x^179200 mod p(x)
-DATA ·IEEEConst+1280(SB)/8, $0x00000001f3e05ecc
-DATA ·IEEEConst+1288(SB)/8, $0x0000000074838d50
-
-// x^178240 mod p(x), x^178176 mod p(x)
-DATA ·IEEEConst+1296(SB)/8, $0x0000000104ddd2cc
-DATA ·IEEEConst+1304(SB)/8, $0x000000001b20f520
-
-// x^177216 mod p(x), x^177152 mod p(x)
-DATA ·IEEEConst+1312(SB)/8, $0x000000015393153c
-DATA ·IEEEConst+1320(SB)/8, $0x0000000050c3590a
-
-// x^176192 mod p(x), x^176128 mod p(x)
-DATA ·IEEEConst+1328(SB)/8, $0x0000000057e942c6
-DATA ·IEEEConst+1336(SB)/8, $0x00000000b41cac8e
-
-// x^175168 mod p(x), x^175104 mod p(x)
-DATA ·IEEEConst+1344(SB)/8, $0x000000012c633850
-DATA ·IEEEConst+1352(SB)/8, $0x000000000c72cc78
-
-// x^174144 mod p(x), x^174080 mod p(x)
-DATA ·IEEEConst+1360(SB)/8, $0x00000000ebcaae4c
-DATA ·IEEEConst+1368(SB)/8, $0x0000000030cdb032
-
-// x^173120 mod p(x), x^173056 mod p(x)
-DATA ·IEEEConst+1376(SB)/8, $0x000000013ee532a6
-DATA ·IEEEConst+1384(SB)/8, $0x000000013e09fc32
-
-// x^172096 mod p(x), x^172032 mod p(x)
-DATA ·IEEEConst+1392(SB)/8, $0x00000001bf0cbc7e
-DATA ·IEEEConst+1400(SB)/8, $0x000000001ed624d2
-
-// x^171072 mod p(x), x^171008 mod p(x)
-DATA ·IEEEConst+1408(SB)/8, $0x00000000d50b7a5a
-DATA ·IEEEConst+1416(SB)/8, $0x00000000781aee1a
-
-// x^170048 mod p(x), x^169984 mod p(x)
-DATA ·IEEEConst+1424(SB)/8, $0x0000000002fca6e8
-DATA ·IEEEConst+1432(SB)/8, $0x00000001c4d8348c
-
-// x^169024 mod p(x), x^168960 mod p(x)
-DATA ·IEEEConst+1440(SB)/8, $0x000000007af40044
-DATA ·IEEEConst+1448(SB)/8, $0x0000000057a40336
-
-// x^168000 mod p(x), x^167936 mod p(x)
-DATA ·IEEEConst+1456(SB)/8, $0x0000000016178744
-DATA ·IEEEConst+1464(SB)/8, $0x0000000085544940
-
-// x^166976 mod p(x), x^166912 mod p(x)
-DATA ·IEEEConst+1472(SB)/8, $0x000000014c177458
-DATA ·IEEEConst+1480(SB)/8, $0x000000019cd21e80
-
-// x^165952 mod p(x), x^165888 mod p(x)
-DATA ·IEEEConst+1488(SB)/8, $0x000000011b6ddf04
-DATA ·IEEEConst+1496(SB)/8, $0x000000013eb95bc0
-
-// x^164928 mod p(x), x^164864 mod p(x)
-DATA ·IEEEConst+1504(SB)/8, $0x00000001f3e29ccc
-DATA ·IEEEConst+1512(SB)/8, $0x00000001dfc9fdfc
-
-// x^163904 mod p(x), x^163840 mod p(x)
-DATA ·IEEEConst+1520(SB)/8, $0x0000000135ae7562
-DATA ·IEEEConst+1528(SB)/8, $0x00000000cd028bc2
-
-// x^162880 mod p(x), x^162816 mod p(x)
-DATA ·IEEEConst+1536(SB)/8, $0x0000000190ef812c
-DATA ·IEEEConst+1544(SB)/8, $0x0000000090db8c44
-
-// x^161856 mod p(x), x^161792 mod p(x)
-DATA ·IEEEConst+1552(SB)/8, $0x0000000067a2c786
-DATA ·IEEEConst+1560(SB)/8, $0x000000010010a4ce
-
-// x^160832 mod p(x), x^160768 mod p(x)
-DATA ·IEEEConst+1568(SB)/8, $0x0000000048b9496c
-DATA ·IEEEConst+1576(SB)/8, $0x00000001c8f4c72c
-
-// x^159808 mod p(x), x^159744 mod p(x)
-DATA ·IEEEConst+1584(SB)/8, $0x000000015a422de6
-DATA ·IEEEConst+1592(SB)/8, $0x000000001c26170c
-
-// x^158784 mod p(x), x^158720 mod p(x)
-DATA ·IEEEConst+1600(SB)/8, $0x00000001ef0e3640
-DATA ·IEEEConst+1608(SB)/8, $0x00000000e3fccf68
-
-// x^157760 mod p(x), x^157696 mod p(x)
-DATA ·IEEEConst+1616(SB)/8, $0x00000001006d2d26
-DATA ·IEEEConst+1624(SB)/8, $0x00000000d513ed24
-
-// x^156736 mod p(x), x^156672 mod p(x)
-DATA ·IEEEConst+1632(SB)/8, $0x00000001170d56d6
-DATA ·IEEEConst+1640(SB)/8, $0x00000000141beada
-
-// x^155712 mod p(x), x^155648 mod p(x)
-DATA ·IEEEConst+1648(SB)/8, $0x00000000a5fb613c
-DATA ·IEEEConst+1656(SB)/8, $0x000000011071aea0
-
-// x^154688 mod p(x), x^154624 mod p(x)
-DATA ·IEEEConst+1664(SB)/8, $0x0000000040bbf7fc
-DATA ·IEEEConst+1672(SB)/8, $0x000000012e19080a
-
-// x^153664 mod p(x), x^153600 mod p(x)
-DATA ·IEEEConst+1680(SB)/8, $0x000000016ac3a5b2
-DATA ·IEEEConst+1688(SB)/8, $0x0000000100ecf826
-
-// x^152640 mod p(x), x^152576 mod p(x)
-DATA ·IEEEConst+1696(SB)/8, $0x00000000abf16230
-DATA ·IEEEConst+1704(SB)/8, $0x0000000069b09412
-
-// x^151616 mod p(x), x^151552 mod p(x)
-DATA ·IEEEConst+1712(SB)/8, $0x00000001ebe23fac
-DATA ·IEEEConst+1720(SB)/8, $0x0000000122297bac
-
-// x^150592 mod p(x), x^150528 mod p(x)
-DATA ·IEEEConst+1728(SB)/8, $0x000000008b6a0894
-DATA ·IEEEConst+1736(SB)/8, $0x00000000e9e4b068
-
-// x^149568 mod p(x), x^149504 mod p(x)
-DATA ·IEEEConst+1744(SB)/8, $0x00000001288ea478
-DATA ·IEEEConst+1752(SB)/8, $0x000000004b38651a
-
-// x^148544 mod p(x), x^148480 mod p(x)
-DATA ·IEEEConst+1760(SB)/8, $0x000000016619c442
-DATA ·IEEEConst+1768(SB)/8, $0x00000001468360e2
-
-// x^147520 mod p(x), x^147456 mod p(x)
-DATA ·IEEEConst+1776(SB)/8, $0x0000000086230038
-DATA ·IEEEConst+1784(SB)/8, $0x00000000121c2408
-
-// x^146496 mod p(x), x^146432 mod p(x)
-DATA ·IEEEConst+1792(SB)/8, $0x000000017746a756
-DATA ·IEEEConst+1800(SB)/8, $0x00000000da7e7d08
-
-// x^145472 mod p(x), x^145408 mod p(x)
-DATA ·IEEEConst+1808(SB)/8, $0x0000000191b8f8f8
-DATA ·IEEEConst+1816(SB)/8, $0x00000001058d7652
-
-// x^144448 mod p(x), x^144384 mod p(x)
-DATA ·IEEEConst+1824(SB)/8, $0x000000008e167708
-DATA ·IEEEConst+1832(SB)/8, $0x000000014a098a90
-
-// x^143424 mod p(x), x^143360 mod p(x)
-DATA ·IEEEConst+1840(SB)/8, $0x0000000148b22d54
-DATA ·IEEEConst+1848(SB)/8, $0x0000000020dbe72e
-
-// x^142400 mod p(x), x^142336 mod p(x)
-DATA ·IEEEConst+1856(SB)/8, $0x0000000044ba2c3c
-DATA ·IEEEConst+1864(SB)/8, $0x000000011e7323e8
-
-// x^141376 mod p(x), x^141312 mod p(x)
-DATA ·IEEEConst+1872(SB)/8, $0x00000000b54d2b52
-DATA ·IEEEConst+1880(SB)/8, $0x00000000d5d4bf94
-
-// x^140352 mod p(x), x^140288 mod p(x)
-DATA ·IEEEConst+1888(SB)/8, $0x0000000005a4fd8a
-DATA ·IEEEConst+1896(SB)/8, $0x0000000199d8746c
-
-// x^139328 mod p(x), x^139264 mod p(x)
-DATA ·IEEEConst+1904(SB)/8, $0x0000000139f9fc46
-DATA ·IEEEConst+1912(SB)/8, $0x00000000ce9ca8a0
-
-// x^138304 mod p(x), x^138240 mod p(x)
-DATA ·IEEEConst+1920(SB)/8, $0x000000015a1fa824
-DATA ·IEEEConst+1928(SB)/8, $0x00000000136edece
-
-// x^137280 mod p(x), x^137216 mod p(x)
-DATA ·IEEEConst+1936(SB)/8, $0x000000000a61ae4c
-DATA ·IEEEConst+1944(SB)/8, $0x000000019b92a068
-
-// x^136256 mod p(x), x^136192 mod p(x)
-DATA ·IEEEConst+1952(SB)/8, $0x0000000145e9113e
-DATA ·IEEEConst+1960(SB)/8, $0x0000000071d62206
-
-// x^135232 mod p(x), x^135168 mod p(x)
-DATA ·IEEEConst+1968(SB)/8, $0x000000006a348448
-DATA ·IEEEConst+1976(SB)/8, $0x00000000dfc50158
-
-// x^134208 mod p(x), x^134144 mod p(x)
-DATA ·IEEEConst+1984(SB)/8, $0x000000004d80a08c
-DATA ·IEEEConst+1992(SB)/8, $0x00000001517626bc
-
-// x^133184 mod p(x), x^133120 mod p(x)
-DATA ·IEEEConst+2000(SB)/8, $0x000000014b6837a0
-DATA ·IEEEConst+2008(SB)/8, $0x0000000148d1e4fa
-
-// x^132160 mod p(x), x^132096 mod p(x)
-DATA ·IEEEConst+2016(SB)/8, $0x000000016896a7fc
-DATA ·IEEEConst+2024(SB)/8, $0x0000000094d8266e
-
-// x^131136 mod p(x), x^131072 mod p(x)
-DATA ·IEEEConst+2032(SB)/8, $0x000000014f187140
-DATA ·IEEEConst+2040(SB)/8, $0x00000000606c5e34
-
-// x^130112 mod p(x), x^130048 mod p(x)
-DATA ·IEEEConst+2048(SB)/8, $0x000000019581b9da
-DATA ·IEEEConst+2056(SB)/8, $0x000000019766beaa
-
-// x^129088 mod p(x), x^129024 mod p(x)
-DATA ·IEEEConst+2064(SB)/8, $0x00000001091bc984
-DATA ·IEEEConst+2072(SB)/8, $0x00000001d80c506c
-
-// x^128064 mod p(x), x^128000 mod p(x)
-DATA ·IEEEConst+2080(SB)/8, $0x000000001067223c
-DATA ·IEEEConst+2088(SB)/8, $0x000000001e73837c
-
-// x^127040 mod p(x), x^126976 mod p(x)
-DATA ·IEEEConst+2096(SB)/8, $0x00000001ab16ea02
-DATA ·IEEEConst+2104(SB)/8, $0x0000000064d587de
-
-// x^126016 mod p(x), x^125952 mod p(x)
-DATA ·IEEEConst+2112(SB)/8, $0x000000013c4598a8
-DATA ·IEEEConst+2120(SB)/8, $0x00000000f4a507b0
-
-// x^124992 mod p(x), x^124928 mod p(x)
-DATA ·IEEEConst+2128(SB)/8, $0x00000000b3735430
-DATA ·IEEEConst+2136(SB)/8, $0x0000000040e342fc
-
-// x^123968 mod p(x), x^123904 mod p(x)
-DATA ·IEEEConst+2144(SB)/8, $0x00000001bb3fc0c0
-DATA ·IEEEConst+2152(SB)/8, $0x00000001d5ad9c3a
-
-// x^122944 mod p(x), x^122880 mod p(x)
-DATA ·IEEEConst+2160(SB)/8, $0x00000001570ae19c
-DATA ·IEEEConst+2168(SB)/8, $0x0000000094a691a4
-
-// x^121920 mod p(x), x^121856 mod p(x)
-DATA ·IEEEConst+2176(SB)/8, $0x00000001ea910712
-DATA ·IEEEConst+2184(SB)/8, $0x00000001271ecdfa
-
-// x^120896 mod p(x), x^120832 mod p(x)
-DATA ·IEEEConst+2192(SB)/8, $0x0000000167127128
-DATA ·IEEEConst+2200(SB)/8, $0x000000009e54475a
-
-// x^119872 mod p(x), x^119808 mod p(x)
-DATA ·IEEEConst+2208(SB)/8, $0x0000000019e790a2
-DATA ·IEEEConst+2216(SB)/8, $0x00000000c9c099ee
-
-// x^118848 mod p(x), x^118784 mod p(x)
-DATA ·IEEEConst+2224(SB)/8, $0x000000003788f710
-DATA ·IEEEConst+2232(SB)/8, $0x000000009a2f736c
-
-// x^117824 mod p(x), x^117760 mod p(x)
-DATA ·IEEEConst+2240(SB)/8, $0x00000001682a160e
-DATA ·IEEEConst+2248(SB)/8, $0x00000000bb9f4996
-
-// x^116800 mod p(x), x^116736 mod p(x)
-DATA ·IEEEConst+2256(SB)/8, $0x000000007f0ebd2e
-DATA ·IEEEConst+2264(SB)/8, $0x00000001db688050
-
-// x^115776 mod p(x), x^115712 mod p(x)
-DATA ·IEEEConst+2272(SB)/8, $0x000000002b032080
-DATA ·IEEEConst+2280(SB)/8, $0x00000000e9b10af4
-
-// x^114752 mod p(x), x^114688 mod p(x)
-DATA ·IEEEConst+2288(SB)/8, $0x00000000cfd1664a
-DATA ·IEEEConst+2296(SB)/8, $0x000000012d4545e4
-
-// x^113728 mod p(x), x^113664 mod p(x)
-DATA ·IEEEConst+2304(SB)/8, $0x00000000aa1181c2
-DATA ·IEEEConst+2312(SB)/8, $0x000000000361139c
-
-// x^112704 mod p(x), x^112640 mod p(x)
-DATA ·IEEEConst+2320(SB)/8, $0x00000000ddd08002
-DATA ·IEEEConst+2328(SB)/8, $0x00000001a5a1a3a8
-
-// x^111680 mod p(x), x^111616 mod p(x)
-DATA ·IEEEConst+2336(SB)/8, $0x00000000e8dd0446
-DATA ·IEEEConst+2344(SB)/8, $0x000000006844e0b0
-
-// x^110656 mod p(x), x^110592 mod p(x)
-DATA ·IEEEConst+2352(SB)/8, $0x00000001bbd94a00
-DATA ·IEEEConst+2360(SB)/8, $0x00000000c3762f28
-
-// x^109632 mod p(x), x^109568 mod p(x)
-DATA ·IEEEConst+2368(SB)/8, $0x00000000ab6cd180
-DATA ·IEEEConst+2376(SB)/8, $0x00000001d26287a2
-
-// x^108608 mod p(x), x^108544 mod p(x)
-DATA ·IEEEConst+2384(SB)/8, $0x0000000031803ce2
-DATA ·IEEEConst+2392(SB)/8, $0x00000001f6f0bba8
-
-// x^107584 mod p(x), x^107520 mod p(x)
-DATA ·IEEEConst+2400(SB)/8, $0x0000000024f40b0c
-DATA ·IEEEConst+2408(SB)/8, $0x000000002ffabd62
-
-// x^106560 mod p(x), x^106496 mod p(x)
-DATA ·IEEEConst+2416(SB)/8, $0x00000001ba1d9834
-DATA ·IEEEConst+2424(SB)/8, $0x00000000fb4516b8
-
-// x^105536 mod p(x), x^105472 mod p(x)
-DATA ·IEEEConst+2432(SB)/8, $0x0000000104de61aa
-DATA ·IEEEConst+2440(SB)/8, $0x000000018cfa961c
-
-// x^104512 mod p(x), x^104448 mod p(x)
-DATA ·IEEEConst+2448(SB)/8, $0x0000000113e40d46
-DATA ·IEEEConst+2456(SB)/8, $0x000000019e588d52
-
-// x^103488 mod p(x), x^103424 mod p(x)
-DATA ·IEEEConst+2464(SB)/8, $0x00000001415598a0
-DATA ·IEEEConst+2472(SB)/8, $0x00000001180f0bbc
-
-// x^102464 mod p(x), x^102400 mod p(x)
-DATA ·IEEEConst+2480(SB)/8, $0x00000000bf6c8c90
-DATA ·IEEEConst+2488(SB)/8, $0x00000000e1d9177a
-
-// x^101440 mod p(x), x^101376 mod p(x)
-DATA ·IEEEConst+2496(SB)/8, $0x00000001788b0504
-DATA ·IEEEConst+2504(SB)/8, $0x0000000105abc27c
-
-// x^100416 mod p(x), x^100352 mod p(x)
-DATA ·IEEEConst+2512(SB)/8, $0x0000000038385d02
-DATA ·IEEEConst+2520(SB)/8, $0x00000000972e4a58
-
-// x^99392 mod p(x), x^99328 mod p(x)
-DATA ·IEEEConst+2528(SB)/8, $0x00000001b6c83844
-DATA ·IEEEConst+2536(SB)/8, $0x0000000183499a5e
-
-// x^98368 mod p(x), x^98304 mod p(x)
-DATA ·IEEEConst+2544(SB)/8, $0x0000000051061a8a
-DATA ·IEEEConst+2552(SB)/8, $0x00000001c96a8cca
-
-// x^97344 mod p(x), x^97280 mod p(x)
-DATA ·IEEEConst+2560(SB)/8, $0x000000017351388a
-DATA ·IEEEConst+2568(SB)/8, $0x00000001a1a5b60c
-
-// x^96320 mod p(x), x^96256 mod p(x)
-DATA ·IEEEConst+2576(SB)/8, $0x0000000132928f92
-DATA ·IEEEConst+2584(SB)/8, $0x00000000e4b6ac9c
-
-// x^95296 mod p(x), x^95232 mod p(x)
-DATA ·IEEEConst+2592(SB)/8, $0x00000000e6b4f48a
-DATA ·IEEEConst+2600(SB)/8, $0x00000001807e7f5a
-
-// x^94272 mod p(x), x^94208 mod p(x)
-DATA ·IEEEConst+2608(SB)/8, $0x0000000039d15e90
-DATA ·IEEEConst+2616(SB)/8, $0x000000017a7e3bc8
-
-// x^93248 mod p(x), x^93184 mod p(x)
-DATA ·IEEEConst+2624(SB)/8, $0x00000000312d6074
-DATA ·IEEEConst+2632(SB)/8, $0x00000000d73975da
-
-// x^92224 mod p(x), x^92160 mod p(x)
-DATA ·IEEEConst+2640(SB)/8, $0x000000017bbb2cc4
-DATA ·IEEEConst+2648(SB)/8, $0x000000017375d038
-
-// x^91200 mod p(x), x^91136 mod p(x)
-DATA ·IEEEConst+2656(SB)/8, $0x000000016ded3e18
-DATA ·IEEEConst+2664(SB)/8, $0x00000000193680bc
-
-// x^90176 mod p(x), x^90112 mod p(x)
-DATA ·IEEEConst+2672(SB)/8, $0x00000000f1638b16
-DATA ·IEEEConst+2680(SB)/8, $0x00000000999b06f6
-
-// x^89152 mod p(x), x^89088 mod p(x)
-DATA ·IEEEConst+2688(SB)/8, $0x00000001d38b9ecc
-DATA ·IEEEConst+2696(SB)/8, $0x00000001f685d2b8
-
-// x^88128 mod p(x), x^88064 mod p(x)
-DATA ·IEEEConst+2704(SB)/8, $0x000000018b8d09dc
-DATA ·IEEEConst+2712(SB)/8, $0x00000001f4ecbed2
-
-// x^87104 mod p(x), x^87040 mod p(x)
-DATA ·IEEEConst+2720(SB)/8, $0x00000000e7bc27d2
-DATA ·IEEEConst+2728(SB)/8, $0x00000000ba16f1a0
-
-// x^86080 mod p(x), x^86016 mod p(x)
-DATA ·IEEEConst+2736(SB)/8, $0x00000000275e1e96
-DATA ·IEEEConst+2744(SB)/8, $0x0000000115aceac4
-
-// x^85056 mod p(x), x^84992 mod p(x)
-DATA ·IEEEConst+2752(SB)/8, $0x00000000e2e3031e
-DATA ·IEEEConst+2760(SB)/8, $0x00000001aeff6292
-
-// x^84032 mod p(x), x^83968 mod p(x)
-DATA ·IEEEConst+2768(SB)/8, $0x00000001041c84d8
-DATA ·IEEEConst+2776(SB)/8, $0x000000009640124c
-
-// x^83008 mod p(x), x^82944 mod p(x)
-DATA ·IEEEConst+2784(SB)/8, $0x00000000706ce672
-DATA ·IEEEConst+2792(SB)/8, $0x0000000114f41f02
-
-// x^81984 mod p(x), x^81920 mod p(x)
-DATA ·IEEEConst+2800(SB)/8, $0x000000015d5070da
-DATA ·IEEEConst+2808(SB)/8, $0x000000009c5f3586
-
-// x^80960 mod p(x), x^80896 mod p(x)
-DATA ·IEEEConst+2816(SB)/8, $0x0000000038f9493a
-DATA ·IEEEConst+2824(SB)/8, $0x00000001878275fa
-
-// x^79936 mod p(x), x^79872 mod p(x)
-DATA ·IEEEConst+2832(SB)/8, $0x00000000a3348a76
-DATA ·IEEEConst+2840(SB)/8, $0x00000000ddc42ce8
-
-// x^78912 mod p(x), x^78848 mod p(x)
-DATA ·IEEEConst+2848(SB)/8, $0x00000001ad0aab92
-DATA ·IEEEConst+2856(SB)/8, $0x0000000181d2c73a
-
-// x^77888 mod p(x), x^77824 mod p(x)
-DATA ·IEEEConst+2864(SB)/8, $0x000000019e85f712
-DATA ·IEEEConst+2872(SB)/8, $0x0000000141c9320a
-
-// x^76864 mod p(x), x^76800 mod p(x)
-DATA ·IEEEConst+2880(SB)/8, $0x000000005a871e76
-DATA ·IEEEConst+2888(SB)/8, $0x000000015235719a
-
-// x^75840 mod p(x), x^75776 mod p(x)
-DATA ·IEEEConst+2896(SB)/8, $0x000000017249c662
-DATA ·IEEEConst+2904(SB)/8, $0x00000000be27d804
-
-// x^74816 mod p(x), x^74752 mod p(x)
-DATA ·IEEEConst+2912(SB)/8, $0x000000003a084712
-DATA ·IEEEConst+2920(SB)/8, $0x000000006242d45a
-
-// x^73792 mod p(x), x^73728 mod p(x)
-DATA ·IEEEConst+2928(SB)/8, $0x00000000ed438478
-DATA ·IEEEConst+2936(SB)/8, $0x000000009a53638e
-
-// x^72768 mod p(x), x^72704 mod p(x)
-DATA ·IEEEConst+2944(SB)/8, $0x00000000abac34cc
-DATA ·IEEEConst+2952(SB)/8, $0x00000001001ecfb6
-
-// x^71744 mod p(x), x^71680 mod p(x)
-DATA ·IEEEConst+2960(SB)/8, $0x000000005f35ef3e
-DATA ·IEEEConst+2968(SB)/8, $0x000000016d7c2d64
-
-// x^70720 mod p(x), x^70656 mod p(x)
-DATA ·IEEEConst+2976(SB)/8, $0x0000000047d6608c
-DATA ·IEEEConst+2984(SB)/8, $0x00000001d0ce46c0
-
-// x^69696 mod p(x), x^69632 mod p(x)
-DATA ·IEEEConst+2992(SB)/8, $0x000000002d01470e
-DATA ·IEEEConst+3000(SB)/8, $0x0000000124c907b4
-
-// x^68672 mod p(x), x^68608 mod p(x)
-DATA ·IEEEConst+3008(SB)/8, $0x0000000158bbc7b0
-DATA ·IEEEConst+3016(SB)/8, $0x0000000018a555ca
-
-// x^67648 mod p(x), x^67584 mod p(x)
-DATA ·IEEEConst+3024(SB)/8, $0x00000000c0a23e8e
-DATA ·IEEEConst+3032(SB)/8, $0x000000006b0980bc
-
-// x^66624 mod p(x), x^66560 mod p(x)
-DATA ·IEEEConst+3040(SB)/8, $0x00000001ebd85c88
-DATA ·IEEEConst+3048(SB)/8, $0x000000008bbba964
-
-// x^65600 mod p(x), x^65536 mod p(x)
-DATA ·IEEEConst+3056(SB)/8, $0x000000019ee20bb2
-DATA ·IEEEConst+3064(SB)/8, $0x00000001070a5a1e
-
-// x^64576 mod p(x), x^64512 mod p(x)
-DATA ·IEEEConst+3072(SB)/8, $0x00000001acabf2d6
-DATA ·IEEEConst+3080(SB)/8, $0x000000002204322a
-
-// x^63552 mod p(x), x^63488 mod p(x)
-DATA ·IEEEConst+3088(SB)/8, $0x00000001b7963d56
-DATA ·IEEEConst+3096(SB)/8, $0x00000000a27524d0
-
-// x^62528 mod p(x), x^62464 mod p(x)
-DATA ·IEEEConst+3104(SB)/8, $0x000000017bffa1fe
-DATA ·IEEEConst+3112(SB)/8, $0x0000000020b1e4ba
-
-// x^61504 mod p(x), x^61440 mod p(x)
-DATA ·IEEEConst+3120(SB)/8, $0x000000001f15333e
-DATA ·IEEEConst+3128(SB)/8, $0x0000000032cc27fc
-
-// x^60480 mod p(x), x^60416 mod p(x)
-DATA ·IEEEConst+3136(SB)/8, $0x000000018593129e
-DATA ·IEEEConst+3144(SB)/8, $0x0000000044dd22b8
-
-// x^59456 mod p(x), x^59392 mod p(x)
-DATA ·IEEEConst+3152(SB)/8, $0x000000019cb32602
-DATA ·IEEEConst+3160(SB)/8, $0x00000000dffc9e0a
-
-// x^58432 mod p(x), x^58368 mod p(x)
-DATA ·IEEEConst+3168(SB)/8, $0x0000000142b05cc8
-DATA ·IEEEConst+3176(SB)/8, $0x00000001b7a0ed14
-
-// x^57408 mod p(x), x^57344 mod p(x)
-DATA ·IEEEConst+3184(SB)/8, $0x00000001be49e7a4
-DATA ·IEEEConst+3192(SB)/8, $0x00000000c7842488
-
-// x^56384 mod p(x), x^56320 mod p(x)
-DATA ·IEEEConst+3200(SB)/8, $0x0000000108f69d6c
-DATA ·IEEEConst+3208(SB)/8, $0x00000001c02a4fee
-
-// x^55360 mod p(x), x^55296 mod p(x)
-DATA ·IEEEConst+3216(SB)/8, $0x000000006c0971f0
-DATA ·IEEEConst+3224(SB)/8, $0x000000003c273778
-
-// x^54336 mod p(x), x^54272 mod p(x)
-DATA ·IEEEConst+3232(SB)/8, $0x000000005b16467a
-DATA ·IEEEConst+3240(SB)/8, $0x00000001d63f8894
-
-// x^53312 mod p(x), x^53248 mod p(x)
-DATA ·IEEEConst+3248(SB)/8, $0x00000001551a628e
-DATA ·IEEEConst+3256(SB)/8, $0x000000006be557d6
-
-// x^52288 mod p(x), x^52224 mod p(x)
-DATA ·IEEEConst+3264(SB)/8, $0x000000019e42ea92
-DATA ·IEEEConst+3272(SB)/8, $0x000000006a7806ea
-
-// x^51264 mod p(x), x^51200 mod p(x)
-DATA ·IEEEConst+3280(SB)/8, $0x000000012fa83ff2
-DATA ·IEEEConst+3288(SB)/8, $0x000000016155aa0c
-
-// x^50240 mod p(x), x^50176 mod p(x)
-DATA ·IEEEConst+3296(SB)/8, $0x000000011ca9cde0
-DATA ·IEEEConst+3304(SB)/8, $0x00000000908650ac
-
-// x^49216 mod p(x), x^49152 mod p(x)
-DATA ·IEEEConst+3312(SB)/8, $0x00000000c8e5cd74
-DATA ·IEEEConst+3320(SB)/8, $0x00000000aa5a8084
-
-// x^48192 mod p(x), x^48128 mod p(x)
-DATA ·IEEEConst+3328(SB)/8, $0x0000000096c27f0c
-DATA ·IEEEConst+3336(SB)/8, $0x0000000191bb500a
-
-// x^47168 mod p(x), x^47104 mod p(x)
-DATA ·IEEEConst+3344(SB)/8, $0x000000002baed926
-DATA ·IEEEConst+3352(SB)/8, $0x0000000064e9bed0
-
-// x^46144 mod p(x), x^46080 mod p(x)
-DATA ·IEEEConst+3360(SB)/8, $0x000000017c8de8d2
-DATA ·IEEEConst+3368(SB)/8, $0x000000009444f302
-
-// x^45120 mod p(x), x^45056 mod p(x)
-DATA ·IEEEConst+3376(SB)/8, $0x00000000d43d6068
-DATA ·IEEEConst+3384(SB)/8, $0x000000019db07d3c
-
-// x^44096 mod p(x), x^44032 mod p(x)
-DATA ·IEEEConst+3392(SB)/8, $0x00000000cb2c4b26
-DATA ·IEEEConst+3400(SB)/8, $0x00000001359e3e6e
-
-// x^43072 mod p(x), x^43008 mod p(x)
-DATA ·IEEEConst+3408(SB)/8, $0x0000000145b8da26
-DATA ·IEEEConst+3416(SB)/8, $0x00000001e4f10dd2
-
-// x^42048 mod p(x), x^41984 mod p(x)
-DATA ·IEEEConst+3424(SB)/8, $0x000000018fff4b08
-DATA ·IEEEConst+3432(SB)/8, $0x0000000124f5735e
-
-// x^41024 mod p(x), x^40960 mod p(x)
-DATA ·IEEEConst+3440(SB)/8, $0x0000000150b58ed0
-DATA ·IEEEConst+3448(SB)/8, $0x0000000124760a4c
-
-// x^40000 mod p(x), x^39936 mod p(x)
-DATA ·IEEEConst+3456(SB)/8, $0x00000001549f39bc
-DATA ·IEEEConst+3464(SB)/8, $0x000000000f1fc186
-
-// x^38976 mod p(x), x^38912 mod p(x)
-DATA ·IEEEConst+3472(SB)/8, $0x00000000ef4d2f42
-DATA ·IEEEConst+3480(SB)/8, $0x00000000150e4cc4
-
-// x^37952 mod p(x), x^37888 mod p(x)
-DATA ·IEEEConst+3488(SB)/8, $0x00000001b1468572
-DATA ·IEEEConst+3496(SB)/8, $0x000000002a6204e8
-
-// x^36928 mod p(x), x^36864 mod p(x)
-DATA ·IEEEConst+3504(SB)/8, $0x000000013d7403b2
-DATA ·IEEEConst+3512(SB)/8, $0x00000000beb1d432
-
-// x^35904 mod p(x), x^35840 mod p(x)
-DATA ·IEEEConst+3520(SB)/8, $0x00000001a4681842
-DATA ·IEEEConst+3528(SB)/8, $0x0000000135f3f1f0
-
-// x^34880 mod p(x), x^34816 mod p(x)
-DATA ·IEEEConst+3536(SB)/8, $0x0000000167714492
-DATA ·IEEEConst+3544(SB)/8, $0x0000000074fe2232
-
-// x^33856 mod p(x), x^33792 mod p(x)
-DATA ·IEEEConst+3552(SB)/8, $0x00000001e599099a
-DATA ·IEEEConst+3560(SB)/8, $0x000000001ac6e2ba
-
-// x^32832 mod p(x), x^32768 mod p(x)
-DATA ·IEEEConst+3568(SB)/8, $0x00000000fe128194
-DATA ·IEEEConst+3576(SB)/8, $0x0000000013fca91e
-
-// x^31808 mod p(x), x^31744 mod p(x)
-DATA ·IEEEConst+3584(SB)/8, $0x0000000077e8b990
-DATA ·IEEEConst+3592(SB)/8, $0x0000000183f4931e
-
-// x^30784 mod p(x), x^30720 mod p(x)
-DATA ·IEEEConst+3600(SB)/8, $0x00000001a267f63a
-DATA ·IEEEConst+3608(SB)/8, $0x00000000b6d9b4e4
-
-// x^29760 mod p(x), x^29696 mod p(x)
-DATA ·IEEEConst+3616(SB)/8, $0x00000001945c245a
-DATA ·IEEEConst+3624(SB)/8, $0x00000000b5188656
-
-// x^28736 mod p(x), x^28672 mod p(x)
-DATA ·IEEEConst+3632(SB)/8, $0x0000000149002e76
-DATA ·IEEEConst+3640(SB)/8, $0x0000000027a81a84
-
-// x^27712 mod p(x), x^27648 mod p(x)
-DATA ·IEEEConst+3648(SB)/8, $0x00000001bb8310a4
-DATA ·IEEEConst+3656(SB)/8, $0x0000000125699258
-
-// x^26688 mod p(x), x^26624 mod p(x)
-DATA ·IEEEConst+3664(SB)/8, $0x000000019ec60bcc
-DATA ·IEEEConst+3672(SB)/8, $0x00000001b23de796
-
-// x^25664 mod p(x), x^25600 mod p(x)
-DATA ·IEEEConst+3680(SB)/8, $0x000000012d8590ae
-DATA ·IEEEConst+3688(SB)/8, $0x00000000fe4365dc
-
-// x^24640 mod p(x), x^24576 mod p(x)
-DATA ·IEEEConst+3696(SB)/8, $0x0000000065b00684
-DATA ·IEEEConst+3704(SB)/8, $0x00000000c68f497a
-
-// x^23616 mod p(x), x^23552 mod p(x)
-DATA ·IEEEConst+3712(SB)/8, $0x000000015e5aeadc
-DATA ·IEEEConst+3720(SB)/8, $0x00000000fbf521ee
-
-// x^22592 mod p(x), x^22528 mod p(x)
-DATA ·IEEEConst+3728(SB)/8, $0x00000000b77ff2b0
-DATA ·IEEEConst+3736(SB)/8, $0x000000015eac3378
-
-// x^21568 mod p(x), x^21504 mod p(x)
-DATA ·IEEEConst+3744(SB)/8, $0x0000000188da2ff6
-DATA ·IEEEConst+3752(SB)/8, $0x0000000134914b90
-
-// x^20544 mod p(x), x^20480 mod p(x)
-DATA ·IEEEConst+3760(SB)/8, $0x0000000063da929a
-DATA ·IEEEConst+3768(SB)/8, $0x0000000016335cfe
-
-// x^19520 mod p(x), x^19456 mod p(x)
-DATA ·IEEEConst+3776(SB)/8, $0x00000001389caa80
-DATA ·IEEEConst+3784(SB)/8, $0x000000010372d10c
-
-// x^18496 mod p(x), x^18432 mod p(x)
-DATA ·IEEEConst+3792(SB)/8, $0x000000013db599d2
-DATA ·IEEEConst+3800(SB)/8, $0x000000015097b908
-
-// x^17472 mod p(x), x^17408 mod p(x)
-DATA ·IEEEConst+3808(SB)/8, $0x0000000122505a86
-DATA ·IEEEConst+3816(SB)/8, $0x00000001227a7572
-
-// x^16448 mod p(x), x^16384 mod p(x)
-DATA ·IEEEConst+3824(SB)/8, $0x000000016bd72746
-DATA ·IEEEConst+3832(SB)/8, $0x000000009a8f75c0
-
-// x^15424 mod p(x), x^15360 mod p(x)
-DATA ·IEEEConst+3840(SB)/8, $0x00000001c3faf1d4
-DATA ·IEEEConst+3848(SB)/8, $0x00000000682c77a2
-
-// x^14400 mod p(x), x^14336 mod p(x)
-DATA ·IEEEConst+3856(SB)/8, $0x00000001111c826c
-DATA ·IEEEConst+3864(SB)/8, $0x00000000231f091c
-
-// x^13376 mod p(x), x^13312 mod p(x)
-DATA ·IEEEConst+3872(SB)/8, $0x00000000153e9fb2
-DATA ·IEEEConst+3880(SB)/8, $0x000000007d4439f2
-
-// x^12352 mod p(x), x^12288 mod p(x)
-DATA ·IEEEConst+3888(SB)/8, $0x000000002b1f7b60
-DATA ·IEEEConst+3896(SB)/8, $0x000000017e221efc
-
-// x^11328 mod p(x), x^11264 mod p(x)
-DATA ·IEEEConst+3904(SB)/8, $0x00000000b1dba570
-DATA ·IEEEConst+3912(SB)/8, $0x0000000167457c38
-
-// x^10304 mod p(x), x^10240 mod p(x)
-DATA ·IEEEConst+3920(SB)/8, $0x00000001f6397b76
-DATA ·IEEEConst+3928(SB)/8, $0x00000000bdf081c4
-
-// x^9280 mod p(x), x^9216 mod p(x)
-DATA ·IEEEConst+3936(SB)/8, $0x0000000156335214
-DATA ·IEEEConst+3944(SB)/8, $0x000000016286d6b0
-
-// x^8256 mod p(x), x^8192 mod p(x)
-DATA ·IEEEConst+3952(SB)/8, $0x00000001d70e3986
-DATA ·IEEEConst+3960(SB)/8, $0x00000000c84f001c
-
-// x^7232 mod p(x), x^7168 mod p(x)
-DATA ·IEEEConst+3968(SB)/8, $0x000000003701a774
-DATA ·IEEEConst+3976(SB)/8, $0x0000000064efe7c0
-
-// x^6208 mod p(x), x^6144 mod p(x)
-DATA ·IEEEConst+3984(SB)/8, $0x00000000ac81ef72
-DATA ·IEEEConst+3992(SB)/8, $0x000000000ac2d904
-
-// x^5184 mod p(x), x^5120 mod p(x)
-DATA ·IEEEConst+4000(SB)/8, $0x0000000133212464
-DATA ·IEEEConst+4008(SB)/8, $0x00000000fd226d14
-
-// x^4160 mod p(x), x^4096 mod p(x)
-DATA ·IEEEConst+4016(SB)/8, $0x00000000e4e45610
-DATA ·IEEEConst+4024(SB)/8, $0x000000011cfd42e0
-
-// x^3136 mod p(x), x^3072 mod p(x)
-DATA ·IEEEConst+4032(SB)/8, $0x000000000c1bd370
-DATA ·IEEEConst+4040(SB)/8, $0x000000016e5a5678
-
-// x^2112 mod p(x), x^2048 mod p(x)
-DATA ·IEEEConst+4048(SB)/8, $0x00000001a7b9e7a6
-DATA ·IEEEConst+4056(SB)/8, $0x00000001d888fe22
-
-// x^1088 mod p(x), x^1024 mod p(x)
-DATA ·IEEEConst+4064(SB)/8, $0x000000007d657a10
-DATA ·IEEEConst+4072(SB)/8, $0x00000001af77fcd4
-
-// x^2048 mod p(x), x^2016 mod p(x), x^1984 mod p(x), x^1952 mod p(x)
-DATA ·IEEEConst+4080(SB)/8, $0x99168a18ec447f11
-DATA ·IEEEConst+4088(SB)/8, $0xed837b2613e8221e
-
-// x^1920 mod p(x), x^1888 mod p(x), x^1856 mod p(x), x^1824 mod p(x)
-DATA ·IEEEConst+4096(SB)/8, $0xe23e954e8fd2cd3c
-DATA ·IEEEConst+4104(SB)/8, $0xc8acdd8147b9ce5a
-
-// x^1792 mod p(x), x^1760 mod p(x), x^1728 mod p(x), x^1696 mod p(x)
-DATA ·IEEEConst+4112(SB)/8, $0x92f8befe6b1d2b53
-DATA ·IEEEConst+4120(SB)/8, $0xd9ad6d87d4277e25
-
-// x^1664 mod p(x), x^1632 mod p(x), x^1600 mod p(x), x^1568 mod p(x)
-DATA ·IEEEConst+4128(SB)/8, $0xf38a3556291ea462
-DATA ·IEEEConst+4136(SB)/8, $0xc10ec5e033fbca3b
-
-// x^1536 mod p(x), x^1504 mod p(x), x^1472 mod p(x), x^1440 mod p(x)
-DATA ·IEEEConst+4144(SB)/8, $0x974ac56262b6ca4b
-DATA ·IEEEConst+4152(SB)/8, $0xc0b55b0e82e02e2f
-
-// x^1408 mod p(x), x^1376 mod p(x), x^1344 mod p(x), x^1312 mod p(x)
-DATA ·IEEEConst+4160(SB)/8, $0x855712b3784d2a56
-DATA ·IEEEConst+4168(SB)/8, $0x71aa1df0e172334d
-
-// x^1280 mod p(x), x^1248 mod p(x), x^1216 mod p(x), x^1184 mod p(x)
-DATA ·IEEEConst+4176(SB)/8, $0xa5abe9f80eaee722
-DATA ·IEEEConst+4184(SB)/8, $0xfee3053e3969324d
-
-// x^1152 mod p(x), x^1120 mod p(x), x^1088 mod p(x), x^1056 mod p(x)
-DATA ·IEEEConst+4192(SB)/8, $0x1fa0943ddb54814c
-DATA ·IEEEConst+4200(SB)/8, $0xf44779b93eb2bd08
-
-// x^1024 mod p(x), x^992 mod p(x), x^960 mod p(x), x^928 mod p(x)
-DATA ·IEEEConst+4208(SB)/8, $0xa53ff440d7bbfe6a
-DATA ·IEEEConst+4216(SB)/8, $0xf5449b3f00cc3374
-
-// x^896 mod p(x), x^864 mod p(x), x^832 mod p(x), x^800 mod p(x)
-DATA ·IEEEConst+4224(SB)/8, $0xebe7e3566325605c
-DATA ·IEEEConst+4232(SB)/8, $0x6f8346e1d777606e
-
-// x^768 mod p(x), x^736 mod p(x), x^704 mod p(x), x^672 mod p(x)
-DATA ·IEEEConst+4240(SB)/8, $0xc65a272ce5b592b8
-DATA ·IEEEConst+4248(SB)/8, $0xe3ab4f2ac0b95347
-
-// x^640 mod p(x), x^608 mod p(x), x^576 mod p(x), x^544 mod p(x)
-DATA ·IEEEConst+4256(SB)/8, $0x5705a9ca4721589f
-DATA ·IEEEConst+4264(SB)/8, $0xaa2215ea329ecc11
-
-// x^512 mod p(x), x^480 mod p(x), x^448 mod p(x), x^416 mod p(x)
-DATA ·IEEEConst+4272(SB)/8, $0xe3720acb88d14467
-DATA ·IEEEConst+4280(SB)/8, $0x1ed8f66ed95efd26
-
-// x^384 mod p(x), x^352 mod p(x), x^320 mod p(x), x^288 mod p(x)
-DATA ·IEEEConst+4288(SB)/8, $0xba1aca0315141c31
-DATA ·IEEEConst+4296(SB)/8, $0x78ed02d5a700e96a
-
-// x^256 mod p(x), x^224 mod p(x), x^192 mod p(x), x^160 mod p(x)
-DATA ·IEEEConst+4304(SB)/8, $0xad2a31b3ed627dae
-DATA ·IEEEConst+4312(SB)/8, $0xba8ccbe832b39da3
-
-// x^128 mod p(x), x^96 mod p(x), x^64 mod p(x), x^32 mod p(x)
-DATA ·IEEEConst+4320(SB)/8, $0x6655004fa06a2517
-DATA ·IEEEConst+4328(SB)/8, $0xedb88320b1e6b092
-
-GLOBL ·IEEEConst(SB), RODATA, $4336
-
-// Barrett constant m - (4^32)/n
-DATA ·IEEEBarConst(SB)/8, $0x00000001f7011641
-DATA ·IEEEBarConst+8(SB)/8, $0x0000000000000000
-DATA ·IEEEBarConst+16(SB)/8, $0x00000001db710641
-DATA ·IEEEBarConst+24(SB)/8, $0x0000000000000000
-GLOBL ·IEEEBarConst(SB), RODATA, $32
-
-// Reduce 262144 kbits to 1024 bits
-// x^261184 mod p(x), x^261120 mod p(x)
-DATA ·CastConst+0(SB)/8, $0x000000009c37c408
-DATA ·CastConst+8(SB)/8, $0x00000000b6ca9e20
-
-// x^260160 mod p(x), x^260096 mod p(x)
-DATA ·CastConst+16(SB)/8, $0x00000001b51df26c
-DATA ·CastConst+24(SB)/8, $0x00000000350249a8
-
-// x^259136 mod p(x), x^259072 mod p(x)
-DATA ·CastConst+32(SB)/8, $0x000000000724b9d0
-DATA ·CastConst+40(SB)/8, $0x00000001862dac54
-
-// x^258112 mod p(x), x^258048 mod p(x)
-DATA ·CastConst+48(SB)/8, $0x00000001c00532fe
-DATA ·CastConst+56(SB)/8, $0x00000001d87fb48c
-
-// x^257088 mod p(x), x^257024 mod p(x)
-DATA ·CastConst+64(SB)/8, $0x00000000f05a9362
-DATA ·CastConst+72(SB)/8, $0x00000001f39b699e
-
-// x^256064 mod p(x), x^256000 mod p(x)
-DATA ·CastConst+80(SB)/8, $0x00000001e1007970
-DATA ·CastConst+88(SB)/8, $0x0000000101da11b4
-
-// x^255040 mod p(x), x^254976 mod p(x)
-DATA ·CastConst+96(SB)/8, $0x00000000a57366ee
-DATA ·CastConst+104(SB)/8, $0x00000001cab571e0
-
-// x^254016 mod p(x), x^253952 mod p(x)
-DATA ·CastConst+112(SB)/8, $0x0000000192011284
-DATA ·CastConst+120(SB)/8, $0x00000000c7020cfe
-
-// x^252992 mod p(x), x^252928 mod p(x)
-DATA ·CastConst+128(SB)/8, $0x0000000162716d9a
-DATA ·CastConst+136(SB)/8, $0x00000000cdaed1ae
-
-// x^251968 mod p(x), x^251904 mod p(x)
-DATA ·CastConst+144(SB)/8, $0x00000000cd97ecde
-DATA ·CastConst+152(SB)/8, $0x00000001e804effc
-
-// x^250944 mod p(x), x^250880 mod p(x)
-DATA ·CastConst+160(SB)/8, $0x0000000058812bc0
-DATA ·CastConst+168(SB)/8, $0x0000000077c3ea3a
-
-// x^249920 mod p(x), x^249856 mod p(x)
-DATA ·CastConst+176(SB)/8, $0x0000000088b8c12e
-DATA ·CastConst+184(SB)/8, $0x0000000068df31b4
-
-// x^248896 mod p(x), x^248832 mod p(x)
-DATA ·CastConst+192(SB)/8, $0x00000001230b234c
-DATA ·CastConst+200(SB)/8, $0x00000000b059b6c2
-
-// x^247872 mod p(x), x^247808 mod p(x)
-DATA ·CastConst+208(SB)/8, $0x00000001120b416e
-DATA ·CastConst+216(SB)/8, $0x0000000145fb8ed8
-
-// x^246848 mod p(x), x^246784 mod p(x)
-DATA ·CastConst+224(SB)/8, $0x00000001974aecb0
-DATA ·CastConst+232(SB)/8, $0x00000000cbc09168
-
-// x^245824 mod p(x), x^245760 mod p(x)
-DATA ·CastConst+240(SB)/8, $0x000000008ee3f226
-DATA ·CastConst+248(SB)/8, $0x000000005ceeedc2
-
-// x^244800 mod p(x), x^244736 mod p(x)
-DATA ·CastConst+256(SB)/8, $0x00000001089aba9a
-DATA ·CastConst+264(SB)/8, $0x0000000047d74e86
-
-// x^243776 mod p(x), x^243712 mod p(x)
-DATA ·CastConst+272(SB)/8, $0x0000000065113872
-DATA ·CastConst+280(SB)/8, $0x00000001407e9e22
-
-// x^242752 mod p(x), x^242688 mod p(x)
-DATA ·CastConst+288(SB)/8, $0x000000005c07ec10
-DATA ·CastConst+296(SB)/8, $0x00000001da967bda
-
-// x^241728 mod p(x), x^241664 mod p(x)
-DATA ·CastConst+304(SB)/8, $0x0000000187590924
-DATA ·CastConst+312(SB)/8, $0x000000006c898368
-
-// x^240704 mod p(x), x^240640 mod p(x)
-DATA ·CastConst+320(SB)/8, $0x00000000e35da7c6
-DATA ·CastConst+328(SB)/8, $0x00000000f2d14c98
-
-// x^239680 mod p(x), x^239616 mod p(x)
-DATA ·CastConst+336(SB)/8, $0x000000000415855a
-DATA ·CastConst+344(SB)/8, $0x00000001993c6ad4
-
-// x^238656 mod p(x), x^238592 mod p(x)
-DATA ·CastConst+352(SB)/8, $0x0000000073617758
-DATA ·CastConst+360(SB)/8, $0x000000014683d1ac
-
-// x^237632 mod p(x), x^237568 mod p(x)
-DATA ·CastConst+368(SB)/8, $0x0000000176021d28
-DATA ·CastConst+376(SB)/8, $0x00000001a7c93e6c
-
-// x^236608 mod p(x), x^236544 mod p(x)
-DATA ·CastConst+384(SB)/8, $0x00000001c358fd0a
-DATA ·CastConst+392(SB)/8, $0x000000010211e90a
-
-// x^235584 mod p(x), x^235520 mod p(x)
-DATA ·CastConst+400(SB)/8, $0x00000001ff7a2c18
-DATA ·CastConst+408(SB)/8, $0x000000001119403e
-
-// x^234560 mod p(x), x^234496 mod p(x)
-DATA ·CastConst+416(SB)/8, $0x00000000f2d9f7e4
-DATA ·CastConst+424(SB)/8, $0x000000001c3261aa
-
-// x^233536 mod p(x), x^233472 mod p(x)
-DATA ·CastConst+432(SB)/8, $0x000000016cf1f9c8
-DATA ·CastConst+440(SB)/8, $0x000000014e37a634
-
-// x^232512 mod p(x), x^232448 mod p(x)
-DATA ·CastConst+448(SB)/8, $0x000000010af9279a
-DATA ·CastConst+456(SB)/8, $0x0000000073786c0c
-
-// x^231488 mod p(x), x^231424 mod p(x)
-DATA ·CastConst+464(SB)/8, $0x0000000004f101e8
-DATA ·CastConst+472(SB)/8, $0x000000011dc037f8
-
-// x^230464 mod p(x), x^230400 mod p(x)
-DATA ·CastConst+480(SB)/8, $0x0000000070bcf184
-DATA ·CastConst+488(SB)/8, $0x0000000031433dfc
-
-// x^229440 mod p(x), x^229376 mod p(x)
-DATA ·CastConst+496(SB)/8, $0x000000000a8de642
-DATA ·CastConst+504(SB)/8, $0x000000009cde8348
-
-// x^228416 mod p(x), x^228352 mod p(x)
-DATA ·CastConst+512(SB)/8, $0x0000000062ea130c
-DATA ·CastConst+520(SB)/8, $0x0000000038d3c2a6
-
-// x^227392 mod p(x), x^227328 mod p(x)
-DATA ·CastConst+528(SB)/8, $0x00000001eb31cbb2
-DATA ·CastConst+536(SB)/8, $0x000000011b25f260
-
-// x^226368 mod p(x), x^226304 mod p(x)
-DATA ·CastConst+544(SB)/8, $0x0000000170783448
-DATA ·CastConst+552(SB)/8, $0x000000001629e6f0
-
-// x^225344 mod p(x), x^225280 mod p(x)
-DATA ·CastConst+560(SB)/8, $0x00000001a684b4c6
-DATA ·CastConst+568(SB)/8, $0x0000000160838b4c
-
-// x^224320 mod p(x), x^224256 mod p(x)
-DATA ·CastConst+576(SB)/8, $0x00000000253ca5b4
-DATA ·CastConst+584(SB)/8, $0x000000007a44011c
-
-// x^223296 mod p(x), x^223232 mod p(x)
-DATA ·CastConst+592(SB)/8, $0x0000000057b4b1e2
-DATA ·CastConst+600(SB)/8, $0x00000000226f417a
-
-// x^222272 mod p(x), x^222208 mod p(x)
-DATA ·CastConst+608(SB)/8, $0x00000000b6bd084c
-DATA ·CastConst+616(SB)/8, $0x0000000045eb2eb4
-
-// x^221248 mod p(x), x^221184 mod p(x)
-DATA ·CastConst+624(SB)/8, $0x0000000123c2d592
-DATA ·CastConst+632(SB)/8, $0x000000014459d70c
-
-// x^220224 mod p(x), x^220160 mod p(x)
-DATA ·CastConst+640(SB)/8, $0x00000000159dafce
-DATA ·CastConst+648(SB)/8, $0x00000001d406ed82
-
-// x^219200 mod p(x), x^219136 mod p(x)
-DATA ·CastConst+656(SB)/8, $0x0000000127e1a64e
-DATA ·CastConst+664(SB)/8, $0x0000000160c8e1a8
-
-// x^218176 mod p(x), x^218112 mod p(x)
-DATA ·CastConst+672(SB)/8, $0x0000000056860754
-DATA ·CastConst+680(SB)/8, $0x0000000027ba8098
-
-// x^217152 mod p(x), x^217088 mod p(x)
-DATA ·CastConst+688(SB)/8, $0x00000001e661aae8
-DATA ·CastConst+696(SB)/8, $0x000000006d92d018
-
-// x^216128 mod p(x), x^216064 mod p(x)
-DATA ·CastConst+704(SB)/8, $0x00000000f82c6166
-DATA ·CastConst+712(SB)/8, $0x000000012ed7e3f2
-
-// x^215104 mod p(x), x^215040 mod p(x)
-DATA ·CastConst+720(SB)/8, $0x00000000c4f9c7ae
-DATA ·CastConst+728(SB)/8, $0x000000002dc87788
-
-// x^214080 mod p(x), x^214016 mod p(x)
-DATA ·CastConst+736(SB)/8, $0x0000000074203d20
-DATA ·CastConst+744(SB)/8, $0x0000000018240bb8
-
-// x^213056 mod p(x), x^212992 mod p(x)
-DATA ·CastConst+752(SB)/8, $0x0000000198173052
-DATA ·CastConst+760(SB)/8, $0x000000001ad38158
-
-// x^212032 mod p(x), x^211968 mod p(x)
-DATA ·CastConst+768(SB)/8, $0x00000001ce8aba54
-DATA ·CastConst+776(SB)/8, $0x00000001396b78f2
-
-// x^211008 mod p(x), x^210944 mod p(x)
-DATA ·CastConst+784(SB)/8, $0x00000001850d5d94
-DATA ·CastConst+792(SB)/8, $0x000000011a681334
-
-// x^209984 mod p(x), x^209920 mod p(x)
-DATA ·CastConst+800(SB)/8, $0x00000001d609239c
-DATA ·CastConst+808(SB)/8, $0x000000012104732e
-
-// x^208960 mod p(x), x^208896 mod p(x)
-DATA ·CastConst+816(SB)/8, $0x000000001595f048
-DATA ·CastConst+824(SB)/8, $0x00000000a140d90c
-
-// x^207936 mod p(x), x^207872 mod p(x)
-DATA ·CastConst+832(SB)/8, $0x0000000042ccee08
-DATA ·CastConst+840(SB)/8, $0x00000001b7215eda
-
-// x^206912 mod p(x), x^206848 mod p(x)
-DATA ·CastConst+848(SB)/8, $0x000000010a389d74
-DATA ·CastConst+856(SB)/8, $0x00000001aaf1df3c
-
-// x^205888 mod p(x), x^205824 mod p(x)
-DATA ·CastConst+864(SB)/8, $0x000000012a840da6
-DATA ·CastConst+872(SB)/8, $0x0000000029d15b8a
-
-// x^204864 mod p(x), x^204800 mod p(x)
-DATA ·CastConst+880(SB)/8, $0x000000001d181c0c
-DATA ·CastConst+888(SB)/8, $0x00000000f1a96922
-
-// x^203840 mod p(x), x^203776 mod p(x)
-DATA ·CastConst+896(SB)/8, $0x0000000068b7d1f6
-DATA ·CastConst+904(SB)/8, $0x00000001ac80d03c
-
-// x^202816 mod p(x), x^202752 mod p(x)
-DATA ·CastConst+912(SB)/8, $0x000000005b0f14fc
-DATA ·CastConst+920(SB)/8, $0x000000000f11d56a
-
-// x^201792 mod p(x), x^201728 mod p(x)
-DATA ·CastConst+928(SB)/8, $0x0000000179e9e730
-DATA ·CastConst+936(SB)/8, $0x00000001f1c022a2
-
-// x^200768 mod p(x), x^200704 mod p(x)
-DATA ·CastConst+944(SB)/8, $0x00000001ce1368d6
-DATA ·CastConst+952(SB)/8, $0x0000000173d00ae2
-
-// x^199744 mod p(x), x^199680 mod p(x)
-DATA ·CastConst+960(SB)/8, $0x0000000112c3a84c
-DATA ·CastConst+968(SB)/8, $0x00000001d4ffe4ac
-
-// x^198720 mod p(x), x^198656 mod p(x)
-DATA ·CastConst+976(SB)/8, $0x00000000de940fee
-DATA ·CastConst+984(SB)/8, $0x000000016edc5ae4
-
-// x^197696 mod p(x), x^197632 mod p(x)
-DATA ·CastConst+992(SB)/8, $0x00000000fe896b7e
-DATA ·CastConst+1000(SB)/8, $0x00000001f1a02140
-
-// x^196672 mod p(x), x^196608 mod p(x)
-DATA ·CastConst+1008(SB)/8, $0x00000001f797431c
-DATA ·CastConst+1016(SB)/8, $0x00000000ca0b28a0
-
-// x^195648 mod p(x), x^195584 mod p(x)
-DATA ·CastConst+1024(SB)/8, $0x0000000053e989ba
-DATA ·CastConst+1032(SB)/8, $0x00000001928e30a2
-
-// x^194624 mod p(x), x^194560 mod p(x)
-DATA ·CastConst+1040(SB)/8, $0x000000003920cd16
-DATA ·CastConst+1048(SB)/8, $0x0000000097b1b002
-
-// x^193600 mod p(x), x^193536 mod p(x)
-DATA ·CastConst+1056(SB)/8, $0x00000001e6f579b8
-DATA ·CastConst+1064(SB)/8, $0x00000000b15bf906
-
-// x^192576 mod p(x), x^192512 mod p(x)
-DATA ·CastConst+1072(SB)/8, $0x000000007493cb0a
-DATA ·CastConst+1080(SB)/8, $0x00000000411c5d52
-
-// x^191552 mod p(x), x^191488 mod p(x)
-DATA ·CastConst+1088(SB)/8, $0x00000001bdd376d8
-DATA ·CastConst+1096(SB)/8, $0x00000001c36f3300
-
-// x^190528 mod p(x), x^190464 mod p(x)
-DATA ·CastConst+1104(SB)/8, $0x000000016badfee6
-DATA ·CastConst+1112(SB)/8, $0x00000001119227e0
-
-// x^189504 mod p(x), x^189440 mod p(x)
-DATA ·CastConst+1120(SB)/8, $0x0000000071de5c58
-DATA ·CastConst+1128(SB)/8, $0x00000000114d4702
-
-// x^188480 mod p(x), x^188416 mod p(x)
-DATA ·CastConst+1136(SB)/8, $0x00000000453f317c
-DATA ·CastConst+1144(SB)/8, $0x00000000458b5b98
-
-// x^187456 mod p(x), x^187392 mod p(x)
-DATA ·CastConst+1152(SB)/8, $0x0000000121675cce
-DATA ·CastConst+1160(SB)/8, $0x000000012e31fb8e
-
-// x^186432 mod p(x), x^186368 mod p(x)
-DATA ·CastConst+1168(SB)/8, $0x00000001f409ee92
-DATA ·CastConst+1176(SB)/8, $0x000000005cf619d8
-
-// x^185408 mod p(x), x^185344 mod p(x)
-DATA ·CastConst+1184(SB)/8, $0x00000000f36b9c88
-DATA ·CastConst+1192(SB)/8, $0x0000000063f4d8b2
-
-// x^184384 mod p(x), x^184320 mod p(x)
-DATA ·CastConst+1200(SB)/8, $0x0000000036b398f4
-DATA ·CastConst+1208(SB)/8, $0x000000004138dc8a
-
-// x^183360 mod p(x), x^183296 mod p(x)
-DATA ·CastConst+1216(SB)/8, $0x00000001748f9adc
-DATA ·CastConst+1224(SB)/8, $0x00000001d29ee8e0
-
-// x^182336 mod p(x), x^182272 mod p(x)
-DATA ·CastConst+1232(SB)/8, $0x00000001be94ec00
-DATA ·CastConst+1240(SB)/8, $0x000000006a08ace8
-
-// x^181312 mod p(x), x^181248 mod p(x)
-DATA ·CastConst+1248(SB)/8, $0x00000000b74370d6
-DATA ·CastConst+1256(SB)/8, $0x0000000127d42010
-
-// x^180288 mod p(x), x^180224 mod p(x)
-DATA ·CastConst+1264(SB)/8, $0x00000001174d0b98
-DATA ·CastConst+1272(SB)/8, $0x0000000019d76b62
-
-// x^179264 mod p(x), x^179200 mod p(x)
-DATA ·CastConst+1280(SB)/8, $0x00000000befc06a4
-DATA ·CastConst+1288(SB)/8, $0x00000001b1471f6e
-
-// x^178240 mod p(x), x^178176 mod p(x)
-DATA ·CastConst+1296(SB)/8, $0x00000001ae125288
-DATA ·CastConst+1304(SB)/8, $0x00000001f64c19cc
-
-// x^177216 mod p(x), x^177152 mod p(x)
-DATA ·CastConst+1312(SB)/8, $0x0000000095c19b34
-DATA ·CastConst+1320(SB)/8, $0x00000000003c0ea0
-
-// x^176192 mod p(x), x^176128 mod p(x)
-DATA ·CastConst+1328(SB)/8, $0x00000001a78496f2
-DATA ·CastConst+1336(SB)/8, $0x000000014d73abf6
-
-// x^175168 mod p(x), x^175104 mod p(x)
-DATA ·CastConst+1344(SB)/8, $0x00000001ac5390a0
-DATA ·CastConst+1352(SB)/8, $0x00000001620eb844
-
-// x^174144 mod p(x), x^174080 mod p(x)
-DATA ·CastConst+1360(SB)/8, $0x000000002a80ed6e
-DATA ·CastConst+1368(SB)/8, $0x0000000147655048
-
-// x^173120 mod p(x), x^173056 mod p(x)
-DATA ·CastConst+1376(SB)/8, $0x00000001fa9b0128
-DATA ·CastConst+1384(SB)/8, $0x0000000067b5077e
-
-// x^172096 mod p(x), x^172032 mod p(x)
-DATA ·CastConst+1392(SB)/8, $0x00000001ea94929e
-DATA ·CastConst+1400(SB)/8, $0x0000000010ffe206
-
-// x^171072 mod p(x), x^171008 mod p(x)
-DATA ·CastConst+1408(SB)/8, $0x0000000125f4305c
-DATA ·CastConst+1416(SB)/8, $0x000000000fee8f1e
-
-// x^170048 mod p(x), x^169984 mod p(x)
-DATA ·CastConst+1424(SB)/8, $0x00000001471e2002
-DATA ·CastConst+1432(SB)/8, $0x00000001da26fbae
-
-// x^169024 mod p(x), x^168960 mod p(x)
-DATA ·CastConst+1440(SB)/8, $0x0000000132d2253a
-DATA ·CastConst+1448(SB)/8, $0x00000001b3a8bd88
-
-// x^168000 mod p(x), x^167936 mod p(x)
-DATA ·CastConst+1456(SB)/8, $0x00000000f26b3592
-DATA ·CastConst+1464(SB)/8, $0x00000000e8f3898e
-
-// x^166976 mod p(x), x^166912 mod p(x)
-DATA ·CastConst+1472(SB)/8, $0x00000000bc8b67b0
-DATA ·CastConst+1480(SB)/8, $0x00000000b0d0d28c
-
-// x^165952 mod p(x), x^165888 mod p(x)
-DATA ·CastConst+1488(SB)/8, $0x000000013a826ef2
-DATA ·CastConst+1496(SB)/8, $0x0000000030f2a798
-
-// x^164928 mod p(x), x^164864 mod p(x)
-DATA ·CastConst+1504(SB)/8, $0x0000000081482c84
-DATA ·CastConst+1512(SB)/8, $0x000000000fba1002
-
-// x^163904 mod p(x), x^163840 mod p(x)
-DATA ·CastConst+1520(SB)/8, $0x00000000e77307c2
-DATA ·CastConst+1528(SB)/8, $0x00000000bdb9bd72
-
-// x^162880 mod p(x), x^162816 mod p(x)
-DATA ·CastConst+1536(SB)/8, $0x00000000d4a07ec8
-DATA ·CastConst+1544(SB)/8, $0x0000000075d3bf5a
-
-// x^161856 mod p(x), x^161792 mod p(x)
-DATA ·CastConst+1552(SB)/8, $0x0000000017102100
-DATA ·CastConst+1560(SB)/8, $0x00000000ef1f98a0
-
-// x^160832 mod p(x), x^160768 mod p(x)
-DATA ·CastConst+1568(SB)/8, $0x00000000db406486
-DATA ·CastConst+1576(SB)/8, $0x00000000689c7602
-
-// x^159808 mod p(x), x^159744 mod p(x)
-DATA ·CastConst+1584(SB)/8, $0x0000000192db7f88
-DATA ·CastConst+1592(SB)/8, $0x000000016d5fa5fe
-
-// x^158784 mod p(x), x^158720 mod p(x)
-DATA ·CastConst+1600(SB)/8, $0x000000018bf67b1e
-DATA ·CastConst+1608(SB)/8, $0x00000001d0d2b9ca
-
-// x^157760 mod p(x), x^157696 mod p(x)
-DATA ·CastConst+1616(SB)/8, $0x000000007c09163e
-DATA ·CastConst+1624(SB)/8, $0x0000000041e7b470
-
-// x^156736 mod p(x), x^156672 mod p(x)
-DATA ·CastConst+1632(SB)/8, $0x000000000adac060
-DATA ·CastConst+1640(SB)/8, $0x00000001cbb6495e
-
-// x^155712 mod p(x), x^155648 mod p(x)
-DATA ·CastConst+1648(SB)/8, $0x00000000bd8316ae
-DATA ·CastConst+1656(SB)/8, $0x000000010052a0b0
-
-// x^154688 mod p(x), x^154624 mod p(x)
-DATA ·CastConst+1664(SB)/8, $0x000000019f09ab54
-DATA ·CastConst+1672(SB)/8, $0x00000001d8effb5c
-
-// x^153664 mod p(x), x^153600 mod p(x)
-DATA ·CastConst+1680(SB)/8, $0x0000000125155542
-DATA ·CastConst+1688(SB)/8, $0x00000001d969853c
-
-// x^152640 mod p(x), x^152576 mod p(x)
-DATA ·CastConst+1696(SB)/8, $0x000000018fdb5882
-DATA ·CastConst+1704(SB)/8, $0x00000000523ccce2
-
-// x^151616 mod p(x), x^151552 mod p(x)
-DATA ·CastConst+1712(SB)/8, $0x00000000e794b3f4
-DATA ·CastConst+1720(SB)/8, $0x000000001e2436bc
-
-// x^150592 mod p(x), x^150528 mod p(x)
-DATA ·CastConst+1728(SB)/8, $0x000000016f9bb022
-DATA ·CastConst+1736(SB)/8, $0x00000000ddd1c3a2
-
-// x^149568 mod p(x), x^149504 mod p(x)
-DATA ·CastConst+1744(SB)/8, $0x00000000290c9978
-DATA ·CastConst+1752(SB)/8, $0x0000000019fcfe38
-
-// x^148544 mod p(x), x^148480 mod p(x)
-DATA ·CastConst+1760(SB)/8, $0x0000000083c0f350
-DATA ·CastConst+1768(SB)/8, $0x00000001ce95db64
-
-// x^147520 mod p(x), x^147456 mod p(x)
-DATA ·CastConst+1776(SB)/8, $0x0000000173ea6628
-DATA ·CastConst+1784(SB)/8, $0x00000000af582806
-
-// x^146496 mod p(x), x^146432 mod p(x)
-DATA ·CastConst+1792(SB)/8, $0x00000001c8b4e00a
-DATA ·CastConst+1800(SB)/8, $0x00000001006388f6
-
-// x^145472 mod p(x), x^145408 mod p(x)
-DATA ·CastConst+1808(SB)/8, $0x00000000de95d6aa
-DATA ·CastConst+1816(SB)/8, $0x0000000179eca00a
-
-// x^144448 mod p(x), x^144384 mod p(x)
-DATA ·CastConst+1824(SB)/8, $0x000000010b7f7248
-DATA ·CastConst+1832(SB)/8, $0x0000000122410a6a
-
-// x^143424 mod p(x), x^143360 mod p(x)
-DATA ·CastConst+1840(SB)/8, $0x00000001326e3a06
-DATA ·CastConst+1848(SB)/8, $0x000000004288e87c
-
-// x^142400 mod p(x), x^142336 mod p(x)
-DATA ·CastConst+1856(SB)/8, $0x00000000bb62c2e6
-DATA ·CastConst+1864(SB)/8, $0x000000016c5490da
-
-// x^141376 mod p(x), x^141312 mod p(x)
-DATA ·CastConst+1872(SB)/8, $0x0000000156a4b2c2
-DATA ·CastConst+1880(SB)/8, $0x00000000d1c71f6e
-
-// x^140352 mod p(x), x^140288 mod p(x)
-DATA ·CastConst+1888(SB)/8, $0x000000011dfe763a
-DATA ·CastConst+1896(SB)/8, $0x00000001b4ce08a6
-
-// x^139328 mod p(x), x^139264 mod p(x)
-DATA ·CastConst+1904(SB)/8, $0x000000007bcca8e2
-DATA ·CastConst+1912(SB)/8, $0x00000001466ba60c
-
-// x^138304 mod p(x), x^138240 mod p(x)
-DATA ·CastConst+1920(SB)/8, $0x0000000186118faa
-DATA ·CastConst+1928(SB)/8, $0x00000001f6c488a4
-
-// x^137280 mod p(x), x^137216 mod p(x)
-DATA ·CastConst+1936(SB)/8, $0x0000000111a65a88
-DATA ·CastConst+1944(SB)/8, $0x000000013bfb0682
-
-// x^136256 mod p(x), x^136192 mod p(x)
-DATA ·CastConst+1952(SB)/8, $0x000000003565e1c4
-DATA ·CastConst+1960(SB)/8, $0x00000000690e9e54
-
-// x^135232 mod p(x), x^135168 mod p(x)
-DATA ·CastConst+1968(SB)/8, $0x000000012ed02a82
-DATA ·CastConst+1976(SB)/8, $0x00000000281346b6
-
-// x^134208 mod p(x), x^134144 mod p(x)
-DATA ·CastConst+1984(SB)/8, $0x00000000c486ecfc
-DATA ·CastConst+1992(SB)/8, $0x0000000156464024
-
-// x^133184 mod p(x), x^133120 mod p(x)
-DATA ·CastConst+2000(SB)/8, $0x0000000001b951b2
-DATA ·CastConst+2008(SB)/8, $0x000000016063a8dc
-
-// x^132160 mod p(x), x^132096 mod p(x)
-DATA ·CastConst+2016(SB)/8, $0x0000000048143916
-DATA ·CastConst+2024(SB)/8, $0x0000000116a66362
-
-// x^131136 mod p(x), x^131072 mod p(x)
-DATA ·CastConst+2032(SB)/8, $0x00000001dc2ae124
-DATA ·CastConst+2040(SB)/8, $0x000000017e8aa4d2
-
-// x^130112 mod p(x), x^130048 mod p(x)
-DATA ·CastConst+2048(SB)/8, $0x00000001416c58d6
-DATA ·CastConst+2056(SB)/8, $0x00000001728eb10c
-
-// x^129088 mod p(x), x^129024 mod p(x)
-DATA ·CastConst+2064(SB)/8, $0x00000000a479744a
-DATA ·CastConst+2072(SB)/8, $0x00000001b08fd7fa
-
-// x^128064 mod p(x), x^128000 mod p(x)
-DATA ·CastConst+2080(SB)/8, $0x0000000096ca3a26
-DATA ·CastConst+2088(SB)/8, $0x00000001092a16e8
-
-// x^127040 mod p(x), x^126976 mod p(x)
-DATA ·CastConst+2096(SB)/8, $0x00000000ff223d4e
-DATA ·CastConst+2104(SB)/8, $0x00000000a505637c
-
-// x^126016 mod p(x), x^125952 mod p(x)
-DATA ·CastConst+2112(SB)/8, $0x000000010e84da42
-DATA ·CastConst+2120(SB)/8, $0x00000000d94869b2
-
-// x^124992 mod p(x), x^124928 mod p(x)
-DATA ·CastConst+2128(SB)/8, $0x00000001b61ba3d0
-DATA ·CastConst+2136(SB)/8, $0x00000001c8b203ae
-
-// x^123968 mod p(x), x^123904 mod p(x)
-DATA ·CastConst+2144(SB)/8, $0x00000000680f2de8
-DATA ·CastConst+2152(SB)/8, $0x000000005704aea0
-
-// x^122944 mod p(x), x^122880 mod p(x)
-DATA ·CastConst+2160(SB)/8, $0x000000008772a9a8
-DATA ·CastConst+2168(SB)/8, $0x000000012e295fa2
-
-// x^121920 mod p(x), x^121856 mod p(x)
-DATA ·CastConst+2176(SB)/8, $0x0000000155f295bc
-DATA ·CastConst+2184(SB)/8, $0x000000011d0908bc
-
-// x^120896 mod p(x), x^120832 mod p(x)
-DATA ·CastConst+2192(SB)/8, $0x00000000595f9282
-DATA ·CastConst+2200(SB)/8, $0x0000000193ed97ea
-
-// x^119872 mod p(x), x^119808 mod p(x)
-DATA ·CastConst+2208(SB)/8, $0x0000000164b1c25a
-DATA ·CastConst+2216(SB)/8, $0x000000013a0f1c52
-
-// x^118848 mod p(x), x^118784 mod p(x)
-DATA ·CastConst+2224(SB)/8, $0x00000000fbd67c50
-DATA ·CastConst+2232(SB)/8, $0x000000010c2c40c0
-
-// x^117824 mod p(x), x^117760 mod p(x)
-DATA ·CastConst+2240(SB)/8, $0x0000000096076268
-DATA ·CastConst+2248(SB)/8, $0x00000000ff6fac3e
-
-// x^116800 mod p(x), x^116736 mod p(x)
-DATA ·CastConst+2256(SB)/8, $0x00000001d288e4cc
-DATA ·CastConst+2264(SB)/8, $0x000000017b3609c0
-
-// x^115776 mod p(x), x^115712 mod p(x)
-DATA ·CastConst+2272(SB)/8, $0x00000001eaac1bdc
-DATA ·CastConst+2280(SB)/8, $0x0000000088c8c922
-
-// x^114752 mod p(x), x^114688 mod p(x)
-DATA ·CastConst+2288(SB)/8, $0x00000001f1ea39e2
-DATA ·CastConst+2296(SB)/8, $0x00000001751baae6
-
-// x^113728 mod p(x), x^113664 mod p(x)
-DATA ·CastConst+2304(SB)/8, $0x00000001eb6506fc
-DATA ·CastConst+2312(SB)/8, $0x0000000107952972
-
-// x^112704 mod p(x), x^112640 mod p(x)
-DATA ·CastConst+2320(SB)/8, $0x000000010f806ffe
-DATA ·CastConst+2328(SB)/8, $0x0000000162b00abe
-
-// x^111680 mod p(x), x^111616 mod p(x)
-DATA ·CastConst+2336(SB)/8, $0x000000010408481e
-DATA ·CastConst+2344(SB)/8, $0x000000000d7b404c
-
-// x^110656 mod p(x), x^110592 mod p(x)
-DATA ·CastConst+2352(SB)/8, $0x0000000188260534
-DATA ·CastConst+2360(SB)/8, $0x00000000763b13d4
-
-// x^109632 mod p(x), x^109568 mod p(x)
-DATA ·CastConst+2368(SB)/8, $0x0000000058fc73e0
-DATA ·CastConst+2376(SB)/8, $0x00000000f6dc22d8
-
-// x^108608 mod p(x), x^108544 mod p(x)
-DATA ·CastConst+2384(SB)/8, $0x00000000391c59b8
-DATA ·CastConst+2392(SB)/8, $0x000000007daae060
-
-// x^107584 mod p(x), x^107520 mod p(x)
-DATA ·CastConst+2400(SB)/8, $0x000000018b638400
-DATA ·CastConst+2408(SB)/8, $0x000000013359ab7c
-
-// x^106560 mod p(x), x^106496 mod p(x)
-DATA ·CastConst+2416(SB)/8, $0x000000011738f5c4
-DATA ·CastConst+2424(SB)/8, $0x000000008add438a
-
-// x^105536 mod p(x), x^105472 mod p(x)
-DATA ·CastConst+2432(SB)/8, $0x000000008cf7c6da
-DATA ·CastConst+2440(SB)/8, $0x00000001edbefdea
-
-// x^104512 mod p(x), x^104448 mod p(x)
-DATA ·CastConst+2448(SB)/8, $0x00000001ef97fb16
-DATA ·CastConst+2456(SB)/8, $0x000000004104e0f8
-
-// x^103488 mod p(x), x^103424 mod p(x)
-DATA ·CastConst+2464(SB)/8, $0x0000000102130e20
-DATA ·CastConst+2472(SB)/8, $0x00000000b48a8222
-
-// x^102464 mod p(x), x^102400 mod p(x)
-DATA ·CastConst+2480(SB)/8, $0x00000000db968898
-DATA ·CastConst+2488(SB)/8, $0x00000001bcb46844
-
-// x^101440 mod p(x), x^101376 mod p(x)
-DATA ·CastConst+2496(SB)/8, $0x00000000b5047b5e
-DATA ·CastConst+2504(SB)/8, $0x000000013293ce0a
-
-// x^100416 mod p(x), x^100352 mod p(x)
-DATA ·CastConst+2512(SB)/8, $0x000000010b90fdb2
-DATA ·CastConst+2520(SB)/8, $0x00000001710d0844
-
-// x^99392 mod p(x), x^99328 mod p(x)
-DATA ·CastConst+2528(SB)/8, $0x000000004834a32e
-DATA ·CastConst+2536(SB)/8, $0x0000000117907f6e
-
-// x^98368 mod p(x), x^98304 mod p(x)
-DATA ·CastConst+2544(SB)/8, $0x0000000059c8f2b0
-DATA ·CastConst+2552(SB)/8, $0x0000000087ddf93e
-
-// x^97344 mod p(x), x^97280 mod p(x)
-DATA ·CastConst+2560(SB)/8, $0x0000000122cec508
-DATA ·CastConst+2568(SB)/8, $0x000000005970e9b0
-
-// x^96320 mod p(x), x^96256 mod p(x)
-DATA ·CastConst+2576(SB)/8, $0x000000000a330cda
-DATA ·CastConst+2584(SB)/8, $0x0000000185b2b7d0
-
-// x^95296 mod p(x), x^95232 mod p(x)
-DATA ·CastConst+2592(SB)/8, $0x000000014a47148c
-DATA ·CastConst+2600(SB)/8, $0x00000001dcee0efc
-
-// x^94272 mod p(x), x^94208 mod p(x)
-DATA ·CastConst+2608(SB)/8, $0x0000000042c61cb8
-DATA ·CastConst+2616(SB)/8, $0x0000000030da2722
-
-// x^93248 mod p(x), x^93184 mod p(x)
-DATA ·CastConst+2624(SB)/8, $0x0000000012fe6960
-DATA ·CastConst+2632(SB)/8, $0x000000012f925a18
-
-// x^92224 mod p(x), x^92160 mod p(x)
-DATA ·CastConst+2640(SB)/8, $0x00000000dbda2c20
-DATA ·CastConst+2648(SB)/8, $0x00000000dd2e357c
-
-// x^91200 mod p(x), x^91136 mod p(x)
-DATA ·CastConst+2656(SB)/8, $0x000000011122410c
-DATA ·CastConst+2664(SB)/8, $0x00000000071c80de
-
-// x^90176 mod p(x), x^90112 mod p(x)
-DATA ·CastConst+2672(SB)/8, $0x00000000977b2070
-DATA ·CastConst+2680(SB)/8, $0x000000011513140a
-
-// x^89152 mod p(x), x^89088 mod p(x)
-DATA ·CastConst+2688(SB)/8, $0x000000014050438e
-DATA ·CastConst+2696(SB)/8, $0x00000001df876e8e
-
-// x^88128 mod p(x), x^88064 mod p(x)
-DATA ·CastConst+2704(SB)/8, $0x0000000147c840e8
-DATA ·CastConst+2712(SB)/8, $0x000000015f81d6ce
-
-// x^87104 mod p(x), x^87040 mod p(x)
-DATA ·CastConst+2720(SB)/8, $0x00000001cc7c88ce
-DATA ·CastConst+2728(SB)/8, $0x000000019dd94dbe
-
-// x^86080 mod p(x), x^86016 mod p(x)
-DATA ·CastConst+2736(SB)/8, $0x00000001476b35a4
-DATA ·CastConst+2744(SB)/8, $0x00000001373d206e
-
-// x^85056 mod p(x), x^84992 mod p(x)
-DATA ·CastConst+2752(SB)/8, $0x000000013d52d508
-DATA ·CastConst+2760(SB)/8, $0x00000000668ccade
-
-// x^84032 mod p(x), x^83968 mod p(x)
-DATA ·CastConst+2768(SB)/8, $0x000000008e4be32e
-DATA ·CastConst+2776(SB)/8, $0x00000001b192d268
-
-// x^83008 mod p(x), x^82944 mod p(x)
-DATA ·CastConst+2784(SB)/8, $0x00000000024120fe
-DATA ·CastConst+2792(SB)/8, $0x00000000e30f3a78
-
-// x^81984 mod p(x), x^81920 mod p(x)
-DATA ·CastConst+2800(SB)/8, $0x00000000ddecddb4
-DATA ·CastConst+2808(SB)/8, $0x000000010ef1f7bc
-
-// x^80960 mod p(x), x^80896 mod p(x)
-DATA ·CastConst+2816(SB)/8, $0x00000000d4d403bc
-DATA ·CastConst+2824(SB)/8, $0x00000001f5ac7380
-
-// x^79936 mod p(x), x^79872 mod p(x)
-DATA ·CastConst+2832(SB)/8, $0x00000001734b89aa
-DATA ·CastConst+2840(SB)/8, $0x000000011822ea70
-
-// x^78912 mod p(x), x^78848 mod p(x)
-DATA ·CastConst+2848(SB)/8, $0x000000010e7a58d6
-DATA ·CastConst+2856(SB)/8, $0x00000000c3a33848
-
-// x^77888 mod p(x), x^77824 mod p(x)
-DATA ·CastConst+2864(SB)/8, $0x00000001f9f04e9c
-DATA ·CastConst+2872(SB)/8, $0x00000001bd151c24
-
-// x^76864 mod p(x), x^76800 mod p(x)
-DATA ·CastConst+2880(SB)/8, $0x00000000b692225e
-DATA ·CastConst+2888(SB)/8, $0x0000000056002d76
-
-// x^75840 mod p(x), x^75776 mod p(x)
-DATA ·CastConst+2896(SB)/8, $0x000000019b8d3f3e
-DATA ·CastConst+2904(SB)/8, $0x000000014657c4f4
-
-// x^74816 mod p(x), x^74752 mod p(x)
-DATA ·CastConst+2912(SB)/8, $0x00000001a874f11e
-DATA ·CastConst+2920(SB)/8, $0x0000000113742d7c
-
-// x^73792 mod p(x), x^73728 mod p(x)
-DATA ·CastConst+2928(SB)/8, $0x000000010d5a4254
-DATA ·CastConst+2936(SB)/8, $0x000000019c5920ba
-
-// x^72768 mod p(x), x^72704 mod p(x)
-DATA ·CastConst+2944(SB)/8, $0x00000000bbb2f5d6
-DATA ·CastConst+2952(SB)/8, $0x000000005216d2d6
-
-// x^71744 mod p(x), x^71680 mod p(x)
-DATA ·CastConst+2960(SB)/8, $0x0000000179cc0e36
-DATA ·CastConst+2968(SB)/8, $0x0000000136f5ad8a
-
-// x^70720 mod p(x), x^70656 mod p(x)
-DATA ·CastConst+2976(SB)/8, $0x00000001dca1da4a
-DATA ·CastConst+2984(SB)/8, $0x000000018b07beb6
-
-// x^69696 mod p(x), x^69632 mod p(x)
-DATA ·CastConst+2992(SB)/8, $0x00000000feb1a192
-DATA ·CastConst+3000(SB)/8, $0x00000000db1e93b0
-
-// x^68672 mod p(x), x^68608 mod p(x)
-DATA ·CastConst+3008(SB)/8, $0x00000000d1eeedd6
-DATA ·CastConst+3016(SB)/8, $0x000000000b96fa3a
-
-// x^67648 mod p(x), x^67584 mod p(x)
-DATA ·CastConst+3024(SB)/8, $0x000000008fad9bb4
-DATA ·CastConst+3032(SB)/8, $0x00000001d9968af0
-
-// x^66624 mod p(x), x^66560 mod p(x)
-DATA ·CastConst+3040(SB)/8, $0x00000001884938e4
-DATA ·CastConst+3048(SB)/8, $0x000000000e4a77a2
-
-// x^65600 mod p(x), x^65536 mod p(x)
-DATA ·CastConst+3056(SB)/8, $0x00000001bc2e9bc0
-DATA ·CastConst+3064(SB)/8, $0x00000000508c2ac8
-
-// x^64576 mod p(x), x^64512 mod p(x)
-DATA ·CastConst+3072(SB)/8, $0x00000001f9658a68
-DATA ·CastConst+3080(SB)/8, $0x0000000021572a80
-
-// x^63552 mod p(x), x^63488 mod p(x)
-DATA ·CastConst+3088(SB)/8, $0x000000001b9224fc
-DATA ·CastConst+3096(SB)/8, $0x00000001b859daf2
-
-// x^62528 mod p(x), x^62464 mod p(x)
-DATA ·CastConst+3104(SB)/8, $0x0000000055b2fb84
-DATA ·CastConst+3112(SB)/8, $0x000000016f788474
-
-// x^61504 mod p(x), x^61440 mod p(x)
-DATA ·CastConst+3120(SB)/8, $0x000000018b090348
-DATA ·CastConst+3128(SB)/8, $0x00000001b438810e
-
-// x^60480 mod p(x), x^60416 mod p(x)
-DATA ·CastConst+3136(SB)/8, $0x000000011ccbd5ea
-DATA ·CastConst+3144(SB)/8, $0x0000000095ddc6f2
-
-// x^59456 mod p(x), x^59392 mod p(x)
-DATA ·CastConst+3152(SB)/8, $0x0000000007ae47f8
-DATA ·CastConst+3160(SB)/8, $0x00000001d977c20c
-
-// x^58432 mod p(x), x^58368 mod p(x)
-DATA ·CastConst+3168(SB)/8, $0x0000000172acbec0
-DATA ·CastConst+3176(SB)/8, $0x00000000ebedb99a
-
-// x^57408 mod p(x), x^57344 mod p(x)
-DATA ·CastConst+3184(SB)/8, $0x00000001c6e3ff20
-DATA ·CastConst+3192(SB)/8, $0x00000001df9e9e92
-
-// x^56384 mod p(x), x^56320 mod p(x)
-DATA ·CastConst+3200(SB)/8, $0x00000000e1b38744
-DATA ·CastConst+3208(SB)/8, $0x00000001a4a3f952
-
-// x^55360 mod p(x), x^55296 mod p(x)
-DATA ·CastConst+3216(SB)/8, $0x00000000791585b2
-DATA ·CastConst+3224(SB)/8, $0x00000000e2f51220
-
-// x^54336 mod p(x), x^54272 mod p(x)
-DATA ·CastConst+3232(SB)/8, $0x00000000ac53b894
-DATA ·CastConst+3240(SB)/8, $0x000000004aa01f3e
-
-// x^53312 mod p(x), x^53248 mod p(x)
-DATA ·CastConst+3248(SB)/8, $0x00000001ed5f2cf4
-DATA ·CastConst+3256(SB)/8, $0x00000000b3e90a58
-
-// x^52288 mod p(x), x^52224 mod p(x)
-DATA ·CastConst+3264(SB)/8, $0x00000001df48b2e0
-DATA ·CastConst+3272(SB)/8, $0x000000000c9ca2aa
-
-// x^51264 mod p(x), x^51200 mod p(x)
-DATA ·CastConst+3280(SB)/8, $0x00000000049c1c62
-DATA ·CastConst+3288(SB)/8, $0x0000000151682316
-
-// x^50240 mod p(x), x^50176 mod p(x)
-DATA ·CastConst+3296(SB)/8, $0x000000017c460c12
-DATA ·CastConst+3304(SB)/8, $0x0000000036fce78c
-
-// x^49216 mod p(x), x^49152 mod p(x)
-DATA ·CastConst+3312(SB)/8, $0x000000015be4da7e
-DATA ·CastConst+3320(SB)/8, $0x000000009037dc10
-
-// x^48192 mod p(x), x^48128 mod p(x)
-DATA ·CastConst+3328(SB)/8, $0x000000010f38f668
-DATA ·CastConst+3336(SB)/8, $0x00000000d3298582
-
-// x^47168 mod p(x), x^47104 mod p(x)
-DATA ·CastConst+3344(SB)/8, $0x0000000039f40a00
-DATA ·CastConst+3352(SB)/8, $0x00000001b42e8ad6
-
-// x^46144 mod p(x), x^46080 mod p(x)
-DATA ·CastConst+3360(SB)/8, $0x00000000bd4c10c4
-DATA ·CastConst+3368(SB)/8, $0x00000000142a9838
-
-// x^45120 mod p(x), x^45056 mod p(x)
-DATA ·CastConst+3376(SB)/8, $0x0000000042db1d98
-DATA ·CastConst+3384(SB)/8, $0x0000000109c7f190
-
-// x^44096 mod p(x), x^44032 mod p(x)
-DATA ·CastConst+3392(SB)/8, $0x00000001c905bae6
-DATA ·CastConst+3400(SB)/8, $0x0000000056ff9310
-
-// x^43072 mod p(x), x^43008 mod p(x)
-DATA ·CastConst+3408(SB)/8, $0x00000000069d40ea
-DATA ·CastConst+3416(SB)/8, $0x00000001594513aa
-
-// x^42048 mod p(x), x^41984 mod p(x)
-DATA ·CastConst+3424(SB)/8, $0x000000008e4fbad0
-DATA ·CastConst+3432(SB)/8, $0x00000001e3b5b1e8
-
-// x^41024 mod p(x), x^40960 mod p(x)
-DATA ·CastConst+3440(SB)/8, $0x0000000047bedd46
-DATA ·CastConst+3448(SB)/8, $0x000000011dd5fc08
-
-// x^40000 mod p(x), x^39936 mod p(x)
-DATA ·CastConst+3456(SB)/8, $0x0000000026396bf8
-DATA ·CastConst+3464(SB)/8, $0x00000001675f0cc2
-
-// x^38976 mod p(x), x^38912 mod p(x)
-DATA ·CastConst+3472(SB)/8, $0x00000000379beb92
-DATA ·CastConst+3480(SB)/8, $0x00000000d1c8dd44
-
-// x^37952 mod p(x), x^37888 mod p(x)
-DATA ·CastConst+3488(SB)/8, $0x000000000abae54a
-DATA ·CastConst+3496(SB)/8, $0x0000000115ebd3d8
-
-// x^36928 mod p(x), x^36864 mod p(x)
-DATA ·CastConst+3504(SB)/8, $0x0000000007e6a128
-DATA ·CastConst+3512(SB)/8, $0x00000001ecbd0dac
-
-// x^35904 mod p(x), x^35840 mod p(x)
-DATA ·CastConst+3520(SB)/8, $0x000000000ade29d2
-DATA ·CastConst+3528(SB)/8, $0x00000000cdf67af2
-
-// x^34880 mod p(x), x^34816 mod p(x)
-DATA ·CastConst+3536(SB)/8, $0x00000000f974c45c
-DATA ·CastConst+3544(SB)/8, $0x000000004c01ff4c
-
-// x^33856 mod p(x), x^33792 mod p(x)
-DATA ·CastConst+3552(SB)/8, $0x00000000e77ac60a
-DATA ·CastConst+3560(SB)/8, $0x00000000f2d8657e
-
-// x^32832 mod p(x), x^32768 mod p(x)
-DATA ·CastConst+3568(SB)/8, $0x0000000145895816
-DATA ·CastConst+3576(SB)/8, $0x000000006bae74c4
-
-// x^31808 mod p(x), x^31744 mod p(x)
-DATA ·CastConst+3584(SB)/8, $0x0000000038e362be
-DATA ·CastConst+3592(SB)/8, $0x0000000152af8aa0
-
-// x^30784 mod p(x), x^30720 mod p(x)
-DATA ·CastConst+3600(SB)/8, $0x000000007f991a64
-DATA ·CastConst+3608(SB)/8, $0x0000000004663802
-
-// x^29760 mod p(x), x^29696 mod p(x)
-DATA ·CastConst+3616(SB)/8, $0x00000000fa366d3a
-DATA ·CastConst+3624(SB)/8, $0x00000001ab2f5afc
-
-// x^28736 mod p(x), x^28672 mod p(x)
-DATA ·CastConst+3632(SB)/8, $0x00000001a2bb34f0
-DATA ·CastConst+3640(SB)/8, $0x0000000074a4ebd4
-
-// x^27712 mod p(x), x^27648 mod p(x)
-DATA ·CastConst+3648(SB)/8, $0x0000000028a9981e
-DATA ·CastConst+3656(SB)/8, $0x00000001d7ab3a4c
-
-// x^26688 mod p(x), x^26624 mod p(x)
-DATA ·CastConst+3664(SB)/8, $0x00000001dbc672be
-DATA ·CastConst+3672(SB)/8, $0x00000001a8da60c6
-
-// x^25664 mod p(x), x^25600 mod p(x)
-DATA ·CastConst+3680(SB)/8, $0x00000000b04d77f6
-DATA ·CastConst+3688(SB)/8, $0x000000013cf63820
-
-// x^24640 mod p(x), x^24576 mod p(x)
-DATA ·CastConst+3696(SB)/8, $0x0000000124400d96
-DATA ·CastConst+3704(SB)/8, $0x00000000bec12e1e
-
-// x^23616 mod p(x), x^23552 mod p(x)
-DATA ·CastConst+3712(SB)/8, $0x000000014ca4b414
-DATA ·CastConst+3720(SB)/8, $0x00000001c6368010
-
-// x^22592 mod p(x), x^22528 mod p(x)
-DATA ·CastConst+3728(SB)/8, $0x000000012fe2c938
-DATA ·CastConst+3736(SB)/8, $0x00000001e6e78758
-
-// x^21568 mod p(x), x^21504 mod p(x)
-DATA ·CastConst+3744(SB)/8, $0x00000001faed01e6
-DATA ·CastConst+3752(SB)/8, $0x000000008d7f2b3c
-
-// x^20544 mod p(x), x^20480 mod p(x)
-DATA ·CastConst+3760(SB)/8, $0x000000007e80ecfe
-DATA ·CastConst+3768(SB)/8, $0x000000016b4a156e
-
-// x^19520 mod p(x), x^19456 mod p(x)
-DATA ·CastConst+3776(SB)/8, $0x0000000098daee94
-DATA ·CastConst+3784(SB)/8, $0x00000001c63cfeb6
-
-// x^18496 mod p(x), x^18432 mod p(x)
-DATA ·CastConst+3792(SB)/8, $0x000000010a04edea
-DATA ·CastConst+3800(SB)/8, $0x000000015f902670
-
-// x^17472 mod p(x), x^17408 mod p(x)
-DATA ·CastConst+3808(SB)/8, $0x00000001c00b4524
-DATA ·CastConst+3816(SB)/8, $0x00000001cd5de11e
-
-// x^16448 mod p(x), x^16384 mod p(x)
-DATA ·CastConst+3824(SB)/8, $0x0000000170296550
-DATA ·CastConst+3832(SB)/8, $0x000000001acaec54
-
-// x^15424 mod p(x), x^15360 mod p(x)
-DATA ·CastConst+3840(SB)/8, $0x0000000181afaa48
-DATA ·CastConst+3848(SB)/8, $0x000000002bd0ca78
-
-// x^14400 mod p(x), x^14336 mod p(x)
-DATA ·CastConst+3856(SB)/8, $0x0000000185a31ffa
-DATA ·CastConst+3864(SB)/8, $0x0000000032d63d5c
-
-// x^13376 mod p(x), x^13312 mod p(x)
-DATA ·CastConst+3872(SB)/8, $0x000000002469f608
-DATA ·CastConst+3880(SB)/8, $0x000000001c6d4e4c
-
-// x^12352 mod p(x), x^12288 mod p(x)
-DATA ·CastConst+3888(SB)/8, $0x000000006980102a
-DATA ·CastConst+3896(SB)/8, $0x0000000106a60b92
-
-// x^11328 mod p(x), x^11264 mod p(x)
-DATA ·CastConst+3904(SB)/8, $0x0000000111ea9ca8
-DATA ·CastConst+3912(SB)/8, $0x00000000d3855e12
-
-// x^10304 mod p(x), x^10240 mod p(x)
-DATA ·CastConst+3920(SB)/8, $0x00000001bd1d29ce
-DATA ·CastConst+3928(SB)/8, $0x00000000e3125636
-
-// x^9280 mod p(x), x^9216 mod p(x)
-DATA ·CastConst+3936(SB)/8, $0x00000001b34b9580
-DATA ·CastConst+3944(SB)/8, $0x000000009e8f7ea4
-
-// x^8256 mod p(x), x^8192 mod p(x)
-DATA ·CastConst+3952(SB)/8, $0x000000003076054e
-DATA ·CastConst+3960(SB)/8, $0x00000001c82e562c
-
-// x^7232 mod p(x), x^7168 mod p(x)
-DATA ·CastConst+3968(SB)/8, $0x000000012a608ea4
-DATA ·CastConst+3976(SB)/8, $0x00000000ca9f09ce
-
-// x^6208 mod p(x), x^6144 mod p(x)
-DATA ·CastConst+3984(SB)/8, $0x00000000784d05fe
-DATA ·CastConst+3992(SB)/8, $0x00000000c63764e6
-
-// x^5184 mod p(x), x^5120 mod p(x)
-DATA ·CastConst+4000(SB)/8, $0x000000016ef0d82a
-DATA ·CastConst+4008(SB)/8, $0x0000000168d2e49e
-
-// x^4160 mod p(x), x^4096 mod p(x)
-DATA ·CastConst+4016(SB)/8, $0x0000000075bda454
-DATA ·CastConst+4024(SB)/8, $0x00000000e986c148
-
-// x^3136 mod p(x), x^3072 mod p(x)
-DATA ·CastConst+4032(SB)/8, $0x000000003dc0a1c4
-DATA ·CastConst+4040(SB)/8, $0x00000000cfb65894
-
-// x^2112 mod p(x), x^2048 mod p(x)
-DATA ·CastConst+4048(SB)/8, $0x00000000e9a5d8be
-DATA ·CastConst+4056(SB)/8, $0x0000000111cadee4
-
-// x^1088 mod p(x), x^1024 mod p(x)
-DATA ·CastConst+4064(SB)/8, $0x00000001609bc4b4
-DATA ·CastConst+4072(SB)/8, $0x0000000171fb63ce
-
-// x^2048 mod p(x), x^2016 mod p(x), x^1984 mod p(x), x^1952 mod p(x)
-DATA ·CastConst+4080(SB)/8, $0x5cf015c388e56f72
-DATA ·CastConst+4088(SB)/8, $0x7fec2963e5bf8048
-
-// x^1920 mod p(x), x^1888 mod p(x), x^1856 mod p(x), x^1824 mod p(x)
-DATA ·CastConst+4096(SB)/8, $0x963a18920246e2e6
-DATA ·CastConst+4104(SB)/8, $0x38e888d4844752a9
-
-// x^1792 mod p(x), x^1760 mod p(x), x^1728 mod p(x), x^1696 mod p(x)
-DATA ·CastConst+4112(SB)/8, $0x419a441956993a31
-DATA ·CastConst+4120(SB)/8, $0x42316c00730206ad
-
-// x^1664 mod p(x), x^1632 mod p(x), x^1600 mod p(x), x^1568 mod p(x)
-DATA ·CastConst+4128(SB)/8, $0x924752ba2b830011
-DATA ·CastConst+4136(SB)/8, $0x543d5c543e65ddf9
-
-// x^1536 mod p(x), x^1504 mod p(x), x^1472 mod p(x), x^1440 mod p(x)
-DATA ·CastConst+4144(SB)/8, $0x55bd7f9518e4a304
-DATA ·CastConst+4152(SB)/8, $0x78e87aaf56767c92
-
-// x^1408 mod p(x), x^1376 mod p(x), x^1344 mod p(x), x^1312 mod p(x)
-DATA ·CastConst+4160(SB)/8, $0x6d76739fe0553f1e
-DATA ·CastConst+4168(SB)/8, $0x8f68fcec1903da7f
-
-// x^1280 mod p(x), x^1248 mod p(x), x^1216 mod p(x), x^1184 mod p(x)
-DATA ·CastConst+4176(SB)/8, $0xc133722b1fe0b5c3
-DATA ·CastConst+4184(SB)/8, $0x3f4840246791d588
-
-// x^1152 mod p(x), x^1120 mod p(x), x^1088 mod p(x), x^1056 mod p(x)
-DATA ·CastConst+4192(SB)/8, $0x64b67ee0e55ef1f3
-DATA ·CastConst+4200(SB)/8, $0x34c96751b04de25a
-
-// x^1024 mod p(x), x^992 mod p(x), x^960 mod p(x), x^928 mod p(x)
-DATA ·CastConst+4208(SB)/8, $0x069db049b8fdb1e7
-DATA ·CastConst+4216(SB)/8, $0x156c8e180b4a395b
-
-// x^896 mod p(x), x^864 mod p(x), x^832 mod p(x), x^800 mod p(x)
-DATA ·CastConst+4224(SB)/8, $0xa11bfaf3c9e90b9e
-DATA ·CastConst+4232(SB)/8, $0xe0b99ccbe661f7be
-
-// x^768 mod p(x), x^736 mod p(x), x^704 mod p(x), x^672 mod p(x)
-DATA ·CastConst+4240(SB)/8, $0x817cdc5119b29a35
-DATA ·CastConst+4248(SB)/8, $0x041d37768cd75659
-
-// x^640 mod p(x), x^608 mod p(x), x^576 mod p(x), x^544 mod p(x)
-DATA ·CastConst+4256(SB)/8, $0x1ce9d94b36c41f1c
-DATA ·CastConst+4264(SB)/8, $0x3a0777818cfaa965
-
-// x^512 mod p(x), x^480 mod p(x), x^448 mod p(x), x^416 mod p(x)
-DATA ·CastConst+4272(SB)/8, $0x4f256efcb82be955
-DATA ·CastConst+4280(SB)/8, $0x0e148e8252377a55
-
-// x^384 mod p(x), x^352 mod p(x), x^320 mod p(x), x^288 mod p(x)
-DATA ·CastConst+4288(SB)/8, $0xec1631edb2dea967
-DATA ·CastConst+4296(SB)/8, $0x9c25531d19e65dde
-
-// x^256 mod p(x), x^224 mod p(x), x^192 mod p(x), x^160 mod p(x)
-DATA ·CastConst+4304(SB)/8, $0x5d27e147510ac59a
-DATA ·CastConst+4312(SB)/8, $0x790606ff9957c0a6
-
-// x^128 mod p(x), x^96 mod p(x), x^64 mod p(x), x^32 mod p(x)
-DATA ·CastConst+4320(SB)/8, $0xa66805eb18b8ea18
-DATA ·CastConst+4328(SB)/8, $0x82f63b786ea2d55c
-
-GLOBL ·CastConst(SB), RODATA, $4336
-
-// Barrett constant m - (4^32)/n
-DATA ·CastBarConst(SB)/8, $0x00000000dea713f1
-DATA ·CastBarConst+8(SB)/8, $0x0000000000000000
-DATA ·CastBarConst+16(SB)/8, $0x0000000105ec76f1
-DATA ·CastBarConst+24(SB)/8, $0x0000000000000000
-GLOBL ·CastBarConst(SB), RODATA, $32
-
-// Reduce 262144 kbits to 1024 bits
-// x^261184 mod p(x), x^261120 mod p(x)
-DATA ·KoopConst+0(SB)/8, $0x00000000d72535b2
-DATA ·KoopConst+8(SB)/8, $0x000000007fd74916
-
-// x^260160 mod p(x), x^260096 mod p(x)
-DATA ·KoopConst+16(SB)/8, $0x0000000118a2a1b4
-DATA ·KoopConst+24(SB)/8, $0x000000010e944b56
-
-// x^259136 mod p(x), x^259072 mod p(x)
-DATA ·KoopConst+32(SB)/8, $0x0000000147b5c49c
-DATA ·KoopConst+40(SB)/8, $0x00000000bfe71c20
-
-// x^258112 mod p(x), x^258048 mod p(x)
-DATA ·KoopConst+48(SB)/8, $0x00000001ca76a040
-DATA ·KoopConst+56(SB)/8, $0x0000000021324d9a
-
-// x^257088 mod p(x), x^257024 mod p(x)
-DATA ·KoopConst+64(SB)/8, $0x00000001e3152efc
-DATA ·KoopConst+72(SB)/8, $0x00000000d20972ce
-
-// x^256064 mod p(x), x^256000 mod p(x)
-DATA ·KoopConst+80(SB)/8, $0x00000001b0349792
-DATA ·KoopConst+88(SB)/8, $0x000000003475ea06
-
-// x^255040 mod p(x), x^254976 mod p(x)
-DATA ·KoopConst+96(SB)/8, $0x0000000120a60fe0
-DATA ·KoopConst+104(SB)/8, $0x00000001e40e36c4
-
-// x^254016 mod p(x), x^253952 mod p(x)
-DATA ·KoopConst+112(SB)/8, $0x00000000b3c4b082
-DATA ·KoopConst+120(SB)/8, $0x00000000b2490102
-
-// x^252992 mod p(x), x^252928 mod p(x)
-DATA ·KoopConst+128(SB)/8, $0x000000017fe9f3d2
-DATA ·KoopConst+136(SB)/8, $0x000000016b9e1332
-
-// x^251968 mod p(x), x^251904 mod p(x)
-DATA ·KoopConst+144(SB)/8, $0x0000000145703cbe
-DATA ·KoopConst+152(SB)/8, $0x00000001d6c378f4
-
-// x^250944 mod p(x), x^250880 mod p(x)
-DATA ·KoopConst+160(SB)/8, $0x0000000107551c9c
-DATA ·KoopConst+168(SB)/8, $0x0000000085796eac
-
-// x^249920 mod p(x), x^249856 mod p(x)
-DATA ·KoopConst+176(SB)/8, $0x000000003865a702
-DATA ·KoopConst+184(SB)/8, $0x000000019d2f3aaa
-
-// x^248896 mod p(x), x^248832 mod p(x)
-DATA ·KoopConst+192(SB)/8, $0x000000005504f9b8
-DATA ·KoopConst+200(SB)/8, $0x00000001554ddbd4
-
-// x^247872 mod p(x), x^247808 mod p(x)
-DATA ·KoopConst+208(SB)/8, $0x00000000239bcdd4
-DATA ·KoopConst+216(SB)/8, $0x00000000a76376b0
-
-// x^246848 mod p(x), x^246784 mod p(x)
-DATA ·KoopConst+224(SB)/8, $0x00000000caead774
-DATA ·KoopConst+232(SB)/8, $0x0000000139b7283c
-
-// x^245824 mod p(x), x^245760 mod p(x)
-DATA ·KoopConst+240(SB)/8, $0x0000000022a3fa16
-DATA ·KoopConst+248(SB)/8, $0x0000000111087030
-
-// x^244800 mod p(x), x^244736 mod p(x)
-DATA ·KoopConst+256(SB)/8, $0x000000011f89160e
-DATA ·KoopConst+264(SB)/8, $0x00000000ad786dc2
-
-// x^243776 mod p(x), x^243712 mod p(x)
-DATA ·KoopConst+272(SB)/8, $0x00000001a976c248
-DATA ·KoopConst+280(SB)/8, $0x00000000b7a1d068
-
-// x^242752 mod p(x), x^242688 mod p(x)
-DATA ·KoopConst+288(SB)/8, $0x00000000c20d09c8
-DATA ·KoopConst+296(SB)/8, $0x000000009c5c591c
-
-// x^241728 mod p(x), x^241664 mod p(x)
-DATA ·KoopConst+304(SB)/8, $0x000000016264fe38
-DATA ·KoopConst+312(SB)/8, $0x000000016482aa1a
-
-// x^240704 mod p(x), x^240640 mod p(x)
-DATA ·KoopConst+320(SB)/8, $0x00000001b57aee6a
-DATA ·KoopConst+328(SB)/8, $0x000000009a409ba8
-
-// x^239680 mod p(x), x^239616 mod p(x)
-DATA ·KoopConst+336(SB)/8, $0x00000000e8f1be0a
-DATA ·KoopConst+344(SB)/8, $0x00000001ad8eaed8
-
-// x^238656 mod p(x), x^238592 mod p(x)
-DATA ·KoopConst+352(SB)/8, $0x0000000053fcd0fc
-DATA ·KoopConst+360(SB)/8, $0x000000017558b57a
-
-// x^237632 mod p(x), x^237568 mod p(x)
-DATA ·KoopConst+368(SB)/8, $0x000000012df9d496
-DATA ·KoopConst+376(SB)/8, $0x00000000cbb749c8
-
-// x^236608 mod p(x), x^236544 mod p(x)
-DATA ·KoopConst+384(SB)/8, $0x000000004cb0db26
-DATA ·KoopConst+392(SB)/8, $0x000000008524fc5a
-
-// x^235584 mod p(x), x^235520 mod p(x)
-DATA ·KoopConst+400(SB)/8, $0x00000001150c4584
-DATA ·KoopConst+408(SB)/8, $0x0000000028ce6b76
-
-// x^234560 mod p(x), x^234496 mod p(x)
-DATA ·KoopConst+416(SB)/8, $0x0000000104f52056
-DATA ·KoopConst+424(SB)/8, $0x00000000e0c48bdc
-
-// x^233536 mod p(x), x^233472 mod p(x)
-DATA ·KoopConst+432(SB)/8, $0x000000008ea11ac8
-DATA ·KoopConst+440(SB)/8, $0x000000003dd3bf9a
-
-// x^232512 mod p(x), x^232448 mod p(x)
-DATA ·KoopConst+448(SB)/8, $0x00000001cc0a3942
-DATA ·KoopConst+456(SB)/8, $0x00000000cb71066c
-
-// x^231488 mod p(x), x^231424 mod p(x)
-DATA ·KoopConst+464(SB)/8, $0x00000000d26231e6
-DATA ·KoopConst+472(SB)/8, $0x00000001d4ee1540
-
-// x^230464 mod p(x), x^230400 mod p(x)
-DATA ·KoopConst+480(SB)/8, $0x00000000c70d5730
-DATA ·KoopConst+488(SB)/8, $0x00000001d82bed0a
-
-// x^229440 mod p(x), x^229376 mod p(x)
-DATA ·KoopConst+496(SB)/8, $0x00000000e215dfc4
-DATA ·KoopConst+504(SB)/8, $0x000000016e0c7d86
-
-// x^228416 mod p(x), x^228352 mod p(x)
-DATA ·KoopConst+512(SB)/8, $0x000000013870d0dc
-DATA ·KoopConst+520(SB)/8, $0x00000001437051b0
-
-// x^227392 mod p(x), x^227328 mod p(x)
-DATA ·KoopConst+528(SB)/8, $0x0000000153e4cf3c
-DATA ·KoopConst+536(SB)/8, $0x00000000f9a8d4be
-
-// x^226368 mod p(x), x^226304 mod p(x)
-DATA ·KoopConst+544(SB)/8, $0x0000000125f6fdf0
-DATA ·KoopConst+552(SB)/8, $0x000000016b09be1c
-
-// x^225344 mod p(x), x^225280 mod p(x)
-DATA ·KoopConst+560(SB)/8, $0x0000000157ba3a82
-DATA ·KoopConst+568(SB)/8, $0x0000000105f50ed6
-
-// x^224320 mod p(x), x^224256 mod p(x)
-DATA ·KoopConst+576(SB)/8, $0x00000001cf711064
-DATA ·KoopConst+584(SB)/8, $0x00000001ca7fe3cc
-
-// x^223296 mod p(x), x^223232 mod p(x)
-DATA ·KoopConst+592(SB)/8, $0x00000001006353d2
-DATA ·KoopConst+600(SB)/8, $0x0000000192372e78
-
-// x^222272 mod p(x), x^222208 mod p(x)
-DATA ·KoopConst+608(SB)/8, $0x000000010cd9faec
-DATA ·KoopConst+616(SB)/8, $0x000000008a47af7e
-
-// x^221248 mod p(x), x^221184 mod p(x)
-DATA ·KoopConst+624(SB)/8, $0x000000012148b190
-DATA ·KoopConst+632(SB)/8, $0x00000000a67473e8
-
-// x^220224 mod p(x), x^220160 mod p(x)
-DATA ·KoopConst+640(SB)/8, $0x00000000776473d6
-DATA ·KoopConst+648(SB)/8, $0x000000013689f2fa
-
-// x^219200 mod p(x), x^219136 mod p(x)
-DATA ·KoopConst+656(SB)/8, $0x00000001ce765bd6
-DATA ·KoopConst+664(SB)/8, $0x00000000e7231774
-
-// x^218176 mod p(x), x^218112 mod p(x)
-DATA ·KoopConst+672(SB)/8, $0x00000000b29165e8
-DATA ·KoopConst+680(SB)/8, $0x0000000011b5ae68
-
-// x^217152 mod p(x), x^217088 mod p(x)
-DATA ·KoopConst+688(SB)/8, $0x0000000084ff5a68
-DATA ·KoopConst+696(SB)/8, $0x000000004fd5c188
-
-// x^216128 mod p(x), x^216064 mod p(x)
-DATA ·KoopConst+704(SB)/8, $0x00000001921e9076
-DATA ·KoopConst+712(SB)/8, $0x000000012148fa22
-
-// x^215104 mod p(x), x^215040 mod p(x)
-DATA ·KoopConst+720(SB)/8, $0x000000009a753a3c
-DATA ·KoopConst+728(SB)/8, $0x000000010cff4f3e
-
-// x^214080 mod p(x), x^214016 mod p(x)
-DATA ·KoopConst+736(SB)/8, $0x000000000251401e
-DATA ·KoopConst+744(SB)/8, $0x00000001f9d991d4
-
-// x^213056 mod p(x), x^212992 mod p(x)
-DATA ·KoopConst+752(SB)/8, $0x00000001f65541fa
-DATA ·KoopConst+760(SB)/8, $0x00000001c31db214
-
-// x^212032 mod p(x), x^211968 mod p(x)
-DATA ·KoopConst+768(SB)/8, $0x00000001d8c8117a
-DATA ·KoopConst+776(SB)/8, $0x00000001849fba4a
-
-// x^211008 mod p(x), x^210944 mod p(x)
-DATA ·KoopConst+784(SB)/8, $0x000000014f7a2200
-DATA ·KoopConst+792(SB)/8, $0x00000001cb603184
-
-// x^209984 mod p(x), x^209920 mod p(x)
-DATA ·KoopConst+800(SB)/8, $0x000000005154a9f4
-DATA ·KoopConst+808(SB)/8, $0x0000000132db7116
-
-// x^208960 mod p(x), x^208896 mod p(x)
-DATA ·KoopConst+816(SB)/8, $0x00000001dfc69196
-DATA ·KoopConst+824(SB)/8, $0x0000000010694e22
-
-// x^207936 mod p(x), x^207872 mod p(x)
-DATA ·KoopConst+832(SB)/8, $0x00000001c29f1aa0
-DATA ·KoopConst+840(SB)/8, $0x0000000103b7b478
-
-// x^206912 mod p(x), x^206848 mod p(x)
-DATA ·KoopConst+848(SB)/8, $0x000000013785f232
-DATA ·KoopConst+856(SB)/8, $0x000000000ab44030
-
-// x^205888 mod p(x), x^205824 mod p(x)
-DATA ·KoopConst+864(SB)/8, $0x000000010133536e
-DATA ·KoopConst+872(SB)/8, $0x0000000131385b68
-
-// x^204864 mod p(x), x^204800 mod p(x)
-DATA ·KoopConst+880(SB)/8, $0x00000001d45421dc
-DATA ·KoopConst+888(SB)/8, $0x00000001761dab66
-
-// x^203840 mod p(x), x^203776 mod p(x)
-DATA ·KoopConst+896(SB)/8, $0x000000000b59cc28
-DATA ·KoopConst+904(SB)/8, $0x000000012cf0a2a6
-
-// x^202816 mod p(x), x^202752 mod p(x)
-DATA ·KoopConst+912(SB)/8, $0x00000001f2f74aba
-DATA ·KoopConst+920(SB)/8, $0x00000001f4ce25a2
-
-// x^201792 mod p(x), x^201728 mod p(x)
-DATA ·KoopConst+928(SB)/8, $0x00000000fb308e7e
-DATA ·KoopConst+936(SB)/8, $0x000000014c2aae20
-
-// x^200768 mod p(x), x^200704 mod p(x)
-DATA ·KoopConst+944(SB)/8, $0x0000000167583fa6
-DATA ·KoopConst+952(SB)/8, $0x00000001c162a55a
-
-// x^199744 mod p(x), x^199680 mod p(x)
-DATA ·KoopConst+960(SB)/8, $0x000000017ebb13e0
-DATA ·KoopConst+968(SB)/8, $0x0000000185681a40
-
-// x^198720 mod p(x), x^198656 mod p(x)
-DATA ·KoopConst+976(SB)/8, $0x00000001ca653306
-DATA ·KoopConst+984(SB)/8, $0x00000001f2642b48
-
-// x^197696 mod p(x), x^197632 mod p(x)
-DATA ·KoopConst+992(SB)/8, $0x0000000093bb6946
-DATA ·KoopConst+1000(SB)/8, $0x00000001d9cb5a78
-
-// x^196672 mod p(x), x^196608 mod p(x)
-DATA ·KoopConst+1008(SB)/8, $0x00000000cbc1553e
-DATA ·KoopConst+1016(SB)/8, $0x000000008059328c
-
-// x^195648 mod p(x), x^195584 mod p(x)
-DATA ·KoopConst+1024(SB)/8, $0x00000001f9a86fec
-DATA ·KoopConst+1032(SB)/8, $0x000000009373c360
-
-// x^194624 mod p(x), x^194560 mod p(x)
-DATA ·KoopConst+1040(SB)/8, $0x0000000005c52d8a
-DATA ·KoopConst+1048(SB)/8, $0x00000001a14061d6
-
-// x^193600 mod p(x), x^193536 mod p(x)
-DATA ·KoopConst+1056(SB)/8, $0x000000010d8dc668
-DATA ·KoopConst+1064(SB)/8, $0x00000000a9864d48
-
-// x^192576 mod p(x), x^192512 mod p(x)
-DATA ·KoopConst+1072(SB)/8, $0x0000000158571310
-DATA ·KoopConst+1080(SB)/8, $0x000000011df8c040
-
-// x^191552 mod p(x), x^191488 mod p(x)
-DATA ·KoopConst+1088(SB)/8, $0x0000000166102348
-DATA ·KoopConst+1096(SB)/8, $0x0000000023a3e6b6
-
-// x^190528 mod p(x), x^190464 mod p(x)
-DATA ·KoopConst+1104(SB)/8, $0x0000000009513050
-DATA ·KoopConst+1112(SB)/8, $0x00000001207db28a
-
-// x^189504 mod p(x), x^189440 mod p(x)
-DATA ·KoopConst+1120(SB)/8, $0x00000000b0725c74
-DATA ·KoopConst+1128(SB)/8, $0x00000000f94bc632
-
-// x^188480 mod p(x), x^188416 mod p(x)
-DATA ·KoopConst+1136(SB)/8, $0x000000002985c7e2
-DATA ·KoopConst+1144(SB)/8, $0x00000000ea32cbf6
-
-// x^187456 mod p(x), x^187392 mod p(x)
-DATA ·KoopConst+1152(SB)/8, $0x00000000a7d4da9e
-DATA ·KoopConst+1160(SB)/8, $0x0000000004eb981a
-
-// x^186432 mod p(x), x^186368 mod p(x)
-DATA ·KoopConst+1168(SB)/8, $0x000000000a3f8792
-DATA ·KoopConst+1176(SB)/8, $0x00000000ca8ce712
-
-// x^185408 mod p(x), x^185344 mod p(x)
-DATA ·KoopConst+1184(SB)/8, $0x00000001ca2c1ce4
-DATA ·KoopConst+1192(SB)/8, $0x0000000065ba801c
-
-// x^184384 mod p(x), x^184320 mod p(x)
-DATA ·KoopConst+1200(SB)/8, $0x00000000e2900196
-DATA ·KoopConst+1208(SB)/8, $0x0000000194aade7a
-
-// x^183360 mod p(x), x^183296 mod p(x)
-DATA ·KoopConst+1216(SB)/8, $0x00000001fbadf0e4
-DATA ·KoopConst+1224(SB)/8, $0x00000001e7939fb2
-
-// x^182336 mod p(x), x^182272 mod p(x)
-DATA ·KoopConst+1232(SB)/8, $0x00000000d5d96c40
-DATA ·KoopConst+1240(SB)/8, $0x0000000098e5fe22
-
-// x^181312 mod p(x), x^181248 mod p(x)
-DATA ·KoopConst+1248(SB)/8, $0x000000015c11d3f2
-DATA ·KoopConst+1256(SB)/8, $0x000000016bba0324
-
-// x^180288 mod p(x), x^180224 mod p(x)
-DATA ·KoopConst+1264(SB)/8, $0x0000000111fb2648
-DATA ·KoopConst+1272(SB)/8, $0x0000000104dce052
-
-// x^179264 mod p(x), x^179200 mod p(x)
-DATA ·KoopConst+1280(SB)/8, $0x00000001d9f3a564
-DATA ·KoopConst+1288(SB)/8, $0x00000001af31a42e
-
-// x^178240 mod p(x), x^178176 mod p(x)
-DATA ·KoopConst+1296(SB)/8, $0x00000001b556cd1e
-DATA ·KoopConst+1304(SB)/8, $0x00000001c56c57ba
-
-// x^177216 mod p(x), x^177152 mod p(x)
-DATA ·KoopConst+1312(SB)/8, $0x0000000101994d2c
-DATA ·KoopConst+1320(SB)/8, $0x00000000f6bb1a2e
-
-// x^176192 mod p(x), x^176128 mod p(x)
-DATA ·KoopConst+1328(SB)/8, $0x00000001e8dbf09c
-DATA ·KoopConst+1336(SB)/8, $0x00000001abdbf2b2
-
-// x^175168 mod p(x), x^175104 mod p(x)
-DATA ·KoopConst+1344(SB)/8, $0x000000015580543a
-DATA ·KoopConst+1352(SB)/8, $0x00000001a665a880
-
-// x^174144 mod p(x), x^174080 mod p(x)
-DATA ·KoopConst+1360(SB)/8, $0x00000000c7074f24
-DATA ·KoopConst+1368(SB)/8, $0x00000000c102c700
-
-// x^173120 mod p(x), x^173056 mod p(x)
-DATA ·KoopConst+1376(SB)/8, $0x00000000fa4112b0
-DATA ·KoopConst+1384(SB)/8, $0x00000000ee362a50
-
-// x^172096 mod p(x), x^172032 mod p(x)
-DATA ·KoopConst+1392(SB)/8, $0x00000000e786c13e
-DATA ·KoopConst+1400(SB)/8, $0x0000000045f29038
-
-// x^171072 mod p(x), x^171008 mod p(x)
-DATA ·KoopConst+1408(SB)/8, $0x00000001e45e3694
-DATA ·KoopConst+1416(SB)/8, $0x0000000117b9ab5c
-
-// x^170048 mod p(x), x^169984 mod p(x)
-DATA ·KoopConst+1424(SB)/8, $0x000000005423dd8c
-DATA ·KoopConst+1432(SB)/8, $0x00000001115dff5e
-
-// x^169024 mod p(x), x^168960 mod p(x)
-DATA ·KoopConst+1440(SB)/8, $0x00000001a1e67766
-DATA ·KoopConst+1448(SB)/8, $0x0000000117fad29c
-
-// x^168000 mod p(x), x^167936 mod p(x)
-DATA ·KoopConst+1456(SB)/8, $0x0000000041a3f508
-DATA ·KoopConst+1464(SB)/8, $0x000000017de134e6
-
-// x^166976 mod p(x), x^166912 mod p(x)
-DATA ·KoopConst+1472(SB)/8, $0x000000003e792f7e
-DATA ·KoopConst+1480(SB)/8, $0x00000000a2f5d19c
-
-// x^165952 mod p(x), x^165888 mod p(x)
-DATA ·KoopConst+1488(SB)/8, $0x00000000c8948aaa
-DATA ·KoopConst+1496(SB)/8, $0x00000000dee13658
-
-// x^164928 mod p(x), x^164864 mod p(x)
-DATA ·KoopConst+1504(SB)/8, $0x000000005d4ccb36
-DATA ·KoopConst+1512(SB)/8, $0x000000015355440c
-
-// x^163904 mod p(x), x^163840 mod p(x)
-DATA ·KoopConst+1520(SB)/8, $0x00000000e92a78a2
-DATA ·KoopConst+1528(SB)/8, $0x0000000197a21778
-
-// x^162880 mod p(x), x^162816 mod p(x)
-DATA ·KoopConst+1536(SB)/8, $0x000000016ba67caa
-DATA ·KoopConst+1544(SB)/8, $0x00000001a3835ec0
-
-// x^161856 mod p(x), x^161792 mod p(x)
-DATA ·KoopConst+1552(SB)/8, $0x000000004838afc6
-DATA ·KoopConst+1560(SB)/8, $0x0000000011f20912
-
-// x^160832 mod p(x), x^160768 mod p(x)
-DATA ·KoopConst+1568(SB)/8, $0x000000016644e308
-DATA ·KoopConst+1576(SB)/8, $0x00000001cce9d6cc
-
-// x^159808 mod p(x), x^159744 mod p(x)
-DATA ·KoopConst+1584(SB)/8, $0x0000000037c22f42
-DATA ·KoopConst+1592(SB)/8, $0x0000000084d1e71c
-
-// x^158784 mod p(x), x^158720 mod p(x)
-DATA ·KoopConst+1600(SB)/8, $0x00000001dedba6ca
-DATA ·KoopConst+1608(SB)/8, $0x0000000197c2ad54
-
-// x^157760 mod p(x), x^157696 mod p(x)
-DATA ·KoopConst+1616(SB)/8, $0x0000000146a43500
-DATA ·KoopConst+1624(SB)/8, $0x000000018609261e
-
-// x^156736 mod p(x), x^156672 mod p(x)
-DATA ·KoopConst+1632(SB)/8, $0x000000001cf762de
-DATA ·KoopConst+1640(SB)/8, $0x00000000b4b4c224
-
-// x^155712 mod p(x), x^155648 mod p(x)
-DATA ·KoopConst+1648(SB)/8, $0x0000000022ff7eda
-DATA ·KoopConst+1656(SB)/8, $0x0000000080817496
-
-// x^154688 mod p(x), x^154624 mod p(x)
-DATA ·KoopConst+1664(SB)/8, $0x00000001b6df625e
-DATA ·KoopConst+1672(SB)/8, $0x00000001aefb473c
-
-// x^153664 mod p(x), x^153600 mod p(x)
-DATA ·KoopConst+1680(SB)/8, $0x00000001cc99ab58
-DATA ·KoopConst+1688(SB)/8, $0x000000013f1aa474
-
-// x^152640 mod p(x), x^152576 mod p(x)
-DATA ·KoopConst+1696(SB)/8, $0x00000001c53f5ce2
-DATA ·KoopConst+1704(SB)/8, $0x000000010ca2c756
-
-// x^151616 mod p(x), x^151552 mod p(x)
-DATA ·KoopConst+1712(SB)/8, $0x0000000082a9c60e
-DATA ·KoopConst+1720(SB)/8, $0x000000002c63533a
-
-// x^150592 mod p(x), x^150528 mod p(x)
-DATA ·KoopConst+1728(SB)/8, $0x00000000ec78b570
-DATA ·KoopConst+1736(SB)/8, $0x00000001b7f2ad50
-
-// x^149568 mod p(x), x^149504 mod p(x)
-DATA ·KoopConst+1744(SB)/8, $0x00000001d3fe1e8e
-DATA ·KoopConst+1752(SB)/8, $0x00000000acdf4c20
-
-// x^148544 mod p(x), x^148480 mod p(x)
-DATA ·KoopConst+1760(SB)/8, $0x000000007f9a7bde
-DATA ·KoopConst+1768(SB)/8, $0x000000000bd29e8c
-
-// x^147520 mod p(x), x^147456 mod p(x)
-DATA ·KoopConst+1776(SB)/8, $0x00000000e606f518
-DATA ·KoopConst+1784(SB)/8, $0x00000001eef6992e
-
-// x^146496 mod p(x), x^146432 mod p(x)
-DATA ·KoopConst+1792(SB)/8, $0x000000008538cb96
-DATA ·KoopConst+1800(SB)/8, $0x00000000b01644e6
-
-// x^145472 mod p(x), x^145408 mod p(x)
-DATA ·KoopConst+1808(SB)/8, $0x0000000131d030b2
-DATA ·KoopConst+1816(SB)/8, $0x0000000059c51acc
-
-// x^144448 mod p(x), x^144384 mod p(x)
-DATA ·KoopConst+1824(SB)/8, $0x00000000115a4d0e
-DATA ·KoopConst+1832(SB)/8, $0x00000001a2849272
-
-// x^143424 mod p(x), x^143360 mod p(x)
-DATA ·KoopConst+1840(SB)/8, $0x00000000e8a5356e
-DATA ·KoopConst+1848(SB)/8, $0x00000001a4e0b610
-
-// x^142400 mod p(x), x^142336 mod p(x)
-DATA ·KoopConst+1856(SB)/8, $0x0000000158d988be
-DATA ·KoopConst+1864(SB)/8, $0x00000000084e81a6
-
-// x^141376 mod p(x), x^141312 mod p(x)
-DATA ·KoopConst+1872(SB)/8, $0x00000001240db498
-DATA ·KoopConst+1880(SB)/8, $0x00000001b71f1fd8
-
-// x^140352 mod p(x), x^140288 mod p(x)
-DATA ·KoopConst+1888(SB)/8, $0x000000009ce87826
-DATA ·KoopConst+1896(SB)/8, $0x000000017f7df380
-
-// x^139328 mod p(x), x^139264 mod p(x)
-DATA ·KoopConst+1904(SB)/8, $0x0000000021944aae
-DATA ·KoopConst+1912(SB)/8, $0x00000001f7f4e190
-
-// x^138304 mod p(x), x^138240 mod p(x)
-DATA ·KoopConst+1920(SB)/8, $0x00000001cea3d67e
-DATA ·KoopConst+1928(SB)/8, $0x0000000150220d86
-
-// x^137280 mod p(x), x^137216 mod p(x)
-DATA ·KoopConst+1936(SB)/8, $0x000000004434e926
-DATA ·KoopConst+1944(SB)/8, $0x00000001db7d2b2e
-
-// x^136256 mod p(x), x^136192 mod p(x)
-DATA ·KoopConst+1952(SB)/8, $0x0000000011db8cbe
-DATA ·KoopConst+1960(SB)/8, $0x00000000b6ba9668
-
-// x^135232 mod p(x), x^135168 mod p(x)
-DATA ·KoopConst+1968(SB)/8, $0x00000001f6e0b8dc
-DATA ·KoopConst+1976(SB)/8, $0x0000000103fdcecc
-
-// x^134208 mod p(x), x^134144 mod p(x)
-DATA ·KoopConst+1984(SB)/8, $0x00000001f163f4a0
-DATA ·KoopConst+1992(SB)/8, $0x0000000079816a22
-
-// x^133184 mod p(x), x^133120 mod p(x)
-DATA ·KoopConst+2000(SB)/8, $0x000000007b6cc60e
-DATA ·KoopConst+2008(SB)/8, $0x0000000173483482
-
-// x^132160 mod p(x), x^132096 mod p(x)
-DATA ·KoopConst+2016(SB)/8, $0x000000000f26c82c
-DATA ·KoopConst+2024(SB)/8, $0x00000000643ea4c0
-
-// x^131136 mod p(x), x^131072 mod p(x)
-DATA ·KoopConst+2032(SB)/8, $0x00000000b0acad80
-DATA ·KoopConst+2040(SB)/8, $0x00000000a64752d2
-
-// x^130112 mod p(x), x^130048 mod p(x)
-DATA ·KoopConst+2048(SB)/8, $0x000000013687e91c
-DATA ·KoopConst+2056(SB)/8, $0x00000000ca98eb3a
-
-// x^129088 mod p(x), x^129024 mod p(x)
-DATA ·KoopConst+2064(SB)/8, $0x000000006bac3a96
-DATA ·KoopConst+2072(SB)/8, $0x00000001ca6ac8f8
-
-// x^128064 mod p(x), x^128000 mod p(x)
-DATA ·KoopConst+2080(SB)/8, $0x00000001bf197d5c
-DATA ·KoopConst+2088(SB)/8, $0x00000001c48e2e68
-
-// x^127040 mod p(x), x^126976 mod p(x)
-DATA ·KoopConst+2096(SB)/8, $0x00000000256e84f2
-DATA ·KoopConst+2104(SB)/8, $0x0000000070086782
-
-// x^126016 mod p(x), x^125952 mod p(x)
-DATA ·KoopConst+2112(SB)/8, $0x000000003eff0d16
-DATA ·KoopConst+2120(SB)/8, $0x00000000f763621c
-
-// x^124992 mod p(x), x^124928 mod p(x)
-DATA ·KoopConst+2128(SB)/8, $0x00000001748e9fd2
-DATA ·KoopConst+2136(SB)/8, $0x00000000ba58646a
-
-// x^123968 mod p(x), x^123904 mod p(x)
-DATA ·KoopConst+2144(SB)/8, $0x000000015bb85b42
-DATA ·KoopConst+2152(SB)/8, $0x0000000138e157d8
-
-// x^122944 mod p(x), x^122880 mod p(x)
-DATA ·KoopConst+2160(SB)/8, $0x0000000164d1a980
-DATA ·KoopConst+2168(SB)/8, $0x00000001bf0a09dc
-
-// x^121920 mod p(x), x^121856 mod p(x)
-DATA ·KoopConst+2176(SB)/8, $0x000000001415c9f0
-DATA ·KoopConst+2184(SB)/8, $0x0000000098faf300
-
-// x^120896 mod p(x), x^120832 mod p(x)
-DATA ·KoopConst+2192(SB)/8, $0x0000000195ae2f48
-DATA ·KoopConst+2200(SB)/8, $0x00000001f872f2c6
-
-// x^119872 mod p(x), x^119808 mod p(x)
-DATA ·KoopConst+2208(SB)/8, $0x0000000059d1d81a
-DATA ·KoopConst+2216(SB)/8, $0x00000000f92577be
-
-// x^118848 mod p(x), x^118784 mod p(x)
-DATA ·KoopConst+2224(SB)/8, $0x00000001bf80257a
-DATA ·KoopConst+2232(SB)/8, $0x00000001a4d975f4
-
-// x^117824 mod p(x), x^117760 mod p(x)
-DATA ·KoopConst+2240(SB)/8, $0x000000011e39bfce
-DATA ·KoopConst+2248(SB)/8, $0x000000018b74eeca
-
-// x^116800 mod p(x), x^116736 mod p(x)
-DATA ·KoopConst+2256(SB)/8, $0x00000001287a0456
-DATA ·KoopConst+2264(SB)/8, $0x00000000e8980404
-
-// x^115776 mod p(x), x^115712 mod p(x)
-DATA ·KoopConst+2272(SB)/8, $0x00000000a5eb589c
-DATA ·KoopConst+2280(SB)/8, $0x0000000176ef2b74
-
-// x^114752 mod p(x), x^114688 mod p(x)
-DATA ·KoopConst+2288(SB)/8, $0x000000017d71c452
-DATA ·KoopConst+2296(SB)/8, $0x0000000063c85caa
-
-// x^113728 mod p(x), x^113664 mod p(x)
-DATA ·KoopConst+2304(SB)/8, $0x00000000fa941f08
-DATA ·KoopConst+2312(SB)/8, $0x00000001708012cc
-
-// x^112704 mod p(x), x^112640 mod p(x)
-DATA ·KoopConst+2320(SB)/8, $0x0000000064ea030e
-DATA ·KoopConst+2328(SB)/8, $0x00000000474d58f6
-
-// x^111680 mod p(x), x^111616 mod p(x)
-DATA ·KoopConst+2336(SB)/8, $0x000000019b7cc7ba
-DATA ·KoopConst+2344(SB)/8, $0x00000001c76085a6
-
-// x^110656 mod p(x), x^110592 mod p(x)
-DATA ·KoopConst+2352(SB)/8, $0x00000000225cb7ba
-DATA ·KoopConst+2360(SB)/8, $0x000000018fb0681a
-
-// x^109632 mod p(x), x^109568 mod p(x)
-DATA ·KoopConst+2368(SB)/8, $0x000000010ab3e1da
-DATA ·KoopConst+2376(SB)/8, $0x00000001fcee1f16
-
-// x^108608 mod p(x), x^108544 mod p(x)
-DATA ·KoopConst+2384(SB)/8, $0x00000001ce5cc33e
-DATA ·KoopConst+2392(SB)/8, $0x00000000cfbffb7c
-
-// x^107584 mod p(x), x^107520 mod p(x)
-DATA ·KoopConst+2400(SB)/8, $0x000000005e980f6e
-DATA ·KoopConst+2408(SB)/8, $0x000000017af8ee72
-
-// x^106560 mod p(x), x^106496 mod p(x)
-DATA ·KoopConst+2416(SB)/8, $0x00000000d3bf3f46
-DATA ·KoopConst+2424(SB)/8, $0x000000001c2ad3e2
-
-// x^105536 mod p(x), x^105472 mod p(x)
-DATA ·KoopConst+2432(SB)/8, $0x000000018d554ae0
-DATA ·KoopConst+2440(SB)/8, $0x00000000ee05450a
-
-// x^104512 mod p(x), x^104448 mod p(x)
-DATA ·KoopConst+2448(SB)/8, $0x000000018e276eb0
-DATA ·KoopConst+2456(SB)/8, $0x000000000f7d5bac
-
-// x^103488 mod p(x), x^103424 mod p(x)
-DATA ·KoopConst+2464(SB)/8, $0x000000001c0319ce
-DATA ·KoopConst+2472(SB)/8, $0x00000001cb26e004
-
-// x^102464 mod p(x), x^102400 mod p(x)
-DATA ·KoopConst+2480(SB)/8, $0x00000001ca0c75ec
-DATA ·KoopConst+2488(SB)/8, $0x00000001553314e2
-
-// x^101440 mod p(x), x^101376 mod p(x)
-DATA ·KoopConst+2496(SB)/8, $0x00000001fb075330
-DATA ·KoopConst+2504(SB)/8, $0x000000005729be2c
-
-// x^100416 mod p(x), x^100352 mod p(x)
-DATA ·KoopConst+2512(SB)/8, $0x00000000677920e4
-DATA ·KoopConst+2520(SB)/8, $0x0000000192c4479c
-
-// x^99392 mod p(x), x^99328 mod p(x)
-DATA ·KoopConst+2528(SB)/8, $0x00000000332247c8
-DATA ·KoopConst+2536(SB)/8, $0x0000000078d842b6
-
-// x^98368 mod p(x), x^98304 mod p(x)
-DATA ·KoopConst+2544(SB)/8, $0x00000000ef84fc6c
-DATA ·KoopConst+2552(SB)/8, $0x0000000145ffa282
-
-// x^97344 mod p(x), x^97280 mod p(x)
-DATA ·KoopConst+2560(SB)/8, $0x0000000139ba7690
-DATA ·KoopConst+2568(SB)/8, $0x000000019d679bf4
-
-// x^96320 mod p(x), x^96256 mod p(x)
-DATA ·KoopConst+2576(SB)/8, $0x00000000029ef444
-DATA ·KoopConst+2584(SB)/8, $0x000000019412f7a0
-
-// x^95296 mod p(x), x^95232 mod p(x)
-DATA ·KoopConst+2592(SB)/8, $0x00000001d872048c
-DATA ·KoopConst+2600(SB)/8, $0x00000000b28c5c96
-
-// x^94272 mod p(x), x^94208 mod p(x)
-DATA ·KoopConst+2608(SB)/8, $0x000000016535d70a
-DATA ·KoopConst+2616(SB)/8, $0x00000000554bfd44
-
-// x^93248 mod p(x), x^93184 mod p(x)
-DATA ·KoopConst+2624(SB)/8, $0x00000000761dd222
-DATA ·KoopConst+2632(SB)/8, $0x00000000ce9cfa48
-
-// x^92224 mod p(x), x^92160 mod p(x)
-DATA ·KoopConst+2640(SB)/8, $0x00000001509a3a44
-DATA ·KoopConst+2648(SB)/8, $0x00000000a4702ab2
-
-// x^91200 mod p(x), x^91136 mod p(x)
-DATA ·KoopConst+2656(SB)/8, $0x000000007e7019f2
-DATA ·KoopConst+2664(SB)/8, $0x00000001c967fbee
-
-// x^90176 mod p(x), x^90112 mod p(x)
-DATA ·KoopConst+2672(SB)/8, $0x00000000fb4c56ea
-DATA ·KoopConst+2680(SB)/8, $0x00000000fd514b3e
-
-// x^89152 mod p(x), x^89088 mod p(x)
-DATA ·KoopConst+2688(SB)/8, $0x000000012022e0ee
-DATA ·KoopConst+2696(SB)/8, $0x00000001c0b6f95e
-
-// x^88128 mod p(x), x^88064 mod p(x)
-DATA ·KoopConst+2704(SB)/8, $0x0000000004bc6054
-DATA ·KoopConst+2712(SB)/8, $0x0000000180e103ce
-
-// x^87104 mod p(x), x^87040 mod p(x)
-DATA ·KoopConst+2720(SB)/8, $0x000000017a1a0030
-DATA ·KoopConst+2728(SB)/8, $0x00000001a1630916
-
-// x^86080 mod p(x), x^86016 mod p(x)
-DATA ·KoopConst+2736(SB)/8, $0x00000001c021a864
-DATA ·KoopConst+2744(SB)/8, $0x000000009a727fb2
-
-// x^85056 mod p(x), x^84992 mod p(x)
-DATA ·KoopConst+2752(SB)/8, $0x000000009c54421e
-DATA ·KoopConst+2760(SB)/8, $0x00000000e83b081a
-
-// x^84032 mod p(x), x^83968 mod p(x)
-DATA ·KoopConst+2768(SB)/8, $0x00000001b4e33e6a
-DATA ·KoopConst+2776(SB)/8, $0x000000006b1a1f44
-
-// x^83008 mod p(x), x^82944 mod p(x)
-DATA ·KoopConst+2784(SB)/8, $0x000000015d615af0
-DATA ·KoopConst+2792(SB)/8, $0x00000000cf280394
-
-// x^81984 mod p(x), x^81920 mod p(x)
-DATA ·KoopConst+2800(SB)/8, $0x00000001914a3ba8
-DATA ·KoopConst+2808(SB)/8, $0x00000001154b8a9a
-
-// x^80960 mod p(x), x^80896 mod p(x)
-DATA ·KoopConst+2816(SB)/8, $0x000000005f72ec44
-DATA ·KoopConst+2824(SB)/8, $0x0000000149ec63e2
-
-// x^79936 mod p(x), x^79872 mod p(x)
-DATA ·KoopConst+2832(SB)/8, $0x00000000a33746a8
-DATA ·KoopConst+2840(SB)/8, $0x000000018ef902c4
-
-// x^78912 mod p(x), x^78848 mod p(x)
-DATA ·KoopConst+2848(SB)/8, $0x00000001c91e90d4
-DATA ·KoopConst+2856(SB)/8, $0x0000000069addb88
-
-// x^77888 mod p(x), x^77824 mod p(x)
-DATA ·KoopConst+2864(SB)/8, $0x00000001052eb05e
-DATA ·KoopConst+2872(SB)/8, $0x00000000e90a29ae
-
-// x^76864 mod p(x), x^76800 mod p(x)
-DATA ·KoopConst+2880(SB)/8, $0x000000006a32f754
-DATA ·KoopConst+2888(SB)/8, $0x00000000c53641ae
-
-// x^75840 mod p(x), x^75776 mod p(x)
-DATA ·KoopConst+2896(SB)/8, $0x00000001ecbd6436
-DATA ·KoopConst+2904(SB)/8, $0x00000000a17c3796
-
-// x^74816 mod p(x), x^74752 mod p(x)
-DATA ·KoopConst+2912(SB)/8, $0x000000000fd3f93a
-DATA ·KoopConst+2920(SB)/8, $0x000000015307a62c
-
-// x^73792 mod p(x), x^73728 mod p(x)
-DATA ·KoopConst+2928(SB)/8, $0x00000001686a4c24
-DATA ·KoopConst+2936(SB)/8, $0x000000002f94bbda
-
-// x^72768 mod p(x), x^72704 mod p(x)
-DATA ·KoopConst+2944(SB)/8, $0x00000001e40afca0
-DATA ·KoopConst+2952(SB)/8, $0x0000000072c8b5e6
-
-// x^71744 mod p(x), x^71680 mod p(x)
-DATA ·KoopConst+2960(SB)/8, $0x000000012779a2b8
-DATA ·KoopConst+2968(SB)/8, $0x00000000f09b7424
-
-// x^70720 mod p(x), x^70656 mod p(x)
-DATA ·KoopConst+2976(SB)/8, $0x00000000dcdaeb9e
-DATA ·KoopConst+2984(SB)/8, $0x00000001c57de3da
-
-// x^69696 mod p(x), x^69632 mod p(x)
-DATA ·KoopConst+2992(SB)/8, $0x00000001674f7a2a
-DATA ·KoopConst+3000(SB)/8, $0x000000013922b30e
-
-// x^68672 mod p(x), x^68608 mod p(x)
-DATA ·KoopConst+3008(SB)/8, $0x00000000dcb9e846
-DATA ·KoopConst+3016(SB)/8, $0x000000008759a6c2
-
-// x^67648 mod p(x), x^67584 mod p(x)
-DATA ·KoopConst+3024(SB)/8, $0x00000000ea9a6af6
-DATA ·KoopConst+3032(SB)/8, $0x00000000545ae424
-
-// x^66624 mod p(x), x^66560 mod p(x)
-DATA ·KoopConst+3040(SB)/8, $0x000000006d1f7a74
-DATA ·KoopConst+3048(SB)/8, $0x00000001e0cbafd2
-
-// x^65600 mod p(x), x^65536 mod p(x)
-DATA ·KoopConst+3056(SB)/8, $0x000000006add215e
-DATA ·KoopConst+3064(SB)/8, $0x0000000018360c04
-
-// x^64576 mod p(x), x^64512 mod p(x)
-DATA ·KoopConst+3072(SB)/8, $0x000000010a9ee4b0
-DATA ·KoopConst+3080(SB)/8, $0x00000000941dc432
-
-// x^63552 mod p(x), x^63488 mod p(x)
-DATA ·KoopConst+3088(SB)/8, $0x00000000304c48d2
-DATA ·KoopConst+3096(SB)/8, $0x0000000004d3566e
-
-// x^62528 mod p(x), x^62464 mod p(x)
-DATA ·KoopConst+3104(SB)/8, $0x0000000163d0e672
-DATA ·KoopConst+3112(SB)/8, $0x0000000096aed14e
-
-// x^61504 mod p(x), x^61440 mod p(x)
-DATA ·KoopConst+3120(SB)/8, $0x0000000010049166
-DATA ·KoopConst+3128(SB)/8, $0x0000000087c13618
-
-// x^60480 mod p(x), x^60416 mod p(x)
-DATA ·KoopConst+3136(SB)/8, $0x00000001d3913e34
-DATA ·KoopConst+3144(SB)/8, $0x00000001d52f7b0c
-
-// x^59456 mod p(x), x^59392 mod p(x)
-DATA ·KoopConst+3152(SB)/8, $0x00000001e392d54a
-DATA ·KoopConst+3160(SB)/8, $0x000000000182058e
-
-// x^58432 mod p(x), x^58368 mod p(x)
-DATA ·KoopConst+3168(SB)/8, $0x0000000173f2704a
-DATA ·KoopConst+3176(SB)/8, $0x00000001ed73aa02
-
-// x^57408 mod p(x), x^57344 mod p(x)
-DATA ·KoopConst+3184(SB)/8, $0x000000019112b480
-DATA ·KoopConst+3192(SB)/8, $0x000000002721a82e
-
-// x^56384 mod p(x), x^56320 mod p(x)
-DATA ·KoopConst+3200(SB)/8, $0x0000000093d295d6
-DATA ·KoopConst+3208(SB)/8, $0x000000012ca83da2
-
-// x^55360 mod p(x), x^55296 mod p(x)
-DATA ·KoopConst+3216(SB)/8, $0x0000000114e37f44
-DATA ·KoopConst+3224(SB)/8, $0x00000000da358698
-
-// x^54336 mod p(x), x^54272 mod p(x)
-DATA ·KoopConst+3232(SB)/8, $0x00000000fcfebc86
-DATA ·KoopConst+3240(SB)/8, $0x0000000011fad322
-
-// x^53312 mod p(x), x^53248 mod p(x)
-DATA ·KoopConst+3248(SB)/8, $0x00000000834c48d6
-DATA ·KoopConst+3256(SB)/8, $0x000000012b25025c
-
-// x^52288 mod p(x), x^52224 mod p(x)
-DATA ·KoopConst+3264(SB)/8, $0x000000017b909372
-DATA ·KoopConst+3272(SB)/8, $0x000000001290cd24
-
-// x^51264 mod p(x), x^51200 mod p(x)
-DATA ·KoopConst+3280(SB)/8, $0x000000010156b9ac
-DATA ·KoopConst+3288(SB)/8, $0x000000016edd0b06
-
-// x^50240 mod p(x), x^50176 mod p(x)
-DATA ·KoopConst+3296(SB)/8, $0x0000000113a82fa8
-DATA ·KoopConst+3304(SB)/8, $0x00000000c08e222a
-
-// x^49216 mod p(x), x^49152 mod p(x)
-DATA ·KoopConst+3312(SB)/8, $0x0000000182dacb74
-DATA ·KoopConst+3320(SB)/8, $0x00000000cfb4d10e
-
-// x^48192 mod p(x), x^48128 mod p(x)
-DATA ·KoopConst+3328(SB)/8, $0x000000010210dc40
-DATA ·KoopConst+3336(SB)/8, $0x000000013e156ece
-
-// x^47168 mod p(x), x^47104 mod p(x)
-DATA ·KoopConst+3344(SB)/8, $0x000000008ab5ed20
-DATA ·KoopConst+3352(SB)/8, $0x00000000f12d89f8
-
-// x^46144 mod p(x), x^46080 mod p(x)
-DATA ·KoopConst+3360(SB)/8, $0x00000000810386fa
-DATA ·KoopConst+3368(SB)/8, $0x00000001fce3337c
-
-// x^45120 mod p(x), x^45056 mod p(x)
-DATA ·KoopConst+3376(SB)/8, $0x000000011dce2fe2
-DATA ·KoopConst+3384(SB)/8, $0x00000001c4bf3514
-
-// x^44096 mod p(x), x^44032 mod p(x)
-DATA ·KoopConst+3392(SB)/8, $0x000000004bb0a390
-DATA ·KoopConst+3400(SB)/8, $0x00000001ae67c492
-
-// x^43072 mod p(x), x^43008 mod p(x)
-DATA ·KoopConst+3408(SB)/8, $0x00000000028d486a
-DATA ·KoopConst+3416(SB)/8, $0x00000000302af704
-
-// x^42048 mod p(x), x^41984 mod p(x)
-DATA ·KoopConst+3424(SB)/8, $0x000000010e4d63fe
-DATA ·KoopConst+3432(SB)/8, $0x00000001e375b250
-
-// x^41024 mod p(x), x^40960 mod p(x)
-DATA ·KoopConst+3440(SB)/8, $0x000000014fd6f458
-DATA ·KoopConst+3448(SB)/8, $0x00000001678b58c0
-
-// x^40000 mod p(x), x^39936 mod p(x)
-DATA ·KoopConst+3456(SB)/8, $0x00000000db7a83a2
-DATA ·KoopConst+3464(SB)/8, $0x0000000065103c1e
-
-// x^38976 mod p(x), x^38912 mod p(x)
-DATA ·KoopConst+3472(SB)/8, $0x000000016cf9fa3c
-DATA ·KoopConst+3480(SB)/8, $0x000000000ccd28ca
-
-// x^37952 mod p(x), x^37888 mod p(x)
-DATA ·KoopConst+3488(SB)/8, $0x000000016bb33912
-DATA ·KoopConst+3496(SB)/8, $0x0000000059c177d4
-
-// x^36928 mod p(x), x^36864 mod p(x)
-DATA ·KoopConst+3504(SB)/8, $0x0000000135bda8bc
-DATA ·KoopConst+3512(SB)/8, $0x00000001d162f83a
-
-// x^35904 mod p(x), x^35840 mod p(x)
-DATA ·KoopConst+3520(SB)/8, $0x000000004e8c6b76
-DATA ·KoopConst+3528(SB)/8, $0x00000001efc0230c
-
-// x^34880 mod p(x), x^34816 mod p(x)
-DATA ·KoopConst+3536(SB)/8, $0x00000000e17cb750
-DATA ·KoopConst+3544(SB)/8, $0x00000001a2a2e2d2
-
-// x^33856 mod p(x), x^33792 mod p(x)
-DATA ·KoopConst+3552(SB)/8, $0x000000010e8bb9cc
-DATA ·KoopConst+3560(SB)/8, $0x00000001145c9dc2
-
-// x^32832 mod p(x), x^32768 mod p(x)
-DATA ·KoopConst+3568(SB)/8, $0x00000001859d1cae
-DATA ·KoopConst+3576(SB)/8, $0x00000000949e4a48
-
-// x^31808 mod p(x), x^31744 mod p(x)
-DATA ·KoopConst+3584(SB)/8, $0x0000000167802bbe
-DATA ·KoopConst+3592(SB)/8, $0x0000000128beecbc
-
-// x^30784 mod p(x), x^30720 mod p(x)
-DATA ·KoopConst+3600(SB)/8, $0x0000000086f5219c
-DATA ·KoopConst+3608(SB)/8, $0x00000001ffc96ae4
-
-// x^29760 mod p(x), x^29696 mod p(x)
-DATA ·KoopConst+3616(SB)/8, $0x00000001349a4faa
-DATA ·KoopConst+3624(SB)/8, $0x00000001ba81e0aa
-
-// x^28736 mod p(x), x^28672 mod p(x)
-DATA ·KoopConst+3632(SB)/8, $0x000000007da3353e
-DATA ·KoopConst+3640(SB)/8, $0x0000000104d7df14
-
-// x^27712 mod p(x), x^27648 mod p(x)
-DATA ·KoopConst+3648(SB)/8, $0x00000000440fba4e
-DATA ·KoopConst+3656(SB)/8, $0x00000001c2ff8518
-
-// x^26688 mod p(x), x^26624 mod p(x)
-DATA ·KoopConst+3664(SB)/8, $0x00000000507aba70
-DATA ·KoopConst+3672(SB)/8, $0x00000000ba6d4708
-
-// x^25664 mod p(x), x^25600 mod p(x)
-DATA ·KoopConst+3680(SB)/8, $0x0000000015b578b6
-DATA ·KoopConst+3688(SB)/8, $0x00000001d49d4bba
-
-// x^24640 mod p(x), x^24576 mod p(x)
-DATA ·KoopConst+3696(SB)/8, $0x0000000141633fb2
-DATA ·KoopConst+3704(SB)/8, $0x00000000d21247e6
-
-// x^23616 mod p(x), x^23552 mod p(x)
-DATA ·KoopConst+3712(SB)/8, $0x0000000178712680
-DATA ·KoopConst+3720(SB)/8, $0x0000000063b4004a
-
-// x^22592 mod p(x), x^22528 mod p(x)
-DATA ·KoopConst+3728(SB)/8, $0x000000001404c194
-DATA ·KoopConst+3736(SB)/8, $0x0000000094f55d2c
-
-// x^21568 mod p(x), x^21504 mod p(x)
-DATA ·KoopConst+3744(SB)/8, $0x00000000469dbe46
-DATA ·KoopConst+3752(SB)/8, $0x00000001ca68fe74
-
-// x^20544 mod p(x), x^20480 mod p(x)
-DATA ·KoopConst+3760(SB)/8, $0x00000000fb093fd8
-DATA ·KoopConst+3768(SB)/8, $0x00000001fd7d1b4c
-
-// x^19520 mod p(x), x^19456 mod p(x)
-DATA ·KoopConst+3776(SB)/8, $0x00000000767a2bfe
-DATA ·KoopConst+3784(SB)/8, $0x0000000055982d0c
-
-// x^18496 mod p(x), x^18432 mod p(x)
-DATA ·KoopConst+3792(SB)/8, $0x00000001344e22bc
-DATA ·KoopConst+3800(SB)/8, $0x00000000221553a6
-
-// x^17472 mod p(x), x^17408 mod p(x)
-DATA ·KoopConst+3808(SB)/8, $0x0000000161cd9978
-DATA ·KoopConst+3816(SB)/8, $0x000000013d9a153a
-
-// x^16448 mod p(x), x^16384 mod p(x)
-DATA ·KoopConst+3824(SB)/8, $0x00000001d702e906
-DATA ·KoopConst+3832(SB)/8, $0x00000001cd108b3c
-
-// x^15424 mod p(x), x^15360 mod p(x)
-DATA ·KoopConst+3840(SB)/8, $0x00000001c7db9908
-DATA ·KoopConst+3848(SB)/8, $0x00000001d0af0f4a
-
-// x^14400 mod p(x), x^14336 mod p(x)
-DATA ·KoopConst+3856(SB)/8, $0x00000001665d025c
-DATA ·KoopConst+3864(SB)/8, $0x00000001196cf0ec
-
-// x^13376 mod p(x), x^13312 mod p(x)
-DATA ·KoopConst+3872(SB)/8, $0x000000012df97c0e
-DATA ·KoopConst+3880(SB)/8, $0x00000001c88c9704
-
-// x^12352 mod p(x), x^12288 mod p(x)
-DATA ·KoopConst+3888(SB)/8, $0x000000006fed84da
-DATA ·KoopConst+3896(SB)/8, $0x000000002013d300
-
-// x^11328 mod p(x), x^11264 mod p(x)
-DATA ·KoopConst+3904(SB)/8, $0x00000000b094146e
-DATA ·KoopConst+3912(SB)/8, $0x00000001c458501e
-
-// x^10304 mod p(x), x^10240 mod p(x)
-DATA ·KoopConst+3920(SB)/8, $0x00000001ceb518a6
-DATA ·KoopConst+3928(SB)/8, $0x000000003ce14802
-
-// x^9280 mod p(x), x^9216 mod p(x)
-DATA ·KoopConst+3936(SB)/8, $0x000000011f16db0a
-DATA ·KoopConst+3944(SB)/8, $0x00000000bb72bb98
-
-// x^8256 mod p(x), x^8192 mod p(x)
-DATA ·KoopConst+3952(SB)/8, $0x00000001d4aa130e
-DATA ·KoopConst+3960(SB)/8, $0x00000000fb9aeaba
-
-// x^7232 mod p(x), x^7168 mod p(x)
-DATA ·KoopConst+3968(SB)/8, $0x00000001991f01d2
-DATA ·KoopConst+3976(SB)/8, $0x000000000131f5e6
-
-// x^6208 mod p(x), x^6144 mod p(x)
-DATA ·KoopConst+3984(SB)/8, $0x000000006bd58b4c
-DATA ·KoopConst+3992(SB)/8, $0x0000000089d5799a
-
-// x^5184 mod p(x), x^5120 mod p(x)
-DATA ·KoopConst+4000(SB)/8, $0x000000007272c166
-DATA ·KoopConst+4008(SB)/8, $0x00000000474c43b0
-
-// x^4160 mod p(x), x^4096 mod p(x)
-DATA ·KoopConst+4016(SB)/8, $0x000000013974e6f8
-DATA ·KoopConst+4024(SB)/8, $0x00000001db991f34
-
-// x^3136 mod p(x), x^3072 mod p(x)
-DATA ·KoopConst+4032(SB)/8, $0x000000000bd6e03c
-DATA ·KoopConst+4040(SB)/8, $0x000000004b1bfd00
-
-// x^2112 mod p(x), x^2048 mod p(x)
-DATA ·KoopConst+4048(SB)/8, $0x000000005988c652
-DATA ·KoopConst+4056(SB)/8, $0x000000004036b796
-
-// x^1088 mod p(x), x^1024 mod p(x)
-DATA ·KoopConst+4064(SB)/8, $0x00000000129ef036
-DATA ·KoopConst+4072(SB)/8, $0x000000000c5ec3d4
-
-// x^2048 mod p(x), x^2016 mod p(x), x^1984 mod p(x), x^1952 mod p(x)
-DATA ·KoopConst+4080(SB)/8, $0xd6f94847201b5bcb
-DATA ·KoopConst+4088(SB)/8, $0x1efc02e79571e892
-
-// x^1920 mod p(x), x^1888 mod p(x), x^1856 mod p(x), x^1824 mod p(x)
-DATA ·KoopConst+4096(SB)/8, $0xce08adcc294c1393
-DATA ·KoopConst+4104(SB)/8, $0x0b269b5c5ab5f161
-
-// x^1792 mod p(x), x^1760 mod p(x), x^1728 mod p(x), x^1696 mod p(x)
-DATA ·KoopConst+4112(SB)/8, $0x17315505e4201e72
-DATA ·KoopConst+4120(SB)/8, $0x2e841f4784acf3e9
-
-// x^1664 mod p(x), x^1632 mod p(x), x^1600 mod p(x), x^1568 mod p(x)
-DATA ·KoopConst+4128(SB)/8, $0x37cfc3a67cc667e3
-DATA ·KoopConst+4136(SB)/8, $0x7020425856bc424b
-
-// x^1536 mod p(x), x^1504 mod p(x), x^1472 mod p(x), x^1440 mod p(x)
-DATA ·KoopConst+4144(SB)/8, $0x8e2fa3369218d2c3
-DATA ·KoopConst+4152(SB)/8, $0xdf81bf923f7c6ef1
-
-// x^1408 mod p(x), x^1376 mod p(x), x^1344 mod p(x), x^1312 mod p(x)
-DATA ·KoopConst+4160(SB)/8, $0x5ce20d2d39ed1981
-DATA ·KoopConst+4168(SB)/8, $0x9d0898a0af5ddc43
-
-// x^1280 mod p(x), x^1248 mod p(x), x^1216 mod p(x), x^1184 mod p(x)
-DATA ·KoopConst+4176(SB)/8, $0x6f7f4546ca081e03
-DATA ·KoopConst+4184(SB)/8, $0x4992836903fda047
-
-// x^1152 mod p(x), x^1120 mod p(x), x^1088 mod p(x), x^1056 mod p(x)
-DATA ·KoopConst+4192(SB)/8, $0xfd4f413b9bf11d68
-DATA ·KoopConst+4200(SB)/8, $0xf4ddf452094f781b
-
-// x^1024 mod p(x), x^992 mod p(x), x^960 mod p(x), x^928 mod p(x)
-DATA ·KoopConst+4208(SB)/8, $0x11d84204062f61ea
-DATA ·KoopConst+4216(SB)/8, $0x9487f1e51f3588cf
-
-// x^896 mod p(x), x^864 mod p(x), x^832 mod p(x), x^800 mod p(x)
-DATA ·KoopConst+4224(SB)/8, $0xfaedf111abf58a1f
-DATA ·KoopConst+4232(SB)/8, $0x31da2c22b1384ec9
-
-// x^768 mod p(x), x^736 mod p(x), x^704 mod p(x), x^672 mod p(x)
-DATA ·KoopConst+4240(SB)/8, $0x0246b541e8f81b22
-DATA ·KoopConst+4248(SB)/8, $0xc857ede58a42eb47
-
-// x^640 mod p(x), x^608 mod p(x), x^576 mod p(x), x^544 mod p(x)
-DATA ·KoopConst+4256(SB)/8, $0xd4dbfa9b92b0372e
-DATA ·KoopConst+4264(SB)/8, $0xe0354c0b2cd1c09a
-
-// x^512 mod p(x), x^480 mod p(x), x^448 mod p(x), x^416 mod p(x)
-DATA ·KoopConst+4272(SB)/8, $0x5f36c79cfc4417ec
-DATA ·KoopConst+4280(SB)/8, $0x4b92cf8d54b8f25b
-
-// x^384 mod p(x), x^352 mod p(x), x^320 mod p(x), x^288 mod p(x)
-DATA ·KoopConst+4288(SB)/8, $0xdad234918345041e
-DATA ·KoopConst+4296(SB)/8, $0x4e44c81828229301
-
-// x^256 mod p(x), x^224 mod p(x), x^192 mod p(x), x^160 mod p(x)
-DATA ·KoopConst+4304(SB)/8, $0x56fd28cc8e02f1d0
-DATA ·KoopConst+4312(SB)/8, $0x3da5e43c8ee9ee84
-
-// x^128 mod p(x), x^96 mod p(x), x^64 mod p(x), x^32 mod p(x)
-DATA ·KoopConst+4320(SB)/8, $0xa583017cdfcb9f08
-DATA ·KoopConst+4328(SB)/8, $0xeb31d82e0c62ab26
-
-GLOBL ·KoopConst(SB), RODATA, $4336
-
-// Barrett constant m - (4^32)/n
-DATA ·KoopBarConst(SB)/8, $0x0000000017d232cd
-DATA ·KoopBarConst+8(SB)/8, $0x0000000000000000
-DATA ·KoopBarConst+16(SB)/8, $0x00000001d663b05d
-DATA ·KoopBarConst+24(SB)/8, $0x0000000000000000
-GLOBL ·KoopBarConst(SB), RODATA, $32
diff --git a/vendor/github.com/klauspost/crc32/gen.go b/vendor/github.com/klauspost/crc32/gen.go
deleted file mode 100644
index fb3040a7d..000000000
--- a/vendor/github.com/klauspost/crc32/gen.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2023 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:generate go run gen_const_ppc64le.go
-
-package crc32