Re: [PATCH] RISC-V: Optimize branches with shifted immediate operands

2024-09-05 Thread Jovan Vukic
> It's worth noting there is a newer way which is usually slightly simpler > than a match_operator. Specifically code iterators. Thank you for the very detailed feedback. It is not a problem to add code iterators. I would add iterators for "eq" and "ne" in riscv/iterators.md since they don't cur

Re: [PATCH] RISC-V: Optimize branches with shifted immediate operands

2024-09-03 Thread Jeff Law
On 9/2/24 7:52 AM, Jovan Vukic wrote: The patch adds a new instruction pattern to handle conditional branches with equality checks between shifted arithmetic operands. This pattern optimizes the use of shifted constants (with trailing zeros), making it more efficient. For the C code: void

[PATCH] RISC-V: Optimize branches with shifted immediate operands

2024-09-02 Thread Jovan Vukic
The patch adds a new instruction pattern to handle conditional branches with equality checks between shifted arithmetic operands. This pattern optimizes the use of shifted constants (with trailing zeros), making it more efficient. For the C code: void f5(long long a) { if ((a & 0x212) == 0