Skip to content

Commit

Permalink
etc: add script for checking list_intrin.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Oct 21, 2023
1 parent fa4923d commit 0ee926f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions etc/generate-list-intrin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e

bold() {
printf "\033[1m%s\033[0m\n" "$*"
}

if [[ $# -ne 0 ]]; then
bold "error expected no arguments, got $#!"
exit 1
fi

echo "Checking intrinsics used in code base versus declared in 'list_intrin.txt' . . ."

grep -oh -e "_mm\w*\b" include/*.* | sort | uniq > intrin_actuals.txt

python3 - <<END
import sys
with open('intrin_actuals.txt', 'r') as f:
intrin_actuals = [x.strip() for x in f.readlines()]
with open('list_intrin.txt', 'r') as f:
list_intrin = [x.strip()[:x.find(';')] for x in f.readlines() if not x.startswith('#')]
for intrin_actual in intrin_actuals:
if not intrin_actual in list_intrin:
print(f"\033[41m{('\`' + intrin_actual + '\`').ljust(16, ' ')} found in \`include/*.hpp\` but not in \`list_intrin.txt\`!\033[0m")
for intrin in list_intrin:
if not intrin in intrin_actuals:
print(f"\033[41m{('\`' + intrin + '\`').ljust(16, ' ')} found in \`list_intrin.txt\` but not in \`include/*.hpp\`!\033[0m")
END

rm -f intrin_actuals.txt

0 comments on commit 0ee926f

Please sign in to comment.