https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123313
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2025-12-29
--- Comment #3 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Yea, this could definitely be improved. The biggest question is where to put
the improvement. A secondary question would be whether or not we want to
include in gcc-16.
I wandered ifcvt a bit and it seems like this isn't going to fit any of the
existing routines well at all. So in my prototype its
noce_try_store_flag_logical.
A secondary issue is costing. For reasons I don't know (it was part of the
original RISC-V port) the sCC insns only allow SImode destinations. For the
standard gimple->rtl expansion path that's an annoyance, but not catastrophic.
But for uses within ifcvt.cc that can be catastrophic as the extra insns
artifically inflate the cost of the converted sequence. So that probably needs
an independent patch. It looks trivial to fix, but there's always the
possibility of testing fallout.
With the prototype & adjustment to sCC expansion I get:
slti a0,a2,10 # 24 [c=4 l=4] *sle_didi
addi a0,a0,-1 # 25 [c=4 l=4] *adddi3/1
or a0,a0,a1 # 18 [c=4 l=4] *iordi3/0
I'm inclined to _not_ push this for gcc-16 though. It's a new BZ, doesn't fix
a regression, etc.