/
DetectAVXInstructions.ps1
56 lines (51 loc) · 1.87 KB
/
DetectAVXInstructions.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$root = $args[0]
if ($root.Length.Equals(0)) {
$root=$PWD
}
cd $root
$dirs = Get-ChildItem $root -Directory #-Recurse "Release" | Where-Object {$_.FullName -inotmatch "avx"}
$dlls = $dirs | Get-ChildItem -Recurse -File -Filter *.dll
$dllfound = 0
foreach ($dll in $dlls) {
$result = & dumpbin $dll.FullName /DISASM:nobytes /NOLOGO | select-string -pattern "ymm[0-9]"
if ($result.length -gt 0) {
$dll.FullName + ": AVX FOUND <-----------------------------"
$dllfound++
} else {
$dll.FullName + ": AVX NOT FOUND"
}
}
$pyds = $dirs | Get-ChildItem -Recurse -File -Filter *.pyd
$pydfound = 0
foreach ($pyd in $pyds) {
$result = & dumpbin $pyd.FullName /DISASM:nobytes /NOLOGO | select-string -pattern "ymm[0-9]"
if ($result.length -gt 0) {
$pyd.FullName + ": AVX FOUND <-----------------------------"
$pydfound++
} else {
$pyd.FullName + ": AVX NOT FOUND"
}
}
$exes = $dirs | Get-ChildItem -Recurse -File -Filter *.exe
$exefound = 0
foreach ($exe in $exes) {
$result = & dumpbin $exe.FullName /DISASM:nobytes /NOLOGO | select-string -pattern "ymm[0-9]"
if ($result.length -gt 0) {
$exe.FullName + ": AVX FOUND <-----------------------------"
$exefound++
} else {
$exe.FullName + ": AVX NOT FOUND"
}
}
$libs = $dirs | Get-ChildItem -Recurse -File -Filter *.lib
$libfound = 0
foreach ($lib in $libs) {
$result = & dumpbin $lib.FullName /DISASM:nobytes /NOLOGO | select-string -pattern "ymm[0-9]"
if ($result.length -gt 0) {
$lib.FullName + ": AVX FOUND <-----------------------------"
$libfound++
} else {
$lib.FullName + ": AVX NOT FOUND"
}
}
"Found $dllfound DLLs, $pydfound PYDs, $libfound libs, and $exefound exes with AVX registers out of $($dlls.count) DLLs, $($pyds.count) PYDs, $($libs.count) libs, and $($exes.count) exes scanned"