Skip to content

Commit

Permalink
Filter by instruction set extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent 98459d1 commit 95e8144
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
17 changes: 16 additions & 1 deletion code/viewer_partial.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
<label :for="group" style="display: inline">{{ group }}</label>
</div>

<p></p>
<b style="padding-top: 10px">Instruction Set Extensions:</b>
<p></p>

<div v-for="extension in allExtensions">
<input type="checkbox" :id="extension" :value="extension" v-model="extensions" />
<label :for="extension" style="display: inline">{{ extension }}</label>
</div>

<p></p>
<b>Filter by content:</b>
<p></p>
Expand Down Expand Up @@ -50,13 +59,17 @@
setup() {
const search = ref("");
const allGroups = {% endraw %} {{ all_groups() }} {% raw %};
const allExtensions = ["LSX", "LASX"];
const groups = ref(allGroups);
const extensions = ref(allExtensions);

const intrinsics = computed(() => {
let result = [];
for (let val of allIntrinsics) {
if (!groups.value.includes(val.group)) {
continue;
} else if (!extensions.value.includes(val.extension)) {
continue;
} else if (val.name.includes(search.value)) {
result.push(val);
} else if (val.content.includes(search.value)) {
Expand All @@ -72,7 +85,9 @@
intrinsics,
search,
groups,
allGroups
allGroups,
extensions,
allExtensions
}
}
}).mount('#app')
Expand Down
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,10 @@ def all_intrinsics():
if line.startswith("##"):
body = "\n".join(lines[i + 1 :])
intrinsic = line[2:].strip()
if "_lsx_" in intrinsic:
extension = "LSX"
else:
extension = "LASX"
result.append(
{
"name": intrinsic,
Expand All @@ -1677,6 +1681,7 @@ def all_intrinsics():
extensions=["fenced_code", "codehilite"],
),
"group": title,
"extension": extension
}
)
break
Expand All @@ -1691,4 +1696,4 @@ def all_groups():
title = line[1:].strip()
result.append(title)
break
return json.dumps(sorted(result))
return json.dumps(sorted(list(set(result))))

0 comments on commit 95e8144

Please sign in to comment.