On Mon, 2025-11-17 at 14:38 +0800, zhaozhou wrote: > Add new template muldi3_ui12 for mul(reg, ui12), which mode is DImode > and op2 is const_uns_arith_operand. And the template is matched when > the mul operation can not be optimized, such as slli, alsl et. > > gcc/ChangeLog: > > * config/loongarch/loongarch-protos.h > (loongarch_scalar_uimult_p): Func declaration. > * config/loongarch/loongarch.cc (loongarch_scalar_uimult_p): > Check func for new template. > * config/loongarch/loongarch.md (muldi3_ui12): New template. > > gcc/testsuite/ChangeLog: > > * gcc.target/loongarch/muld_d_ui12_1.c: New test. > * gcc.target/loongarch/muld_d_ui12_2.c: New test.
IMO this is too hacky. This is basically working around a missing CSE by deferring the expansion from expand to split, but the correct solution is just fixing this in CSE, as it's showing up in even x86_64 code generation. I'll create a bug report about the missing CSE. -- Xi Ruoyao <[email protected]>
