asimd: Prevent misdecodes from occurring

Pointed out by Mary when reviewing the shift code.
This commit is contained in:
Lioncash 2020-06-18 14:59:32 -04:00
parent 6ca20c2fe3
commit 00b2f9b319
2 changed files with 14 additions and 3 deletions

View file

@ -8,6 +8,7 @@
#include <algorithm>
#include <functional>
#include <optional>
#include <set>
#include <vector>
#include "common/bit_util.h"
@ -35,6 +36,15 @@ std::vector<ASIMDMatcher<V>> GetASIMDDecodeTable() {
return Common::BitCount(matcher1.GetMask()) > Common::BitCount(matcher2.GetMask());
});
// Exceptions to the above rule of thumb.
const std::set<std::string> comes_first{
"VBIC, VMOV, VMVN, VORR (immediate)"
};
std::stable_partition(table.begin(), table.end(), [&](const auto& matcher) {
return comes_first.count(matcher.GetName()) > 0;
});
return table;
}