On Sat, Aug 05, 2023 at 05:31:00 AM Jeff Law <jeffreya...@gmail.com> wrote: > >On 8/1/23 19:38, Xiao Zeng wrote: >> This patch recognizes Zicond patterns when the select pattern >> with condition eq or neq to 0 (using eq as an example), namely: >> >> 1 rd = (rs2 == 0) ? non-imm : 0 >> 2 rd = (rs2 == 0) ? non-imm : non-imm >> 3 rd = (rs2 == 0) ? reg : non-imm >> 4 rd = (rs2 == 0) ? reg : reg >> >> gcc/ChangeLog: >> >> * config/riscv/riscv.cc (riscv_expand_conditional_move): Recognize >> Zicond patterns >> * config/riscv/riscv.md: Recognize Zicond patterns through >>mov<mode>cc >So I've made minor adjustments to the remaining three cases. First we >need to check the code before optimizing the cases were one of the arms >of the conditional move matches op0. > >I slightly adjusted the case for out of range constants. Its better to >check SMALL_OPERAND rather than testing for specific constants. And >when that triggers, we can just force the value into a register and >continue as-is rather than recursing. > These changes make the code more concise and readable. Thumbs up!
>The patch I'm committing fixes one comment typo (whitespace) and a bit >of accidentally duplicated code I added in a prior commit. > >Next up Raphael's patches to handle nontrival conditionals by emiting an >scc insn :-) It would be great to see other implementations for conditional execution. :-) > >Jeff > >ps. I'm deferrring the testsuite bits until we sort out the costing >problems. THey're definitely not forgotten and I still use them in my >local tree. Thank you Jeff, I look forward to a unified, complete and concise implementation method for cost calculation as soon as possible. Thanks Xiao Zeng