examples/sha1: use comments (#41)
This commit is contained in:
@@ -18,13 +18,13 @@ func main() {
|
|||||||
w := AllocLocal(64)
|
w := AllocLocal(64)
|
||||||
W := func(r int) Mem { return w.Offset((r % 16) * 4) }
|
W := func(r int) Mem { return w.Offset((r % 16) * 4) }
|
||||||
|
|
||||||
// Load initial hash.
|
Comment("Load initial hash.")
|
||||||
hash := [5]Register{GP32(), GP32(), GP32(), GP32(), GP32()}
|
hash := [5]Register{GP32(), GP32(), GP32(), GP32(), GP32()}
|
||||||
for i, r := range hash {
|
for i, r := range hash {
|
||||||
MOVL(h.Offset(4*i), r)
|
MOVL(h.Offset(4*i), r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize registers.
|
Comment("Initialize registers.")
|
||||||
a, b, c, d, e := GP32(), GP32(), GP32(), GP32(), GP32()
|
a, b, c, d, e := GP32(), GP32(), GP32(), GP32(), GP32()
|
||||||
for i, r := range []Register{a, b, c, d, e} {
|
for i, r := range []Register{a, b, c, d, e} {
|
||||||
MOVL(hash[i], r)
|
MOVL(hash[i], r)
|
||||||
@@ -42,6 +42,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for r := 0; r < 80; r++ {
|
for r := 0; r < 80; r++ {
|
||||||
|
Commentf("Round %d.", r)
|
||||||
q := quarter[r/20]
|
q := quarter[r/20]
|
||||||
|
|
||||||
// Load message value.
|
// Load message value.
|
||||||
@@ -72,12 +73,12 @@ func main() {
|
|||||||
a, b, c, d, e = t, a, b, c, d
|
a, b, c, d, e = t, a, b, c, d
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final add.
|
Comment("Final add.")
|
||||||
for i, r := range []Register{a, b, c, d, e} {
|
for i, r := range []Register{a, b, c, d, e} {
|
||||||
ADDL(r, hash[i])
|
ADDL(r, hash[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store results back.
|
Comment("Store results back.")
|
||||||
for i, r := range hash {
|
for i, r := range hash {
|
||||||
MOVL(r, h.Offset(4*i))
|
MOVL(r, h.Offset(4*i))
|
||||||
}
|
}
|
||||||
|
|||||||
2388
examples/sha1/sha1.s
2388
examples/sha1/sha1.s
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user