On 9/24/26 11:54 PM, Naveen wrote:
Add a neg<mode>cc expansion for integral comparisons on RISC-V.
The expansion implements:
X ? -X : X
as:
CMP = condition ? 1 : 0
MASK = -CMP
RESULT = X ^ MASK
RESULT += CMP
This pattern can be used by existing if-conversion paths. Use a
separate pseudo for the XOR result so that the output pseudo is
assigned only once.
Signed-off-by: Naveen <[email protected]>
So I know this has already been integrated, but how was this tested?
I'm asking because it's very clearly regressing some tests in this
RISC-V space that I would expect would have failed if even just the
riscv.exp tests had been run.
They are code quality rather than code correctness regressions.
Primarily dealing with selects across -1, 1 which can be more
efficiently done with arithmetic right shift to splat the sign bit
followed by ori with the constant 1.
I can recover some of the missed cases with a with a well placed
define_split. But others are more painful to recover.
I suspect the pending slight revamp of ifcvt to try all approaches and
select the least costly will fix this, so it may not be that big of a
deal in the long term. The more important issue is to make sure that
patches are being tested properly before submission.
Thanks,
Jeff