So this ends up looking a lot like the bits that I had to revert several weeks ago :-) The core issue we have is given an INSN the generic code will cost the SET_SRC and SET_DEST and sum them. But that's far from ideal on a RISC target. For a register destination, the cost can be determined be looking at just the SET_SRC. Which is precisely what this patch does. When the outer code is an INSN and we're presented with a SET we take one of two paths. If the destination is a register, then we recurse just on the SET_SRC and we're done. Otherwise we fall back to the existing code which sums the cost of the SET_SRC and SET_DEST. That fallback path isn't great and probably could be further improved (just costing SET_DEST in that case is probably quite reasonable). The difference between this version and the bits that slipped through by accident several weeks ago is that old version mis-used the API due to a thinko on my part. This tightens up various zicond tests to avoid undesirable matching. This has been tested on rv64gc -- the only difference it makes on the testsuite is the new tests (included in this patch) flip from failing to passing. Pushed to the trunk. Jeff