Re:[pushed] [PATCH] LoongArch: Optimize for conditional move operations

2025-01-01 Thread Lulu Cheng
Pushed to r15-6493. 在 2024/12/30 上午10:39, Guo Jie 写道: The optimization example is as follows. From: if (condition) dest += 1 << 16; To: dest += (condition ? 1 : 0) << 16; It does not use maskeqz and masknez, thus reducing the number of instructions. gcc/ChangeLog: * config

Re: [PATCH] LoongArch: Optimize for conditional move operations

2024-12-29 Thread Guo Jie
Thanks for your suggestion! Indeed, there are still some scenarios that can be optimized and improved next. 在 2024/12/30 下午12:06, Xi Ruoyao 写道: On Mon, 2024-12-30 at 10:39 +0800, Guo Jie wrote: +   /* Make sure that imm is a positive integer power of 2.  */ Maybe we should also co

Re: [PATCH] LoongArch: Optimize for conditional move operations

2024-12-29 Thread Xi Ruoyao
On Mon, 2024-12-30 at 10:39 +0800, Guo Jie wrote: > +   /* Make sure that imm is a positive integer power of > 2.  */ Maybe we should also consider the case $imm = 2^k + 1$ as they can be implemented with sl[te] and bstrins.[wd]. But it can be done in another patch anyway. > +  

[PATCH] LoongArch: Optimize for conditional move operations

2024-12-29 Thread Guo Jie
The optimization example is as follows. From: if (condition) dest += 1 << 16; To: dest += (condition ? 1 : 0) << 16; It does not use maskeqz and masknez, thus reducing the number of instructions. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_expand_conditiona