Skip to content

Commit

Permalink
Add more xvshuf4i figures
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Jul 17, 2024
1 parent d28b964 commit 6a68d05
Show file tree
Hide file tree
Showing 5 changed files with 545 additions and 0 deletions.
65 changes: 65 additions & 0 deletions docs/diagram/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,71 @@ def xvshuf():
add_line(f, 2, 0, i, 3, 0, i)
end(f)

def xvshuf4i_bhw():
global elen, vlen
for el, name in [(32, "w"), (16, "h"), (8, "b")]:
elen = el
vlen = 256
with open(f"xvshuf4i_{name}.svg", "w") as f:
init(f, 2, 1)
add_row(f)
add_box(
f,
"a",
"data",
indices=list(range(3, -1, -1)) * (vlen // el // 4),
)
add_row(f)
add_box(f, "ret", "returns")

# a to returns
for i in range(vlen // elen):
for j in range(4):
add_line(f, 1, 0, i, 2, 0, i // 4 * 4 + j)
end(f)

def xvshuf4i_d():
global elen, vlen
elen = 64
vlen = 256
with open("xvshuf4i_d.svg", "w") as f:
init(f, 2, 2)
add_row(f)
add_box(
f,
"b",
"data",
indices=[3, 2, 3, 2],
)
add_box(
f,
"a",
"data",
indices=[1, 0, 1, 0],
)
add_row(f)
add_box(f, "ret", "returns")

# a & b to returns
add_line(f, 1, 0, 2, 2, 0, 3)
add_line(f, 1, 0, 3, 2, 0, 3)
add_line(f, 1, 1, 2, 2, 0, 3)
add_line(f, 1, 1, 3, 2, 0, 3)
add_line(f, 1, 0, 2, 2, 0, 2)
add_line(f, 1, 0, 3, 2, 0, 2)
add_line(f, 1, 1, 2, 2, 0, 2)
add_line(f, 1, 1, 3, 2, 0, 2)
add_line(f, 1, 0, 0, 2, 0, 1)
add_line(f, 1, 0, 1, 2, 0, 1)
add_line(f, 1, 1, 0, 2, 0, 1)
add_line(f, 1, 1, 1, 2, 0, 1)
add_line(f, 1, 0, 0, 2, 0, 0)
add_line(f, 1, 0, 1, 2, 0, 0)
add_line(f, 1, 1, 0, 2, 0, 0)
add_line(f, 1, 1, 1, 2, 0, 0)
end(f)

if __name__ == "__main__":
xvshuf()
xvshuf4i_bhw()
xvshuf4i_d()
236 changes: 236 additions & 0 deletions docs/diagram/xvshuf4i_b.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6a68d05

Please sign in to comment.