Hi Pan, > + /* Step-2: lt = x < y */ > + riscv_emit_binary (LTU, pmode_lt, pmode_x, pmode_y); > + > + /* Step-3: lt = -lt */ > + riscv_emit_unary (NEG, pmode_lt, pmode_lt); > + > + /* Step-4: lt = ~lt */ > + riscv_emit_unary (NOT, pmode_lt, pmode_lt);
Can we replace step 3 and 4 with sub lt, -1 directly when it's supposed to be optimized like that anyway? I was a bit irritated when reading the code because I figured we could surely save one instruction there but then realized that the cover letter has the shorter sequence. The rest LGTM. When you say other variants are still to be implemented does that also include variants for zbb with min/max or zicond? Regards Robin