https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112935
Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |tree-optimization Target|loongarch64-*-* | --- Comment #12 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- This also happens for x86_64, with 13.2: .L2: movl %edi, %edx shrb %dil xorl %eax, %edx shrw %ax andl $1, %edx negl %edx andw $-24575, %dx xorl %edx, %eax subb $1, %cl jne .L2 With trunk: .L2: mov ecx, edi shr dil xor ecx, eax shr ax and ecx, 1 lea edx, [rcx+rcx*4] sal edx, 13 add edx, ecx xor eax, edx sub sil, 1 jne .L2 So this seems not only a target issue. I'll move it back to tree-optimization and open LoongArch cost model issue as a new ticket.