Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peepopt: handle offset too large in shiftadd #4165

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions passes/pmgen/peepopt_shiftadd.pmg
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,16 @@ code
new_a.append(old_a);
} else {
// data >> (...+c) transformed to data[MAX:c] >> (...)
new_a.append(old_a.extract_end(offset));

if(offset < GetSize(old_a)) // some signal bits left?
new_a.append(old_a.extract_end(offset));
phsauter marked this conversation as resolved.
Show resolved Hide resolved
else {
if(shift->type.in($shiftx))
log_warning("at %s: result of indexed part-selection is always constant (selecting from '%s' with index '%s + %d')\n", \
phsauter marked this conversation as resolved.
Show resolved Hide resolved
shift->get_src_attribute().c_str(), log_signal(old_a), log_signal(var_signal), offset);
else
log_warning("at %s: result of shift operation is always constant (shifting '%s' by '%s + %d'-bits)\n", \
shift->get_src_attribute().c_str(), log_signal(old_a), log_signal(var_signal), offset);
}
}

SigSpec new_b = {var_signal, SigSpec(State::S0, log2scale)};
Expand Down