在 2022/9/29 上午3:18, Richard Henderson 写道: > On 9/28/22 09:42, Xi Ruoyao wrote: >>> There is nothing in string-maskoff.h that the compiler should not be >>> able to produce >>> itself from the generic version.  Having a brief look, the compiler >>> simply needs to be >>> improved to unify two current AND patterns (which is an existing >>> bug) and add the >>> additional case for bstrins.d. >> >> Added GCC LoongArch port maintainer into Cc:. >> >> It's actually more complicated.  Without the inline assembly in >> repeat_bytes(), the compiler does not hoist the 4-instruction 64-bit >> immediate load sequence out of a loop for "some reason I don't know >> yet". > > Oh that's interesting.  I suspect that adding a REG_EQUAL note for > each (or perhaps just the last) insn emitted by loongarch_move_integer > would fix that. > > I have optimized this problem, and the modification is in the attachment. However, in some cases, the immediate count load will be two more than the original implementation instruction. I'm still working on that.