Joern Rennecke <joern.renne...@embecosm.com> writes: > On 11/20/23 11:26, Richard Sandiford wrote: >>> + /* ?!? What is the point of this adjustment to DST_MASK? */ >>> + if (code == PLUS || code == MINUS >>> + || code == MULT || code == ASHIFT) >>> + dst_mask >>> + = dst_mask ? ((2ULL << floor_log2 (dst_mask)) - 1) : 0; >> >> Yeah, sympathise with the ?!? here :) > Jeff Law: >> Inherited. Like the other bit of magic I think I'll do a test with them >> pulled out to see if I can make something undesirable trigger. > > This represents the carry effect. Even if the destination only cares about > some high order bits, you have to consider all lower order bits of the inputs. > > For ASHIFT, you could refine this in the case of a constant shift count.
Ah, right. Think it would be worth a comment. But I wonder whether we should centralise all this code-specific information into a single place. I.e. rather than having one switch to say "PLUS is OK" or "AND is OK", and then having code-specific handling elsewhere, we could enumerate how to handle a code. Thanks, Richard