Skip to content

Commit

Permalink
s2: Simplify asm code (#541)
Browse files Browse the repository at this point in the history
* s2: Simplify asm code
  • Loading branch information
klauspost authored Apr 5, 2022
1 parent 8c016bf commit 3cfe836
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 349 deletions.
17 changes: 9 additions & 8 deletions s2/_generate/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ func main() {
Constraint(buildtags.Term("gc").ToConstraint())
Constraint(buildtags.Not("noasm").ToConstraint())

// We need a function to add comments.
TEXT("_dummy_", 0, "func()")
Comment("#ifdef GOAMD64_v4")
Comment("#ifndef GOAMD64_v3")
Comment("#define GOAMD64_v3")
Comment("#endif")
Comment("#endif")
RET()

o := options{
bmi1: false,
bmi2: false,
Expand Down Expand Up @@ -2507,14 +2516,6 @@ func (o options) matchLen(name string, a, b, len reg.GPVirtual, end LabelRef) re
// 2016 BMI :TZCNT r64, r64 L: 0.57ns= 2.0c T: 0.29ns= 1.00c
// 315 AMD64 :BSF r64, r64 L: 0.88ns= 3.1c T: 0.86ns= 3.00c
TZCNTQ(tmp, tmp)
Comment("#define TZCNTQ_EMITTED 1")
Comment("#endif\n")
Comment("#ifdef GOAMD64_v4")
TZCNTQ(tmp, tmp)
Comment("#define TZCNTQ_EMITTED 1")
Comment("#endif\n")
Comment("#ifdef TZCNTQ_EMITTED")
Comment("#undef TZCNTQ_EMITTED")
Comment("#else")
BSFQ(tmp, tmp)
Comment("#endif")
Expand Down
2 changes: 2 additions & 0 deletions s2/encodeblock_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3cfe836

Please sign in to comment.