Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s2: Simplify asm code #541

Merged
merged 4 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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