Fix little endian packed array counting (#2499).

This commit is contained in:
Wilson Snyder
2020-12-13 16:23:59 -05:00
parent 82fc142c1c
commit 882b310897
4 changed files with 100 additions and 8 deletions
+4 -6
View File
@@ -225,12 +225,10 @@ private:
} else if (AstPackArrayDType* adtypep = VN_CAST(ddtypep, PackArrayDType)) {
// SELBIT(array, index) -> SEL(array, index*width-of-subindex, width-of-subindex)
AstNode* subp = rhsp;
if (fromRange.lo() != 0 || fromRange.hi() < 0) {
if (fromRange.littleEndian()) {
subp = newSubNeg(fromRange.hi(), subp);
} else {
subp = newSubNeg(subp, fromRange.lo());
}
if (fromRange.littleEndian()) {
subp = newSubNeg(fromRange.hi(), subp);
} else {
subp = newSubNeg(subp, fromRange.lo());
}
UASSERT_OBJ(!(!fromRange.elements() || (adtypep->width() % fromRange.elements()) != 0),
adtypep,