actually maxu. and maxs. as well as minu. and maxu. these are needed for potential saturation scenarios overflow occurs when src2 "wins" over src1. swapping the operands allows the opposite detection with no need for a 2nd operation. when used in sv with a scalar src2 it can be used to clamp *and detect* when clamping occurred on an entire vector src1.
also need Rc=1 variants which merge "cmp" functionality into the instructions. has to be done carefully because it's not exactly the same as normal Rc=1, it is more like "cmp".
combined cmp with max: * the lt flag is set if RA<RB * the gt flag if RA>RB etc. but XER.SO being set can detect if the entire batch is set. the dependencies however are hell. it would be better to have a CRfield vector "reduction" operation, afterwards.
CR0.GT being set is effectively "src2 wins" CR0.LT is effectively "src1 wins" CR0.EQ is effectively "nobody wins"
https://git.libre-soc.org/?p=libreriscv.git;a=commitdiff;h=656bc167fc33f761f33e8ec80b09452d93a9bc8b commit 656bc167fc33f761f33e8ec80b09452d93a9bc8b Author: Jacob Lifshay <programmerjake@gmail.com> Date: Thu Apr 20 18:06:06 2023 -0700 change minmax CR0 to be a compared with b, not the result compared with 0 I still need to change the simulator
(In reply to Jacob Lifshay from comment #4) > change minmax CR0 to be a compared with b, not the result compared with 0 > > I still need to change the simulator just the csv file RA_OR_ZERO should do it.
(In reply to Luke Kenneth Casson Leighton from comment #5) > (In reply to Jacob Lifshay from comment #4) > > > change minmax CR0 to be a compared with b, not the result compared with 0 > > > > I still need to change the simulator > > just the csv file RA_OR_ZERO should do it. no, the simulator needs the whole new pseudocode for minmax and opcode allocation and MM-form and MMM handling, etc. which i'm going to do all together for a partial list see https://bugs.libre-soc.org/show_bug.cgi?id=1057#c0
(In reply to Jacob Lifshay from comment #6) > no, the simulator needs the whole new pseudocode for minmax and opcode > allocation and MM-form and MMM handling, etc. which i'm going to do all > together ahh ok. i thought they'd been done already
this has been added to both the pseudocode on the wiki and the simulator...CR0 is set to the result of comparing the inputs when Rc=1